@clevertask/scribe 0.0.3 → 0.0.4
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/dist/{SlashCommandList-D_Ndw6pj.js → SlashCommandList-DLPd43Tg.js} +538 -538
- package/dist/assets/index.css +1 -0
- package/dist/{browser-D3_ToIiA.js → browser-Ce149ePN.js} +497 -508
- package/dist/components/Menu/BubbleMenu.js +1 -1
- package/dist/components/Scribe/extension/extension-link.js +482 -432
- package/dist/components/Scribe/extension/extension-selectedText.js +1 -1
- package/dist/components/Scribe/extension/index.d.ts +1 -1
- package/dist/components/Scribe/extension/index.js +719 -783
- package/dist/components/Scribe/extension/math-extension.d.ts +2 -0
- package/dist/components/Scribe/extension/math-extension.js +11768 -0
- package/dist/components/Scribe/extension/slashCommand/SlashCommandList.js +3 -3
- package/dist/components/Scribe/extension/slashCommand/index.js +76 -75
- package/dist/components/Scribe/extension/slashCommand/renderItems.js +2 -2
- package/dist/components/Scribe/index.js +3 -3
- package/dist/{index-ggVAwdRQ.js → index-Bl1eZGET.js} +520 -516
- package/dist/{index-CUP7vhu5.js → index-pCZujIH1.js} +2073 -1967
- package/dist/main.css +1 -1
- package/dist/{turndown.browser.es-CeowJDZ0.js → turndown.browser.es-BSoGafvq.js} +249 -253
- package/dist/utils/html-to-markdown.js +1 -1
- package/dist/utils/markdown-to-html.js +1 -1
- package/package.json +43 -42
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import ct from "./extension-link.js";
|
|
2
|
-
import { E as J,
|
|
2
|
+
import { E as J, P as D, a as _, D as F, b as q, N as k, n as Xe, m as M, S as v, k as qe, j as dt, T as S, F as R, l as N, o as ue, p as ut, q as Ge, r as Je, s as pt, w as G, M as ee, c as K, t as j, u as be, v as ht, x as ft, y as mt, z as gt } from "../../../index-pCZujIH1.js";
|
|
3
3
|
import { SlashCommand as bt } from "./slashCommand/index.js";
|
|
4
4
|
import wt from "./extension-selectedText.js";
|
|
5
5
|
import yt from "./slashCommand/renderItems.js";
|
|
6
6
|
import { getSuggestionItems as Ct } from "./slashCommand/items.js";
|
|
7
|
-
|
|
7
|
+
import { LatexExtension as Mt } from "./math-extension.js";
|
|
8
|
+
const At = J.create({
|
|
8
9
|
name: "focus",
|
|
9
10
|
addOptions() {
|
|
10
11
|
return {
|
|
@@ -14,8 +15,8 @@ const Mt = J.create({
|
|
|
14
15
|
},
|
|
15
16
|
addProseMirrorPlugins() {
|
|
16
17
|
return [
|
|
17
|
-
new
|
|
18
|
-
key: new
|
|
18
|
+
new D({
|
|
19
|
+
key: new _("focus"),
|
|
19
20
|
props: {
|
|
20
21
|
decorations: ({ doc: t, selection: e }) => {
|
|
21
22
|
const { isEditable: n, isFocused: o } = this.editor, { anchor: r } = e, s = [];
|
|
@@ -35,7 +36,7 @@ const Mt = J.create({
|
|
|
35
36
|
return !1;
|
|
36
37
|
if (l += 1, this.options.mode === "deepest" && i - l > 0 || this.options.mode === "shallowest" && l > 1)
|
|
37
38
|
return this.options.mode === "deepest";
|
|
38
|
-
s.push(
|
|
39
|
+
s.push(q.node(c, c + a.nodeSize, {
|
|
39
40
|
class: this.options.className
|
|
40
41
|
}));
|
|
41
42
|
}), F.create(t, s);
|
|
@@ -44,7 +45,7 @@ const Mt = J.create({
|
|
|
44
45
|
})
|
|
45
46
|
];
|
|
46
47
|
}
|
|
47
|
-
}),
|
|
48
|
+
}), kt = /(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/, Tt = k.create({
|
|
48
49
|
name: "image",
|
|
49
50
|
addOptions() {
|
|
50
51
|
return {
|
|
@@ -81,7 +82,7 @@ const Mt = J.create({
|
|
|
81
82
|
];
|
|
82
83
|
},
|
|
83
84
|
renderHTML({ HTMLAttributes: t }) {
|
|
84
|
-
return ["img",
|
|
85
|
+
return ["img", M(this.options.HTMLAttributes, t)];
|
|
85
86
|
},
|
|
86
87
|
addCommands() {
|
|
87
88
|
return {
|
|
@@ -93,8 +94,8 @@ const Mt = J.create({
|
|
|
93
94
|
},
|
|
94
95
|
addInputRules() {
|
|
95
96
|
return [
|
|
96
|
-
|
|
97
|
-
find:
|
|
97
|
+
Xe({
|
|
98
|
+
find: kt,
|
|
98
99
|
type: this.type,
|
|
99
100
|
getAttributes: (t) => {
|
|
100
101
|
const [, , e, n, o] = t;
|
|
@@ -113,11 +114,10 @@ if (typeof WeakMap < "u") {
|
|
|
113
114
|
let n = 0;
|
|
114
115
|
we = (o) => {
|
|
115
116
|
for (let r = 0; r < t.length; r += 2)
|
|
116
|
-
if (t[r] == o)
|
|
117
|
-
return t[r + 1];
|
|
117
|
+
if (t[r] == o) return t[r + 1];
|
|
118
118
|
}, ye = (o, r) => (n == 10 && (n = 0), t[n++] = o, t[n++] = r);
|
|
119
119
|
}
|
|
120
|
-
var
|
|
120
|
+
var C = class {
|
|
121
121
|
constructor(t, e, n, o) {
|
|
122
122
|
this.width = t, this.height = e, this.map = n, this.problems = o;
|
|
123
123
|
}
|
|
@@ -125,8 +125,7 @@ var M = class {
|
|
|
125
125
|
findCell(t) {
|
|
126
126
|
for (let e = 0; e < this.map.length; e++) {
|
|
127
127
|
const n = this.map[e];
|
|
128
|
-
if (n != t)
|
|
129
|
-
continue;
|
|
128
|
+
if (n != t) continue;
|
|
130
129
|
const o = e % this.width, r = e / this.width | 0;
|
|
131
130
|
let s = o + 1, i = r + 1;
|
|
132
131
|
for (let l = 1; s < this.width && this.map[e + l] == n; l++)
|
|
@@ -189,8 +188,7 @@ var M = class {
|
|
|
189
188
|
if (o == t) {
|
|
190
189
|
let i = e + t * this.width;
|
|
191
190
|
const l = (t + 1) * this.width;
|
|
192
|
-
for (; i < l && this.map[i] < r; )
|
|
193
|
-
i++;
|
|
191
|
+
for (; i < l && this.map[i] < r; ) i++;
|
|
194
192
|
return i == l ? s - 1 : this.map[i];
|
|
195
193
|
}
|
|
196
194
|
r = s;
|
|
@@ -198,65 +196,62 @@ var M = class {
|
|
|
198
196
|
}
|
|
199
197
|
// Find the table map for the given table node.
|
|
200
198
|
static get(t) {
|
|
201
|
-
return we(t) || ye(t,
|
|
199
|
+
return we(t) || ye(t, vt(t));
|
|
202
200
|
}
|
|
203
201
|
};
|
|
204
|
-
function
|
|
202
|
+
function vt(t) {
|
|
205
203
|
if (t.type.spec.tableRole != "table")
|
|
206
204
|
throw new RangeError("Not a table node: " + t.type.name);
|
|
207
|
-
const e =
|
|
205
|
+
const e = St(t), n = t.childCount, o = [];
|
|
208
206
|
let r = 0, s = null;
|
|
209
207
|
const i = [];
|
|
210
|
-
for (let c = 0,
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
d++;
|
|
208
|
+
for (let c = 0, u = e * n; c < u; c++) o[c] = 0;
|
|
209
|
+
for (let c = 0, u = 0; c < n; c++) {
|
|
210
|
+
const d = t.child(c);
|
|
211
|
+
u++;
|
|
215
212
|
for (let f = 0; ; f++) {
|
|
216
|
-
for (; r < o.length && o[r] != 0; )
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
for (let P = 0; P < w; P++) {
|
|
222
|
-
if (P + c >= n) {
|
|
213
|
+
for (; r < o.length && o[r] != 0; ) r++;
|
|
214
|
+
if (f == d.childCount) break;
|
|
215
|
+
const m = d.child(f), { colspan: g, rowspan: w, colwidth: L } = m.attrs;
|
|
216
|
+
for (let z = 0; z < w; z++) {
|
|
217
|
+
if (z + c >= n) {
|
|
223
218
|
(s || (s = [])).push({
|
|
224
219
|
type: "overlong_rowspan",
|
|
225
|
-
pos:
|
|
226
|
-
n: w -
|
|
220
|
+
pos: u,
|
|
221
|
+
n: w - z
|
|
227
222
|
});
|
|
228
223
|
break;
|
|
229
224
|
}
|
|
230
|
-
const
|
|
225
|
+
const U = r + z * e;
|
|
231
226
|
for (let W = 0; W < g; W++) {
|
|
232
|
-
o[
|
|
227
|
+
o[U + W] == 0 ? o[U + W] = u : (s || (s = [])).push({
|
|
233
228
|
type: "collision",
|
|
234
229
|
row: c,
|
|
235
|
-
pos:
|
|
230
|
+
pos: u,
|
|
236
231
|
n: g - W
|
|
237
232
|
});
|
|
238
|
-
const te =
|
|
233
|
+
const te = L && L[W];
|
|
239
234
|
if (te) {
|
|
240
|
-
const Z = (
|
|
235
|
+
const Z = (U + W) % e * 2, he = i[Z];
|
|
241
236
|
he == null || he != te && i[Z + 1] == 1 ? (i[Z] = te, i[Z + 1] = 1) : he == te && i[Z + 1]++;
|
|
242
237
|
}
|
|
243
238
|
}
|
|
244
239
|
}
|
|
245
|
-
r += g,
|
|
240
|
+
r += g, u += m.nodeSize;
|
|
246
241
|
}
|
|
247
242
|
const p = (c + 1) * e;
|
|
248
243
|
let h = 0;
|
|
249
|
-
for (; r < p; )
|
|
250
|
-
|
|
251
|
-
h && (s || (s = [])).push({ type: "missing", row: c, n: h }), d++;
|
|
244
|
+
for (; r < p; ) o[r++] == 0 && h++;
|
|
245
|
+
h && (s || (s = [])).push({ type: "missing", row: c, n: h }), u++;
|
|
252
246
|
}
|
|
253
|
-
|
|
247
|
+
(e === 0 || n === 0) && (s || (s = [])).push({ type: "zero_sized" });
|
|
248
|
+
const l = new C(e, n, o, s);
|
|
254
249
|
let a = !1;
|
|
255
250
|
for (let c = 0; !a && c < i.length; c += 2)
|
|
256
251
|
i[c] != null && i[c + 1] < n && (a = !0);
|
|
257
|
-
return a &&
|
|
252
|
+
return a && xt(l, i, t), l;
|
|
258
253
|
}
|
|
259
|
-
function
|
|
254
|
+
function St(t) {
|
|
260
255
|
let e = -1, n = !1;
|
|
261
256
|
for (let o = 0; o < t.childCount; o++) {
|
|
262
257
|
const r = t.child(o);
|
|
@@ -277,13 +272,12 @@ function Tt(t) {
|
|
|
277
272
|
}
|
|
278
273
|
return e;
|
|
279
274
|
}
|
|
280
|
-
function
|
|
275
|
+
function xt(t, e, n) {
|
|
281
276
|
t.problems || (t.problems = []);
|
|
282
277
|
const o = {};
|
|
283
278
|
for (let r = 0; r < t.map.length; r++) {
|
|
284
279
|
const s = t.map[r];
|
|
285
|
-
if (o[s])
|
|
286
|
-
continue;
|
|
280
|
+
if (o[s]) continue;
|
|
287
281
|
o[s] = !0;
|
|
288
282
|
const i = n.nodeAt(s);
|
|
289
283
|
if (!i)
|
|
@@ -291,8 +285,8 @@ function St(t, e, n) {
|
|
|
291
285
|
let l = null;
|
|
292
286
|
const a = i.attrs;
|
|
293
287
|
for (let c = 0; c < a.colspan; c++) {
|
|
294
|
-
const
|
|
295
|
-
|
|
288
|
+
const u = (r + c) % t.width, d = e[u * 2];
|
|
289
|
+
d != null && (!a.colwidth || a.colwidth[c] != d) && ((l || (l = Lt(a)))[c] = d);
|
|
296
290
|
}
|
|
297
291
|
l && t.problems.unshift({
|
|
298
292
|
type: "colwidth mismatch",
|
|
@@ -301,12 +295,10 @@ function St(t, e, n) {
|
|
|
301
295
|
});
|
|
302
296
|
}
|
|
303
297
|
}
|
|
304
|
-
function
|
|
305
|
-
if (t.colwidth)
|
|
306
|
-
return t.colwidth.slice();
|
|
298
|
+
function Lt(t) {
|
|
299
|
+
if (t.colwidth) return t.colwidth.slice();
|
|
307
300
|
const e = [];
|
|
308
|
-
for (let n = 0; n < t.colspan; n++)
|
|
309
|
-
e.push(0);
|
|
301
|
+
for (let n = 0; n < t.colspan; n++) e.push(0);
|
|
310
302
|
return e;
|
|
311
303
|
}
|
|
312
304
|
function T(t) {
|
|
@@ -320,26 +312,24 @@ function T(t) {
|
|
|
320
312
|
}
|
|
321
313
|
return e;
|
|
322
314
|
}
|
|
323
|
-
var
|
|
324
|
-
function
|
|
315
|
+
var B = new _("selectingCells");
|
|
316
|
+
function Y(t) {
|
|
325
317
|
for (let e = t.depth - 1; e > 0; e--)
|
|
326
318
|
if (t.node(e).type.spec.tableRole == "row")
|
|
327
319
|
return t.node(0).resolve(t.before(e + 1));
|
|
328
320
|
return null;
|
|
329
321
|
}
|
|
330
|
-
function
|
|
322
|
+
function Rt(t) {
|
|
331
323
|
for (let e = t.depth; e > 0; e--) {
|
|
332
324
|
const n = t.node(e).type.spec.tableRole;
|
|
333
|
-
if (n === "cell" || n === "header_cell")
|
|
334
|
-
return t.node(e);
|
|
325
|
+
if (n === "cell" || n === "header_cell") return t.node(e);
|
|
335
326
|
}
|
|
336
327
|
return null;
|
|
337
328
|
}
|
|
338
329
|
function E(t) {
|
|
339
330
|
const e = t.selection.$head;
|
|
340
331
|
for (let n = e.depth; n > 0; n--)
|
|
341
|
-
if (e.node(n).type.spec.tableRole == "row")
|
|
342
|
-
return !0;
|
|
332
|
+
if (e.node(n).type.spec.tableRole == "row") return !0;
|
|
343
333
|
return !1;
|
|
344
334
|
}
|
|
345
335
|
function pe(t) {
|
|
@@ -348,16 +338,15 @@ function pe(t) {
|
|
|
348
338
|
return e.$anchorCell.pos > e.$headCell.pos ? e.$anchorCell : e.$headCell;
|
|
349
339
|
if ("node" in e && e.node && e.node.type.spec.tableRole == "cell")
|
|
350
340
|
return e.$anchor;
|
|
351
|
-
const n =
|
|
341
|
+
const n = Y(e.$head) || Ht(e.$head);
|
|
352
342
|
if (n)
|
|
353
343
|
return n;
|
|
354
344
|
throw new RangeError(`No cell found around position ${e.head}`);
|
|
355
345
|
}
|
|
356
|
-
function
|
|
346
|
+
function Ht(t) {
|
|
357
347
|
for (let e = t.nodeAfter, n = t.pos; e; e = e.firstChild, n++) {
|
|
358
348
|
const o = e.type.spec.tableRole;
|
|
359
|
-
if (o == "cell" || o == "header_cell")
|
|
360
|
-
return t.doc.resolve(n);
|
|
349
|
+
if (o == "cell" || o == "header_cell") return t.doc.resolve(n);
|
|
361
350
|
}
|
|
362
351
|
for (let e = t.nodeBefore, n = t.pos; e; e = e.lastChild, n--) {
|
|
363
352
|
const o = e.type.spec.tableRole;
|
|
@@ -368,80 +357,78 @@ function Rt(t) {
|
|
|
368
357
|
function Ce(t) {
|
|
369
358
|
return t.parent.type.spec.tableRole == "row" && !!t.nodeAfter;
|
|
370
359
|
}
|
|
371
|
-
function
|
|
360
|
+
function Et(t) {
|
|
372
361
|
return t.node(0).resolve(t.pos + t.nodeAfter.nodeSize);
|
|
373
362
|
}
|
|
374
|
-
function
|
|
363
|
+
function Te(t, e) {
|
|
375
364
|
return t.depth == e.depth && t.pos >= e.start(-1) && t.pos <= e.end(-1);
|
|
376
365
|
}
|
|
377
|
-
function
|
|
378
|
-
const o = t.node(-1), r =
|
|
366
|
+
function Ye(t, e, n) {
|
|
367
|
+
const o = t.node(-1), r = C.get(o), s = t.start(-1), i = r.nextCell(t.pos - s, e, n);
|
|
379
368
|
return i == null ? null : t.node(0).resolve(s + i);
|
|
380
369
|
}
|
|
381
|
-
function
|
|
370
|
+
function X(t, e, n = 1) {
|
|
382
371
|
const o = { ...t, colspan: t.colspan - n };
|
|
383
372
|
return o.colwidth && (o.colwidth = o.colwidth.slice(), o.colwidth.splice(e, n), o.colwidth.some((r) => r > 0) || (o.colwidth = null)), o;
|
|
384
373
|
}
|
|
385
|
-
function
|
|
374
|
+
function Ue(t, e, n = 1) {
|
|
386
375
|
const o = { ...t, colspan: t.colspan + n };
|
|
387
376
|
if (o.colwidth) {
|
|
388
377
|
o.colwidth = o.colwidth.slice();
|
|
389
|
-
for (let r = 0; r < n; r++)
|
|
390
|
-
o.colwidth.splice(e, 0, 0);
|
|
378
|
+
for (let r = 0; r < n; r++) o.colwidth.splice(e, 0, 0);
|
|
391
379
|
}
|
|
392
380
|
return o;
|
|
393
381
|
}
|
|
394
|
-
function
|
|
382
|
+
function It(t, e, n) {
|
|
395
383
|
const o = T(e.type.schema).header_cell;
|
|
396
384
|
for (let r = 0; r < t.height; r++)
|
|
397
385
|
if (e.nodeAt(t.map[n + r * t.width]).type != o)
|
|
398
386
|
return !1;
|
|
399
387
|
return !0;
|
|
400
388
|
}
|
|
401
|
-
var
|
|
389
|
+
var b = class P extends v {
|
|
402
390
|
// A table selection is identified by its anchor and head cells. The
|
|
403
391
|
// positions given to this constructor should point _before_ two
|
|
404
392
|
// cells in the same table. They may be the same, to select a single
|
|
405
393
|
// cell.
|
|
406
394
|
constructor(e, n = e) {
|
|
407
|
-
const o = e.node(-1), r =
|
|
395
|
+
const o = e.node(-1), r = C.get(o), s = e.start(-1), i = r.rectBetween(
|
|
408
396
|
e.pos - s,
|
|
409
397
|
n.pos - s
|
|
410
|
-
), l = e.node(0), a = r.cellsInRect(i).filter((
|
|
398
|
+
), l = e.node(0), a = r.cellsInRect(i).filter((u) => u != n.pos - s);
|
|
411
399
|
a.unshift(n.pos - s);
|
|
412
|
-
const c = a.map((
|
|
413
|
-
const
|
|
414
|
-
if (!
|
|
415
|
-
throw RangeError(`No cell with offset ${
|
|
416
|
-
const p = s +
|
|
400
|
+
const c = a.map((u) => {
|
|
401
|
+
const d = o.nodeAt(u);
|
|
402
|
+
if (!d)
|
|
403
|
+
throw RangeError(`No cell with offset ${u} found`);
|
|
404
|
+
const p = s + u + 1;
|
|
417
405
|
return new dt(
|
|
418
406
|
l.resolve(p),
|
|
419
|
-
l.resolve(p +
|
|
407
|
+
l.resolve(p + d.content.size)
|
|
420
408
|
);
|
|
421
409
|
});
|
|
422
410
|
super(c[0].$from, c[0].$to, c), this.$anchorCell = e, this.$headCell = n;
|
|
423
411
|
}
|
|
424
412
|
map(e, n) {
|
|
425
413
|
const o = e.resolve(n.map(this.$anchorCell.pos)), r = e.resolve(n.map(this.$headCell.pos));
|
|
426
|
-
if (Ce(o) && Ce(r) &&
|
|
414
|
+
if (Ce(o) && Ce(r) && Te(o, r)) {
|
|
427
415
|
const s = this.$anchorCell.node(-1) != o.node(-1);
|
|
428
|
-
return s && this.isRowSelection() ?
|
|
416
|
+
return s && this.isRowSelection() ? P.rowSelection(o, r) : s && this.isColSelection() ? P.colSelection(o, r) : new P(o, r);
|
|
429
417
|
}
|
|
430
|
-
return
|
|
418
|
+
return S.between(o, r);
|
|
431
419
|
}
|
|
432
420
|
// Returns a rectangular slice of table rows containing the selected
|
|
433
421
|
// cells.
|
|
434
422
|
content() {
|
|
435
|
-
const e = this.$anchorCell.node(-1), n =
|
|
423
|
+
const e = this.$anchorCell.node(-1), n = C.get(e), o = this.$anchorCell.start(-1), r = n.rectBetween(
|
|
436
424
|
this.$anchorCell.pos - o,
|
|
437
425
|
this.$headCell.pos - o
|
|
438
426
|
), s = {}, i = [];
|
|
439
427
|
for (let a = r.top; a < r.bottom; a++) {
|
|
440
428
|
const c = [];
|
|
441
|
-
for (let
|
|
442
|
-
const p = n.map[
|
|
443
|
-
if (s[p])
|
|
444
|
-
continue;
|
|
429
|
+
for (let u = a * n.width + r.left, d = r.left; d < r.right; d++, u++) {
|
|
430
|
+
const p = n.map[u];
|
|
431
|
+
if (s[p]) continue;
|
|
445
432
|
s[p] = !0;
|
|
446
433
|
const h = n.findCell(p);
|
|
447
434
|
let f = e.nodeAt(p);
|
|
@@ -450,7 +437,7 @@ var y = class z extends S {
|
|
|
450
437
|
const m = r.left - h.left, g = h.right - r.right;
|
|
451
438
|
if (m > 0 || g > 0) {
|
|
452
439
|
let w = f.attrs;
|
|
453
|
-
if (m > 0 && (w =
|
|
440
|
+
if (m > 0 && (w = X(w, 0, m)), g > 0 && (w = X(
|
|
454
441
|
w,
|
|
455
442
|
w.colspan - g,
|
|
456
443
|
g
|
|
@@ -486,7 +473,7 @@ var y = class z extends S {
|
|
|
486
473
|
i ? N.empty : n
|
|
487
474
|
);
|
|
488
475
|
}
|
|
489
|
-
const s =
|
|
476
|
+
const s = v.findFrom(
|
|
490
477
|
e.doc.resolve(e.mapping.slice(o).map(this.to)),
|
|
491
478
|
-1
|
|
492
479
|
);
|
|
@@ -496,7 +483,7 @@ var y = class z extends S {
|
|
|
496
483
|
this.replace(e, new N(R.from(n), 0, 0));
|
|
497
484
|
}
|
|
498
485
|
forEachCell(e) {
|
|
499
|
-
const n = this.$anchorCell.node(-1), o =
|
|
486
|
+
const n = this.$anchorCell.node(-1), o = C.get(n), r = this.$anchorCell.start(-1), s = o.cellsInRect(
|
|
500
487
|
o.rectBetween(
|
|
501
488
|
this.$anchorCell.pos - r,
|
|
502
489
|
this.$headCell.pos - r
|
|
@@ -509,44 +496,42 @@ var y = class z extends S {
|
|
|
509
496
|
// bottom of the table.
|
|
510
497
|
isColSelection() {
|
|
511
498
|
const e = this.$anchorCell.index(-1), n = this.$headCell.index(-1);
|
|
512
|
-
if (Math.min(e, n) > 0)
|
|
513
|
-
return !1;
|
|
499
|
+
if (Math.min(e, n) > 0) return !1;
|
|
514
500
|
const o = e + this.$anchorCell.nodeAfter.attrs.rowspan, r = n + this.$headCell.nodeAfter.attrs.rowspan;
|
|
515
501
|
return Math.max(o, r) == this.$headCell.node(-1).childCount;
|
|
516
502
|
}
|
|
517
503
|
// Returns the smallest column selection that covers the given anchor
|
|
518
504
|
// and head cell.
|
|
519
505
|
static colSelection(e, n = e) {
|
|
520
|
-
const o = e.node(-1), r =
|
|
506
|
+
const o = e.node(-1), r = C.get(o), s = e.start(-1), i = r.findCell(e.pos - s), l = r.findCell(n.pos - s), a = e.node(0);
|
|
521
507
|
return i.top <= l.top ? (i.top > 0 && (e = a.resolve(s + r.map[i.left])), l.bottom < r.height && (n = a.resolve(
|
|
522
508
|
s + r.map[r.width * (r.height - 1) + l.right - 1]
|
|
523
509
|
))) : (l.top > 0 && (n = a.resolve(s + r.map[l.left])), i.bottom < r.height && (e = a.resolve(
|
|
524
510
|
s + r.map[r.width * (r.height - 1) + i.right - 1]
|
|
525
|
-
))), new
|
|
511
|
+
))), new P(e, n);
|
|
526
512
|
}
|
|
527
513
|
// True if this selection goes all the way from the left to the
|
|
528
514
|
// right of the table.
|
|
529
515
|
isRowSelection() {
|
|
530
|
-
const e = this.$anchorCell.node(-1), n =
|
|
531
|
-
if (Math.min(r, s) > 0)
|
|
532
|
-
return !1;
|
|
516
|
+
const e = this.$anchorCell.node(-1), n = C.get(e), o = this.$anchorCell.start(-1), r = n.colCount(this.$anchorCell.pos - o), s = n.colCount(this.$headCell.pos - o);
|
|
517
|
+
if (Math.min(r, s) > 0) return !1;
|
|
533
518
|
const i = r + this.$anchorCell.nodeAfter.attrs.colspan, l = s + this.$headCell.nodeAfter.attrs.colspan;
|
|
534
519
|
return Math.max(i, l) == n.width;
|
|
535
520
|
}
|
|
536
521
|
eq(e) {
|
|
537
|
-
return e instanceof
|
|
522
|
+
return e instanceof P && e.$anchorCell.pos == this.$anchorCell.pos && e.$headCell.pos == this.$headCell.pos;
|
|
538
523
|
}
|
|
539
524
|
// Returns the smallest row selection that covers the given anchor
|
|
540
525
|
// and head cell.
|
|
541
526
|
static rowSelection(e, n = e) {
|
|
542
|
-
const o = e.node(-1), r =
|
|
527
|
+
const o = e.node(-1), r = C.get(o), s = e.start(-1), i = r.findCell(e.pos - s), l = r.findCell(n.pos - s), a = e.node(0);
|
|
543
528
|
return i.left <= l.left ? (i.left > 0 && (e = a.resolve(
|
|
544
529
|
s + r.map[i.top * r.width]
|
|
545
530
|
)), l.right < r.width && (n = a.resolve(
|
|
546
531
|
s + r.map[r.width * (l.top + 1) - 1]
|
|
547
532
|
))) : (l.left > 0 && (n = a.resolve(s + r.map[l.top * r.width])), i.right < r.width && (e = a.resolve(
|
|
548
533
|
s + r.map[r.width * (i.top + 1) - 1]
|
|
549
|
-
))), new
|
|
534
|
+
))), new P(e, n);
|
|
550
535
|
}
|
|
551
536
|
toJSON() {
|
|
552
537
|
return {
|
|
@@ -556,18 +541,18 @@ var y = class z extends S {
|
|
|
556
541
|
};
|
|
557
542
|
}
|
|
558
543
|
static fromJSON(e, n) {
|
|
559
|
-
return new
|
|
544
|
+
return new P(e.resolve(n.anchor), e.resolve(n.head));
|
|
560
545
|
}
|
|
561
546
|
static create(e, n, o = n) {
|
|
562
|
-
return new
|
|
547
|
+
return new P(e.resolve(n), e.resolve(o));
|
|
563
548
|
}
|
|
564
549
|
getBookmark() {
|
|
565
|
-
return new
|
|
550
|
+
return new Nt(this.$anchorCell.pos, this.$headCell.pos);
|
|
566
551
|
}
|
|
567
552
|
};
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
var
|
|
553
|
+
b.prototype.visible = !1;
|
|
554
|
+
v.jsonID("cell", b);
|
|
555
|
+
var Nt = class Ze {
|
|
571
556
|
constructor(e, n) {
|
|
572
557
|
this.anchor = e, this.head = n;
|
|
573
558
|
}
|
|
@@ -576,22 +561,20 @@ var It = class Ze {
|
|
|
576
561
|
}
|
|
577
562
|
resolve(e) {
|
|
578
563
|
const n = e.resolve(this.anchor), o = e.resolve(this.head);
|
|
579
|
-
return n.parent.type.spec.tableRole == "row" && o.parent.type.spec.tableRole == "row" && n.index() < n.parent.childCount && o.index() < o.parent.childCount &&
|
|
564
|
+
return n.parent.type.spec.tableRole == "row" && o.parent.type.spec.tableRole == "row" && n.index() < n.parent.childCount && o.index() < o.parent.childCount && Te(n, o) ? new b(n, o) : v.near(o, 1);
|
|
580
565
|
}
|
|
581
566
|
};
|
|
582
|
-
function
|
|
583
|
-
if (!(t.selection instanceof
|
|
584
|
-
return null;
|
|
567
|
+
function Ot(t) {
|
|
568
|
+
if (!(t.selection instanceof b)) return null;
|
|
585
569
|
const e = [];
|
|
586
570
|
return t.selection.forEachCell((n, o) => {
|
|
587
571
|
e.push(
|
|
588
|
-
|
|
572
|
+
q.node(o, o + n.nodeSize, { class: "selectedCell" })
|
|
589
573
|
);
|
|
590
574
|
}), F.create(t.doc, e);
|
|
591
575
|
}
|
|
592
|
-
function
|
|
593
|
-
if (t.pos == e.pos || t.pos < e.pos - 6)
|
|
594
|
-
return !1;
|
|
576
|
+
function zt({ $from: t, $to: e }) {
|
|
577
|
+
if (t.pos == e.pos || t.pos < e.pos - 6) return !1;
|
|
595
578
|
let n = t.pos, o = e.pos, r = t.depth;
|
|
596
579
|
for (; r >= 0 && !(t.after(r + 1) < t.end(r)); r--, n++)
|
|
597
580
|
;
|
|
@@ -617,115 +600,111 @@ function Pt({ $from: t, $to: e }) {
|
|
|
617
600
|
}
|
|
618
601
|
return n !== o && e.parentOffset === 0;
|
|
619
602
|
}
|
|
620
|
-
function
|
|
603
|
+
function $t(t, e, n) {
|
|
621
604
|
const o = (e || t).selection, r = (e || t).doc;
|
|
622
605
|
let s, i;
|
|
623
606
|
if (o instanceof ue && (i = o.node.type.spec.tableRole)) {
|
|
624
607
|
if (i == "cell" || i == "header_cell")
|
|
625
|
-
s =
|
|
608
|
+
s = b.create(r, o.from);
|
|
626
609
|
else if (i == "row") {
|
|
627
610
|
const l = r.resolve(o.from + 1);
|
|
628
|
-
s =
|
|
611
|
+
s = b.rowSelection(l, l);
|
|
629
612
|
} else if (!n) {
|
|
630
|
-
const l =
|
|
631
|
-
s =
|
|
613
|
+
const l = C.get(o.node), a = o.from + 1, c = a + l.map[l.width * l.height - 1];
|
|
614
|
+
s = b.create(r, a + 1, c);
|
|
632
615
|
}
|
|
633
|
-
} else o instanceof
|
|
616
|
+
} else o instanceof S && zt(o) ? s = S.create(r, o.from) : o instanceof S && Pt(o) && (s = S.create(r, o.$from.start(), o.$from.end()));
|
|
634
617
|
return s && (e || (e = t.tr)).setSelection(s), e;
|
|
635
618
|
}
|
|
636
|
-
var
|
|
619
|
+
var Bt = new _("fix-tables");
|
|
637
620
|
function Qe(t, e, n, o) {
|
|
638
621
|
const r = t.childCount, s = e.childCount;
|
|
639
|
-
e:
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
}
|
|
622
|
+
e: for (let i = 0, l = 0; i < s; i++) {
|
|
623
|
+
const a = e.child(i);
|
|
624
|
+
for (let c = l, u = Math.min(r, i + 3); c < u; c++)
|
|
625
|
+
if (t.child(c) == a) {
|
|
626
|
+
l = c + 1, n += a.nodeSize;
|
|
627
|
+
continue e;
|
|
628
|
+
}
|
|
629
|
+
o(a, n), l < r && t.child(l).sameMarkup(a) ? Qe(t.child(l), a, n + 1, o) : a.nodesBetween(0, a.content.size, o, n + 1), n += a.nodeSize;
|
|
630
|
+
}
|
|
649
631
|
}
|
|
650
632
|
function et(t, e) {
|
|
651
633
|
let n;
|
|
652
634
|
const o = (r, s) => {
|
|
653
|
-
r.type.spec.tableRole == "table" && (n =
|
|
635
|
+
r.type.spec.tableRole == "table" && (n = Dt(t, r, s, n));
|
|
654
636
|
};
|
|
655
637
|
return e ? e.doc != t.doc && Qe(e.doc, t.doc, 0, o) : t.doc.descendants(o), n;
|
|
656
638
|
}
|
|
657
|
-
function
|
|
658
|
-
const r =
|
|
659
|
-
if (!r.problems)
|
|
660
|
-
return o;
|
|
639
|
+
function Dt(t, e, n, o) {
|
|
640
|
+
const r = C.get(e);
|
|
641
|
+
if (!r.problems) return o;
|
|
661
642
|
o || (o = t.tr);
|
|
662
643
|
const s = [];
|
|
663
|
-
for (let a = 0; a < r.height; a++)
|
|
664
|
-
s.push(0);
|
|
644
|
+
for (let a = 0; a < r.height; a++) s.push(0);
|
|
665
645
|
for (let a = 0; a < r.problems.length; a++) {
|
|
666
646
|
const c = r.problems[a];
|
|
667
647
|
if (c.type == "collision") {
|
|
668
|
-
const
|
|
669
|
-
if (!
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
for (let p = 0; p < u.rowspan; p++)
|
|
673
|
-
s[c.row + p] += c.n;
|
|
648
|
+
const u = e.nodeAt(c.pos);
|
|
649
|
+
if (!u) continue;
|
|
650
|
+
const d = u.attrs;
|
|
651
|
+
for (let p = 0; p < d.rowspan; p++) s[c.row + p] += c.n;
|
|
674
652
|
o.setNodeMarkup(
|
|
675
653
|
o.mapping.map(n + 1 + c.pos),
|
|
676
654
|
null,
|
|
677
|
-
|
|
655
|
+
X(d, d.colspan - c.n, c.n)
|
|
678
656
|
);
|
|
679
657
|
} else if (c.type == "missing")
|
|
680
658
|
s[c.row] += c.n;
|
|
681
659
|
else if (c.type == "overlong_rowspan") {
|
|
682
|
-
const
|
|
683
|
-
if (!
|
|
684
|
-
continue;
|
|
660
|
+
const u = e.nodeAt(c.pos);
|
|
661
|
+
if (!u) continue;
|
|
685
662
|
o.setNodeMarkup(o.mapping.map(n + 1 + c.pos), null, {
|
|
686
|
-
...
|
|
687
|
-
rowspan:
|
|
663
|
+
...u.attrs,
|
|
664
|
+
rowspan: u.attrs.rowspan - c.n
|
|
688
665
|
});
|
|
689
666
|
} else if (c.type == "colwidth mismatch") {
|
|
690
|
-
const
|
|
691
|
-
if (!
|
|
692
|
-
continue;
|
|
667
|
+
const u = e.nodeAt(c.pos);
|
|
668
|
+
if (!u) continue;
|
|
693
669
|
o.setNodeMarkup(o.mapping.map(n + 1 + c.pos), null, {
|
|
694
|
-
...
|
|
670
|
+
...u.attrs,
|
|
695
671
|
colwidth: c.colwidth
|
|
696
672
|
});
|
|
673
|
+
} else if (c.type == "zero_sized") {
|
|
674
|
+
const u = o.mapping.map(n);
|
|
675
|
+
o.delete(u, u + e.nodeSize);
|
|
697
676
|
}
|
|
698
677
|
}
|
|
699
678
|
let i, l;
|
|
700
679
|
for (let a = 0; a < s.length; a++)
|
|
701
680
|
s[a] && (i == null && (i = a), l = a);
|
|
702
681
|
for (let a = 0, c = n + 1; a < r.height; a++) {
|
|
703
|
-
const
|
|
682
|
+
const u = e.child(a), d = c + u.nodeSize, p = s[a];
|
|
704
683
|
if (p > 0) {
|
|
705
684
|
let h = "cell";
|
|
706
|
-
|
|
685
|
+
u.firstChild && (h = u.firstChild.type.spec.tableRole);
|
|
707
686
|
const f = [];
|
|
708
687
|
for (let g = 0; g < p; g++) {
|
|
709
688
|
const w = T(t.schema)[h].createAndFill();
|
|
710
689
|
w && f.push(w);
|
|
711
690
|
}
|
|
712
|
-
const m = (a == 0 || i == a - 1) && l == a ? c + 1 :
|
|
691
|
+
const m = (a == 0 || i == a - 1) && l == a ? c + 1 : d - 1;
|
|
713
692
|
o.insert(o.mapping.map(m), f);
|
|
714
693
|
}
|
|
715
|
-
c =
|
|
694
|
+
c = d;
|
|
716
695
|
}
|
|
717
|
-
return o.setMeta(
|
|
696
|
+
return o.setMeta(Bt, { fixTables: !0 });
|
|
718
697
|
}
|
|
719
698
|
function O(t) {
|
|
720
|
-
const e = t.selection, n = pe(t), o = n.node(-1), r = n.start(-1), s =
|
|
721
|
-
return { ...e instanceof
|
|
699
|
+
const e = t.selection, n = pe(t), o = n.node(-1), r = n.start(-1), s = C.get(o);
|
|
700
|
+
return { ...e instanceof b ? s.rectBetween(
|
|
722
701
|
e.$anchorCell.pos - r,
|
|
723
702
|
e.$headCell.pos - r
|
|
724
703
|
) : s.findCell(n.pos - r), tableStart: r, map: s, table: o };
|
|
725
704
|
}
|
|
726
705
|
function tt(t, { map: e, tableStart: n, table: o }, r) {
|
|
727
706
|
let s = r > 0 ? -1 : 0;
|
|
728
|
-
|
|
707
|
+
It(e, o, r + s) && (s = r == 0 || r == e.width ? null : 0);
|
|
729
708
|
for (let i = 0; i < e.height; i++) {
|
|
730
709
|
const l = i * e.width + r;
|
|
731
710
|
if (r > 0 && r < e.width && e.map[l - 1] == e.map[l]) {
|
|
@@ -733,7 +712,7 @@ function tt(t, { map: e, tableStart: n, table: o }, r) {
|
|
|
733
712
|
t.setNodeMarkup(
|
|
734
713
|
t.mapping.map(n + a),
|
|
735
714
|
null,
|
|
736
|
-
|
|
715
|
+
Ue(c.attrs, r - e.colCount(a))
|
|
737
716
|
), i += c.attrs.rowspan - 1;
|
|
738
717
|
} else {
|
|
739
718
|
const a = s == null ? T(o.type.schema).cell : o.nodeAt(e.map[l + s]).type, c = e.positionAt(i, r, o);
|
|
@@ -742,59 +721,55 @@ function tt(t, { map: e, tableStart: n, table: o }, r) {
|
|
|
742
721
|
}
|
|
743
722
|
return t;
|
|
744
723
|
}
|
|
745
|
-
function
|
|
746
|
-
if (!E(t))
|
|
747
|
-
return !1;
|
|
724
|
+
function _t(t, e) {
|
|
725
|
+
if (!E(t)) return !1;
|
|
748
726
|
if (e) {
|
|
749
727
|
const n = O(t);
|
|
750
728
|
e(tt(t.tr, n, n.left));
|
|
751
729
|
}
|
|
752
730
|
return !0;
|
|
753
731
|
}
|
|
754
|
-
function
|
|
755
|
-
if (!E(t))
|
|
756
|
-
return !1;
|
|
732
|
+
function Wt(t, e) {
|
|
733
|
+
if (!E(t)) return !1;
|
|
757
734
|
if (e) {
|
|
758
735
|
const n = O(t);
|
|
759
736
|
e(tt(t.tr, n, n.right));
|
|
760
737
|
}
|
|
761
738
|
return !0;
|
|
762
739
|
}
|
|
763
|
-
function
|
|
740
|
+
function Vt(t, { map: e, table: n, tableStart: o }, r) {
|
|
764
741
|
const s = t.mapping.maps.length;
|
|
765
742
|
for (let i = 0; i < e.height; ) {
|
|
766
|
-
const l = i * e.width + r, a = e.map[l], c = n.nodeAt(a),
|
|
743
|
+
const l = i * e.width + r, a = e.map[l], c = n.nodeAt(a), u = c.attrs;
|
|
767
744
|
if (r > 0 && e.map[l - 1] == a || r < e.width - 1 && e.map[l + 1] == a)
|
|
768
745
|
t.setNodeMarkup(
|
|
769
746
|
t.mapping.slice(s).map(o + a),
|
|
770
747
|
null,
|
|
771
|
-
|
|
748
|
+
X(u, r - e.colCount(a))
|
|
772
749
|
);
|
|
773
750
|
else {
|
|
774
|
-
const
|
|
775
|
-
t.delete(
|
|
751
|
+
const d = t.mapping.slice(s).map(o + a);
|
|
752
|
+
t.delete(d, d + c.nodeSize);
|
|
776
753
|
}
|
|
777
|
-
i +=
|
|
754
|
+
i += u.rowspan;
|
|
778
755
|
}
|
|
779
756
|
}
|
|
780
|
-
function
|
|
781
|
-
if (!E(t))
|
|
782
|
-
return !1;
|
|
757
|
+
function Ft(t, e) {
|
|
758
|
+
if (!E(t)) return !1;
|
|
783
759
|
if (e) {
|
|
784
760
|
const n = O(t), o = t.tr;
|
|
785
|
-
if (n.left == 0 && n.right == n.map.width)
|
|
786
|
-
|
|
787
|
-
for (let r = n.right - 1; Wt(o, n, r), r != n.left; r--) {
|
|
761
|
+
if (n.left == 0 && n.right == n.map.width) return !1;
|
|
762
|
+
for (let r = n.right - 1; Vt(o, n, r), r != n.left; r--) {
|
|
788
763
|
const s = n.tableStart ? o.doc.nodeAt(n.tableStart - 1) : o.doc;
|
|
789
764
|
if (!s)
|
|
790
765
|
throw RangeError("No table found");
|
|
791
|
-
n.table = s, n.map =
|
|
766
|
+
n.table = s, n.map = C.get(s);
|
|
792
767
|
}
|
|
793
768
|
e(o);
|
|
794
769
|
}
|
|
795
770
|
return !0;
|
|
796
771
|
}
|
|
797
|
-
function
|
|
772
|
+
function Kt(t, e, n) {
|
|
798
773
|
var o;
|
|
799
774
|
const r = T(e.type.schema).header_cell;
|
|
800
775
|
for (let s = 0; s < t.width; s++)
|
|
@@ -805,36 +780,33 @@ function Ft(t, e, n) {
|
|
|
805
780
|
function nt(t, { map: e, tableStart: n, table: o }, r) {
|
|
806
781
|
var s;
|
|
807
782
|
let i = n;
|
|
808
|
-
for (let c = 0; c < r; c++)
|
|
809
|
-
i += o.child(c).nodeSize;
|
|
783
|
+
for (let c = 0; c < r; c++) i += o.child(c).nodeSize;
|
|
810
784
|
const l = [];
|
|
811
785
|
let a = r > 0 ? -1 : 0;
|
|
812
|
-
|
|
813
|
-
for (let c = 0,
|
|
814
|
-
if (r > 0 && r < e.height && e.map[
|
|
815
|
-
const
|
|
816
|
-
t.setNodeMarkup(n +
|
|
786
|
+
Kt(e, o, r + a) && (a = r == 0 || r == e.height ? null : 0);
|
|
787
|
+
for (let c = 0, u = e.width * r; c < e.width; c++, u++)
|
|
788
|
+
if (r > 0 && r < e.height && e.map[u] == e.map[u - e.width]) {
|
|
789
|
+
const d = e.map[u], p = o.nodeAt(d).attrs;
|
|
790
|
+
t.setNodeMarkup(n + d, null, {
|
|
817
791
|
...p,
|
|
818
792
|
rowspan: p.rowspan + 1
|
|
819
793
|
}), c += p.colspan - 1;
|
|
820
794
|
} else {
|
|
821
|
-
const
|
|
795
|
+
const d = a == null ? T(o.type.schema).cell : (s = o.nodeAt(e.map[u + a * e.width])) == null ? void 0 : s.type, p = d == null ? void 0 : d.createAndFill();
|
|
822
796
|
p && l.push(p);
|
|
823
797
|
}
|
|
824
798
|
return t.insert(i, T(o.type.schema).row.create(null, l)), t;
|
|
825
799
|
}
|
|
826
|
-
function
|
|
827
|
-
if (!E(t))
|
|
828
|
-
return !1;
|
|
800
|
+
function jt(t, e) {
|
|
801
|
+
if (!E(t)) return !1;
|
|
829
802
|
if (e) {
|
|
830
803
|
const n = O(t);
|
|
831
804
|
e(nt(t.tr, n, n.top));
|
|
832
805
|
}
|
|
833
806
|
return !0;
|
|
834
807
|
}
|
|
835
|
-
function
|
|
836
|
-
if (!E(t))
|
|
837
|
-
return !1;
|
|
808
|
+
function Xt(t, e) {
|
|
809
|
+
if (!E(t)) return !1;
|
|
838
810
|
if (e) {
|
|
839
811
|
const n = O(t);
|
|
840
812
|
e(nt(t.tr, n, n.bottom));
|
|
@@ -843,22 +815,21 @@ function jt(t, e) {
|
|
|
843
815
|
}
|
|
844
816
|
function qt(t, { map: e, table: n, tableStart: o }, r) {
|
|
845
817
|
let s = 0;
|
|
846
|
-
for (let c = 0; c < r; c++)
|
|
847
|
-
s += n.child(c).nodeSize;
|
|
818
|
+
for (let c = 0; c < r; c++) s += n.child(c).nodeSize;
|
|
848
819
|
const i = s + n.child(r).nodeSize, l = t.mapping.maps.length;
|
|
849
820
|
t.delete(s + o, i + o);
|
|
850
821
|
const a = /* @__PURE__ */ new Set();
|
|
851
|
-
for (let c = 0,
|
|
852
|
-
const
|
|
853
|
-
if (!a.has(
|
|
854
|
-
if (a.add(
|
|
855
|
-
const p = n.nodeAt(
|
|
856
|
-
t.setNodeMarkup(t.mapping.slice(l).map(
|
|
822
|
+
for (let c = 0, u = r * e.width; c < e.width; c++, u++) {
|
|
823
|
+
const d = e.map[u];
|
|
824
|
+
if (!a.has(d)) {
|
|
825
|
+
if (a.add(d), r > 0 && d == e.map[u - e.width]) {
|
|
826
|
+
const p = n.nodeAt(d).attrs;
|
|
827
|
+
t.setNodeMarkup(t.mapping.slice(l).map(d + o), null, {
|
|
857
828
|
...p,
|
|
858
829
|
rowspan: p.rowspan - 1
|
|
859
830
|
}), c += p.colspan - 1;
|
|
860
|
-
} else if (r < e.height &&
|
|
861
|
-
const p = n.nodeAt(
|
|
831
|
+
} else if (r < e.height && d == e.map[u + e.width]) {
|
|
832
|
+
const p = n.nodeAt(d), h = p.attrs, f = p.type.create(
|
|
862
833
|
{ ...h, rowspan: p.attrs.rowspan - 1 },
|
|
863
834
|
p.content
|
|
864
835
|
), m = e.positionAt(r + 1, c, n);
|
|
@@ -867,18 +838,16 @@ function qt(t, { map: e, table: n, tableStart: o }, r) {
|
|
|
867
838
|
}
|
|
868
839
|
}
|
|
869
840
|
}
|
|
870
|
-
function
|
|
871
|
-
if (!E(t))
|
|
872
|
-
return !1;
|
|
841
|
+
function Gt(t, e) {
|
|
842
|
+
if (!E(t)) return !1;
|
|
873
843
|
if (e) {
|
|
874
844
|
const n = O(t), o = t.tr;
|
|
875
|
-
if (n.top == 0 && n.bottom == n.map.height)
|
|
876
|
-
return !1;
|
|
845
|
+
if (n.top == 0 && n.bottom == n.map.height) return !1;
|
|
877
846
|
for (let r = n.bottom - 1; qt(o, n, r), r != n.top; r--) {
|
|
878
847
|
const s = n.tableStart ? o.doc.nodeAt(n.tableStart - 1) : o.doc;
|
|
879
848
|
if (!s)
|
|
880
849
|
throw RangeError("No table found");
|
|
881
|
-
n.table = s, n.map =
|
|
850
|
+
n.table = s, n.map = C.get(n.table);
|
|
882
851
|
}
|
|
883
852
|
e(o);
|
|
884
853
|
}
|
|
@@ -888,7 +857,7 @@ function Se(t) {
|
|
|
888
857
|
const e = t.content;
|
|
889
858
|
return e.childCount == 1 && e.child(0).isTextblock && e.child(0).childCount == 0;
|
|
890
859
|
}
|
|
891
|
-
function
|
|
860
|
+
function Jt({ width: t, height: e, map: n }, o) {
|
|
892
861
|
let r = o.top * t + o.left, s = r, i = (o.bottom - 1) * t + o.left, l = r + (o.right - o.left - 1);
|
|
893
862
|
for (let a = o.top; a < o.bottom; a++) {
|
|
894
863
|
if (o.left > 0 && n[s] == n[s - 1] || o.right < t && n[l] == n[l + 1])
|
|
@@ -904,17 +873,16 @@ function Gt({ width: t, height: e, map: n }, o) {
|
|
|
904
873
|
}
|
|
905
874
|
function xe(t, e) {
|
|
906
875
|
const n = t.selection;
|
|
907
|
-
if (!(n instanceof
|
|
876
|
+
if (!(n instanceof b) || n.$anchorCell.pos == n.$headCell.pos)
|
|
908
877
|
return !1;
|
|
909
878
|
const o = O(t), { map: r } = o;
|
|
910
|
-
if (
|
|
911
|
-
return !1;
|
|
879
|
+
if (Jt(r, o)) return !1;
|
|
912
880
|
if (e) {
|
|
913
881
|
const s = t.tr, i = {};
|
|
914
882
|
let l = R.empty, a, c;
|
|
915
|
-
for (let
|
|
916
|
-
for (let
|
|
917
|
-
const p = r.map[
|
|
883
|
+
for (let u = o.top; u < o.bottom; u++)
|
|
884
|
+
for (let d = o.left; d < o.right; d++) {
|
|
885
|
+
const p = r.map[u * r.width + d], h = o.table.nodeAt(p);
|
|
918
886
|
if (!(i[p] || !h))
|
|
919
887
|
if (i[p] = !0, a == null)
|
|
920
888
|
a = p, c = h;
|
|
@@ -927,39 +895,37 @@ function xe(t, e) {
|
|
|
927
895
|
if (a == null || c == null)
|
|
928
896
|
return !0;
|
|
929
897
|
if (s.setNodeMarkup(a + o.tableStart, null, {
|
|
930
|
-
...
|
|
898
|
+
...Ue(
|
|
931
899
|
c.attrs,
|
|
932
900
|
c.attrs.colspan,
|
|
933
901
|
o.right - o.left - c.attrs.colspan
|
|
934
902
|
),
|
|
935
903
|
rowspan: o.bottom - o.top
|
|
936
904
|
}), l.size) {
|
|
937
|
-
const
|
|
938
|
-
s.replaceWith(
|
|
905
|
+
const u = a + 1 + c.content.size, d = Se(c) ? a + 1 : u;
|
|
906
|
+
s.replaceWith(d + o.tableStart, u + o.tableStart, l);
|
|
939
907
|
}
|
|
940
908
|
s.setSelection(
|
|
941
|
-
new
|
|
909
|
+
new b(s.doc.resolve(a + o.tableStart))
|
|
942
910
|
), e(s);
|
|
943
911
|
}
|
|
944
912
|
return !0;
|
|
945
913
|
}
|
|
946
914
|
function Le(t, e) {
|
|
947
915
|
const n = T(t.schema);
|
|
948
|
-
return
|
|
916
|
+
return Yt(({ node: o }) => n[o.type.spec.tableRole])(t, e);
|
|
949
917
|
}
|
|
950
|
-
function
|
|
918
|
+
function Yt(t) {
|
|
951
919
|
return (e, n) => {
|
|
952
920
|
var o;
|
|
953
921
|
const r = e.selection;
|
|
954
922
|
let s, i;
|
|
955
|
-
if (r instanceof
|
|
956
|
-
if (r.$anchorCell.pos != r.$headCell.pos)
|
|
957
|
-
return !1;
|
|
923
|
+
if (r instanceof b) {
|
|
924
|
+
if (r.$anchorCell.pos != r.$headCell.pos) return !1;
|
|
958
925
|
s = r.$anchorCell.nodeAfter, i = r.$anchorCell.pos;
|
|
959
926
|
} else {
|
|
960
|
-
if (s =
|
|
961
|
-
|
|
962
|
-
i = (o = U(r.$from)) == null ? void 0 : o.pos;
|
|
927
|
+
if (s = Rt(r.$from), !s) return !1;
|
|
928
|
+
i = (o = Y(r.$from)) == null ? void 0 : o.pos;
|
|
963
929
|
}
|
|
964
930
|
if (s == null || i == null || s.attrs.colspan == 1 && s.attrs.rowspan == 1)
|
|
965
931
|
return !1;
|
|
@@ -967,8 +933,8 @@ function Jt(t) {
|
|
|
967
933
|
let l = s.attrs;
|
|
968
934
|
const a = [], c = l.colwidth;
|
|
969
935
|
l.rowspan > 1 && (l = { ...l, rowspan: 1 }), l.colspan > 1 && (l = { ...l, colspan: 1 });
|
|
970
|
-
const
|
|
971
|
-
for (let h = 0; h <
|
|
936
|
+
const u = O(e), d = e.tr;
|
|
937
|
+
for (let h = 0; h < u.right - u.left; h++)
|
|
972
938
|
a.push(
|
|
973
939
|
c ? {
|
|
974
940
|
...l,
|
|
@@ -976,39 +942,37 @@ function Jt(t) {
|
|
|
976
942
|
} : l
|
|
977
943
|
);
|
|
978
944
|
let p;
|
|
979
|
-
for (let h =
|
|
980
|
-
let f =
|
|
981
|
-
h ==
|
|
982
|
-
for (let m =
|
|
983
|
-
m ==
|
|
984
|
-
p =
|
|
945
|
+
for (let h = u.top; h < u.bottom; h++) {
|
|
946
|
+
let f = u.map.positionAt(h, u.left, u.table);
|
|
947
|
+
h == u.top && (f += s.nodeSize);
|
|
948
|
+
for (let m = u.left, g = 0; m < u.right; m++, g++)
|
|
949
|
+
m == u.left && h == u.top || d.insert(
|
|
950
|
+
p = d.mapping.map(f + u.tableStart, 1),
|
|
985
951
|
t({ node: s, row: h, col: m }).createAndFill(a[g])
|
|
986
952
|
);
|
|
987
953
|
}
|
|
988
|
-
|
|
954
|
+
d.setNodeMarkup(
|
|
989
955
|
i,
|
|
990
|
-
t({ node: s, row:
|
|
956
|
+
t({ node: s, row: u.top, col: u.left }),
|
|
991
957
|
a[0]
|
|
992
|
-
), r instanceof
|
|
993
|
-
new
|
|
994
|
-
|
|
995
|
-
p ?
|
|
958
|
+
), r instanceof b && d.setSelection(
|
|
959
|
+
new b(
|
|
960
|
+
d.doc.resolve(r.$anchorCell.pos),
|
|
961
|
+
p ? d.doc.resolve(p) : void 0
|
|
996
962
|
)
|
|
997
|
-
), n(
|
|
963
|
+
), n(d);
|
|
998
964
|
}
|
|
999
965
|
return !0;
|
|
1000
966
|
};
|
|
1001
967
|
}
|
|
1002
968
|
function Ut(t, e) {
|
|
1003
969
|
return function(n, o) {
|
|
1004
|
-
if (!E(n))
|
|
1005
|
-
return !1;
|
|
970
|
+
if (!E(n)) return !1;
|
|
1006
971
|
const r = pe(n);
|
|
1007
|
-
if (r.nodeAfter.attrs[t] === e)
|
|
1008
|
-
return !1;
|
|
972
|
+
if (r.nodeAfter.attrs[t] === e) return !1;
|
|
1009
973
|
if (o) {
|
|
1010
974
|
const s = n.tr;
|
|
1011
|
-
n.selection instanceof
|
|
975
|
+
n.selection instanceof b ? n.selection.forEachCell((i, l) => {
|
|
1012
976
|
i.attrs[t] !== e && s.setNodeMarkup(l, null, {
|
|
1013
977
|
...i.attrs,
|
|
1014
978
|
[t]: e
|
|
@@ -1021,10 +985,9 @@ function Ut(t, e) {
|
|
|
1021
985
|
return !0;
|
|
1022
986
|
};
|
|
1023
987
|
}
|
|
1024
|
-
function
|
|
988
|
+
function Zt(t) {
|
|
1025
989
|
return function(e, n) {
|
|
1026
|
-
if (!E(e))
|
|
1027
|
-
return !1;
|
|
990
|
+
if (!E(e)) return !1;
|
|
1028
991
|
if (n) {
|
|
1029
992
|
const o = T(e.schema), r = O(e), s = e.tr, i = r.map.cellsInRect(
|
|
1030
993
|
t == "column" ? {
|
|
@@ -1072,26 +1035,25 @@ function Re(t, e, n) {
|
|
|
1072
1035
|
return !0;
|
|
1073
1036
|
}
|
|
1074
1037
|
function Q(t, e) {
|
|
1075
|
-
return e = e || { useDeprecatedLogic: !1 }, e.useDeprecatedLogic ?
|
|
1076
|
-
if (!E(n))
|
|
1077
|
-
return !1;
|
|
1038
|
+
return e = e || { useDeprecatedLogic: !1 }, e.useDeprecatedLogic ? Zt(t) : function(n, o) {
|
|
1039
|
+
if (!E(n)) return !1;
|
|
1078
1040
|
if (o) {
|
|
1079
1041
|
const r = T(n.schema), s = O(n), i = n.tr, l = Re("row", s, r), a = Re(
|
|
1080
1042
|
"column",
|
|
1081
1043
|
s,
|
|
1082
1044
|
r
|
|
1083
|
-
),
|
|
1045
|
+
), u = (t === "column" ? l : t === "row" ? a : !1) ? 1 : 0, d = t == "column" ? {
|
|
1084
1046
|
left: 0,
|
|
1085
|
-
top:
|
|
1047
|
+
top: u,
|
|
1086
1048
|
right: 1,
|
|
1087
1049
|
bottom: s.map.height
|
|
1088
1050
|
} : t == "row" ? {
|
|
1089
|
-
left:
|
|
1051
|
+
left: u,
|
|
1090
1052
|
top: 0,
|
|
1091
1053
|
right: s.map.width,
|
|
1092
1054
|
bottom: 1
|
|
1093
1055
|
} : s, p = t == "column" ? a ? r.cell : r.header_cell : t == "row" ? l ? r.cell : r.header_cell : r.cell;
|
|
1094
|
-
s.map.cellsInRect(
|
|
1056
|
+
s.map.cellsInRect(d).forEach((h) => {
|
|
1095
1057
|
const f = h + s.tableStart, m = i.doc.nodeAt(f);
|
|
1096
1058
|
m && i.setNodeMarkup(f, p, m.attrs);
|
|
1097
1059
|
}), o(i);
|
|
@@ -1105,14 +1067,13 @@ Q("row", {
|
|
|
1105
1067
|
Q("column", {
|
|
1106
1068
|
useDeprecatedLogic: !0
|
|
1107
1069
|
});
|
|
1108
|
-
var
|
|
1070
|
+
var Qt = Q("cell", {
|
|
1109
1071
|
useDeprecatedLogic: !0
|
|
1110
1072
|
});
|
|
1111
|
-
function
|
|
1073
|
+
function en(t, e) {
|
|
1112
1074
|
if (e < 0) {
|
|
1113
1075
|
const n = t.nodeBefore;
|
|
1114
|
-
if (n)
|
|
1115
|
-
return t.pos - n.nodeSize;
|
|
1076
|
+
if (n) return t.pos - n.nodeSize;
|
|
1116
1077
|
for (let o = t.index(-1) - 1, r = t.before(); o >= 0; o--) {
|
|
1117
1078
|
const s = t.node(-1).child(o), i = s.lastChild;
|
|
1118
1079
|
if (i)
|
|
@@ -1125,8 +1086,7 @@ function Qt(t, e) {
|
|
|
1125
1086
|
const n = t.node(-1);
|
|
1126
1087
|
for (let o = t.indexAfter(-1), r = t.after(); o < n.childCount; o++) {
|
|
1127
1088
|
const s = n.child(o);
|
|
1128
|
-
if (s.childCount)
|
|
1129
|
-
return r + 1;
|
|
1089
|
+
if (s.childCount) return r + 1;
|
|
1130
1090
|
r += s.nodeSize;
|
|
1131
1091
|
}
|
|
1132
1092
|
}
|
|
@@ -1134,21 +1094,19 @@ function Qt(t, e) {
|
|
|
1134
1094
|
}
|
|
1135
1095
|
function He(t) {
|
|
1136
1096
|
return function(e, n) {
|
|
1137
|
-
if (!E(e))
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
if (o == null)
|
|
1141
|
-
return !1;
|
|
1097
|
+
if (!E(e)) return !1;
|
|
1098
|
+
const o = en(pe(e), t);
|
|
1099
|
+
if (o == null) return !1;
|
|
1142
1100
|
if (n) {
|
|
1143
1101
|
const r = e.doc.resolve(o);
|
|
1144
1102
|
n(
|
|
1145
|
-
e.tr.setSelection(
|
|
1103
|
+
e.tr.setSelection(S.between(r, Et(r))).scrollIntoView()
|
|
1146
1104
|
);
|
|
1147
1105
|
}
|
|
1148
1106
|
return !0;
|
|
1149
1107
|
};
|
|
1150
1108
|
}
|
|
1151
|
-
function
|
|
1109
|
+
function tn(t, e) {
|
|
1152
1110
|
const n = t.selection.$anchor;
|
|
1153
1111
|
for (let o = n.depth; o > 0; o--)
|
|
1154
1112
|
if (n.node(o).type.spec.tableRole == "table")
|
|
@@ -1159,8 +1117,7 @@ function en(t, e) {
|
|
|
1159
1117
|
}
|
|
1160
1118
|
function ne(t, e) {
|
|
1161
1119
|
const n = t.selection;
|
|
1162
|
-
if (!(n instanceof
|
|
1163
|
-
return !1;
|
|
1120
|
+
if (!(n instanceof b)) return !1;
|
|
1164
1121
|
if (e) {
|
|
1165
1122
|
const o = t.tr, r = T(t.schema).cell.createAndFill().content;
|
|
1166
1123
|
n.forEachCell((s, i) => {
|
|
@@ -1173,9 +1130,8 @@ function ne(t, e) {
|
|
|
1173
1130
|
}
|
|
1174
1131
|
return !0;
|
|
1175
1132
|
}
|
|
1176
|
-
function
|
|
1177
|
-
if (!t.size)
|
|
1178
|
-
return null;
|
|
1133
|
+
function nn(t) {
|
|
1134
|
+
if (!t.size) return null;
|
|
1179
1135
|
let { content: e, openStart: n, openEnd: o } = t;
|
|
1180
1136
|
for (; e.childCount == 1 && (n > 0 && o > 0 || e.child(0).type.spec.tableRole == "table"); )
|
|
1181
1137
|
n--, o--, e = e.child(0).content;
|
|
@@ -1183,10 +1139,10 @@ function tn(t) {
|
|
|
1183
1139
|
if (s == "row")
|
|
1184
1140
|
for (let a = 0; a < e.childCount; a++) {
|
|
1185
1141
|
let c = e.child(a).content;
|
|
1186
|
-
const
|
|
1187
|
-
(
|
|
1142
|
+
const u = a ? 0 : Math.max(0, n - 1), d = a < e.childCount - 1 ? 0 : Math.max(0, o - 1);
|
|
1143
|
+
(u || d) && (c = Me(
|
|
1188
1144
|
T(i).row,
|
|
1189
|
-
new N(c,
|
|
1145
|
+
new N(c, u, d)
|
|
1190
1146
|
).content), l.push(c);
|
|
1191
1147
|
}
|
|
1192
1148
|
else if (s == "cell" || s == "header_cell")
|
|
@@ -1198,9 +1154,9 @@ function tn(t) {
|
|
|
1198
1154
|
);
|
|
1199
1155
|
else
|
|
1200
1156
|
return null;
|
|
1201
|
-
return
|
|
1157
|
+
return on(i, l);
|
|
1202
1158
|
}
|
|
1203
|
-
function
|
|
1159
|
+
function on(t, e) {
|
|
1204
1160
|
const n = [];
|
|
1205
1161
|
for (let r = 0; r < e.length; r++) {
|
|
1206
1162
|
const s = e[r];
|
|
@@ -1211,8 +1167,7 @@ function nn(t, e) {
|
|
|
1211
1167
|
}
|
|
1212
1168
|
}
|
|
1213
1169
|
let o = 0;
|
|
1214
|
-
for (let r = 0; r < n.length; r++)
|
|
1215
|
-
o = Math.max(o, n[r]);
|
|
1170
|
+
for (let r = 0; r < n.length; r++) o = Math.max(o, n[r]);
|
|
1216
1171
|
for (let r = 0; r < n.length; r++)
|
|
1217
1172
|
if (r >= e.length && e.push(R.empty), n[r] < o) {
|
|
1218
1173
|
const s = T(t).cell.createAndFill(), i = [];
|
|
@@ -1226,21 +1181,21 @@ function Me(t, e) {
|
|
|
1226
1181
|
const n = t.createAndFill();
|
|
1227
1182
|
return new ut(n).replace(0, n.content.size, e).doc;
|
|
1228
1183
|
}
|
|
1229
|
-
function
|
|
1184
|
+
function rn({ width: t, height: e, rows: n }, o, r) {
|
|
1230
1185
|
if (t != o) {
|
|
1231
1186
|
const s = [], i = [];
|
|
1232
1187
|
for (let l = 0; l < n.length; l++) {
|
|
1233
1188
|
const a = n[l], c = [];
|
|
1234
|
-
for (let
|
|
1235
|
-
let p = a.child(
|
|
1236
|
-
|
|
1237
|
-
|
|
1189
|
+
for (let u = s[l] || 0, d = 0; u < o; d++) {
|
|
1190
|
+
let p = a.child(d % a.childCount);
|
|
1191
|
+
u + p.attrs.colspan > o && (p = p.type.createChecked(
|
|
1192
|
+
X(
|
|
1238
1193
|
p.attrs,
|
|
1239
1194
|
p.attrs.colspan,
|
|
1240
|
-
|
|
1195
|
+
u + p.attrs.colspan - o
|
|
1241
1196
|
),
|
|
1242
1197
|
p.content
|
|
1243
|
-
)), c.push(p),
|
|
1198
|
+
)), c.push(p), u += p.attrs.colspan;
|
|
1244
1199
|
for (let h = 1; h < p.attrs.rowspan; h++)
|
|
1245
1200
|
s[l + h] = (s[l + h] || 0) + p.attrs.colspan;
|
|
1246
1201
|
}
|
|
@@ -1252,15 +1207,15 @@ function on({ width: t, height: e, rows: n }, o, r) {
|
|
|
1252
1207
|
const s = [];
|
|
1253
1208
|
for (let i = 0, l = 0; i < r; i++, l++) {
|
|
1254
1209
|
const a = [], c = n[l % e];
|
|
1255
|
-
for (let
|
|
1256
|
-
let
|
|
1257
|
-
i +
|
|
1210
|
+
for (let u = 0; u < c.childCount; u++) {
|
|
1211
|
+
let d = c.child(u);
|
|
1212
|
+
i + d.attrs.rowspan > r && (d = d.type.create(
|
|
1258
1213
|
{
|
|
1259
|
-
...
|
|
1260
|
-
rowspan: Math.max(1, r -
|
|
1214
|
+
...d.attrs,
|
|
1215
|
+
rowspan: Math.max(1, r - d.attrs.rowspan)
|
|
1261
1216
|
},
|
|
1262
|
-
|
|
1263
|
-
)), a.push(
|
|
1217
|
+
d.content
|
|
1218
|
+
)), a.push(d);
|
|
1264
1219
|
}
|
|
1265
1220
|
s.push(R.from(a));
|
|
1266
1221
|
}
|
|
@@ -1268,45 +1223,42 @@ function on({ width: t, height: e, rows: n }, o, r) {
|
|
|
1268
1223
|
}
|
|
1269
1224
|
return { width: t, height: e, rows: n };
|
|
1270
1225
|
}
|
|
1271
|
-
function
|
|
1226
|
+
function sn(t, e, n, o, r, s, i) {
|
|
1272
1227
|
const l = t.doc.type.schema, a = T(l);
|
|
1273
|
-
let c,
|
|
1228
|
+
let c, u;
|
|
1274
1229
|
if (r > e.width)
|
|
1275
|
-
for (let
|
|
1276
|
-
const h = n.child(
|
|
1230
|
+
for (let d = 0, p = 0; d < e.height; d++) {
|
|
1231
|
+
const h = n.child(d);
|
|
1277
1232
|
p += h.nodeSize;
|
|
1278
1233
|
const f = [];
|
|
1279
1234
|
let m;
|
|
1280
|
-
h.lastChild == null || h.lastChild.type == a.cell ? m = c || (c = a.cell.createAndFill()) : m =
|
|
1281
|
-
for (let g = e.width; g < r; g++)
|
|
1282
|
-
f.push(m);
|
|
1235
|
+
h.lastChild == null || h.lastChild.type == a.cell ? m = c || (c = a.cell.createAndFill()) : m = u || (u = a.header_cell.createAndFill());
|
|
1236
|
+
for (let g = e.width; g < r; g++) f.push(m);
|
|
1283
1237
|
t.insert(t.mapping.slice(i).map(p - 1 + o), f);
|
|
1284
1238
|
}
|
|
1285
1239
|
if (s > e.height) {
|
|
1286
|
-
const
|
|
1240
|
+
const d = [];
|
|
1287
1241
|
for (let f = 0, m = (e.height - 1) * e.width; f < Math.max(e.width, r); f++) {
|
|
1288
1242
|
const g = f >= e.width ? !1 : n.nodeAt(e.map[m + f]).type == a.header_cell;
|
|
1289
|
-
|
|
1290
|
-
g ?
|
|
1243
|
+
d.push(
|
|
1244
|
+
g ? u || (u = a.header_cell.createAndFill()) : c || (c = a.cell.createAndFill())
|
|
1291
1245
|
);
|
|
1292
1246
|
}
|
|
1293
|
-
const p = a.row.create(null, R.from(
|
|
1294
|
-
for (let f = e.height; f < s; f++)
|
|
1295
|
-
h.push(p);
|
|
1247
|
+
const p = a.row.create(null, R.from(d)), h = [];
|
|
1248
|
+
for (let f = e.height; f < s; f++) h.push(p);
|
|
1296
1249
|
t.insert(t.mapping.slice(i).map(o + n.nodeSize - 2), h);
|
|
1297
1250
|
}
|
|
1298
|
-
return !!(c ||
|
|
1251
|
+
return !!(c || u);
|
|
1299
1252
|
}
|
|
1300
1253
|
function Ee(t, e, n, o, r, s, i, l) {
|
|
1301
|
-
if (i == 0 || i == e.height)
|
|
1302
|
-
return !1;
|
|
1254
|
+
if (i == 0 || i == e.height) return !1;
|
|
1303
1255
|
let a = !1;
|
|
1304
1256
|
for (let c = r; c < s; c++) {
|
|
1305
|
-
const
|
|
1306
|
-
if (e.map[
|
|
1257
|
+
const u = i * e.width + c, d = e.map[u];
|
|
1258
|
+
if (e.map[u - e.width] == d) {
|
|
1307
1259
|
a = !0;
|
|
1308
|
-
const p = n.nodeAt(
|
|
1309
|
-
t.setNodeMarkup(t.mapping.slice(l).map(
|
|
1260
|
+
const p = n.nodeAt(d), { top: h, left: f } = e.findCell(d);
|
|
1261
|
+
t.setNodeMarkup(t.mapping.slice(l).map(d + o), null, {
|
|
1310
1262
|
...p.attrs,
|
|
1311
1263
|
rowspan: i - h
|
|
1312
1264
|
}), t.insert(
|
|
@@ -1321,18 +1273,17 @@ function Ee(t, e, n, o, r, s, i, l) {
|
|
|
1321
1273
|
return a;
|
|
1322
1274
|
}
|
|
1323
1275
|
function Ie(t, e, n, o, r, s, i, l) {
|
|
1324
|
-
if (i == 0 || i == e.width)
|
|
1325
|
-
return !1;
|
|
1276
|
+
if (i == 0 || i == e.width) return !1;
|
|
1326
1277
|
let a = !1;
|
|
1327
1278
|
for (let c = r; c < s; c++) {
|
|
1328
|
-
const
|
|
1329
|
-
if (e.map[
|
|
1279
|
+
const u = c * e.width + i, d = e.map[u];
|
|
1280
|
+
if (e.map[u - 1] == d) {
|
|
1330
1281
|
a = !0;
|
|
1331
|
-
const p = n.nodeAt(
|
|
1282
|
+
const p = n.nodeAt(d), h = e.colCount(d), f = t.mapping.slice(l).map(d + o);
|
|
1332
1283
|
t.setNodeMarkup(
|
|
1333
1284
|
f,
|
|
1334
1285
|
null,
|
|
1335
|
-
|
|
1286
|
+
X(
|
|
1336
1287
|
p.attrs,
|
|
1337
1288
|
i - h,
|
|
1338
1289
|
p.attrs.colspan - (i - h)
|
|
@@ -1340,7 +1291,7 @@ function Ie(t, e, n, o, r, s, i, l) {
|
|
|
1340
1291
|
), t.insert(
|
|
1341
1292
|
f + p.nodeSize,
|
|
1342
1293
|
p.type.createAndFill(
|
|
1343
|
-
|
|
1294
|
+
X(p.attrs, 0, i - h)
|
|
1344
1295
|
)
|
|
1345
1296
|
), c += p.attrs.rowspan - 1;
|
|
1346
1297
|
}
|
|
@@ -1351,31 +1302,31 @@ function Ne(t, e, n, o, r) {
|
|
|
1351
1302
|
let s = n ? t.doc.nodeAt(n - 1) : t.doc;
|
|
1352
1303
|
if (!s)
|
|
1353
1304
|
throw new Error("No table found");
|
|
1354
|
-
let i =
|
|
1355
|
-
const { top: l, left: a } = o, c = a + r.width,
|
|
1305
|
+
let i = C.get(s);
|
|
1306
|
+
const { top: l, left: a } = o, c = a + r.width, u = l + r.height, d = t.tr;
|
|
1356
1307
|
let p = 0;
|
|
1357
1308
|
function h() {
|
|
1358
|
-
if (s = n ?
|
|
1309
|
+
if (s = n ? d.doc.nodeAt(n - 1) : d.doc, !s)
|
|
1359
1310
|
throw new Error("No table found");
|
|
1360
|
-
i =
|
|
1311
|
+
i = C.get(s), p = d.mapping.maps.length;
|
|
1361
1312
|
}
|
|
1362
|
-
|
|
1363
|
-
for (let f = l; f <
|
|
1313
|
+
sn(d, i, s, n, c, u, p) && h(), Ee(d, i, s, n, a, c, l, p) && h(), Ee(d, i, s, n, a, c, u, p) && h(), Ie(d, i, s, n, l, u, a, p) && h(), Ie(d, i, s, n, l, u, c, p) && h();
|
|
1314
|
+
for (let f = l; f < u; f++) {
|
|
1364
1315
|
const m = i.positionAt(f, a, s), g = i.positionAt(f, c, s);
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1316
|
+
d.replace(
|
|
1317
|
+
d.mapping.slice(p).map(m + n),
|
|
1318
|
+
d.mapping.slice(p).map(g + n),
|
|
1368
1319
|
new N(r.rows[f - l], 0, 0)
|
|
1369
1320
|
);
|
|
1370
1321
|
}
|
|
1371
|
-
h(),
|
|
1372
|
-
new
|
|
1373
|
-
|
|
1374
|
-
|
|
1322
|
+
h(), d.setSelection(
|
|
1323
|
+
new b(
|
|
1324
|
+
d.doc.resolve(n + i.positionAt(l, a, s)),
|
|
1325
|
+
d.doc.resolve(n + i.positionAt(u - 1, c - 1, s))
|
|
1375
1326
|
)
|
|
1376
|
-
), e(
|
|
1327
|
+
), e(d);
|
|
1377
1328
|
}
|
|
1378
|
-
var
|
|
1329
|
+
var ln = qe({
|
|
1379
1330
|
ArrowLeft: oe("horiz", -1),
|
|
1380
1331
|
ArrowRight: oe("horiz", 1),
|
|
1381
1332
|
ArrowUp: oe("vert", -1),
|
|
@@ -1394,65 +1345,59 @@ function le(t, e, n) {
|
|
|
1394
1345
|
}
|
|
1395
1346
|
function oe(t, e) {
|
|
1396
1347
|
return (n, o, r) => {
|
|
1397
|
-
if (!r)
|
|
1398
|
-
return !1;
|
|
1348
|
+
if (!r) return !1;
|
|
1399
1349
|
const s = n.selection;
|
|
1400
|
-
if (s instanceof
|
|
1350
|
+
if (s instanceof b)
|
|
1401
1351
|
return le(
|
|
1402
1352
|
n,
|
|
1403
1353
|
o,
|
|
1404
|
-
|
|
1354
|
+
v.near(s.$headCell, e)
|
|
1405
1355
|
);
|
|
1406
|
-
if (t != "horiz" && !s.empty)
|
|
1407
|
-
return !1;
|
|
1356
|
+
if (t != "horiz" && !s.empty) return !1;
|
|
1408
1357
|
const i = ot(r, t, e);
|
|
1409
|
-
if (i == null)
|
|
1410
|
-
return !1;
|
|
1358
|
+
if (i == null) return !1;
|
|
1411
1359
|
if (t == "horiz")
|
|
1412
1360
|
return le(
|
|
1413
1361
|
n,
|
|
1414
1362
|
o,
|
|
1415
|
-
|
|
1363
|
+
v.near(n.doc.resolve(s.head + e), e)
|
|
1416
1364
|
);
|
|
1417
1365
|
{
|
|
1418
|
-
const l = n.doc.resolve(i), a =
|
|
1366
|
+
const l = n.doc.resolve(i), a = Ye(l, t, e);
|
|
1419
1367
|
let c;
|
|
1420
|
-
return a ? c =
|
|
1368
|
+
return a ? c = v.near(a, 1) : e < 0 ? c = v.near(n.doc.resolve(l.before(-1)), -1) : c = v.near(n.doc.resolve(l.after(-1)), 1), le(n, o, c);
|
|
1421
1369
|
}
|
|
1422
1370
|
};
|
|
1423
1371
|
}
|
|
1424
1372
|
function re(t, e) {
|
|
1425
1373
|
return (n, o, r) => {
|
|
1426
|
-
if (!r)
|
|
1427
|
-
return !1;
|
|
1374
|
+
if (!r) return !1;
|
|
1428
1375
|
const s = n.selection;
|
|
1429
1376
|
let i;
|
|
1430
|
-
if (s instanceof
|
|
1377
|
+
if (s instanceof b)
|
|
1431
1378
|
i = s;
|
|
1432
1379
|
else {
|
|
1433
1380
|
const a = ot(r, t, e);
|
|
1434
|
-
if (a == null)
|
|
1435
|
-
|
|
1436
|
-
i = new y(n.doc.resolve(a));
|
|
1381
|
+
if (a == null) return !1;
|
|
1382
|
+
i = new b(n.doc.resolve(a));
|
|
1437
1383
|
}
|
|
1438
|
-
const l =
|
|
1384
|
+
const l = Ye(i.$headCell, t, e);
|
|
1439
1385
|
return l ? le(
|
|
1440
1386
|
n,
|
|
1441
1387
|
o,
|
|
1442
|
-
new
|
|
1388
|
+
new b(i.$anchorCell, l)
|
|
1443
1389
|
) : !1;
|
|
1444
1390
|
};
|
|
1445
1391
|
}
|
|
1446
|
-
function
|
|
1447
|
-
const n = t.state.doc, o =
|
|
1448
|
-
return o ? (t.dispatch(t.state.tr.setSelection(new
|
|
1392
|
+
function an(t, e) {
|
|
1393
|
+
const n = t.state.doc, o = Y(n.resolve(e));
|
|
1394
|
+
return o ? (t.dispatch(t.state.tr.setSelection(new b(o))), !0) : !1;
|
|
1449
1395
|
}
|
|
1450
|
-
function
|
|
1451
|
-
if (!E(t.state))
|
|
1452
|
-
|
|
1453
|
-
let o = tn(n);
|
|
1396
|
+
function cn(t, e, n) {
|
|
1397
|
+
if (!E(t.state)) return !1;
|
|
1398
|
+
let o = nn(n);
|
|
1454
1399
|
const r = t.state.selection;
|
|
1455
|
-
if (r instanceof
|
|
1400
|
+
if (r instanceof b) {
|
|
1456
1401
|
o || (o = {
|
|
1457
1402
|
width: 1,
|
|
1458
1403
|
height: 1,
|
|
@@ -1462,71 +1407,66 @@ function an(t, e, n) {
|
|
|
1462
1407
|
)
|
|
1463
1408
|
]
|
|
1464
1409
|
});
|
|
1465
|
-
const s = r.$anchorCell.node(-1), i = r.$anchorCell.start(-1), l =
|
|
1410
|
+
const s = r.$anchorCell.node(-1), i = r.$anchorCell.start(-1), l = C.get(s).rectBetween(
|
|
1466
1411
|
r.$anchorCell.pos - i,
|
|
1467
1412
|
r.$headCell.pos - i
|
|
1468
1413
|
);
|
|
1469
|
-
return o =
|
|
1414
|
+
return o = rn(o, l.right - l.left, l.bottom - l.top), Ne(t.state, t.dispatch, i, l, o), !0;
|
|
1470
1415
|
} else if (o) {
|
|
1471
1416
|
const s = pe(t.state), i = s.start(-1);
|
|
1472
1417
|
return Ne(
|
|
1473
1418
|
t.state,
|
|
1474
1419
|
t.dispatch,
|
|
1475
1420
|
i,
|
|
1476
|
-
|
|
1421
|
+
C.get(s.node(-1)).findCell(s.pos - i),
|
|
1477
1422
|
o
|
|
1478
1423
|
), !0;
|
|
1479
1424
|
} else
|
|
1480
1425
|
return !1;
|
|
1481
1426
|
}
|
|
1482
|
-
function
|
|
1427
|
+
function dn(t, e) {
|
|
1483
1428
|
var n;
|
|
1484
|
-
if (e.ctrlKey || e.metaKey)
|
|
1485
|
-
return;
|
|
1429
|
+
if (e.ctrlKey || e.metaKey) return;
|
|
1486
1430
|
const o = Oe(t, e.target);
|
|
1487
1431
|
let r;
|
|
1488
|
-
if (e.shiftKey && t.state.selection instanceof
|
|
1432
|
+
if (e.shiftKey && t.state.selection instanceof b)
|
|
1489
1433
|
s(t.state.selection.$anchorCell, e), e.preventDefault();
|
|
1490
|
-
else if (e.shiftKey && o && (r =
|
|
1434
|
+
else if (e.shiftKey && o && (r = Y(t.state.selection.$anchor)) != null && ((n = fe(t, e)) == null ? void 0 : n.pos) != r.pos)
|
|
1491
1435
|
s(r, e), e.preventDefault();
|
|
1492
1436
|
else if (!o)
|
|
1493
1437
|
return;
|
|
1494
1438
|
function s(a, c) {
|
|
1495
|
-
let
|
|
1496
|
-
const
|
|
1497
|
-
if (!
|
|
1498
|
-
if (u
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
const p = new y(a, d);
|
|
1503
|
-
if (u || !t.state.selection.eq(p)) {
|
|
1439
|
+
let u = fe(t, c);
|
|
1440
|
+
const d = B.getState(t.state) == null;
|
|
1441
|
+
if (!u || !Te(a, u))
|
|
1442
|
+
if (d) u = a;
|
|
1443
|
+
else return;
|
|
1444
|
+
const p = new b(a, u);
|
|
1445
|
+
if (d || !t.state.selection.eq(p)) {
|
|
1504
1446
|
const h = t.state.tr.setSelection(p);
|
|
1505
|
-
|
|
1447
|
+
d && h.setMeta(B, a.pos), t.dispatch(h);
|
|
1506
1448
|
}
|
|
1507
1449
|
}
|
|
1508
1450
|
function i() {
|
|
1509
|
-
t.root.removeEventListener("mouseup", i), t.root.removeEventListener("dragstart", i), t.root.removeEventListener("mousemove", l),
|
|
1451
|
+
t.root.removeEventListener("mouseup", i), t.root.removeEventListener("dragstart", i), t.root.removeEventListener("mousemove", l), B.getState(t.state) != null && t.dispatch(t.state.tr.setMeta(B, -1));
|
|
1510
1452
|
}
|
|
1511
1453
|
function l(a) {
|
|
1512
|
-
const c = a,
|
|
1513
|
-
let
|
|
1514
|
-
if (
|
|
1515
|
-
|
|
1516
|
-
else if (Oe(t, c.target) != o && (
|
|
1454
|
+
const c = a, u = B.getState(t.state);
|
|
1455
|
+
let d;
|
|
1456
|
+
if (u != null)
|
|
1457
|
+
d = t.state.doc.resolve(u);
|
|
1458
|
+
else if (Oe(t, c.target) != o && (d = fe(t, e), !d))
|
|
1517
1459
|
return i();
|
|
1518
|
-
|
|
1460
|
+
d && s(d, c);
|
|
1519
1461
|
}
|
|
1520
1462
|
t.root.addEventListener("mouseup", i), t.root.addEventListener("dragstart", i), t.root.addEventListener("mousemove", l);
|
|
1521
1463
|
}
|
|
1522
1464
|
function ot(t, e, n) {
|
|
1523
|
-
if (!(t.state.selection instanceof
|
|
1524
|
-
return null;
|
|
1465
|
+
if (!(t.state.selection instanceof S)) return null;
|
|
1525
1466
|
const { $head: o } = t.state.selection;
|
|
1526
1467
|
for (let r = o.depth - 1; r >= 0; r--) {
|
|
1527
1468
|
const s = o.node(r);
|
|
1528
|
-
if ((n < 0 ? o.index(r) : o.indexAfter(r)) != (n < 0 ? 0 : s.childCount))
|
|
1529
|
-
return null;
|
|
1469
|
+
if ((n < 0 ? o.index(r) : o.indexAfter(r)) != (n < 0 ? 0 : s.childCount)) return null;
|
|
1530
1470
|
if (s.type.spec.tableRole == "cell" || s.type.spec.tableRole == "header_cell") {
|
|
1531
1471
|
const l = o.before(r), a = e == "vert" ? n > 0 ? "down" : "up" : n > 0 ? "right" : "left";
|
|
1532
1472
|
return t.endOfTextblock(a) ? l : null;
|
|
@@ -1545,17 +1485,17 @@ function fe(t, e) {
|
|
|
1545
1485
|
left: e.clientX,
|
|
1546
1486
|
top: e.clientY
|
|
1547
1487
|
});
|
|
1548
|
-
return n && n ?
|
|
1488
|
+
return n && n ? Y(t.state.doc.resolve(n.pos)) : null;
|
|
1549
1489
|
}
|
|
1550
|
-
var
|
|
1490
|
+
var un = class {
|
|
1551
1491
|
constructor(e, n) {
|
|
1552
1492
|
this.node = e, this.defaultCellMinWidth = n, this.dom = document.createElement("div"), this.dom.className = "tableWrapper", this.table = this.dom.appendChild(document.createElement("table")), this.table.style.setProperty(
|
|
1553
1493
|
"--default-cell-min-width",
|
|
1554
1494
|
`${n}px`
|
|
1555
|
-
), this.colgroup = this.table.appendChild(document.createElement("colgroup")),
|
|
1495
|
+
), this.colgroup = this.table.appendChild(document.createElement("colgroup")), Ae(e, this.colgroup, this.table, n), this.contentDOM = this.table.appendChild(document.createElement("tbody"));
|
|
1556
1496
|
}
|
|
1557
1497
|
update(e) {
|
|
1558
|
-
return e.type != this.node.type ? !1 : (this.node = e,
|
|
1498
|
+
return e.type != this.node.type ? !1 : (this.node = e, Ae(
|
|
1559
1499
|
e,
|
|
1560
1500
|
this.colgroup,
|
|
1561
1501
|
this.table,
|
|
@@ -1566,47 +1506,47 @@ var dn = class {
|
|
|
1566
1506
|
return e.type == "attributes" && (e.target == this.table || this.colgroup.contains(e.target));
|
|
1567
1507
|
}
|
|
1568
1508
|
};
|
|
1569
|
-
function
|
|
1509
|
+
function Ae(t, e, n, o, r, s) {
|
|
1570
1510
|
var i;
|
|
1571
1511
|
let l = 0, a = !0, c = e.firstChild;
|
|
1572
|
-
const
|
|
1573
|
-
if (
|
|
1574
|
-
for (let
|
|
1575
|
-
const { colspan: h, colwidth: f } =
|
|
1512
|
+
const u = t.firstChild;
|
|
1513
|
+
if (u) {
|
|
1514
|
+
for (let d = 0, p = 0; d < u.childCount; d++) {
|
|
1515
|
+
const { colspan: h, colwidth: f } = u.child(d).attrs;
|
|
1576
1516
|
for (let m = 0; m < h; m++, p++) {
|
|
1577
1517
|
const g = r == p ? s : f && f[m], w = g ? g + "px" : "";
|
|
1578
1518
|
if (l += g || o, g || (a = !1), c)
|
|
1579
1519
|
c.style.width != w && (c.style.width = w), c = c.nextSibling;
|
|
1580
1520
|
else {
|
|
1581
|
-
const
|
|
1582
|
-
|
|
1521
|
+
const L = document.createElement("col");
|
|
1522
|
+
L.style.width = w, e.appendChild(L);
|
|
1583
1523
|
}
|
|
1584
1524
|
}
|
|
1585
1525
|
}
|
|
1586
1526
|
for (; c; ) {
|
|
1587
|
-
const
|
|
1588
|
-
(i = c.parentNode) == null || i.removeChild(c), c =
|
|
1527
|
+
const d = c.nextSibling;
|
|
1528
|
+
(i = c.parentNode) == null || i.removeChild(c), c = d;
|
|
1589
1529
|
}
|
|
1590
1530
|
a ? (n.style.width = l + "px", n.style.minWidth = "") : (n.style.width = "", n.style.minWidth = l + "px");
|
|
1591
1531
|
}
|
|
1592
1532
|
}
|
|
1593
|
-
var
|
|
1533
|
+
var x = new _(
|
|
1594
1534
|
"tableColumnResizing"
|
|
1595
1535
|
);
|
|
1596
|
-
function
|
|
1536
|
+
function pn({
|
|
1597
1537
|
handleWidth: t = 5,
|
|
1598
1538
|
cellMinWidth: e = 25,
|
|
1599
1539
|
defaultCellMinWidth: n = 100,
|
|
1600
|
-
View: o =
|
|
1540
|
+
View: o = un,
|
|
1601
1541
|
lastColumnResizable: r = !0
|
|
1602
1542
|
} = {}) {
|
|
1603
|
-
const s = new
|
|
1604
|
-
key:
|
|
1543
|
+
const s = new D({
|
|
1544
|
+
key: x,
|
|
1605
1545
|
state: {
|
|
1606
1546
|
init(i, l) {
|
|
1607
1547
|
var a, c;
|
|
1608
|
-
const
|
|
1609
|
-
return o &&
|
|
1548
|
+
const u = (c = (a = s.spec) == null ? void 0 : a.props) == null ? void 0 : c.nodeViews, d = T(l.schema).table.name;
|
|
1549
|
+
return o && u && (u[d] = (p, h) => new o(p, n, h)), new hn(-1, !1);
|
|
1610
1550
|
},
|
|
1611
1551
|
apply(i, l) {
|
|
1612
1552
|
return l.apply(i);
|
|
@@ -1614,36 +1554,36 @@ function un({
|
|
|
1614
1554
|
},
|
|
1615
1555
|
props: {
|
|
1616
1556
|
attributes: (i) => {
|
|
1617
|
-
const l =
|
|
1557
|
+
const l = x.getState(i);
|
|
1618
1558
|
return l && l.activeHandle > -1 ? { class: "resize-cursor" } : {};
|
|
1619
1559
|
},
|
|
1620
1560
|
handleDOMEvents: {
|
|
1621
1561
|
mousemove: (i, l) => {
|
|
1622
|
-
|
|
1562
|
+
fn(i, l, t, r);
|
|
1623
1563
|
},
|
|
1624
1564
|
mouseleave: (i) => {
|
|
1625
|
-
|
|
1565
|
+
mn(i);
|
|
1626
1566
|
},
|
|
1627
1567
|
mousedown: (i, l) => {
|
|
1628
|
-
|
|
1568
|
+
gn(i, l, e, n);
|
|
1629
1569
|
}
|
|
1630
1570
|
},
|
|
1631
1571
|
decorations: (i) => {
|
|
1632
|
-
const l =
|
|
1572
|
+
const l = x.getState(i);
|
|
1633
1573
|
if (l && l.activeHandle > -1)
|
|
1634
|
-
return
|
|
1574
|
+
return Mn(i, l.activeHandle);
|
|
1635
1575
|
},
|
|
1636
1576
|
nodeViews: {}
|
|
1637
1577
|
}
|
|
1638
1578
|
});
|
|
1639
1579
|
return s;
|
|
1640
1580
|
}
|
|
1641
|
-
var
|
|
1581
|
+
var hn = class ae {
|
|
1642
1582
|
constructor(e, n) {
|
|
1643
1583
|
this.activeHandle = e, this.dragging = n;
|
|
1644
1584
|
}
|
|
1645
1585
|
apply(e) {
|
|
1646
|
-
const n = this, o = e.getMeta(
|
|
1586
|
+
const n = this, o = e.getMeta(x);
|
|
1647
1587
|
if (o && o.setHandle != null)
|
|
1648
1588
|
return new ae(o.setHandle, !1);
|
|
1649
1589
|
if (o && o.setDragging !== void 0)
|
|
@@ -1655,57 +1595,59 @@ var pn = class ae {
|
|
|
1655
1595
|
return n;
|
|
1656
1596
|
}
|
|
1657
1597
|
};
|
|
1658
|
-
function
|
|
1659
|
-
|
|
1598
|
+
function fn(t, e, n, o) {
|
|
1599
|
+
if (!t.editable) return;
|
|
1600
|
+
const r = x.getState(t.state);
|
|
1660
1601
|
if (r && !r.dragging) {
|
|
1661
|
-
const s =
|
|
1602
|
+
const s = wn(e.target);
|
|
1662
1603
|
let i = -1;
|
|
1663
1604
|
if (s) {
|
|
1664
1605
|
const { left: l, right: a } = s.getBoundingClientRect();
|
|
1665
|
-
e.clientX - l <= n ? i =
|
|
1606
|
+
e.clientX - l <= n ? i = ze(t, e, "left", n) : a - e.clientX <= n && (i = ze(t, e, "right", n));
|
|
1666
1607
|
}
|
|
1667
1608
|
if (i != r.activeHandle) {
|
|
1668
1609
|
if (!o && i !== -1) {
|
|
1669
|
-
const l = t.state.doc.resolve(i), a = l.node(-1), c =
|
|
1670
|
-
if (c.colCount(l.pos -
|
|
1610
|
+
const l = t.state.doc.resolve(i), a = l.node(-1), c = C.get(a), u = l.start(-1);
|
|
1611
|
+
if (c.colCount(l.pos - u) + l.nodeAfter.attrs.colspan - 1 == c.width - 1)
|
|
1671
1612
|
return;
|
|
1672
1613
|
}
|
|
1673
1614
|
rt(t, i);
|
|
1674
1615
|
}
|
|
1675
1616
|
}
|
|
1676
1617
|
}
|
|
1677
|
-
function
|
|
1678
|
-
|
|
1618
|
+
function mn(t) {
|
|
1619
|
+
if (!t.editable) return;
|
|
1620
|
+
const e = x.getState(t.state);
|
|
1679
1621
|
e && e.activeHandle > -1 && !e.dragging && rt(t, -1);
|
|
1680
1622
|
}
|
|
1681
|
-
function
|
|
1623
|
+
function gn(t, e, n, o) {
|
|
1682
1624
|
var r;
|
|
1683
|
-
|
|
1625
|
+
if (!t.editable) return !1;
|
|
1626
|
+
const s = (r = t.dom.ownerDocument.defaultView) != null ? r : window, i = x.getState(t.state);
|
|
1684
1627
|
if (!i || i.activeHandle == -1 || i.dragging)
|
|
1685
1628
|
return !1;
|
|
1686
|
-
const l = t.state.doc.nodeAt(i.activeHandle), a =
|
|
1629
|
+
const l = t.state.doc.nodeAt(i.activeHandle), a = bn(t, i.activeHandle, l.attrs);
|
|
1687
1630
|
t.dispatch(
|
|
1688
|
-
t.state.tr.setMeta(
|
|
1631
|
+
t.state.tr.setMeta(x, {
|
|
1689
1632
|
setDragging: { startX: e.clientX, startWidth: a }
|
|
1690
1633
|
})
|
|
1691
1634
|
);
|
|
1692
|
-
function c(
|
|
1693
|
-
s.removeEventListener("mouseup", c), s.removeEventListener("mousemove",
|
|
1694
|
-
const p =
|
|
1695
|
-
p != null && p.dragging && (
|
|
1635
|
+
function c(d) {
|
|
1636
|
+
s.removeEventListener("mouseup", c), s.removeEventListener("mousemove", u);
|
|
1637
|
+
const p = x.getState(t.state);
|
|
1638
|
+
p != null && p.dragging && (yn(
|
|
1696
1639
|
t,
|
|
1697
1640
|
p.activeHandle,
|
|
1698
|
-
|
|
1641
|
+
Pe(p.dragging, d, n)
|
|
1699
1642
|
), t.dispatch(
|
|
1700
|
-
t.state.tr.setMeta(
|
|
1643
|
+
t.state.tr.setMeta(x, { setDragging: null })
|
|
1701
1644
|
));
|
|
1702
1645
|
}
|
|
1703
|
-
function d
|
|
1704
|
-
if (!
|
|
1705
|
-
|
|
1706
|
-
const p = L.getState(t.state);
|
|
1646
|
+
function u(d) {
|
|
1647
|
+
if (!d.which) return c(d);
|
|
1648
|
+
const p = x.getState(t.state);
|
|
1707
1649
|
if (p && p.dragging) {
|
|
1708
|
-
const h =
|
|
1650
|
+
const h = Pe(p.dragging, d, n);
|
|
1709
1651
|
$e(
|
|
1710
1652
|
t,
|
|
1711
1653
|
p.activeHandle,
|
|
@@ -1719,12 +1661,11 @@ function mn(t, e, n, o) {
|
|
|
1719
1661
|
i.activeHandle,
|
|
1720
1662
|
a,
|
|
1721
1663
|
o
|
|
1722
|
-
), s.addEventListener("mouseup", c), s.addEventListener("mousemove",
|
|
1664
|
+
), s.addEventListener("mouseup", c), s.addEventListener("mousemove", u), e.preventDefault(), !0;
|
|
1723
1665
|
}
|
|
1724
|
-
function
|
|
1666
|
+
function bn(t, e, { colspan: n, colwidth: o }) {
|
|
1725
1667
|
const r = o && o[o.length - 1];
|
|
1726
|
-
if (r)
|
|
1727
|
-
return r;
|
|
1668
|
+
if (r) return r;
|
|
1728
1669
|
const s = t.domAtPos(e);
|
|
1729
1670
|
let l = s.node.childNodes[s.offset].offsetWidth, a = n;
|
|
1730
1671
|
if (o)
|
|
@@ -1732,55 +1673,50 @@ function gn(t, e, { colspan: n, colwidth: o }) {
|
|
|
1732
1673
|
o[c] && (l -= o[c], a--);
|
|
1733
1674
|
return l / a;
|
|
1734
1675
|
}
|
|
1735
|
-
function
|
|
1676
|
+
function wn(t) {
|
|
1736
1677
|
for (; t && t.nodeName != "TD" && t.nodeName != "TH"; )
|
|
1737
1678
|
t = t.classList && t.classList.contains("ProseMirror") ? null : t.parentNode;
|
|
1738
1679
|
return t;
|
|
1739
1680
|
}
|
|
1740
|
-
function
|
|
1681
|
+
function ze(t, e, n, o) {
|
|
1741
1682
|
const r = n == "right" ? -o : o, s = t.posAtCoords({
|
|
1742
1683
|
left: e.clientX + r,
|
|
1743
1684
|
top: e.clientY
|
|
1744
1685
|
});
|
|
1745
|
-
if (!s)
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
if (
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
return d % a.width == 0 ? -1 : c + a.map[d - 1];
|
|
1754
|
-
}
|
|
1755
|
-
function ze(t, e, n) {
|
|
1686
|
+
if (!s) return -1;
|
|
1687
|
+
const { pos: i } = s, l = Y(t.state.doc.resolve(i));
|
|
1688
|
+
if (!l) return -1;
|
|
1689
|
+
if (n == "right") return l.pos;
|
|
1690
|
+
const a = C.get(l.node(-1)), c = l.start(-1), u = a.map.indexOf(l.pos - c);
|
|
1691
|
+
return u % a.width == 0 ? -1 : c + a.map[u - 1];
|
|
1692
|
+
}
|
|
1693
|
+
function Pe(t, e, n) {
|
|
1756
1694
|
const o = e.clientX - t.startX;
|
|
1757
1695
|
return Math.max(n, t.startWidth + o);
|
|
1758
1696
|
}
|
|
1759
1697
|
function rt(t, e) {
|
|
1760
1698
|
t.dispatch(
|
|
1761
|
-
t.state.tr.setMeta(
|
|
1699
|
+
t.state.tr.setMeta(x, { setHandle: e })
|
|
1762
1700
|
);
|
|
1763
1701
|
}
|
|
1764
|
-
function
|
|
1765
|
-
const o = t.state.doc.resolve(e), r = o.node(-1), s =
|
|
1702
|
+
function yn(t, e, n) {
|
|
1703
|
+
const o = t.state.doc.resolve(e), r = o.node(-1), s = C.get(r), i = o.start(-1), l = s.colCount(o.pos - i) + o.nodeAfter.attrs.colspan - 1, a = t.state.tr;
|
|
1766
1704
|
for (let c = 0; c < s.height; c++) {
|
|
1767
|
-
const
|
|
1768
|
-
if (c && s.map[
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
const f = p.colwidth ? p.colwidth.slice() : yn(p.colspan);
|
|
1774
|
-
f[h] = n, a.setNodeMarkup(i + u, null, { ...p, colwidth: f });
|
|
1705
|
+
const u = c * s.width + l;
|
|
1706
|
+
if (c && s.map[u] == s.map[u - s.width]) continue;
|
|
1707
|
+
const d = s.map[u], p = r.nodeAt(d).attrs, h = p.colspan == 1 ? 0 : l - s.colCount(d);
|
|
1708
|
+
if (p.colwidth && p.colwidth[h] == n) continue;
|
|
1709
|
+
const f = p.colwidth ? p.colwidth.slice() : Cn(p.colspan);
|
|
1710
|
+
f[h] = n, a.setNodeMarkup(i + d, null, { ...p, colwidth: f });
|
|
1775
1711
|
}
|
|
1776
1712
|
a.docChanged && t.dispatch(a);
|
|
1777
1713
|
}
|
|
1778
1714
|
function $e(t, e, n, o) {
|
|
1779
|
-
const r = t.state.doc.resolve(e), s = r.node(-1), i = r.start(-1), l =
|
|
1715
|
+
const r = t.state.doc.resolve(e), s = r.node(-1), i = r.start(-1), l = C.get(s).colCount(r.pos - i) + r.nodeAfter.attrs.colspan - 1;
|
|
1780
1716
|
let a = t.domAtPos(r.start(-1)).node;
|
|
1781
1717
|
for (; a && a.nodeName != "TABLE"; )
|
|
1782
1718
|
a = a.parentNode;
|
|
1783
|
-
a &&
|
|
1719
|
+
a && Ae(
|
|
1784
1720
|
s,
|
|
1785
1721
|
a.firstChild,
|
|
1786
1722
|
a,
|
|
@@ -1789,37 +1725,37 @@ function $e(t, e, n, o) {
|
|
|
1789
1725
|
n
|
|
1790
1726
|
);
|
|
1791
1727
|
}
|
|
1792
|
-
function
|
|
1728
|
+
function Cn(t) {
|
|
1793
1729
|
return Array(t).fill(0);
|
|
1794
1730
|
}
|
|
1795
|
-
function
|
|
1731
|
+
function Mn(t, e) {
|
|
1796
1732
|
var n;
|
|
1797
1733
|
const o = [], r = t.doc.resolve(e), s = r.node(-1);
|
|
1798
1734
|
if (!s)
|
|
1799
1735
|
return F.empty;
|
|
1800
|
-
const i =
|
|
1736
|
+
const i = C.get(s), l = r.start(-1), a = i.colCount(r.pos - l) + r.nodeAfter.attrs.colspan - 1;
|
|
1801
1737
|
for (let c = 0; c < i.height; c++) {
|
|
1802
|
-
const
|
|
1803
|
-
if ((a == i.width - 1 || i.map[
|
|
1804
|
-
const
|
|
1805
|
-
h.className = "column-resize-handle", (n =
|
|
1806
|
-
|
|
1807
|
-
l +
|
|
1808
|
-
l +
|
|
1738
|
+
const u = a + c * i.width;
|
|
1739
|
+
if ((a == i.width - 1 || i.map[u] != i.map[u + 1]) && (c == 0 || i.map[u] != i.map[u - i.width])) {
|
|
1740
|
+
const d = i.map[u], p = l + d + s.nodeAt(d).nodeSize - 1, h = document.createElement("div");
|
|
1741
|
+
h.className = "column-resize-handle", (n = x.getState(t)) != null && n.dragging && o.push(
|
|
1742
|
+
q.node(
|
|
1743
|
+
l + d,
|
|
1744
|
+
l + d + s.nodeAt(d).nodeSize,
|
|
1809
1745
|
{
|
|
1810
1746
|
class: "column-resize-dragging"
|
|
1811
1747
|
}
|
|
1812
1748
|
)
|
|
1813
|
-
), o.push(
|
|
1749
|
+
), o.push(q.widget(p, h));
|
|
1814
1750
|
}
|
|
1815
1751
|
}
|
|
1816
1752
|
return F.create(t.doc, o);
|
|
1817
1753
|
}
|
|
1818
|
-
function
|
|
1754
|
+
function An({
|
|
1819
1755
|
allowTableNodeSelection: t = !1
|
|
1820
1756
|
} = {}) {
|
|
1821
|
-
return new
|
|
1822
|
-
key:
|
|
1757
|
+
return new D({
|
|
1758
|
+
key: B,
|
|
1823
1759
|
// This piece of state is used to remember when a mouse-drag
|
|
1824
1760
|
// cell-selection is happening, so that it can continue even as
|
|
1825
1761
|
// transactions (which might move its anchor cell) come in.
|
|
@@ -1828,29 +1764,27 @@ function Mn({
|
|
|
1828
1764
|
return null;
|
|
1829
1765
|
},
|
|
1830
1766
|
apply(e, n) {
|
|
1831
|
-
const o = e.getMeta(
|
|
1832
|
-
if (o != null)
|
|
1833
|
-
|
|
1834
|
-
if (n == null || !e.docChanged)
|
|
1835
|
-
return n;
|
|
1767
|
+
const o = e.getMeta(B);
|
|
1768
|
+
if (o != null) return o == -1 ? null : o;
|
|
1769
|
+
if (n == null || !e.docChanged) return n;
|
|
1836
1770
|
const { deleted: r, pos: s } = e.mapping.mapResult(n);
|
|
1837
1771
|
return r ? null : s;
|
|
1838
1772
|
}
|
|
1839
1773
|
},
|
|
1840
1774
|
props: {
|
|
1841
|
-
decorations:
|
|
1775
|
+
decorations: Ot,
|
|
1842
1776
|
handleDOMEvents: {
|
|
1843
|
-
mousedown:
|
|
1777
|
+
mousedown: dn
|
|
1844
1778
|
},
|
|
1845
1779
|
createSelectionBetween(e) {
|
|
1846
|
-
return
|
|
1780
|
+
return B.getState(e.state) != null ? e.state.selection : null;
|
|
1847
1781
|
},
|
|
1848
|
-
handleTripleClick:
|
|
1849
|
-
handleKeyDown:
|
|
1850
|
-
handlePaste:
|
|
1782
|
+
handleTripleClick: an,
|
|
1783
|
+
handleKeyDown: ln,
|
|
1784
|
+
handlePaste: cn
|
|
1851
1785
|
},
|
|
1852
1786
|
appendTransaction(e, n, o) {
|
|
1853
|
-
return
|
|
1787
|
+
return $t(
|
|
1854
1788
|
o,
|
|
1855
1789
|
et(o, n),
|
|
1856
1790
|
t
|
|
@@ -1858,71 +1792,71 @@ function Mn({
|
|
|
1858
1792
|
}
|
|
1859
1793
|
});
|
|
1860
1794
|
}
|
|
1861
|
-
function
|
|
1795
|
+
function ke(t, e) {
|
|
1862
1796
|
return e ? ["width", `${Math.max(e, t)}px`] : ["min-width", `${t}px`];
|
|
1863
1797
|
}
|
|
1864
|
-
function
|
|
1798
|
+
function Be(t, e, n, o, r, s) {
|
|
1865
1799
|
var i;
|
|
1866
1800
|
let l = 0, a = !0, c = e.firstChild;
|
|
1867
|
-
const
|
|
1868
|
-
if (
|
|
1869
|
-
for (let
|
|
1870
|
-
const { colspan: h, colwidth: f } =
|
|
1801
|
+
const u = t.firstChild;
|
|
1802
|
+
if (u !== null)
|
|
1803
|
+
for (let d = 0, p = 0; d < u.childCount; d += 1) {
|
|
1804
|
+
const { colspan: h, colwidth: f } = u.child(d).attrs;
|
|
1871
1805
|
for (let m = 0; m < h; m += 1, p += 1) {
|
|
1872
1806
|
const g = r === p ? s : f && f[m], w = g ? `${g}px` : "";
|
|
1873
1807
|
if (l += g || o, g || (a = !1), c) {
|
|
1874
1808
|
if (c.style.width !== w) {
|
|
1875
|
-
const [
|
|
1876
|
-
c.style.setProperty(
|
|
1809
|
+
const [L, z] = ke(o, g);
|
|
1810
|
+
c.style.setProperty(L, z);
|
|
1877
1811
|
}
|
|
1878
1812
|
c = c.nextSibling;
|
|
1879
1813
|
} else {
|
|
1880
|
-
const
|
|
1881
|
-
|
|
1814
|
+
const L = document.createElement("col"), [z, U] = ke(o, g);
|
|
1815
|
+
L.style.setProperty(z, U), e.appendChild(L);
|
|
1882
1816
|
}
|
|
1883
1817
|
}
|
|
1884
1818
|
}
|
|
1885
1819
|
for (; c; ) {
|
|
1886
|
-
const
|
|
1887
|
-
(i = c.parentNode) === null || i === void 0 || i.removeChild(c), c =
|
|
1820
|
+
const d = c.nextSibling;
|
|
1821
|
+
(i = c.parentNode) === null || i === void 0 || i.removeChild(c), c = d;
|
|
1888
1822
|
}
|
|
1889
1823
|
a ? (n.style.width = `${l}px`, n.style.minWidth = "") : (n.style.width = "", n.style.minWidth = `${l}px`);
|
|
1890
1824
|
}
|
|
1891
|
-
class
|
|
1825
|
+
class kn {
|
|
1892
1826
|
constructor(e, n) {
|
|
1893
|
-
this.node = e, this.cellMinWidth = n, this.dom = document.createElement("div"), this.dom.className = "tableWrapper", this.table = this.dom.appendChild(document.createElement("table")), this.colgroup = this.table.appendChild(document.createElement("colgroup")),
|
|
1827
|
+
this.node = e, this.cellMinWidth = n, this.dom = document.createElement("div"), this.dom.className = "tableWrapper", this.table = this.dom.appendChild(document.createElement("table")), this.colgroup = this.table.appendChild(document.createElement("colgroup")), Be(e, this.colgroup, this.table, n), this.contentDOM = this.table.appendChild(document.createElement("tbody"));
|
|
1894
1828
|
}
|
|
1895
1829
|
update(e) {
|
|
1896
|
-
return e.type !== this.node.type ? !1 : (this.node = e,
|
|
1830
|
+
return e.type !== this.node.type ? !1 : (this.node = e, Be(e, this.colgroup, this.table, this.cellMinWidth), !0);
|
|
1897
1831
|
}
|
|
1898
1832
|
ignoreMutation(e) {
|
|
1899
1833
|
return e.type === "attributes" && (e.target === this.table || this.colgroup.contains(e.target));
|
|
1900
1834
|
}
|
|
1901
1835
|
}
|
|
1902
|
-
function
|
|
1836
|
+
function Tn(t, e, n, o) {
|
|
1903
1837
|
let r = 0, s = !0;
|
|
1904
1838
|
const i = [], l = t.firstChild;
|
|
1905
1839
|
if (!l)
|
|
1906
1840
|
return {};
|
|
1907
|
-
for (let
|
|
1908
|
-
const { colspan: h, colwidth: f } = l.child(
|
|
1841
|
+
for (let d = 0, p = 0; d < l.childCount; d += 1) {
|
|
1842
|
+
const { colspan: h, colwidth: f } = l.child(d).attrs;
|
|
1909
1843
|
for (let m = 0; m < h; m += 1, p += 1) {
|
|
1910
1844
|
const g = n === p ? o : f && f[m];
|
|
1911
1845
|
r += g || e, g || (s = !1);
|
|
1912
|
-
const [w,
|
|
1846
|
+
const [w, L] = ke(e, g);
|
|
1913
1847
|
i.push([
|
|
1914
1848
|
"col",
|
|
1915
|
-
{ style: `${w}: ${
|
|
1849
|
+
{ style: `${w}: ${L}` }
|
|
1916
1850
|
]);
|
|
1917
1851
|
}
|
|
1918
1852
|
}
|
|
1919
1853
|
const a = s ? `${r}px` : "", c = s ? "" : `${r}px`;
|
|
1920
1854
|
return { colgroup: ["colgroup", {}, ...i], tableWidth: a, tableMinWidth: c };
|
|
1921
1855
|
}
|
|
1922
|
-
function
|
|
1856
|
+
function De(t, e) {
|
|
1923
1857
|
return t.createAndFill();
|
|
1924
1858
|
}
|
|
1925
|
-
function
|
|
1859
|
+
function vn(t) {
|
|
1926
1860
|
if (t.cached.tableNodeTypes)
|
|
1927
1861
|
return t.cached.tableNodeTypes;
|
|
1928
1862
|
const e = {};
|
|
@@ -1931,13 +1865,13 @@ function kn(t) {
|
|
|
1931
1865
|
o.spec.tableRole && (e[o.spec.tableRole] = o);
|
|
1932
1866
|
}), t.cached.tableNodeTypes = e, e;
|
|
1933
1867
|
}
|
|
1934
|
-
function
|
|
1935
|
-
const s =
|
|
1868
|
+
function Sn(t, e, n, o, r) {
|
|
1869
|
+
const s = vn(t), i = [], l = [];
|
|
1936
1870
|
for (let c = 0; c < n; c += 1) {
|
|
1937
|
-
const
|
|
1938
|
-
if (
|
|
1939
|
-
const
|
|
1940
|
-
|
|
1871
|
+
const u = De(s.cell);
|
|
1872
|
+
if (u && l.push(u), o) {
|
|
1873
|
+
const d = De(s.header_cell);
|
|
1874
|
+
d && i.push(d);
|
|
1941
1875
|
}
|
|
1942
1876
|
}
|
|
1943
1877
|
const a = [];
|
|
@@ -1945,12 +1879,12 @@ function Tn(t, e, n, o, r) {
|
|
|
1945
1879
|
a.push(s.row.createChecked(null, o && c === 0 ? i : l));
|
|
1946
1880
|
return s.table.createChecked(null, a);
|
|
1947
1881
|
}
|
|
1948
|
-
function
|
|
1949
|
-
return t instanceof
|
|
1882
|
+
function xn(t) {
|
|
1883
|
+
return t instanceof b;
|
|
1950
1884
|
}
|
|
1951
1885
|
const se = ({ editor: t }) => {
|
|
1952
1886
|
const { selection: e } = t.state;
|
|
1953
|
-
if (!
|
|
1887
|
+
if (!xn(e))
|
|
1954
1888
|
return !1;
|
|
1955
1889
|
let n = 0;
|
|
1956
1890
|
const o = pt(e.ranges[0].$from, (s) => s.type.name === "table");
|
|
@@ -1959,7 +1893,7 @@ const se = ({ editor: t }) => {
|
|
|
1959
1893
|
return !1;
|
|
1960
1894
|
["tableCell", "tableHeader"].includes(s.type.name) && (n += 1);
|
|
1961
1895
|
}), n === e.ranges.length ? (t.commands.deleteTable(), !0) : !1;
|
|
1962
|
-
},
|
|
1896
|
+
}, Ln = k.create({
|
|
1963
1897
|
name: "table",
|
|
1964
1898
|
// @ts-ignore
|
|
1965
1899
|
addOptions() {
|
|
@@ -1969,7 +1903,7 @@ const se = ({ editor: t }) => {
|
|
|
1969
1903
|
handleWidth: 5,
|
|
1970
1904
|
cellMinWidth: 25,
|
|
1971
1905
|
// TODO: fix
|
|
1972
|
-
View:
|
|
1906
|
+
View: kn,
|
|
1973
1907
|
lastColumnResizable: !0,
|
|
1974
1908
|
allowTableNodeSelection: !1
|
|
1975
1909
|
};
|
|
@@ -1982,10 +1916,10 @@ const se = ({ editor: t }) => {
|
|
|
1982
1916
|
return [{ tag: "table" }];
|
|
1983
1917
|
},
|
|
1984
1918
|
renderHTML({ node: t, HTMLAttributes: e }) {
|
|
1985
|
-
const { colgroup: n, tableWidth: o, tableMinWidth: r } =
|
|
1919
|
+
const { colgroup: n, tableWidth: o, tableMinWidth: r } = Tn(t, this.options.cellMinWidth);
|
|
1986
1920
|
return [
|
|
1987
1921
|
"table",
|
|
1988
|
-
|
|
1922
|
+
M(this.options.HTMLAttributes, e, {
|
|
1989
1923
|
style: o ? `width: ${o}` : `min-width: ${r}`
|
|
1990
1924
|
}),
|
|
1991
1925
|
n,
|
|
@@ -1995,25 +1929,25 @@ const se = ({ editor: t }) => {
|
|
|
1995
1929
|
addCommands() {
|
|
1996
1930
|
return {
|
|
1997
1931
|
insertTable: ({ rows: t = 3, cols: e = 3, withHeaderRow: n = !0 } = {}) => ({ tr: o, dispatch: r, editor: s }) => {
|
|
1998
|
-
const i =
|
|
1932
|
+
const i = Sn(s.schema, t, e, n);
|
|
1999
1933
|
if (r) {
|
|
2000
1934
|
const l = o.selection.from + 1;
|
|
2001
|
-
o.replaceSelectionWith(i).scrollIntoView().setSelection(
|
|
1935
|
+
o.replaceSelectionWith(i).scrollIntoView().setSelection(S.near(o.doc.resolve(l)));
|
|
2002
1936
|
}
|
|
2003
1937
|
return !0;
|
|
2004
1938
|
},
|
|
2005
|
-
addColumnBefore: () => ({ state: t, dispatch: e }) =>
|
|
2006
|
-
addColumnAfter: () => ({ state: t, dispatch: e }) =>
|
|
2007
|
-
deleteColumn: () => ({ state: t, dispatch: e }) =>
|
|
2008
|
-
addRowBefore: () => ({ state: t, dispatch: e }) =>
|
|
2009
|
-
addRowAfter: () => ({ state: t, dispatch: e }) =>
|
|
2010
|
-
deleteRow: () => ({ state: t, dispatch: e }) =>
|
|
2011
|
-
deleteTable: () => ({ state: t, dispatch: e }) =>
|
|
1939
|
+
addColumnBefore: () => ({ state: t, dispatch: e }) => _t(t, e),
|
|
1940
|
+
addColumnAfter: () => ({ state: t, dispatch: e }) => Wt(t, e),
|
|
1941
|
+
deleteColumn: () => ({ state: t, dispatch: e }) => Ft(t, e),
|
|
1942
|
+
addRowBefore: () => ({ state: t, dispatch: e }) => jt(t, e),
|
|
1943
|
+
addRowAfter: () => ({ state: t, dispatch: e }) => Xt(t, e),
|
|
1944
|
+
deleteRow: () => ({ state: t, dispatch: e }) => Gt(t, e),
|
|
1945
|
+
deleteTable: () => ({ state: t, dispatch: e }) => tn(t, e),
|
|
2012
1946
|
mergeCells: () => ({ state: t, dispatch: e }) => xe(t, e),
|
|
2013
1947
|
splitCell: () => ({ state: t, dispatch: e }) => Le(t, e),
|
|
2014
1948
|
toggleHeaderColumn: () => ({ state: t, dispatch: e }) => Q("column")(t, e),
|
|
2015
1949
|
toggleHeaderRow: () => ({ state: t, dispatch: e }) => Q("row")(t, e),
|
|
2016
|
-
toggleHeaderCell: () => ({ state: t, dispatch: e }) =>
|
|
1950
|
+
toggleHeaderCell: () => ({ state: t, dispatch: e }) => Qt(t, e),
|
|
2017
1951
|
mergeOrSplit: () => ({ state: t, dispatch: e }) => xe(t, e) ? !0 : Le(t, e),
|
|
2018
1952
|
setCellAttribute: (t, e) => ({ state: n, dispatch: o }) => Ut(t, e)(n, o),
|
|
2019
1953
|
goToNextCell: () => ({ state: t, dispatch: e }) => He(1)(t, e),
|
|
@@ -2021,7 +1955,7 @@ const se = ({ editor: t }) => {
|
|
|
2021
1955
|
fixTables: () => ({ state: t, dispatch: e }) => (e && et(t), !0),
|
|
2022
1956
|
setCellSelection: (t) => ({ tr: e, dispatch: n }) => {
|
|
2023
1957
|
if (n) {
|
|
2024
|
-
const o =
|
|
1958
|
+
const o = b.create(e.doc, t.anchorCell, t.headCell);
|
|
2025
1959
|
e.setSelection(o);
|
|
2026
1960
|
}
|
|
2027
1961
|
return !0;
|
|
@@ -2041,7 +1975,7 @@ const se = ({ editor: t }) => {
|
|
|
2041
1975
|
addProseMirrorPlugins() {
|
|
2042
1976
|
return [
|
|
2043
1977
|
...this.options.resizable && this.editor.isEditable ? [
|
|
2044
|
-
|
|
1978
|
+
pn({
|
|
2045
1979
|
handleWidth: this.options.handleWidth,
|
|
2046
1980
|
cellMinWidth: this.options.cellMinWidth,
|
|
2047
1981
|
defaultCellMinWidth: this.options.cellMinWidth,
|
|
@@ -2049,7 +1983,7 @@ const se = ({ editor: t }) => {
|
|
|
2049
1983
|
lastColumnResizable: this.options.lastColumnResizable
|
|
2050
1984
|
})
|
|
2051
1985
|
] : [],
|
|
2052
|
-
|
|
1986
|
+
An({
|
|
2053
1987
|
allowTableNodeSelection: this.options.allowTableNodeSelection
|
|
2054
1988
|
})
|
|
2055
1989
|
];
|
|
@@ -2064,7 +1998,7 @@ const se = ({ editor: t }) => {
|
|
|
2064
1998
|
tableRole: Ge(Je(t, "tableRole", e))
|
|
2065
1999
|
};
|
|
2066
2000
|
}
|
|
2067
|
-
}),
|
|
2001
|
+
}), Rn = /^\s*>\s$/, Hn = k.create({
|
|
2068
2002
|
name: "blockquote",
|
|
2069
2003
|
addOptions() {
|
|
2070
2004
|
return {
|
|
@@ -2080,7 +2014,7 @@ const se = ({ editor: t }) => {
|
|
|
2080
2014
|
];
|
|
2081
2015
|
},
|
|
2082
2016
|
renderHTML({ HTMLAttributes: t }) {
|
|
2083
|
-
return ["blockquote",
|
|
2017
|
+
return ["blockquote", M(this.options.HTMLAttributes, t), 0];
|
|
2084
2018
|
},
|
|
2085
2019
|
addCommands() {
|
|
2086
2020
|
return {
|
|
@@ -2097,12 +2031,12 @@ const se = ({ editor: t }) => {
|
|
|
2097
2031
|
addInputRules() {
|
|
2098
2032
|
return [
|
|
2099
2033
|
G({
|
|
2100
|
-
find:
|
|
2034
|
+
find: Rn,
|
|
2101
2035
|
type: this.type
|
|
2102
2036
|
})
|
|
2103
2037
|
];
|
|
2104
2038
|
}
|
|
2105
|
-
}),
|
|
2039
|
+
}), En = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, In = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g, Nn = /(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/, On = /(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g, zn = ee.create({
|
|
2106
2040
|
name: "bold",
|
|
2107
2041
|
addOptions() {
|
|
2108
2042
|
return {
|
|
@@ -2129,7 +2063,7 @@ const se = ({ editor: t }) => {
|
|
|
2129
2063
|
];
|
|
2130
2064
|
},
|
|
2131
2065
|
renderHTML({ HTMLAttributes: t }) {
|
|
2132
|
-
return ["strong",
|
|
2066
|
+
return ["strong", M(this.options.HTMLAttributes, t), 0];
|
|
2133
2067
|
},
|
|
2134
2068
|
addCommands() {
|
|
2135
2069
|
return {
|
|
@@ -2146,29 +2080,29 @@ const se = ({ editor: t }) => {
|
|
|
2146
2080
|
},
|
|
2147
2081
|
addInputRules() {
|
|
2148
2082
|
return [
|
|
2149
|
-
|
|
2150
|
-
find:
|
|
2083
|
+
j({
|
|
2084
|
+
find: En,
|
|
2151
2085
|
type: this.type
|
|
2152
2086
|
}),
|
|
2153
|
-
|
|
2154
|
-
find:
|
|
2087
|
+
j({
|
|
2088
|
+
find: Nn,
|
|
2155
2089
|
type: this.type
|
|
2156
2090
|
})
|
|
2157
2091
|
];
|
|
2158
2092
|
},
|
|
2159
2093
|
addPasteRules() {
|
|
2160
2094
|
return [
|
|
2161
|
-
|
|
2162
|
-
find:
|
|
2095
|
+
K({
|
|
2096
|
+
find: In,
|
|
2163
2097
|
type: this.type
|
|
2164
2098
|
}),
|
|
2165
|
-
|
|
2166
|
-
find:
|
|
2099
|
+
K({
|
|
2100
|
+
find: On,
|
|
2167
2101
|
type: this.type
|
|
2168
2102
|
})
|
|
2169
2103
|
];
|
|
2170
2104
|
}
|
|
2171
|
-
}), Pn = "listItem",
|
|
2105
|
+
}), Pn = "listItem", _e = "textStyle", We = /^\s*([-+*])\s$/, $n = k.create({
|
|
2172
2106
|
name: "bulletList",
|
|
2173
2107
|
addOptions() {
|
|
2174
2108
|
return {
|
|
@@ -2188,11 +2122,11 @@ const se = ({ editor: t }) => {
|
|
|
2188
2122
|
];
|
|
2189
2123
|
},
|
|
2190
2124
|
renderHTML({ HTMLAttributes: t }) {
|
|
2191
|
-
return ["ul",
|
|
2125
|
+
return ["ul", M(this.options.HTMLAttributes, t), 0];
|
|
2192
2126
|
},
|
|
2193
2127
|
addCommands() {
|
|
2194
2128
|
return {
|
|
2195
|
-
toggleBulletList: () => ({ commands: t, chain: e }) => this.options.keepAttributes ? e().toggleList(this.name, this.options.itemTypeName, this.options.keepMarks).updateAttributes(Pn, this.editor.getAttributes(
|
|
2129
|
+
toggleBulletList: () => ({ commands: t, chain: e }) => this.options.keepAttributes ? e().toggleList(this.name, this.options.itemTypeName, this.options.keepMarks).updateAttributes(Pn, this.editor.getAttributes(_e)).run() : t.toggleList(this.name, this.options.itemTypeName, this.options.keepMarks)
|
|
2196
2130
|
};
|
|
2197
2131
|
},
|
|
2198
2132
|
addKeyboardShortcuts() {
|
|
@@ -2210,13 +2144,13 @@ const se = ({ editor: t }) => {
|
|
|
2210
2144
|
type: this.type,
|
|
2211
2145
|
keepMarks: this.options.keepMarks,
|
|
2212
2146
|
keepAttributes: this.options.keepAttributes,
|
|
2213
|
-
getAttributes: () => this.editor.getAttributes(
|
|
2147
|
+
getAttributes: () => this.editor.getAttributes(_e),
|
|
2214
2148
|
editor: this.editor
|
|
2215
2149
|
})), [
|
|
2216
2150
|
t
|
|
2217
2151
|
];
|
|
2218
2152
|
}
|
|
2219
|
-
}),
|
|
2153
|
+
}), Bn = /(^|[^`])`([^`]+)`(?!`)/, Dn = /(^|[^`])`([^`]+)`(?!`)/g, _n = ee.create({
|
|
2220
2154
|
name: "code",
|
|
2221
2155
|
addOptions() {
|
|
2222
2156
|
return {
|
|
@@ -2232,7 +2166,7 @@ const se = ({ editor: t }) => {
|
|
|
2232
2166
|
];
|
|
2233
2167
|
},
|
|
2234
2168
|
renderHTML({ HTMLAttributes: t }) {
|
|
2235
|
-
return ["code",
|
|
2169
|
+
return ["code", M(this.options.HTMLAttributes, t), 0];
|
|
2236
2170
|
},
|
|
2237
2171
|
addCommands() {
|
|
2238
2172
|
return {
|
|
@@ -2248,21 +2182,21 @@ const se = ({ editor: t }) => {
|
|
|
2248
2182
|
},
|
|
2249
2183
|
addInputRules() {
|
|
2250
2184
|
return [
|
|
2251
|
-
|
|
2252
|
-
find:
|
|
2185
|
+
j({
|
|
2186
|
+
find: Bn,
|
|
2253
2187
|
type: this.type
|
|
2254
2188
|
})
|
|
2255
2189
|
];
|
|
2256
2190
|
},
|
|
2257
2191
|
addPasteRules() {
|
|
2258
2192
|
return [
|
|
2259
|
-
|
|
2260
|
-
find:
|
|
2193
|
+
K({
|
|
2194
|
+
find: Dn,
|
|
2261
2195
|
type: this.type
|
|
2262
2196
|
})
|
|
2263
2197
|
];
|
|
2264
2198
|
}
|
|
2265
|
-
}),
|
|
2199
|
+
}), Wn = /^```([a-z]+)?[\s\n]$/, Vn = /^~~~([a-z]+)?[\s\n]$/, Fn = k.create({
|
|
2266
2200
|
name: "codeBlock",
|
|
2267
2201
|
addOptions() {
|
|
2268
2202
|
return {
|
|
@@ -2302,7 +2236,7 @@ const se = ({ editor: t }) => {
|
|
|
2302
2236
|
renderHTML({ node: t, HTMLAttributes: e }) {
|
|
2303
2237
|
return [
|
|
2304
2238
|
"pre",
|
|
2305
|
-
|
|
2239
|
+
M(this.options.HTMLAttributes, e),
|
|
2306
2240
|
[
|
|
2307
2241
|
"code",
|
|
2308
2242
|
{
|
|
@@ -2346,21 +2280,21 @@ const se = ({ editor: t }) => {
|
|
|
2346
2280
|
if (!s || r.parent.type !== this.type || !(r.parentOffset === r.parent.nodeSize - 2))
|
|
2347
2281
|
return !1;
|
|
2348
2282
|
const l = r.after();
|
|
2349
|
-
return l === void 0 ? !1 : o.nodeAt(l) ? t.commands.command(({ tr: c }) => (c.setSelection(
|
|
2283
|
+
return l === void 0 ? !1 : o.nodeAt(l) ? t.commands.command(({ tr: c }) => (c.setSelection(v.near(o.resolve(l))), !0)) : t.commands.exitCode();
|
|
2350
2284
|
}
|
|
2351
2285
|
};
|
|
2352
2286
|
},
|
|
2353
2287
|
addInputRules() {
|
|
2354
2288
|
return [
|
|
2355
2289
|
be({
|
|
2356
|
-
find:
|
|
2290
|
+
find: Wn,
|
|
2357
2291
|
type: this.type,
|
|
2358
2292
|
getAttributes: (t) => ({
|
|
2359
2293
|
language: t[1]
|
|
2360
2294
|
})
|
|
2361
2295
|
}),
|
|
2362
2296
|
be({
|
|
2363
|
-
find:
|
|
2297
|
+
find: Vn,
|
|
2364
2298
|
type: this.type,
|
|
2365
2299
|
getAttributes: (t) => ({
|
|
2366
2300
|
language: t[1]
|
|
@@ -2372,8 +2306,8 @@ const se = ({ editor: t }) => {
|
|
|
2372
2306
|
return [
|
|
2373
2307
|
// this plugin creates a code block for pasted content from VS Code
|
|
2374
2308
|
// we can also detect the copied code language
|
|
2375
|
-
new
|
|
2376
|
-
key: new
|
|
2309
|
+
new D({
|
|
2310
|
+
key: new _("codeBlockVSCodeHandler"),
|
|
2377
2311
|
props: {
|
|
2378
2312
|
handlePaste: (t, e) => {
|
|
2379
2313
|
if (!e.clipboardData || this.editor.isActive(this.type.name))
|
|
@@ -2383,25 +2317,25 @@ const se = ({ editor: t }) => {
|
|
|
2383
2317
|
return !1;
|
|
2384
2318
|
const { tr: i, schema: l } = t.state, a = l.text(n.replace(/\r\n?/g, `
|
|
2385
2319
|
`));
|
|
2386
|
-
return i.replaceSelectionWith(this.type.create({ language: s }, a)), i.selection.$from.parent.type !== this.type && i.setSelection(
|
|
2320
|
+
return i.replaceSelectionWith(this.type.create({ language: s }, a)), i.selection.$from.parent.type !== this.type && i.setSelection(S.near(i.doc.resolve(Math.max(0, i.selection.from - 2)))), i.setMeta("paste", !0), t.dispatch(i), !0;
|
|
2387
2321
|
}
|
|
2388
2322
|
}
|
|
2389
2323
|
})
|
|
2390
2324
|
];
|
|
2391
2325
|
}
|
|
2392
|
-
}),
|
|
2326
|
+
}), Kn = k.create({
|
|
2393
2327
|
name: "doc",
|
|
2394
2328
|
topNode: !0,
|
|
2395
2329
|
content: "block+"
|
|
2396
2330
|
});
|
|
2397
|
-
function
|
|
2398
|
-
return new
|
|
2331
|
+
function jn(t = {}) {
|
|
2332
|
+
return new D({
|
|
2399
2333
|
view(e) {
|
|
2400
|
-
return new
|
|
2334
|
+
return new Xn(e, t);
|
|
2401
2335
|
}
|
|
2402
2336
|
});
|
|
2403
2337
|
}
|
|
2404
|
-
class
|
|
2338
|
+
class Xn {
|
|
2405
2339
|
constructor(e, n) {
|
|
2406
2340
|
var o;
|
|
2407
2341
|
this.editorView = e, this.cursorPos = null, this.element = null, this.timeout = -1, this.width = (o = n.width) !== null && o !== void 0 ? o : 1, this.color = n.color === !1 ? void 0 : n.color || "black", this.class = n.class, this.handlers = ["dragover", "dragend", "drop", "dragleave"].map((r) => {
|
|
@@ -2421,31 +2355,33 @@ class jn {
|
|
|
2421
2355
|
e != this.cursorPos && (this.cursorPos = e, e == null ? (this.element.parentNode.removeChild(this.element), this.element = null) : this.updateOverlay());
|
|
2422
2356
|
}
|
|
2423
2357
|
updateOverlay() {
|
|
2424
|
-
let e = this.editorView.state.doc.resolve(this.cursorPos), n = !e.parent.inlineContent, o;
|
|
2358
|
+
let e = this.editorView.state.doc.resolve(this.cursorPos), n = !e.parent.inlineContent, o, r = this.editorView.dom, s = r.getBoundingClientRect(), i = s.width / r.offsetWidth, l = s.height / r.offsetHeight;
|
|
2425
2359
|
if (n) {
|
|
2426
|
-
let
|
|
2427
|
-
if (
|
|
2428
|
-
let
|
|
2429
|
-
if (
|
|
2430
|
-
let
|
|
2431
|
-
|
|
2360
|
+
let d = e.nodeBefore, p = e.nodeAfter;
|
|
2361
|
+
if (d || p) {
|
|
2362
|
+
let h = this.editorView.nodeDOM(this.cursorPos - (d ? d.nodeSize : 0));
|
|
2363
|
+
if (h) {
|
|
2364
|
+
let f = h.getBoundingClientRect(), m = d ? f.bottom : f.top;
|
|
2365
|
+
d && p && (m = (m + this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top) / 2);
|
|
2366
|
+
let g = this.width / 2 * l;
|
|
2367
|
+
o = { left: f.left, right: f.right, top: m - g, bottom: m + g };
|
|
2432
2368
|
}
|
|
2433
2369
|
}
|
|
2434
2370
|
}
|
|
2435
2371
|
if (!o) {
|
|
2436
|
-
let
|
|
2437
|
-
o = { left:
|
|
2438
|
-
}
|
|
2439
|
-
let
|
|
2440
|
-
this.element || (this.element =
|
|
2441
|
-
let
|
|
2442
|
-
if (!
|
|
2443
|
-
|
|
2372
|
+
let d = this.editorView.coordsAtPos(this.cursorPos), p = this.width / 2 * i;
|
|
2373
|
+
o = { left: d.left - p, right: d.left + p, top: d.top, bottom: d.bottom };
|
|
2374
|
+
}
|
|
2375
|
+
let a = this.editorView.dom.offsetParent;
|
|
2376
|
+
this.element || (this.element = a.appendChild(document.createElement("div")), this.class && (this.element.className = this.class), this.element.style.cssText = "position: absolute; z-index: 50; pointer-events: none;", this.color && (this.element.style.backgroundColor = this.color)), this.element.classList.toggle("prosemirror-dropcursor-block", n), this.element.classList.toggle("prosemirror-dropcursor-inline", !n);
|
|
2377
|
+
let c, u;
|
|
2378
|
+
if (!a || a == document.body && getComputedStyle(a).position == "static")
|
|
2379
|
+
c = -pageXOffset, u = -pageYOffset;
|
|
2444
2380
|
else {
|
|
2445
|
-
let
|
|
2446
|
-
|
|
2381
|
+
let d = a.getBoundingClientRect(), p = d.width / a.offsetWidth, h = d.height / a.offsetHeight;
|
|
2382
|
+
c = d.left - a.scrollLeft * p, u = d.top - a.scrollTop * h;
|
|
2447
2383
|
}
|
|
2448
|
-
this.element.style.left = o.left -
|
|
2384
|
+
this.element.style.left = (o.left - c) / i + "px", this.element.style.top = (o.top - u) / l + "px", this.element.style.width = (o.right - o.left) / i + "px", this.element.style.height = (o.bottom - o.top) / l + "px";
|
|
2449
2385
|
}
|
|
2450
2386
|
scheduleRemoval(e) {
|
|
2451
2387
|
clearTimeout(this.timeout), this.timeout = setTimeout(() => this.setCursor(null), e);
|
|
@@ -2470,7 +2406,7 @@ class jn {
|
|
|
2470
2406
|
this.scheduleRemoval(20);
|
|
2471
2407
|
}
|
|
2472
2408
|
dragleave(e) {
|
|
2473
|
-
|
|
2409
|
+
this.editorView.dom.contains(e.relatedTarget) || this.setCursor(null);
|
|
2474
2410
|
}
|
|
2475
2411
|
}
|
|
2476
2412
|
const qn = J.create({
|
|
@@ -2484,11 +2420,11 @@ const qn = J.create({
|
|
|
2484
2420
|
},
|
|
2485
2421
|
addProseMirrorPlugins() {
|
|
2486
2422
|
return [
|
|
2487
|
-
|
|
2423
|
+
jn(this.options)
|
|
2488
2424
|
];
|
|
2489
2425
|
}
|
|
2490
2426
|
});
|
|
2491
|
-
class
|
|
2427
|
+
class y extends v {
|
|
2492
2428
|
/**
|
|
2493
2429
|
Create a gap cursor.
|
|
2494
2430
|
*/
|
|
@@ -2497,13 +2433,13 @@ class C extends S {
|
|
|
2497
2433
|
}
|
|
2498
2434
|
map(e, n) {
|
|
2499
2435
|
let o = e.resolve(n.map(this.head));
|
|
2500
|
-
return
|
|
2436
|
+
return y.valid(o) ? new y(o) : v.near(o);
|
|
2501
2437
|
}
|
|
2502
2438
|
content() {
|
|
2503
2439
|
return N.empty;
|
|
2504
2440
|
}
|
|
2505
2441
|
eq(e) {
|
|
2506
|
-
return e instanceof
|
|
2442
|
+
return e instanceof y && e.head == this.head;
|
|
2507
2443
|
}
|
|
2508
2444
|
toJSON() {
|
|
2509
2445
|
return { type: "gapcursor", pos: this.head };
|
|
@@ -2514,20 +2450,20 @@ class C extends S {
|
|
|
2514
2450
|
static fromJSON(e, n) {
|
|
2515
2451
|
if (typeof n.pos != "number")
|
|
2516
2452
|
throw new RangeError("Invalid input for GapCursor.fromJSON");
|
|
2517
|
-
return new
|
|
2453
|
+
return new y(e.resolve(n.pos));
|
|
2518
2454
|
}
|
|
2519
2455
|
/**
|
|
2520
2456
|
@internal
|
|
2521
2457
|
*/
|
|
2522
2458
|
getBookmark() {
|
|
2523
|
-
return new
|
|
2459
|
+
return new ve(this.anchor);
|
|
2524
2460
|
}
|
|
2525
2461
|
/**
|
|
2526
2462
|
@internal
|
|
2527
2463
|
*/
|
|
2528
2464
|
static valid(e) {
|
|
2529
2465
|
let n = e.parent;
|
|
2530
|
-
if (n.isTextblock || !
|
|
2466
|
+
if (n.isTextblock || !Gn(e) || !Jn(e))
|
|
2531
2467
|
return !1;
|
|
2532
2468
|
let o = n.type.spec.allowGapCursor;
|
|
2533
2469
|
if (o != null)
|
|
@@ -2540,7 +2476,7 @@ class C extends S {
|
|
|
2540
2476
|
*/
|
|
2541
2477
|
static findGapCursorFrom(e, n, o = !1) {
|
|
2542
2478
|
e: for (; ; ) {
|
|
2543
|
-
if (!o &&
|
|
2479
|
+
if (!o && y.valid(e))
|
|
2544
2480
|
return e;
|
|
2545
2481
|
let r = e.pos, s = null;
|
|
2546
2482
|
for (let i = e.depth; ; i--) {
|
|
@@ -2552,7 +2488,7 @@ class C extends S {
|
|
|
2552
2488
|
return null;
|
|
2553
2489
|
r += n;
|
|
2554
2490
|
let a = e.doc.resolve(r);
|
|
2555
|
-
if (
|
|
2491
|
+
if (y.valid(a))
|
|
2556
2492
|
return a;
|
|
2557
2493
|
}
|
|
2558
2494
|
for (; ; ) {
|
|
@@ -2566,29 +2502,29 @@ class C extends S {
|
|
|
2566
2502
|
}
|
|
2567
2503
|
s = i, r += n;
|
|
2568
2504
|
let l = e.doc.resolve(r);
|
|
2569
|
-
if (
|
|
2505
|
+
if (y.valid(l))
|
|
2570
2506
|
return l;
|
|
2571
2507
|
}
|
|
2572
2508
|
return null;
|
|
2573
2509
|
}
|
|
2574
2510
|
}
|
|
2575
2511
|
}
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
class
|
|
2512
|
+
y.prototype.visible = !1;
|
|
2513
|
+
y.findFrom = y.findGapCursorFrom;
|
|
2514
|
+
v.jsonID("gapcursor", y);
|
|
2515
|
+
class ve {
|
|
2580
2516
|
constructor(e) {
|
|
2581
2517
|
this.pos = e;
|
|
2582
2518
|
}
|
|
2583
2519
|
map(e) {
|
|
2584
|
-
return new
|
|
2520
|
+
return new ve(e.map(this.pos));
|
|
2585
2521
|
}
|
|
2586
2522
|
resolve(e) {
|
|
2587
2523
|
let n = e.resolve(this.pos);
|
|
2588
|
-
return
|
|
2524
|
+
return y.valid(n) ? new y(n) : v.near(n);
|
|
2589
2525
|
}
|
|
2590
2526
|
}
|
|
2591
|
-
function
|
|
2527
|
+
function Gn(t) {
|
|
2592
2528
|
for (let e = t.depth; e >= 0; e--) {
|
|
2593
2529
|
let n = t.index(e), o = t.node(e);
|
|
2594
2530
|
if (n == 0) {
|
|
@@ -2605,7 +2541,7 @@ function Xn(t) {
|
|
|
2605
2541
|
}
|
|
2606
2542
|
return !0;
|
|
2607
2543
|
}
|
|
2608
|
-
function
|
|
2544
|
+
function Jn(t) {
|
|
2609
2545
|
for (let e = t.depth; e >= 0; e--) {
|
|
2610
2546
|
let n = t.indexAfter(e), o = t.node(e);
|
|
2611
2547
|
if (n == o.childCount) {
|
|
@@ -2622,20 +2558,20 @@ function Gn(t) {
|
|
|
2622
2558
|
}
|
|
2623
2559
|
return !0;
|
|
2624
2560
|
}
|
|
2625
|
-
function
|
|
2626
|
-
return new
|
|
2561
|
+
function Yn() {
|
|
2562
|
+
return new D({
|
|
2627
2563
|
props: {
|
|
2628
|
-
decorations:
|
|
2564
|
+
decorations: eo,
|
|
2629
2565
|
createSelectionBetween(t, e, n) {
|
|
2630
|
-
return e.pos == n.pos &&
|
|
2566
|
+
return e.pos == n.pos && y.valid(n) ? new y(n) : null;
|
|
2631
2567
|
},
|
|
2632
|
-
handleClick:
|
|
2568
|
+
handleClick: Zn,
|
|
2633
2569
|
handleKeyDown: Un,
|
|
2634
|
-
handleDOMEvents: { beforeinput:
|
|
2570
|
+
handleDOMEvents: { beforeinput: Qn }
|
|
2635
2571
|
}
|
|
2636
2572
|
});
|
|
2637
2573
|
}
|
|
2638
|
-
const Un =
|
|
2574
|
+
const Un = qe({
|
|
2639
2575
|
ArrowLeft: ie("horiz", -1),
|
|
2640
2576
|
ArrowRight: ie("horiz", 1),
|
|
2641
2577
|
ArrowUp: ie("vert", -1),
|
|
@@ -2645,26 +2581,26 @@ function ie(t, e) {
|
|
|
2645
2581
|
const n = t == "vert" ? e > 0 ? "down" : "up" : e > 0 ? "right" : "left";
|
|
2646
2582
|
return function(o, r, s) {
|
|
2647
2583
|
let i = o.selection, l = e > 0 ? i.$to : i.$from, a = i.empty;
|
|
2648
|
-
if (i instanceof
|
|
2584
|
+
if (i instanceof S) {
|
|
2649
2585
|
if (!s.endOfTextblock(n) || l.depth == 0)
|
|
2650
2586
|
return !1;
|
|
2651
2587
|
a = !1, l = o.doc.resolve(e > 0 ? l.after() : l.before());
|
|
2652
2588
|
}
|
|
2653
|
-
let c =
|
|
2654
|
-
return c ? (r && r(o.tr.setSelection(new
|
|
2589
|
+
let c = y.findGapCursorFrom(l, e, a);
|
|
2590
|
+
return c ? (r && r(o.tr.setSelection(new y(c))), !0) : !1;
|
|
2655
2591
|
};
|
|
2656
2592
|
}
|
|
2657
|
-
function
|
|
2593
|
+
function Zn(t, e, n) {
|
|
2658
2594
|
if (!t || !t.editable)
|
|
2659
2595
|
return !1;
|
|
2660
2596
|
let o = t.state.doc.resolve(e);
|
|
2661
|
-
if (!
|
|
2597
|
+
if (!y.valid(o))
|
|
2662
2598
|
return !1;
|
|
2663
2599
|
let r = t.posAtCoords({ left: n.clientX, top: n.clientY });
|
|
2664
|
-
return r && r.inside > -1 && ue.isSelectable(t.state.doc.nodeAt(r.inside)) ? !1 : (t.dispatch(t.state.tr.setSelection(new
|
|
2600
|
+
return r && r.inside > -1 && ue.isSelectable(t.state.doc.nodeAt(r.inside)) ? !1 : (t.dispatch(t.state.tr.setSelection(new y(o))), !0);
|
|
2665
2601
|
}
|
|
2666
|
-
function
|
|
2667
|
-
if (e.inputType != "insertCompositionText" || !(t.state.selection instanceof
|
|
2602
|
+
function Qn(t, e) {
|
|
2603
|
+
if (e.inputType != "insertCompositionText" || !(t.state.selection instanceof y))
|
|
2668
2604
|
return !1;
|
|
2669
2605
|
let { $from: n } = t.state.selection, o = n.parent.contentMatchAt(n.index()).findWrapping(t.state.schema.nodes.text);
|
|
2670
2606
|
if (!o)
|
|
@@ -2673,19 +2609,19 @@ function Zn(t, e) {
|
|
|
2673
2609
|
for (let i = o.length - 1; i >= 0; i--)
|
|
2674
2610
|
r = R.from(o[i].createAndFill(null, r));
|
|
2675
2611
|
let s = t.state.tr.replace(n.pos, n.pos, new N(r, 0, 0));
|
|
2676
|
-
return s.setSelection(
|
|
2612
|
+
return s.setSelection(S.near(s.doc.resolve(n.pos + 1))), t.dispatch(s), !1;
|
|
2677
2613
|
}
|
|
2678
|
-
function
|
|
2679
|
-
if (!(t.selection instanceof
|
|
2614
|
+
function eo(t) {
|
|
2615
|
+
if (!(t.selection instanceof y))
|
|
2680
2616
|
return null;
|
|
2681
2617
|
let e = document.createElement("div");
|
|
2682
|
-
return e.className = "ProseMirror-gapcursor", F.create(t.doc, [
|
|
2618
|
+
return e.className = "ProseMirror-gapcursor", F.create(t.doc, [q.widget(t.selection.head, e, { key: "gapcursor" })]);
|
|
2683
2619
|
}
|
|
2684
|
-
const
|
|
2620
|
+
const to = J.create({
|
|
2685
2621
|
name: "gapCursor",
|
|
2686
2622
|
addProseMirrorPlugins() {
|
|
2687
2623
|
return [
|
|
2688
|
-
|
|
2624
|
+
Yn()
|
|
2689
2625
|
];
|
|
2690
2626
|
},
|
|
2691
2627
|
extendNodeSchema(t) {
|
|
@@ -2699,7 +2635,7 @@ const eo = J.create({
|
|
|
2699
2635
|
allowGapCursor: (e = Ge(Je(t, "allowGapCursor", n))) !== null && e !== void 0 ? e : null
|
|
2700
2636
|
};
|
|
2701
2637
|
}
|
|
2702
|
-
}),
|
|
2638
|
+
}), no = k.create({
|
|
2703
2639
|
name: "hardBreak",
|
|
2704
2640
|
addOptions() {
|
|
2705
2641
|
return {
|
|
@@ -2717,7 +2653,7 @@ const eo = J.create({
|
|
|
2717
2653
|
];
|
|
2718
2654
|
},
|
|
2719
2655
|
renderHTML({ HTMLAttributes: t }) {
|
|
2720
|
-
return ["br",
|
|
2656
|
+
return ["br", M(this.options.HTMLAttributes, t)];
|
|
2721
2657
|
},
|
|
2722
2658
|
renderText() {
|
|
2723
2659
|
return `
|
|
@@ -2732,10 +2668,10 @@ const eo = J.create({
|
|
|
2732
2668
|
if (r.$from.parent.type.spec.isolating)
|
|
2733
2669
|
return !1;
|
|
2734
2670
|
const { keepMarks: i } = this.options, { splittableMarks: l } = o.extensionManager, a = s || r.$to.parentOffset && r.$from.marks();
|
|
2735
|
-
return e().insertContent({ type: this.name }).command(({ tr: c, dispatch:
|
|
2736
|
-
if (
|
|
2737
|
-
const
|
|
2738
|
-
c.ensureMarks(
|
|
2671
|
+
return e().insertContent({ type: this.name }).command(({ tr: c, dispatch: u }) => {
|
|
2672
|
+
if (u && a && i) {
|
|
2673
|
+
const d = a.filter((p) => l.includes(p.type.name));
|
|
2674
|
+
c.ensureMarks(d);
|
|
2739
2675
|
}
|
|
2740
2676
|
return !0;
|
|
2741
2677
|
}).run();
|
|
@@ -2749,7 +2685,7 @@ const eo = J.create({
|
|
|
2749
2685
|
"Shift-Enter": () => this.editor.commands.setHardBreak()
|
|
2750
2686
|
};
|
|
2751
2687
|
}
|
|
2752
|
-
}),
|
|
2688
|
+
}), oo = k.create({
|
|
2753
2689
|
name: "heading",
|
|
2754
2690
|
addOptions() {
|
|
2755
2691
|
return {
|
|
@@ -2775,7 +2711,7 @@ const eo = J.create({
|
|
|
2775
2711
|
}));
|
|
2776
2712
|
},
|
|
2777
2713
|
renderHTML({ node: t, HTMLAttributes: e }) {
|
|
2778
|
-
return [`h${this.options.levels.includes(t.attrs.level) ? t.attrs.level : this.options.levels[0]}`,
|
|
2714
|
+
return [`h${this.options.levels.includes(t.attrs.level) ? t.attrs.level : this.options.levels[0]}`, M(this.options.HTMLAttributes, e), 0];
|
|
2779
2715
|
},
|
|
2780
2716
|
addCommands() {
|
|
2781
2717
|
return {
|
|
@@ -2791,7 +2727,7 @@ const eo = J.create({
|
|
|
2791
2727
|
},
|
|
2792
2728
|
addInputRules() {
|
|
2793
2729
|
return this.options.levels.map((t) => be({
|
|
2794
|
-
find: new RegExp(`^(#{
|
|
2730
|
+
find: new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),
|
|
2795
2731
|
type: this.type,
|
|
2796
2732
|
getAttributes: {
|
|
2797
2733
|
level: t
|
|
@@ -2808,7 +2744,7 @@ A.prototype.prepend = function(e) {
|
|
|
2808
2744
|
return e.length ? A.from(e).append(this) : this;
|
|
2809
2745
|
};
|
|
2810
2746
|
A.prototype.appendInner = function(e) {
|
|
2811
|
-
return new
|
|
2747
|
+
return new ro(this, e);
|
|
2812
2748
|
};
|
|
2813
2749
|
A.prototype.slice = function(e, n) {
|
|
2814
2750
|
return e === void 0 && (e = 0), n === void 0 && (n = this.length), e >= n ? A.empty : this.sliceInner(Math.max(0, e), Math.min(this.length, n));
|
|
@@ -2863,7 +2799,7 @@ var st = /* @__PURE__ */ function(t) {
|
|
|
2863
2799
|
}, Object.defineProperties(e.prototype, n), e;
|
|
2864
2800
|
}(A);
|
|
2865
2801
|
A.empty = new st([]);
|
|
2866
|
-
var
|
|
2802
|
+
var ro = /* @__PURE__ */ function(t) {
|
|
2867
2803
|
function e(n, o) {
|
|
2868
2804
|
t.call(this), this.left = n, this.right = o, this.length = n.length + o.length, this.depth = Math.max(n.depth, o.depth) + 1;
|
|
2869
2805
|
}
|
|
@@ -2896,7 +2832,7 @@ var oo = /* @__PURE__ */ function(t) {
|
|
|
2896
2832
|
return this.left.depth >= Math.max(this.right.depth, o.depth) + 1 ? new e(this.left, new e(this.right, o)) : new e(this, o);
|
|
2897
2833
|
}, e;
|
|
2898
2834
|
}(A);
|
|
2899
|
-
const
|
|
2835
|
+
const so = 500;
|
|
2900
2836
|
class H {
|
|
2901
2837
|
constructor(e, n) {
|
|
2902
2838
|
this.items = e, this.eventCount = n;
|
|
@@ -2914,31 +2850,31 @@ class H {
|
|
|
2914
2850
|
}
|
|
2915
2851
|
let r, s;
|
|
2916
2852
|
n && (r = this.remapping(o, this.items.length), s = r.maps.length);
|
|
2917
|
-
let i = e.tr, l, a, c = [],
|
|
2918
|
-
return this.items.forEach((
|
|
2919
|
-
if (!
|
|
2920
|
-
r || (r = this.remapping(o, p + 1), s = r.maps.length), s--,
|
|
2853
|
+
let i = e.tr, l, a, c = [], u = [];
|
|
2854
|
+
return this.items.forEach((d, p) => {
|
|
2855
|
+
if (!d.step) {
|
|
2856
|
+
r || (r = this.remapping(o, p + 1), s = r.maps.length), s--, u.push(d);
|
|
2921
2857
|
return;
|
|
2922
2858
|
}
|
|
2923
2859
|
if (r) {
|
|
2924
|
-
|
|
2925
|
-
let h =
|
|
2926
|
-
h && i.maybeStep(h).doc && (f = i.mapping.maps[i.mapping.maps.length - 1], c.push(new I(f, void 0, void 0, c.length +
|
|
2860
|
+
u.push(new I(d.map));
|
|
2861
|
+
let h = d.step.map(r.slice(s)), f;
|
|
2862
|
+
h && i.maybeStep(h).doc && (f = i.mapping.maps[i.mapping.maps.length - 1], c.push(new I(f, void 0, void 0, c.length + u.length))), s--, f && r.appendMap(f, s);
|
|
2927
2863
|
} else
|
|
2928
|
-
i.maybeStep(
|
|
2929
|
-
if (
|
|
2930
|
-
return l = r ?
|
|
2864
|
+
i.maybeStep(d.step);
|
|
2865
|
+
if (d.selection)
|
|
2866
|
+
return l = r ? d.selection.map(r.slice(s)) : d.selection, a = new H(this.items.slice(0, o).append(u.reverse().concat(c)), this.eventCount - 1), !1;
|
|
2931
2867
|
}, this.items.length, 0), { remaining: a, transform: i, selection: l };
|
|
2932
2868
|
}
|
|
2933
2869
|
// Create a new branch with the given transform added.
|
|
2934
2870
|
addTransform(e, n, o, r) {
|
|
2935
2871
|
let s = [], i = this.eventCount, l = this.items, a = !r && l.length ? l.get(l.length - 1) : null;
|
|
2936
|
-
for (let
|
|
2937
|
-
let
|
|
2938
|
-
(h = a && a.merge(p)) && (p = h,
|
|
2872
|
+
for (let u = 0; u < e.steps.length; u++) {
|
|
2873
|
+
let d = e.steps[u].invert(e.docs[u]), p = new I(e.mapping.maps[u], d, n), h;
|
|
2874
|
+
(h = a && a.merge(p)) && (p = h, u ? s.pop() : l = l.slice(0, l.length - 1)), s.push(p), n && (i++, n = void 0), r || (a = p);
|
|
2939
2875
|
}
|
|
2940
2876
|
let c = i - o.depth;
|
|
2941
|
-
return c >
|
|
2877
|
+
return c > lo && (l = io(l, c), i -= c), new H(l.append(s), i);
|
|
2942
2878
|
}
|
|
2943
2879
|
remapping(e, n) {
|
|
2944
2880
|
let o = new ft();
|
|
@@ -2977,8 +2913,8 @@ class H {
|
|
|
2977
2913
|
let c = [];
|
|
2978
2914
|
for (let p = n; p < i; p++)
|
|
2979
2915
|
c.push(new I(s.maps[p]));
|
|
2980
|
-
let
|
|
2981
|
-
return
|
|
2916
|
+
let u = this.items.slice(0, r).append(c).append(o), d = new H(u, l);
|
|
2917
|
+
return d.emptyItemCount() > so && (d = d.compress(this.items.length - o.length)), d;
|
|
2982
2918
|
}
|
|
2983
2919
|
emptyItemCount() {
|
|
2984
2920
|
let e = 0;
|
|
@@ -3000,17 +2936,17 @@ class H {
|
|
|
3000
2936
|
else if (i.step) {
|
|
3001
2937
|
let a = i.step.map(n.slice(o)), c = a && a.getMap();
|
|
3002
2938
|
if (o--, c && n.appendMap(c, o), a) {
|
|
3003
|
-
let
|
|
3004
|
-
|
|
3005
|
-
let
|
|
3006
|
-
(p = r.length && r[h].merge(
|
|
2939
|
+
let u = i.selection && i.selection.map(n.slice(o));
|
|
2940
|
+
u && s++;
|
|
2941
|
+
let d = new I(c.invert(), a, u), p, h = r.length - 1;
|
|
2942
|
+
(p = r.length && r[h].merge(d)) ? r[h] = p : r.push(d);
|
|
3007
2943
|
}
|
|
3008
2944
|
} else i.map && o--;
|
|
3009
2945
|
}, this.items.length, 0), new H(A.from(r.reverse()), s);
|
|
3010
2946
|
}
|
|
3011
2947
|
}
|
|
3012
2948
|
H.empty = new H(A.empty, 0);
|
|
3013
|
-
function
|
|
2949
|
+
function io(t, e) {
|
|
3014
2950
|
let n;
|
|
3015
2951
|
return t.forEach((o, r) => {
|
|
3016
2952
|
if (o.selection && e-- == 0)
|
|
@@ -3034,23 +2970,23 @@ class $ {
|
|
|
3034
2970
|
this.done = e, this.undone = n, this.prevRanges = o, this.prevTime = r, this.prevComposition = s;
|
|
3035
2971
|
}
|
|
3036
2972
|
}
|
|
3037
|
-
const
|
|
3038
|
-
function
|
|
2973
|
+
const lo = 20;
|
|
2974
|
+
function ao(t, e, n, o) {
|
|
3039
2975
|
let r = n.getMeta(V), s;
|
|
3040
2976
|
if (r)
|
|
3041
2977
|
return r.historyState;
|
|
3042
|
-
n.getMeta(
|
|
2978
|
+
n.getMeta(po) && (t = new $(t.done, t.undone, null, 0, -1));
|
|
3043
2979
|
let i = n.getMeta("appendedTransaction");
|
|
3044
2980
|
if (n.steps.length == 0)
|
|
3045
2981
|
return t;
|
|
3046
2982
|
if (i && i.getMeta(V))
|
|
3047
2983
|
return i.getMeta(V).redo ? new $(t.done.addTransform(n, void 0, o, ce(e)), t.undone, Ve(n.mapping.maps), t.prevTime, t.prevComposition) : new $(t.done, t.undone.addTransform(n, void 0, o, ce(e)), null, t.prevTime, t.prevComposition);
|
|
3048
2984
|
if (n.getMeta("addToHistory") !== !1 && !(i && i.getMeta("addToHistory") === !1)) {
|
|
3049
|
-
let l = n.getMeta("composition"), a = t.prevTime == 0 || !i && t.prevComposition != l && (t.prevTime < (n.time || 0) - o.newGroupDelay || !
|
|
2985
|
+
let l = n.getMeta("composition"), a = t.prevTime == 0 || !i && t.prevComposition != l && (t.prevTime < (n.time || 0) - o.newGroupDelay || !co(n, t.prevRanges)), c = i ? me(t.prevRanges, n.mapping) : Ve(n.mapping.maps);
|
|
3050
2986
|
return new $(t.done.addTransform(n, a ? e.selection.getBookmark() : void 0, o, ce(e)), H.empty, c, n.time, l ?? t.prevComposition);
|
|
3051
2987
|
} else return (s = n.getMeta("rebased")) ? new $(t.done.rebased(n, s), t.undone.rebased(n, s), me(t.prevRanges, n.mapping), t.prevTime, t.prevComposition) : new $(t.done.addMaps(n.mapping.maps), t.undone.addMaps(n.mapping.maps), me(t.prevRanges, n.mapping), t.prevTime, t.prevComposition);
|
|
3052
2988
|
}
|
|
3053
|
-
function
|
|
2989
|
+
function co(t, e) {
|
|
3054
2990
|
if (!e)
|
|
3055
2991
|
return !1;
|
|
3056
2992
|
if (!t.docChanged)
|
|
@@ -3077,7 +3013,7 @@ function me(t, e) {
|
|
|
3077
3013
|
}
|
|
3078
3014
|
return n;
|
|
3079
3015
|
}
|
|
3080
|
-
function
|
|
3016
|
+
function uo(t, e, n) {
|
|
3081
3017
|
let o = ce(e), r = V.get(e).spec.config, s = (n ? t.undone : t.done).popEvent(e, o);
|
|
3082
3018
|
if (!s)
|
|
3083
3019
|
return null;
|
|
@@ -3097,19 +3033,19 @@ function ce(t) {
|
|
|
3097
3033
|
}
|
|
3098
3034
|
return ge;
|
|
3099
3035
|
}
|
|
3100
|
-
const V = new
|
|
3101
|
-
function
|
|
3036
|
+
const V = new _("history"), po = new _("closeHistory");
|
|
3037
|
+
function ho(t = {}) {
|
|
3102
3038
|
return t = {
|
|
3103
3039
|
depth: t.depth || 100,
|
|
3104
3040
|
newGroupDelay: t.newGroupDelay || 500
|
|
3105
|
-
}, new
|
|
3041
|
+
}, new D({
|
|
3106
3042
|
key: V,
|
|
3107
3043
|
state: {
|
|
3108
3044
|
init() {
|
|
3109
3045
|
return new $(H.empty, H.empty, null, 0, -1);
|
|
3110
3046
|
},
|
|
3111
3047
|
apply(e, n, o) {
|
|
3112
|
-
return
|
|
3048
|
+
return ao(n, o, e, t);
|
|
3113
3049
|
}
|
|
3114
3050
|
},
|
|
3115
3051
|
config: t,
|
|
@@ -3129,13 +3065,13 @@ function it(t, e) {
|
|
|
3129
3065
|
if (!r || (t ? r.undone : r.done).eventCount == 0)
|
|
3130
3066
|
return !1;
|
|
3131
3067
|
if (o) {
|
|
3132
|
-
let s =
|
|
3068
|
+
let s = uo(r, n, t);
|
|
3133
3069
|
s && o(e ? s.scrollIntoView() : s);
|
|
3134
3070
|
}
|
|
3135
3071
|
return !0;
|
|
3136
3072
|
};
|
|
3137
3073
|
}
|
|
3138
|
-
const lt = it(!1, !0), at = it(!0, !0),
|
|
3074
|
+
const lt = it(!1, !0), at = it(!0, !0), fo = J.create({
|
|
3139
3075
|
name: "history",
|
|
3140
3076
|
addOptions() {
|
|
3141
3077
|
return {
|
|
@@ -3151,7 +3087,7 @@ const lt = it(!1, !0), at = it(!0, !0), ho = J.create({
|
|
|
3151
3087
|
},
|
|
3152
3088
|
addProseMirrorPlugins() {
|
|
3153
3089
|
return [
|
|
3154
|
-
|
|
3090
|
+
ho(this.options)
|
|
3155
3091
|
];
|
|
3156
3092
|
},
|
|
3157
3093
|
addKeyboardShortcuts() {
|
|
@@ -3164,7 +3100,7 @@ const lt = it(!1, !0), at = it(!0, !0), ho = J.create({
|
|
|
3164
3100
|
"Shift-Mod-я": () => this.editor.commands.redo()
|
|
3165
3101
|
};
|
|
3166
3102
|
}
|
|
3167
|
-
}),
|
|
3103
|
+
}), mo = k.create({
|
|
3168
3104
|
name: "horizontalRule",
|
|
3169
3105
|
addOptions() {
|
|
3170
3106
|
return {
|
|
@@ -3176,7 +3112,7 @@ const lt = it(!1, !0), at = it(!0, !0), ho = J.create({
|
|
|
3176
3112
|
return [{ tag: "hr" }];
|
|
3177
3113
|
},
|
|
3178
3114
|
renderHTML({ HTMLAttributes: t }) {
|
|
3179
|
-
return ["hr",
|
|
3115
|
+
return ["hr", M(this.options.HTMLAttributes, t)];
|
|
3180
3116
|
},
|
|
3181
3117
|
addCommands() {
|
|
3182
3118
|
return {
|
|
@@ -3192,12 +3128,12 @@ const lt = it(!1, !0), at = it(!0, !0), ho = J.create({
|
|
|
3192
3128
|
}) : s.insertContent({ type: this.name }), s.command(({ tr: i, dispatch: l }) => {
|
|
3193
3129
|
var a;
|
|
3194
3130
|
if (l) {
|
|
3195
|
-
const { $to: c } = i.selection,
|
|
3131
|
+
const { $to: c } = i.selection, u = c.end();
|
|
3196
3132
|
if (c.nodeAfter)
|
|
3197
|
-
c.nodeAfter.isTextblock ? i.setSelection(
|
|
3133
|
+
c.nodeAfter.isTextblock ? i.setSelection(S.create(i.doc, c.pos + 1)) : c.nodeAfter.isBlock ? i.setSelection(ue.create(i.doc, c.pos)) : i.setSelection(S.create(i.doc, c.pos));
|
|
3198
3134
|
else {
|
|
3199
|
-
const
|
|
3200
|
-
|
|
3135
|
+
const d = (a = c.parent.type.contentMatch.defaultType) === null || a === void 0 ? void 0 : a.create();
|
|
3136
|
+
d && (i.insert(u, d), i.setSelection(S.create(i.doc, u + 1)));
|
|
3201
3137
|
}
|
|
3202
3138
|
i.scrollIntoView();
|
|
3203
3139
|
}
|
|
@@ -3208,13 +3144,13 @@ const lt = it(!1, !0), at = it(!0, !0), ho = J.create({
|
|
|
3208
3144
|
},
|
|
3209
3145
|
addInputRules() {
|
|
3210
3146
|
return [
|
|
3211
|
-
|
|
3147
|
+
Xe({
|
|
3212
3148
|
find: /^(?:---|—-|___\s|\*\*\*\s)$/,
|
|
3213
3149
|
type: this.type
|
|
3214
3150
|
})
|
|
3215
3151
|
];
|
|
3216
3152
|
}
|
|
3217
|
-
}),
|
|
3153
|
+
}), go = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, bo = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g, wo = /(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/, yo = /(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g, Co = ee.create({
|
|
3218
3154
|
name: "italic",
|
|
3219
3155
|
addOptions() {
|
|
3220
3156
|
return {
|
|
@@ -3240,7 +3176,7 @@ const lt = it(!1, !0), at = it(!0, !0), ho = J.create({
|
|
|
3240
3176
|
];
|
|
3241
3177
|
},
|
|
3242
3178
|
renderHTML({ HTMLAttributes: t }) {
|
|
3243
|
-
return ["em",
|
|
3179
|
+
return ["em", M(this.options.HTMLAttributes, t), 0];
|
|
3244
3180
|
},
|
|
3245
3181
|
addCommands() {
|
|
3246
3182
|
return {
|
|
@@ -3257,29 +3193,29 @@ const lt = it(!1, !0), at = it(!0, !0), ho = J.create({
|
|
|
3257
3193
|
},
|
|
3258
3194
|
addInputRules() {
|
|
3259
3195
|
return [
|
|
3260
|
-
|
|
3261
|
-
find:
|
|
3196
|
+
j({
|
|
3197
|
+
find: go,
|
|
3262
3198
|
type: this.type
|
|
3263
3199
|
}),
|
|
3264
|
-
|
|
3265
|
-
find:
|
|
3200
|
+
j({
|
|
3201
|
+
find: wo,
|
|
3266
3202
|
type: this.type
|
|
3267
3203
|
})
|
|
3268
3204
|
];
|
|
3269
3205
|
},
|
|
3270
3206
|
addPasteRules() {
|
|
3271
3207
|
return [
|
|
3272
|
-
|
|
3273
|
-
find:
|
|
3208
|
+
K({
|
|
3209
|
+
find: bo,
|
|
3274
3210
|
type: this.type
|
|
3275
3211
|
}),
|
|
3276
|
-
|
|
3277
|
-
find:
|
|
3212
|
+
K({
|
|
3213
|
+
find: yo,
|
|
3278
3214
|
type: this.type
|
|
3279
3215
|
})
|
|
3280
3216
|
];
|
|
3281
3217
|
}
|
|
3282
|
-
}),
|
|
3218
|
+
}), Mo = k.create({
|
|
3283
3219
|
name: "listItem",
|
|
3284
3220
|
addOptions() {
|
|
3285
3221
|
return {
|
|
@@ -3298,7 +3234,7 @@ const lt = it(!1, !0), at = it(!0, !0), ho = J.create({
|
|
|
3298
3234
|
];
|
|
3299
3235
|
},
|
|
3300
3236
|
renderHTML({ HTMLAttributes: t }) {
|
|
3301
|
-
return ["li",
|
|
3237
|
+
return ["li", M(this.options.HTMLAttributes, t), 0];
|
|
3302
3238
|
},
|
|
3303
3239
|
addKeyboardShortcuts() {
|
|
3304
3240
|
return {
|
|
@@ -3307,7 +3243,7 @@ const lt = it(!1, !0), at = it(!0, !0), ho = J.create({
|
|
|
3307
3243
|
"Shift-Tab": () => this.editor.commands.liftListItem(this.name)
|
|
3308
3244
|
};
|
|
3309
3245
|
}
|
|
3310
|
-
}),
|
|
3246
|
+
}), Ao = "listItem", Ke = "textStyle", je = /^(\d+)\.\s$/, ko = k.create({
|
|
3311
3247
|
name: "orderedList",
|
|
3312
3248
|
addOptions() {
|
|
3313
3249
|
return {
|
|
@@ -3328,7 +3264,7 @@ const lt = it(!1, !0), at = it(!0, !0), ho = J.create({
|
|
|
3328
3264
|
parseHTML: (t) => t.hasAttribute("start") ? parseInt(t.getAttribute("start") || "", 10) : 1
|
|
3329
3265
|
},
|
|
3330
3266
|
type: {
|
|
3331
|
-
default:
|
|
3267
|
+
default: null,
|
|
3332
3268
|
parseHTML: (t) => t.getAttribute("type")
|
|
3333
3269
|
}
|
|
3334
3270
|
};
|
|
@@ -3342,11 +3278,11 @@ const lt = it(!1, !0), at = it(!0, !0), ho = J.create({
|
|
|
3342
3278
|
},
|
|
3343
3279
|
renderHTML({ HTMLAttributes: t }) {
|
|
3344
3280
|
const { start: e, ...n } = t;
|
|
3345
|
-
return e === 1 ? ["ol",
|
|
3281
|
+
return e === 1 ? ["ol", M(this.options.HTMLAttributes, n), 0] : ["ol", M(this.options.HTMLAttributes, t), 0];
|
|
3346
3282
|
},
|
|
3347
3283
|
addCommands() {
|
|
3348
3284
|
return {
|
|
3349
|
-
toggleOrderedList: () => ({ commands: t, chain: e }) => this.options.keepAttributes ? e().toggleList(this.name, this.options.itemTypeName, this.options.keepMarks).updateAttributes(
|
|
3285
|
+
toggleOrderedList: () => ({ commands: t, chain: e }) => this.options.keepAttributes ? e().toggleList(this.name, this.options.itemTypeName, this.options.keepMarks).updateAttributes(Ao, this.editor.getAttributes(Ke)).run() : t.toggleList(this.name, this.options.itemTypeName, this.options.keepMarks)
|
|
3350
3286
|
};
|
|
3351
3287
|
},
|
|
3352
3288
|
addKeyboardShortcuts() {
|
|
@@ -3373,7 +3309,7 @@ const lt = it(!1, !0), at = it(!0, !0), ho = J.create({
|
|
|
3373
3309
|
t
|
|
3374
3310
|
];
|
|
3375
3311
|
}
|
|
3376
|
-
}),
|
|
3312
|
+
}), To = k.create({
|
|
3377
3313
|
name: "paragraph",
|
|
3378
3314
|
priority: 1e3,
|
|
3379
3315
|
addOptions() {
|
|
@@ -3389,7 +3325,7 @@ const lt = it(!1, !0), at = it(!0, !0), ho = J.create({
|
|
|
3389
3325
|
];
|
|
3390
3326
|
},
|
|
3391
3327
|
renderHTML({ HTMLAttributes: t }) {
|
|
3392
|
-
return ["p",
|
|
3328
|
+
return ["p", M(this.options.HTMLAttributes, t), 0];
|
|
3393
3329
|
},
|
|
3394
3330
|
addCommands() {
|
|
3395
3331
|
return {
|
|
@@ -3401,7 +3337,7 @@ const lt = it(!1, !0), at = it(!0, !0), ho = J.create({
|
|
|
3401
3337
|
"Mod-Alt-0": () => this.editor.commands.setParagraph()
|
|
3402
3338
|
};
|
|
3403
3339
|
}
|
|
3404
|
-
}),
|
|
3340
|
+
}), vo = /(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/, So = /(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g, xo = ee.create({
|
|
3405
3341
|
name: "strike",
|
|
3406
3342
|
addOptions() {
|
|
3407
3343
|
return {
|
|
@@ -3427,7 +3363,7 @@ const lt = it(!1, !0), at = it(!0, !0), ho = J.create({
|
|
|
3427
3363
|
];
|
|
3428
3364
|
},
|
|
3429
3365
|
renderHTML({ HTMLAttributes: t }) {
|
|
3430
|
-
return ["s",
|
|
3366
|
+
return ["s", M(this.options.HTMLAttributes, t), 0];
|
|
3431
3367
|
},
|
|
3432
3368
|
addCommands() {
|
|
3433
3369
|
return {
|
|
@@ -3443,31 +3379,30 @@ const lt = it(!1, !0), at = it(!0, !0), ho = J.create({
|
|
|
3443
3379
|
},
|
|
3444
3380
|
addInputRules() {
|
|
3445
3381
|
return [
|
|
3446
|
-
|
|
3447
|
-
find:
|
|
3382
|
+
j({
|
|
3383
|
+
find: vo,
|
|
3448
3384
|
type: this.type
|
|
3449
3385
|
})
|
|
3450
3386
|
];
|
|
3451
3387
|
},
|
|
3452
3388
|
addPasteRules() {
|
|
3453
3389
|
return [
|
|
3454
|
-
|
|
3455
|
-
find:
|
|
3390
|
+
K({
|
|
3391
|
+
find: So,
|
|
3456
3392
|
type: this.type
|
|
3457
3393
|
})
|
|
3458
3394
|
];
|
|
3459
3395
|
}
|
|
3460
|
-
}),
|
|
3396
|
+
}), Lo = k.create({
|
|
3461
3397
|
name: "text",
|
|
3462
3398
|
group: "inline"
|
|
3463
|
-
}),
|
|
3399
|
+
}), Ro = J.create({
|
|
3464
3400
|
name: "starterKit",
|
|
3465
3401
|
addExtensions() {
|
|
3466
|
-
|
|
3467
|
-
|
|
3468
|
-
return this.options.bold !== !1 && b.push(On.configure((t = this.options) === null || t === void 0 ? void 0 : t.bold)), this.options.blockquote !== !1 && b.push(Rn.configure((e = this.options) === null || e === void 0 ? void 0 : e.blockquote)), this.options.bulletList !== !1 && b.push(zn.configure((n = this.options) === null || n === void 0 ? void 0 : n.bulletList)), this.options.code !== !1 && b.push(Bn.configure((o = this.options) === null || o === void 0 ? void 0 : o.code)), this.options.codeBlock !== !1 && b.push(Vn.configure((r = this.options) === null || r === void 0 ? void 0 : r.codeBlock)), this.options.document !== !1 && b.push(Fn.configure((s = this.options) === null || s === void 0 ? void 0 : s.document)), this.options.dropcursor !== !1 && b.push(qn.configure((i = this.options) === null || i === void 0 ? void 0 : i.dropcursor)), this.options.gapcursor !== !1 && b.push(eo.configure((l = this.options) === null || l === void 0 ? void 0 : l.gapcursor)), this.options.hardBreak !== !1 && b.push(to.configure((a = this.options) === null || a === void 0 ? void 0 : a.hardBreak)), this.options.heading !== !1 && b.push(no.configure((c = this.options) === null || c === void 0 ? void 0 : c.heading)), this.options.history !== !1 && b.push(ho.configure((d = this.options) === null || d === void 0 ? void 0 : d.history)), this.options.horizontalRule !== !1 && b.push(fo.configure((u = this.options) === null || u === void 0 ? void 0 : u.horizontalRule)), this.options.italic !== !1 && b.push(yo.configure((p = this.options) === null || p === void 0 ? void 0 : p.italic)), this.options.listItem !== !1 && b.push(Co.configure((h = this.options) === null || h === void 0 ? void 0 : h.listItem)), this.options.orderedList !== !1 && b.push(vo.configure((f = this.options) === null || f === void 0 ? void 0 : f.orderedList)), this.options.paragraph !== !1 && b.push(Ao.configure((m = this.options) === null || m === void 0 ? void 0 : m.paragraph)), this.options.strike !== !1 && b.push(So.configure((g = this.options) === null || g === void 0 ? void 0 : g.strike)), this.options.text !== !1 && b.push(xo.configure((w = this.options) === null || w === void 0 ? void 0 : w.text)), b;
|
|
3402
|
+
const t = [];
|
|
3403
|
+
return this.options.bold !== !1 && t.push(zn.configure(this.options.bold)), this.options.blockquote !== !1 && t.push(Hn.configure(this.options.blockquote)), this.options.bulletList !== !1 && t.push($n.configure(this.options.bulletList)), this.options.code !== !1 && t.push(_n.configure(this.options.code)), this.options.codeBlock !== !1 && t.push(Fn.configure(this.options.codeBlock)), this.options.document !== !1 && t.push(Kn.configure(this.options.document)), this.options.dropcursor !== !1 && t.push(qn.configure(this.options.dropcursor)), this.options.gapcursor !== !1 && t.push(to.configure(this.options.gapcursor)), this.options.hardBreak !== !1 && t.push(no.configure(this.options.hardBreak)), this.options.heading !== !1 && t.push(oo.configure(this.options.heading)), this.options.history !== !1 && t.push(fo.configure(this.options.history)), this.options.horizontalRule !== !1 && t.push(mo.configure(this.options.horizontalRule)), this.options.italic !== !1 && t.push(Co.configure(this.options.italic)), this.options.listItem !== !1 && t.push(Mo.configure(this.options.listItem)), this.options.orderedList !== !1 && t.push(ko.configure(this.options.orderedList)), this.options.paragraph !== !1 && t.push(To.configure(this.options.paragraph)), this.options.strike !== !1 && t.push(xo.configure(this.options.strike)), this.options.text !== !1 && t.push(Lo.configure(this.options.text)), t;
|
|
3469
3404
|
}
|
|
3470
|
-
}),
|
|
3405
|
+
}), Ho = /^\s*(\[([( |x])?\])\s$/, Eo = k.create({
|
|
3471
3406
|
name: "taskItem",
|
|
3472
3407
|
addOptions() {
|
|
3473
3408
|
return {
|
|
@@ -3506,7 +3441,7 @@ const lt = it(!1, !0), at = it(!0, !0), ho = J.create({
|
|
|
3506
3441
|
renderHTML({ node: t, HTMLAttributes: e }) {
|
|
3507
3442
|
return [
|
|
3508
3443
|
"li",
|
|
3509
|
-
|
|
3444
|
+
M(this.options.HTMLAttributes, e, {
|
|
3510
3445
|
"data-type": this.name
|
|
3511
3446
|
}),
|
|
3512
3447
|
[
|
|
@@ -3541,21 +3476,21 @@ const lt = it(!1, !0), at = it(!0, !0), ho = J.create({
|
|
|
3541
3476
|
l.checked = !l.checked;
|
|
3542
3477
|
return;
|
|
3543
3478
|
}
|
|
3544
|
-
const { checked:
|
|
3545
|
-
o.isEditable && typeof n == "function" && o.chain().focus(void 0, { scrollIntoView: !1 }).command(({ tr:
|
|
3479
|
+
const { checked: u } = c.target;
|
|
3480
|
+
o.isEditable && typeof n == "function" && o.chain().focus(void 0, { scrollIntoView: !1 }).command(({ tr: d }) => {
|
|
3546
3481
|
const p = n();
|
|
3547
3482
|
if (typeof p != "number")
|
|
3548
3483
|
return !1;
|
|
3549
|
-
const h =
|
|
3550
|
-
return
|
|
3484
|
+
const h = d.doc.nodeAt(p);
|
|
3485
|
+
return d.setNodeMarkup(p, void 0, {
|
|
3551
3486
|
...h == null ? void 0 : h.attrs,
|
|
3552
|
-
checked:
|
|
3487
|
+
checked: u
|
|
3553
3488
|
}), !0;
|
|
3554
|
-
}).run(), !o.isEditable && this.options.onReadOnlyChecked && (this.options.onReadOnlyChecked(t,
|
|
3555
|
-
}), Object.entries(this.options.HTMLAttributes).forEach(([c,
|
|
3556
|
-
r.setAttribute(c,
|
|
3557
|
-
}), r.dataset.checked = t.attrs.checked, l.checked = t.attrs.checked, s.append(l, i), r.append(s, a), Object.entries(e).forEach(([c,
|
|
3558
|
-
r.setAttribute(c,
|
|
3489
|
+
}).run(), !o.isEditable && this.options.onReadOnlyChecked && (this.options.onReadOnlyChecked(t, u) || (l.checked = !l.checked));
|
|
3490
|
+
}), Object.entries(this.options.HTMLAttributes).forEach(([c, u]) => {
|
|
3491
|
+
r.setAttribute(c, u);
|
|
3492
|
+
}), r.dataset.checked = t.attrs.checked, l.checked = t.attrs.checked, s.append(l, i), r.append(s, a), Object.entries(e).forEach(([c, u]) => {
|
|
3493
|
+
r.setAttribute(c, u);
|
|
3559
3494
|
}), {
|
|
3560
3495
|
dom: r,
|
|
3561
3496
|
contentDOM: a,
|
|
@@ -3566,7 +3501,7 @@ const lt = it(!1, !0), at = it(!0, !0), ho = J.create({
|
|
|
3566
3501
|
addInputRules() {
|
|
3567
3502
|
return [
|
|
3568
3503
|
G({
|
|
3569
|
-
find:
|
|
3504
|
+
find: Ho,
|
|
3570
3505
|
type: this.type,
|
|
3571
3506
|
getAttributes: (t) => ({
|
|
3572
3507
|
checked: t[t.length - 1] === "x"
|
|
@@ -3574,7 +3509,7 @@ const lt = it(!1, !0), at = it(!0, !0), ho = J.create({
|
|
|
3574
3509
|
})
|
|
3575
3510
|
];
|
|
3576
3511
|
}
|
|
3577
|
-
}),
|
|
3512
|
+
}), Io = k.create({
|
|
3578
3513
|
name: "taskList",
|
|
3579
3514
|
addOptions() {
|
|
3580
3515
|
return {
|
|
@@ -3595,7 +3530,7 @@ const lt = it(!1, !0), at = it(!0, !0), ho = J.create({
|
|
|
3595
3530
|
];
|
|
3596
3531
|
},
|
|
3597
3532
|
renderHTML({ HTMLAttributes: t }) {
|
|
3598
|
-
return ["ul",
|
|
3533
|
+
return ["ul", M(this.options.HTMLAttributes, t, { "data-type": this.name }), 0];
|
|
3599
3534
|
},
|
|
3600
3535
|
addCommands() {
|
|
3601
3536
|
return {
|
|
@@ -3607,7 +3542,7 @@ const lt = it(!1, !0), at = it(!0, !0), ho = J.create({
|
|
|
3607
3542
|
"Mod-Shift-9": () => this.editor.commands.toggleTaskList()
|
|
3608
3543
|
};
|
|
3609
3544
|
}
|
|
3610
|
-
}),
|
|
3545
|
+
}), No = k.create({
|
|
3611
3546
|
name: "tableRow",
|
|
3612
3547
|
addOptions() {
|
|
3613
3548
|
return {
|
|
@@ -3622,9 +3557,9 @@ const lt = it(!1, !0), at = it(!0, !0), ho = J.create({
|
|
|
3622
3557
|
];
|
|
3623
3558
|
},
|
|
3624
3559
|
renderHTML({ HTMLAttributes: t }) {
|
|
3625
|
-
return ["tr",
|
|
3560
|
+
return ["tr", M(this.options.HTMLAttributes, t), 0];
|
|
3626
3561
|
}
|
|
3627
|
-
}),
|
|
3562
|
+
}), Oo = /(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/, zo = /(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g, Po = ee.create({
|
|
3628
3563
|
name: "highlight",
|
|
3629
3564
|
addOptions() {
|
|
3630
3565
|
return {
|
|
@@ -3652,7 +3587,7 @@ const lt = it(!1, !0), at = it(!0, !0), ho = J.create({
|
|
|
3652
3587
|
];
|
|
3653
3588
|
},
|
|
3654
3589
|
renderHTML({ HTMLAttributes: t }) {
|
|
3655
|
-
return ["mark",
|
|
3590
|
+
return ["mark", M(this.options.HTMLAttributes, t), 0];
|
|
3656
3591
|
},
|
|
3657
3592
|
addCommands() {
|
|
3658
3593
|
return {
|
|
@@ -3668,21 +3603,21 @@ const lt = it(!1, !0), at = it(!0, !0), ho = J.create({
|
|
|
3668
3603
|
},
|
|
3669
3604
|
addInputRules() {
|
|
3670
3605
|
return [
|
|
3671
|
-
|
|
3672
|
-
find:
|
|
3606
|
+
j({
|
|
3607
|
+
find: Oo,
|
|
3673
3608
|
type: this.type
|
|
3674
3609
|
})
|
|
3675
3610
|
];
|
|
3676
3611
|
},
|
|
3677
3612
|
addPasteRules() {
|
|
3678
3613
|
return [
|
|
3679
|
-
|
|
3680
|
-
find:
|
|
3614
|
+
K({
|
|
3615
|
+
find: zo,
|
|
3681
3616
|
type: this.type
|
|
3682
3617
|
})
|
|
3683
3618
|
];
|
|
3684
3619
|
}
|
|
3685
|
-
}),
|
|
3620
|
+
}), $o = k.create({
|
|
3686
3621
|
name: "tableCell",
|
|
3687
3622
|
addOptions() {
|
|
3688
3623
|
return {
|
|
@@ -3715,9 +3650,9 @@ const lt = it(!1, !0), at = it(!0, !0), ho = J.create({
|
|
|
3715
3650
|
];
|
|
3716
3651
|
},
|
|
3717
3652
|
renderHTML({ HTMLAttributes: t }) {
|
|
3718
|
-
return ["td",
|
|
3653
|
+
return ["td", M(this.options.HTMLAttributes, t), 0];
|
|
3719
3654
|
}
|
|
3720
|
-
}),
|
|
3655
|
+
}), Bo = J.create({
|
|
3721
3656
|
name: "placeholder",
|
|
3722
3657
|
addOptions() {
|
|
3723
3658
|
return {
|
|
@@ -3731,8 +3666,8 @@ const lt = it(!1, !0), at = it(!0, !0), ho = J.create({
|
|
|
3731
3666
|
},
|
|
3732
3667
|
addProseMirrorPlugins() {
|
|
3733
3668
|
return [
|
|
3734
|
-
new
|
|
3735
|
-
key: new
|
|
3669
|
+
new D({
|
|
3670
|
+
key: new _("placeholder"),
|
|
3736
3671
|
props: {
|
|
3737
3672
|
decorations: ({ doc: t, selection: e }) => {
|
|
3738
3673
|
const n = this.editor.isEditable || !this.options.showOnlyWhenEditable, { anchor: o } = e, r = [];
|
|
@@ -3742,10 +3677,10 @@ const lt = it(!1, !0), at = it(!0, !0), ho = J.create({
|
|
|
3742
3677
|
return t.descendants((i, l) => {
|
|
3743
3678
|
const a = o >= l && o <= l + i.nodeSize, c = !i.isLeaf && gt(i);
|
|
3744
3679
|
if ((a || !this.options.showOnlyCurrent) && c) {
|
|
3745
|
-
const
|
|
3746
|
-
s &&
|
|
3747
|
-
const
|
|
3748
|
-
class:
|
|
3680
|
+
const u = [this.options.emptyNodeClass];
|
|
3681
|
+
s && u.push(this.options.emptyEditorClass);
|
|
3682
|
+
const d = q.node(l, l + i.nodeSize, {
|
|
3683
|
+
class: u.join(" "),
|
|
3749
3684
|
"data-placeholder": typeof this.options.placeholder == "function" ? this.options.placeholder({
|
|
3750
3685
|
editor: this.editor,
|
|
3751
3686
|
node: i,
|
|
@@ -3753,7 +3688,7 @@ const lt = it(!1, !0), at = it(!0, !0), ho = J.create({
|
|
|
3753
3688
|
hasAnchor: a
|
|
3754
3689
|
}) : this.options.placeholder
|
|
3755
3690
|
});
|
|
3756
|
-
r.push(
|
|
3691
|
+
r.push(d);
|
|
3757
3692
|
}
|
|
3758
3693
|
return this.options.includeChildren;
|
|
3759
3694
|
}), F.create(t, r);
|
|
@@ -3762,7 +3697,7 @@ const lt = it(!1, !0), at = it(!0, !0), ho = J.create({
|
|
|
3762
3697
|
})
|
|
3763
3698
|
];
|
|
3764
3699
|
}
|
|
3765
|
-
}),
|
|
3700
|
+
}), Do = k.create({
|
|
3766
3701
|
name: "tableHeader",
|
|
3767
3702
|
addOptions() {
|
|
3768
3703
|
return {
|
|
@@ -3795,30 +3730,30 @@ const lt = it(!1, !0), at = it(!0, !0), ho = J.create({
|
|
|
3795
3730
|
];
|
|
3796
3731
|
},
|
|
3797
3732
|
renderHTML({ HTMLAttributes: t }) {
|
|
3798
|
-
return ["th",
|
|
3733
|
+
return ["th", M(this.options.HTMLAttributes, t), 0];
|
|
3799
3734
|
}
|
|
3800
|
-
}),
|
|
3801
|
-
|
|
3735
|
+
}), Go = (t) => [
|
|
3736
|
+
Ro.configure({
|
|
3802
3737
|
dropcursor: {
|
|
3803
3738
|
width: 4,
|
|
3804
3739
|
color: "#ebf6fe"
|
|
3805
3740
|
}
|
|
3806
3741
|
}),
|
|
3807
|
-
|
|
3742
|
+
Io.configure({
|
|
3808
3743
|
HTMLAttributes: {
|
|
3809
3744
|
class: "scribe-task-list"
|
|
3810
3745
|
}
|
|
3811
3746
|
}),
|
|
3812
|
-
|
|
3747
|
+
Eo.configure({
|
|
3813
3748
|
nested: !0
|
|
3814
3749
|
}),
|
|
3815
|
-
|
|
3750
|
+
Ln.configure({
|
|
3816
3751
|
resizable: !0
|
|
3817
3752
|
}),
|
|
3818
|
-
|
|
3819
|
-
|
|
3820
|
-
|
|
3821
|
-
|
|
3753
|
+
No,
|
|
3754
|
+
Do,
|
|
3755
|
+
$o,
|
|
3756
|
+
Bo.configure({
|
|
3822
3757
|
showOnlyWhenEditable: !0,
|
|
3823
3758
|
includeChildren: !0,
|
|
3824
3759
|
showOnlyCurrent: !1,
|
|
@@ -3826,7 +3761,7 @@ const lt = it(!1, !0), at = it(!0, !0), ho = J.create({
|
|
|
3826
3761
|
emptyNodeClass: "is-node-empty",
|
|
3827
3762
|
placeholder: ({ editor: e, node: n }) => e.isDestroyed ? "" : n.type.name === "heading" ? `Heading ${n.attrs.level}` : t.placeholderText || 'Type "/" for commands...'
|
|
3828
3763
|
}),
|
|
3829
|
-
|
|
3764
|
+
At.configure({ mode: "deepest", className: "has-focus" }),
|
|
3830
3765
|
bt.configure({
|
|
3831
3766
|
slashSuggestion: {
|
|
3832
3767
|
items: Ct,
|
|
@@ -3836,14 +3771,15 @@ const lt = it(!1, !0), at = it(!0, !0), ho = J.create({
|
|
|
3836
3771
|
Po,
|
|
3837
3772
|
wt,
|
|
3838
3773
|
ct,
|
|
3839
|
-
|
|
3774
|
+
Tt.configure({
|
|
3840
3775
|
inline: !0,
|
|
3841
3776
|
HTMLAttributes: {
|
|
3842
3777
|
class: "scribe-image-node"
|
|
3843
3778
|
},
|
|
3844
3779
|
allowBase64: !0
|
|
3845
|
-
})
|
|
3780
|
+
}),
|
|
3781
|
+
Mt
|
|
3846
3782
|
];
|
|
3847
3783
|
export {
|
|
3848
|
-
|
|
3784
|
+
Go as initExtensions
|
|
3849
3785
|
};
|