zt-react-milkdown 0.1.0 → 0.1.2
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/{dist-Cxaq2crg.js → commands-BJpevWrH.js} +123 -123
- package/dist/commands-BmZHd6RL.js +2 -0
- package/dist/{dist-CPVooDwj.cjs → commands-CM7IuhpT.cjs} +2 -2
- package/dist/commands-f4yOm8DQ.cjs +1 -0
- package/dist/{debounce-Bqj_3iJs.cjs → debounce-C_TNzOFT.cjs} +1 -1
- package/dist/{dist-DaM7GJv6.js → dist-CLTsQjPD.js} +319 -318
- package/dist/{dist-CxZn1qUo.js → dist-CZTw9GLV.js} +198 -198
- package/dist/dist-DQnWlYyo.cjs +5 -0
- package/dist/dist-ZPtYoqTI.cjs +1 -0
- package/dist/floating-ui.dom-CV-TLBRq.cjs +1 -0
- package/dist/floating-ui.dom-CoOubeUs.js +762 -0
- package/dist/index.cjs +25 -149
- package/dist/index.mjs +6235 -15737
- package/dist/{lib-C8xOD1Bp.cjs → lib-5pUyY-Tl.cjs} +1 -1
- package/dist/{lib-DkE7Uq2b.js → lib-Bhr5EVOu.js} +110 -112
- package/dist/lib-BmAQCwSQ.cjs +1 -0
- package/dist/{lib-wmHesNI0.js → lib-C1A-pN4b.js} +574 -575
- package/dist/lib-CVebEyb8.cjs +4 -0
- package/dist/lib-ChwoE6v5.js +331 -0
- package/dist/lib-DIx8C5AZ.cjs +1 -0
- package/dist/lib-DVE2k9i1.js +387 -0
- package/dist/{lib-DzK_kn7a.js → lib-D_0WAhKU.js} +3 -3
- package/dist/{lib-m8lKZKxK.js → lib-Dd20rlmV.js} +28 -28
- package/dist/lib-De0djIEV.cjs +5 -0
- package/dist/{lib-D4HMdvmK.cjs → lib-DgEwQN1U.cjs} +1 -1
- package/dist/{dist-Dhukmh4L.js → lib-DmD940Fq.js} +2849 -1735
- package/dist/lib-Dplx6t-N.cjs +3 -0
- package/dist/lib-DzY83R_P.cjs +39 -0
- package/dist/lib-F08NY8fk.cjs +1 -0
- package/dist/{lib-B0rHJ9lJ.js → lib-_NDReOAt.js} +3 -3
- package/dist/{lib-CK9MEMX-.js → lib-bsXGz3fj.js} +28 -27
- package/dist/schema-list-D9Q6QKgo.cjs +1 -0
- package/dist/schema-list-DooYP5HM.js +110 -0
- package/dist/src/core/createEditor.d.ts.map +1 -1
- package/dist/src/local/en-US.d.ts.map +1 -1
- package/dist/src/local/zh-CN.d.ts.map +1 -1
- package/dist/src/plugins/custom/block-transform/block-transform.d.ts +15 -0
- package/dist/src/plugins/custom/block-transform/block-transform.d.ts.map +1 -0
- package/dist/src/plugins/custom/block-transform/index.d.ts +2 -0
- package/dist/src/plugins/custom/block-transform/index.d.ts.map +1 -0
- package/dist/src/plugins/custom/math/index.d.ts +6 -0
- package/dist/src/plugins/custom/math/index.d.ts.map +1 -1
- package/dist/src/plugins/custom/math/math-block-editable.d.ts.map +1 -1
- package/dist/src/plugins/custom/math/math-inline-arrow-navigation.d.ts +5 -0
- package/dist/src/plugins/custom/math/math-inline-arrow-navigation.d.ts.map +1 -0
- package/dist/src/plugins/custom/math/math-inline-edit-plugin.d.ts +29 -0
- package/dist/src/plugins/custom/math/math-inline-edit-plugin.d.ts.map +1 -0
- package/dist/src/plugins/custom/math/math-inline-editable.d.ts +7 -0
- package/dist/src/plugins/custom/math/math-inline-editable.d.ts.map +1 -0
- package/dist/src/plugins/custom/math/math-plugin.d.ts.map +1 -1
- package/dist/src/plugins/custom/selection-tooltip/constants.d.ts +5 -1
- package/dist/src/plugins/custom/selection-tooltip/constants.d.ts.map +1 -1
- package/dist/src/plugins/custom/selection-tooltip/index.d.ts.map +1 -1
- package/dist/src/plugins/custom/selection-tooltip/tooltip-view.d.ts +34 -3
- package/dist/src/plugins/custom/selection-tooltip/tooltip-view.d.ts.map +1 -1
- package/dist/src/plugins/custom/selection-tooltip/types.d.ts +16 -1
- package/dist/src/plugins/custom/selection-tooltip/types.d.ts.map +1 -1
- package/dist/src/plugins/custom/slash-menu/slash-menu-commands.d.ts.map +1 -1
- package/dist/src/plugins/custom/slash-menu/slash-menu-logic.d.ts +4 -0
- package/dist/src/plugins/custom/slash-menu/slash-menu-logic.d.ts.map +1 -1
- package/dist/src/plugins/custom/slash-menu/slash-menu-view.d.ts.map +1 -1
- package/dist/src/plugins/custom/slash-menu/slash-menu.d.ts.map +1 -1
- package/dist/src/plugins/preset-common.d.ts +6 -0
- package/dist/src/plugins/preset-common.d.ts.map +1 -1
- package/dist/src/react/hooks/useMilkdownEditor.d.ts +2 -2
- package/dist/src/react/hooks/useMilkdownEditor.d.ts.map +1 -1
- package/dist/src/types/editor.d.ts +35 -5
- package/dist/src/types/editor.d.ts.map +1 -1
- package/dist/state-BC1dqWPQ.cjs +1 -0
- package/dist/state-BvRk9kiK.cjs +0 -0
- package/dist/state-BvRk9kiK.js +0 -0
- package/dist/state-rTW_1XVf.js +3 -0
- package/dist/style.css +2 -2
- package/package.json +1 -1
- package/dist/commands-CDrea4WB.cjs +0 -1
- package/dist/commands-DoqeX5uJ.js +0 -36
- package/dist/dist-BCCSKc3M.cjs +0 -5
- package/dist/dist-C0PSMrs7.cjs +0 -37
- package/dist/dist-mOpTMw1E.cjs +0 -1
- package/dist/floating-ui.dom-CKbcbmJV.js +0 -883
- package/dist/floating-ui.dom-VaZZ2gzS.cjs +0 -1
- package/dist/index.browser-5LtNN9G9.cjs +0 -1
- package/dist/index.browser-D2DmEB8o.js +0 -26
- package/dist/lib-38nxOnTd.cjs +0 -4
- package/dist/lib-8Tr6mAln.cjs +0 -1
- package/dist/lib-BJgvZywM.cjs +0 -3
- package/dist/lib-BNOSyYeU.cjs +0 -3
- package/dist/lib-C5AzmhNY.cjs +0 -5
- package/dist/lib-CCUU16r8.js +0 -1081
- package/dist/lib-DWZA8C0h.cjs +0 -1
- package/dist/lib-Dbe-cVjv.js +0 -367
- package/dist/lib-IahjxPWM.cjs +0 -3
- package/dist/lib-r5eNG0sa.js +0 -754
- package/dist/rolldown-runtime-CerMd-t8.cjs +0 -1
- package/dist/rolldown-runtime-DnwLefa7.js +0 -23
- package/dist/schema-list-DSdBEAWW.js +0 -171
- package/dist/schema-list-bL8FNes5.cjs +0 -1
- package/dist/state-CHAiIqOA.cjs +0 -1
- package/dist/state-DNxqltZl.js +0 -16
- /package/dist/{debounce-Cuk3VGPr.js → debounce-Z8-khnlZ.js} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { i as l,
|
|
1
|
+
import { M as e, N as t, j as n } from "./lib-DmD940Fq.js";
|
|
2
|
+
import { A as r, a as i, c as a, i as o, m as s, o as c, r as l, s as u, w as d } from "./dist-CLTsQjPD.js";
|
|
3
3
|
//#region node_modules/.pnpm/prosemirror-tables@1.8.5/node_modules/prosemirror-tables/dist/index.js
|
|
4
4
|
var f, p;
|
|
5
5
|
if (typeof WeakMap < "u") {
|
|
@@ -280,7 +280,7 @@ function y(e) {
|
|
|
280
280
|
}
|
|
281
281
|
return t;
|
|
282
282
|
}
|
|
283
|
-
var b = new
|
|
283
|
+
var b = new i("selectingCells");
|
|
284
284
|
function x(e) {
|
|
285
285
|
for (let t = e.depth - 1; t > 0; t--) if (e.node(t).type.spec.tableRole == "row") return e.node(0).resolve(e.before(t + 1));
|
|
286
286
|
return null;
|
|
@@ -344,68 +344,68 @@ function se(e, t, n) {
|
|
|
344
344
|
for (let i = 0; i < e.height; i++) if (t.nodeAt(e.map[n + i * e.width]).type != r) return !1;
|
|
345
345
|
return !0;
|
|
346
346
|
}
|
|
347
|
-
var O = class
|
|
347
|
+
var O = class e extends c {
|
|
348
348
|
constructor(e, t = e) {
|
|
349
349
|
let n = e.node(-1), r = m.get(n), i = e.start(-1), a = r.rectBetween(e.pos - i, t.pos - i), o = e.node(0), s = r.cellsInRect(a).filter((e) => e != t.pos - i);
|
|
350
350
|
s.unshift(t.pos - i);
|
|
351
|
-
let
|
|
351
|
+
let c = s.map((e) => {
|
|
352
352
|
let t = n.nodeAt(e);
|
|
353
353
|
if (!t) throw RangeError(`No cell with offset ${e} found`);
|
|
354
354
|
let r = i + e + 1;
|
|
355
|
-
return new
|
|
355
|
+
return new u(o.resolve(r), o.resolve(r + t.content.size));
|
|
356
356
|
});
|
|
357
|
-
super(
|
|
357
|
+
super(c[0].$from, c[0].$to, c), this.$anchorCell = e, this.$headCell = t;
|
|
358
358
|
}
|
|
359
|
-
map(
|
|
360
|
-
let
|
|
361
|
-
if (w(
|
|
362
|
-
let
|
|
363
|
-
return
|
|
359
|
+
map(t, n) {
|
|
360
|
+
let r = t.resolve(n.map(this.$anchorCell.pos)), i = t.resolve(n.map(this.$headCell.pos));
|
|
361
|
+
if (w(r) && w(i) && T(r, i)) {
|
|
362
|
+
let t = this.$anchorCell.node(-1) != r.node(-1);
|
|
363
|
+
return t && this.isRowSelection() ? e.rowSelection(r, i) : t && this.isColSelection() ? e.colSelection(r, i) : new e(r, i);
|
|
364
364
|
}
|
|
365
|
-
return
|
|
365
|
+
return a.between(r, i);
|
|
366
366
|
}
|
|
367
367
|
content() {
|
|
368
|
-
let
|
|
369
|
-
for (let
|
|
370
|
-
let
|
|
371
|
-
for (let
|
|
372
|
-
let
|
|
373
|
-
if (
|
|
374
|
-
|
|
375
|
-
let s =
|
|
376
|
-
if (!c) throw RangeError(`No cell with offset ${
|
|
377
|
-
let l =
|
|
368
|
+
let e = this.$anchorCell.node(-1), t = m.get(e), n = this.$anchorCell.start(-1), i = t.rectBetween(this.$anchorCell.pos - n, this.$headCell.pos - n), a = {}, o = [];
|
|
369
|
+
for (let n = i.top; n < i.bottom; n++) {
|
|
370
|
+
let r = [];
|
|
371
|
+
for (let o = n * t.width + i.left, s = i.left; s < i.right; s++, o++) {
|
|
372
|
+
let n = t.map[o];
|
|
373
|
+
if (a[n]) continue;
|
|
374
|
+
a[n] = !0;
|
|
375
|
+
let s = t.findCell(n), c = e.nodeAt(n);
|
|
376
|
+
if (!c) throw RangeError(`No cell with offset ${n} found`);
|
|
377
|
+
let l = i.left - s.left, u = s.right - i.right;
|
|
378
378
|
if (l > 0 || u > 0) {
|
|
379
379
|
let e = c.attrs;
|
|
380
|
-
if (l > 0 && (e = D(e, 0, l)), u > 0 && (e = D(e, e.colspan - u, u)), s.left <
|
|
380
|
+
if (l > 0 && (e = D(e, 0, l)), u > 0 && (e = D(e, e.colspan - u, u)), s.left < i.left) {
|
|
381
381
|
if (c = c.type.createAndFill(e), !c) throw RangeError(`Could not create cell with attrs ${JSON.stringify(e)}`);
|
|
382
382
|
} else c = c.type.create(e, c.content);
|
|
383
383
|
}
|
|
384
|
-
if (s.top <
|
|
384
|
+
if (s.top < i.top || s.bottom > i.bottom) {
|
|
385
385
|
let e = {
|
|
386
386
|
...c.attrs,
|
|
387
|
-
rowspan: Math.min(s.bottom,
|
|
387
|
+
rowspan: Math.min(s.bottom, i.bottom) - Math.max(s.top, i.top)
|
|
388
388
|
};
|
|
389
|
-
c = s.top <
|
|
389
|
+
c = s.top < i.top ? c.type.createAndFill(e) : c.type.create(e, c.content);
|
|
390
390
|
}
|
|
391
|
-
|
|
391
|
+
r.push(c);
|
|
392
392
|
}
|
|
393
|
-
|
|
393
|
+
o.push(e.child(n).copy(d.from(r)));
|
|
394
394
|
}
|
|
395
|
-
let
|
|
396
|
-
return new
|
|
397
|
-
}
|
|
398
|
-
replace(e, t =
|
|
399
|
-
let n = e.steps.length,
|
|
400
|
-
for (let a = 0; a <
|
|
401
|
-
let { $from: o, $to: s } =
|
|
402
|
-
e.replace(c.map(o.pos), c.map(s.pos), a ?
|
|
395
|
+
let s = this.isColSelection() && this.isRowSelection() ? e : o;
|
|
396
|
+
return new r(d.from(s), 1, 1);
|
|
397
|
+
}
|
|
398
|
+
replace(e, t = r.empty) {
|
|
399
|
+
let n = e.steps.length, i = this.ranges;
|
|
400
|
+
for (let a = 0; a < i.length; a++) {
|
|
401
|
+
let { $from: o, $to: s } = i[a], c = e.mapping.slice(n);
|
|
402
|
+
e.replace(c.map(o.pos), c.map(s.pos), a ? r.empty : t);
|
|
403
403
|
}
|
|
404
|
-
let
|
|
405
|
-
|
|
404
|
+
let a = c.findFrom(e.doc.resolve(e.mapping.slice(n).map(this.to)), -1);
|
|
405
|
+
a && e.setSelection(a);
|
|
406
406
|
}
|
|
407
|
-
replaceWith(
|
|
408
|
-
this.replace(
|
|
407
|
+
replaceWith(e, t) {
|
|
408
|
+
this.replace(e, new r(d.from(t), 0, 0));
|
|
409
409
|
}
|
|
410
410
|
forEachCell(e) {
|
|
411
411
|
let t = this.$anchorCell.node(-1), n = m.get(t), r = this.$anchorCell.start(-1), i = n.cellsInRect(n.rectBetween(this.$anchorCell.pos - r, this.$headCell.pos - r));
|
|
@@ -417,9 +417,9 @@ var O = class t extends a {
|
|
|
417
417
|
let n = e + this.$anchorCell.nodeAfter.attrs.rowspan, r = t + this.$headCell.nodeAfter.attrs.rowspan;
|
|
418
418
|
return Math.max(n, r) == this.$headCell.node(-1).childCount;
|
|
419
419
|
}
|
|
420
|
-
static colSelection(
|
|
421
|
-
let r =
|
|
422
|
-
return o.top <= s.top ? (o.top > 0 && (
|
|
420
|
+
static colSelection(t, n = t) {
|
|
421
|
+
let r = t.node(-1), i = m.get(r), a = t.start(-1), o = i.findCell(t.pos - a), s = i.findCell(n.pos - a), c = t.node(0);
|
|
422
|
+
return o.top <= s.top ? (o.top > 0 && (t = c.resolve(a + i.map[o.left])), s.bottom < i.height && (n = c.resolve(a + i.map[i.width * (i.height - 1) + s.right - 1]))) : (s.top > 0 && (n = c.resolve(a + i.map[s.left])), o.bottom < i.height && (t = c.resolve(a + i.map[i.width * (i.height - 1) + o.right - 1]))), new e(t, n);
|
|
423
423
|
}
|
|
424
424
|
isRowSelection() {
|
|
425
425
|
let e = this.$anchorCell.node(-1), t = m.get(e), n = this.$anchorCell.start(-1), r = t.colCount(this.$anchorCell.pos - n), i = t.colCount(this.$headCell.pos - n);
|
|
@@ -427,12 +427,12 @@ var O = class t extends a {
|
|
|
427
427
|
let a = r + this.$anchorCell.nodeAfter.attrs.colspan, o = i + this.$headCell.nodeAfter.attrs.colspan;
|
|
428
428
|
return Math.max(a, o) == t.width;
|
|
429
429
|
}
|
|
430
|
-
eq(
|
|
431
|
-
return
|
|
430
|
+
eq(t) {
|
|
431
|
+
return t instanceof e && t.$anchorCell.pos == this.$anchorCell.pos && t.$headCell.pos == this.$headCell.pos;
|
|
432
432
|
}
|
|
433
|
-
static rowSelection(
|
|
434
|
-
let r =
|
|
435
|
-
return o.left <= s.left ? (o.left > 0 && (
|
|
433
|
+
static rowSelection(t, n = t) {
|
|
434
|
+
let r = t.node(-1), i = m.get(r), a = t.start(-1), o = i.findCell(t.pos - a), s = i.findCell(n.pos - a), c = t.node(0);
|
|
435
|
+
return o.left <= s.left ? (o.left > 0 && (t = c.resolve(a + i.map[o.top * i.width])), s.right < i.width && (n = c.resolve(a + i.map[i.width * (s.top + 1) - 1]))) : (s.left > 0 && (n = c.resolve(a + i.map[s.top * i.width])), o.right < i.width && (t = c.resolve(a + i.map[i.width * (o.top + 1) - 1]))), new e(t, n);
|
|
436
436
|
}
|
|
437
437
|
toJSON() {
|
|
438
438
|
return {
|
|
@@ -441,17 +441,17 @@ var O = class t extends a {
|
|
|
441
441
|
head: this.$headCell.pos
|
|
442
442
|
};
|
|
443
443
|
}
|
|
444
|
-
static fromJSON(
|
|
445
|
-
return new t
|
|
444
|
+
static fromJSON(t, n) {
|
|
445
|
+
return new e(t.resolve(n.anchor), t.resolve(n.head));
|
|
446
446
|
}
|
|
447
|
-
static create(
|
|
448
|
-
return new t
|
|
447
|
+
static create(t, n, r = n) {
|
|
448
|
+
return new e(t.resolve(n), t.resolve(r));
|
|
449
449
|
}
|
|
450
450
|
getBookmark() {
|
|
451
451
|
return new ce(this.$anchorCell.pos, this.$headCell.pos);
|
|
452
452
|
}
|
|
453
453
|
};
|
|
454
|
-
O.prototype.visible = !1,
|
|
454
|
+
O.prototype.visible = !1, c.jsonID("cell", O);
|
|
455
455
|
var ce = class e {
|
|
456
456
|
constructor(e, t) {
|
|
457
457
|
this.anchor = e, this.head = t;
|
|
@@ -461,15 +461,15 @@ var ce = class e {
|
|
|
461
461
|
}
|
|
462
462
|
resolve(e) {
|
|
463
463
|
let t = e.resolve(this.anchor), n = e.resolve(this.head);
|
|
464
|
-
return t.parent.type.spec.tableRole == "row" && n.parent.type.spec.tableRole == "row" && t.index() < t.parent.childCount && n.index() < n.parent.childCount && T(t, n) ? new O(t, n) :
|
|
464
|
+
return t.parent.type.spec.tableRole == "row" && n.parent.type.spec.tableRole == "row" && t.index() < t.parent.childCount && n.index() < n.parent.childCount && T(t, n) ? new O(t, n) : c.near(n, 1);
|
|
465
465
|
}
|
|
466
466
|
};
|
|
467
|
-
function le(
|
|
468
|
-
if (!(
|
|
469
|
-
let
|
|
470
|
-
return
|
|
471
|
-
|
|
472
|
-
}),
|
|
467
|
+
function le(t) {
|
|
468
|
+
if (!(t.selection instanceof O)) return null;
|
|
469
|
+
let r = [];
|
|
470
|
+
return t.selection.forEachCell((e, t) => {
|
|
471
|
+
r.push(n.node(t, t + e.nodeSize, { class: "selectedCell" }));
|
|
472
|
+
}), e.create(t.doc, r);
|
|
473
473
|
}
|
|
474
474
|
function ue({ $from: e, $to: t }) {
|
|
475
475
|
if (e.pos == t.pos || e.pos < t.pos - 6) return !1;
|
|
@@ -496,21 +496,21 @@ function de({ $from: e, $to: t }) {
|
|
|
496
496
|
}
|
|
497
497
|
return n !== r && t.parentOffset === 0;
|
|
498
498
|
}
|
|
499
|
-
function fe(e, t,
|
|
500
|
-
let
|
|
501
|
-
if (
|
|
502
|
-
if (
|
|
503
|
-
else if (
|
|
504
|
-
let e =
|
|
499
|
+
function fe(e, t, n) {
|
|
500
|
+
let r = (t || e).selection, i = (t || e).doc, o, s;
|
|
501
|
+
if (r instanceof l && (s = r.node.type.spec.tableRole)) {
|
|
502
|
+
if (s == "cell" || s == "header_cell") o = O.create(i, r.from);
|
|
503
|
+
else if (s == "row") {
|
|
504
|
+
let e = i.resolve(r.from + 1);
|
|
505
505
|
o = O.rowSelection(e, e);
|
|
506
|
-
} else if (!
|
|
507
|
-
let e = m.get(
|
|
508
|
-
o = O.create(
|
|
506
|
+
} else if (!n) {
|
|
507
|
+
let e = m.get(r.node), t = r.from + 1, n = t + e.map[e.width * e.height - 1];
|
|
508
|
+
o = O.create(i, t + 1, n);
|
|
509
509
|
}
|
|
510
|
-
} else
|
|
510
|
+
} else r instanceof a && ue(r) ? o = a.create(i, r.from) : r instanceof a && de(r) && (o = a.create(i, r.$from.start(), r.$from.end()));
|
|
511
511
|
return o && (t ||= e.tr).setSelection(o), t;
|
|
512
512
|
}
|
|
513
|
-
var pe = new
|
|
513
|
+
var pe = new i("fix-tables");
|
|
514
514
|
function k(e, t, n, r) {
|
|
515
515
|
let i = e.childCount, a = t.childCount;
|
|
516
516
|
outer: for (let o = 0, s = 0; o < a; o++) {
|
|
@@ -1037,13 +1037,13 @@ function Me(e, t) {
|
|
|
1037
1037
|
return null;
|
|
1038
1038
|
}
|
|
1039
1039
|
function Ne(e) {
|
|
1040
|
-
return function(t,
|
|
1040
|
+
return function(t, n) {
|
|
1041
1041
|
if (!S(t)) return !1;
|
|
1042
|
-
let
|
|
1043
|
-
if (
|
|
1044
|
-
if (
|
|
1045
|
-
let e = t.doc.resolve(
|
|
1046
|
-
|
|
1042
|
+
let r = Me(C(t), e);
|
|
1043
|
+
if (r == null) return !1;
|
|
1044
|
+
if (n) {
|
|
1045
|
+
let e = t.doc.resolve(r);
|
|
1046
|
+
n(t.tr.setSelection(a.between(e, ae(e))).scrollIntoView());
|
|
1047
1047
|
}
|
|
1048
1048
|
return !0;
|
|
1049
1049
|
};
|
|
@@ -1057,10 +1057,10 @@ function W(e, t) {
|
|
|
1057
1057
|
let n = e.selection;
|
|
1058
1058
|
if (!(n instanceof O)) return !1;
|
|
1059
1059
|
if (t) {
|
|
1060
|
-
let
|
|
1060
|
+
let i = e.tr, a = y(e.schema).cell.createAndFill().content;
|
|
1061
1061
|
n.forEachCell((e, t) => {
|
|
1062
|
-
e.content.eq(a) ||
|
|
1063
|
-
}),
|
|
1062
|
+
e.content.eq(a) || i.replace(i.mapping.map(t + 1), i.mapping.map(t + e.nodeSize - 1), new r(a, 0, 0));
|
|
1063
|
+
}), i.docChanged && t(i);
|
|
1064
1064
|
}
|
|
1065
1065
|
return !0;
|
|
1066
1066
|
}
|
|
@@ -1090,99 +1090,99 @@ function Ie(e) {
|
|
|
1090
1090
|
}
|
|
1091
1091
|
function Le(e) {
|
|
1092
1092
|
if (e.size === 0) return null;
|
|
1093
|
-
let { content: t, openStart: n, openEnd:
|
|
1094
|
-
for (; t.childCount == 1 && (n > 0 &&
|
|
1093
|
+
let { content: t, openStart: n, openEnd: i } = e;
|
|
1094
|
+
for (; t.childCount == 1 && (n > 0 && i > 0 || t.child(0).type.spec.tableRole == "table");) n--, i--, t = t.child(0).content;
|
|
1095
1095
|
let a = t.child(0), o = a.type.spec.tableRole, s = a.type.schema, c = [];
|
|
1096
1096
|
if (o == "row") for (let e = 0; e < t.childCount; e++) {
|
|
1097
|
-
let a = t.child(e).content, o = e ? 0 : Math.max(0, n - 1), l = e < t.childCount - 1 ? 0 : Math.max(0,
|
|
1098
|
-
(o || l) && (a = G(y(s).row, new
|
|
1097
|
+
let a = t.child(e).content, o = e ? 0 : Math.max(0, n - 1), l = e < t.childCount - 1 ? 0 : Math.max(0, i - 1);
|
|
1098
|
+
(o || l) && (a = G(y(s).row, new r(a, o, l)).content), c.push(a);
|
|
1099
1099
|
}
|
|
1100
|
-
else if (o == "cell" || o == "header_cell") c.push(n ||
|
|
1100
|
+
else if (o == "cell" || o == "header_cell") c.push(n || i ? G(y(s).row, new r(t, n, i)).content : t);
|
|
1101
1101
|
else return null;
|
|
1102
1102
|
return Re(s, c);
|
|
1103
1103
|
}
|
|
1104
|
-
function Re(
|
|
1105
|
-
let
|
|
1106
|
-
for (let e = 0; e <
|
|
1107
|
-
let
|
|
1108
|
-
for (let
|
|
1109
|
-
let { rowspan: i, colspan: a } =
|
|
1110
|
-
for (let t = e; t < e + i; t++)
|
|
1104
|
+
function Re(e, t) {
|
|
1105
|
+
let n = [];
|
|
1106
|
+
for (let e = 0; e < t.length; e++) {
|
|
1107
|
+
let r = t[e];
|
|
1108
|
+
for (let t = r.childCount - 1; t >= 0; t--) {
|
|
1109
|
+
let { rowspan: i, colspan: a } = r.child(t).attrs;
|
|
1110
|
+
for (let t = e; t < e + i; t++) n[t] = (n[t] || 0) + a;
|
|
1111
1111
|
}
|
|
1112
1112
|
}
|
|
1113
|
-
let
|
|
1114
|
-
for (let e = 0; e <
|
|
1115
|
-
for (let
|
|
1116
|
-
let
|
|
1117
|
-
for (let e =
|
|
1118
|
-
|
|
1113
|
+
let r = 0;
|
|
1114
|
+
for (let e = 0; e < n.length; e++) r = Math.max(r, n[e]);
|
|
1115
|
+
for (let i = 0; i < n.length; i++) if (i >= t.length && t.push(d.empty), n[i] < r) {
|
|
1116
|
+
let a = y(e).cell.createAndFill(), o = [];
|
|
1117
|
+
for (let e = n[i]; e < r; e++) o.push(a);
|
|
1118
|
+
t[i] = t[i].append(d.from(o));
|
|
1119
1119
|
}
|
|
1120
1120
|
return {
|
|
1121
|
-
height:
|
|
1122
|
-
width:
|
|
1123
|
-
rows:
|
|
1121
|
+
height: t.length,
|
|
1122
|
+
width: r,
|
|
1123
|
+
rows: t
|
|
1124
1124
|
};
|
|
1125
1125
|
}
|
|
1126
1126
|
function G(e, t) {
|
|
1127
1127
|
let n = e.createAndFill();
|
|
1128
|
-
return new
|
|
1129
|
-
}
|
|
1130
|
-
function ze({ width:
|
|
1131
|
-
if (
|
|
1132
|
-
let
|
|
1133
|
-
for (let
|
|
1134
|
-
let
|
|
1135
|
-
for (let
|
|
1136
|
-
let
|
|
1137
|
-
|
|
1138
|
-
for (let
|
|
1128
|
+
return new s(n).replace(0, n.content.size, t).doc;
|
|
1129
|
+
}
|
|
1130
|
+
function ze({ width: e, height: t, rows: n }, r, i) {
|
|
1131
|
+
if (e != r) {
|
|
1132
|
+
let t = [], i = [];
|
|
1133
|
+
for (let e = 0; e < n.length; e++) {
|
|
1134
|
+
let a = n[e], o = [];
|
|
1135
|
+
for (let n = t[e] || 0, i = 0; n < r; i++) {
|
|
1136
|
+
let s = a.child(i % a.childCount);
|
|
1137
|
+
n + s.attrs.colspan > r && (s = s.type.createChecked(D(s.attrs, s.attrs.colspan, n + s.attrs.colspan - r), s.content)), o.push(s), n += s.attrs.colspan;
|
|
1138
|
+
for (let n = 1; n < s.attrs.rowspan; n++) t[e + n] = (t[e + n] || 0) + s.attrs.colspan;
|
|
1139
1139
|
}
|
|
1140
|
-
|
|
1140
|
+
i.push(d.from(o));
|
|
1141
1141
|
}
|
|
1142
|
-
|
|
1143
|
-
}
|
|
1144
|
-
if (
|
|
1145
|
-
let
|
|
1146
|
-
for (let
|
|
1147
|
-
let
|
|
1148
|
-
for (let e = 0; e <
|
|
1149
|
-
let t =
|
|
1150
|
-
|
|
1142
|
+
n = i, e = r;
|
|
1143
|
+
}
|
|
1144
|
+
if (t != i) {
|
|
1145
|
+
let e = [];
|
|
1146
|
+
for (let r = 0, a = 0; r < i; r++, a++) {
|
|
1147
|
+
let o = [], s = n[a % t];
|
|
1148
|
+
for (let e = 0; e < s.childCount; e++) {
|
|
1149
|
+
let t = s.child(e);
|
|
1150
|
+
r + t.attrs.rowspan > i && (t = t.type.create({
|
|
1151
1151
|
...t.attrs,
|
|
1152
|
-
rowspan: Math.max(1,
|
|
1153
|
-
}, t.content)),
|
|
1152
|
+
rowspan: Math.max(1, i - t.attrs.rowspan)
|
|
1153
|
+
}, t.content)), o.push(t);
|
|
1154
1154
|
}
|
|
1155
|
-
|
|
1155
|
+
e.push(d.from(o));
|
|
1156
1156
|
}
|
|
1157
|
-
|
|
1157
|
+
n = e, t = i;
|
|
1158
1158
|
}
|
|
1159
1159
|
return {
|
|
1160
|
-
width:
|
|
1161
|
-
height:
|
|
1162
|
-
rows:
|
|
1160
|
+
width: e,
|
|
1161
|
+
height: t,
|
|
1162
|
+
rows: n
|
|
1163
1163
|
};
|
|
1164
1164
|
}
|
|
1165
|
-
function Be(t, n, r, i, a, o
|
|
1166
|
-
let
|
|
1167
|
-
if (
|
|
1168
|
-
let
|
|
1169
|
-
|
|
1165
|
+
function Be(e, t, n, r, i, a, o) {
|
|
1166
|
+
let s = e.doc.type.schema, c = y(s), l, u;
|
|
1167
|
+
if (i > t.width) for (let a = 0, s = 0; a < t.height; a++) {
|
|
1168
|
+
let d = n.child(a);
|
|
1169
|
+
s += d.nodeSize;
|
|
1170
1170
|
let f = [], p;
|
|
1171
|
-
p =
|
|
1172
|
-
for (let e =
|
|
1173
|
-
|
|
1174
|
-
}
|
|
1175
|
-
if (
|
|
1176
|
-
let
|
|
1177
|
-
for (let e = 0,
|
|
1178
|
-
let i = e >=
|
|
1179
|
-
|
|
1171
|
+
p = d.lastChild == null || d.lastChild.type == c.cell ? l ||= c.cell.createAndFill() : u ||= c.header_cell.createAndFill();
|
|
1172
|
+
for (let e = t.width; e < i; e++) f.push(p);
|
|
1173
|
+
e.insert(e.mapping.slice(o).map(s - 1 + r), f);
|
|
1174
|
+
}
|
|
1175
|
+
if (a > t.height) {
|
|
1176
|
+
let s = [];
|
|
1177
|
+
for (let e = 0, r = (t.height - 1) * t.width; e < Math.max(t.width, i); e++) {
|
|
1178
|
+
let i = e >= t.width ? !1 : n.nodeAt(t.map[r + e]).type == c.header_cell;
|
|
1179
|
+
s.push(i ? u ||= c.header_cell.createAndFill() : l ||= c.cell.createAndFill());
|
|
1180
1180
|
}
|
|
1181
|
-
let f =
|
|
1182
|
-
for (let e =
|
|
1183
|
-
|
|
1181
|
+
let f = c.row.create(null, d.from(s)), p = [];
|
|
1182
|
+
for (let e = t.height; e < a; e++) p.push(f);
|
|
1183
|
+
e.insert(e.mapping.slice(o).map(r + n.nodeSize - 2), p);
|
|
1184
1184
|
}
|
|
1185
|
-
return !!(
|
|
1185
|
+
return !!(l || u);
|
|
1186
1186
|
}
|
|
1187
1187
|
function Ve(e, t, n, r, i, a, o, s) {
|
|
1188
1188
|
if (o == 0 || o == t.height) return !1;
|
|
@@ -1216,22 +1216,22 @@ function He(e, t, n, r, i, a, o, s) {
|
|
|
1216
1216
|
}
|
|
1217
1217
|
return c;
|
|
1218
1218
|
}
|
|
1219
|
-
function Ue(e, t, n,
|
|
1219
|
+
function Ue(e, t, n, i, a) {
|
|
1220
1220
|
let o = n ? e.doc.nodeAt(n - 1) : e.doc;
|
|
1221
1221
|
if (!o) throw Error("No table found");
|
|
1222
|
-
let s = m.get(o), { top: c, left: l } =
|
|
1222
|
+
let s = m.get(o), { top: c, left: l } = i, u = l + a.width, d = c + a.height, f = e.tr, p = 0;
|
|
1223
1223
|
function h() {
|
|
1224
1224
|
if (o = n ? f.doc.nodeAt(n - 1) : f.doc, !o) throw Error("No table found");
|
|
1225
1225
|
s = m.get(o), p = f.mapping.maps.length;
|
|
1226
1226
|
}
|
|
1227
1227
|
Be(f, s, o, n, u, d, p) && h(), Ve(f, s, o, n, l, u, c, p) && h(), Ve(f, s, o, n, l, u, d, p) && h(), He(f, s, o, n, c, d, l, p) && h(), He(f, s, o, n, c, d, u, p) && h();
|
|
1228
1228
|
for (let e = c; e < d; e++) {
|
|
1229
|
-
let t = s.positionAt(e, l, o),
|
|
1230
|
-
f.replace(f.mapping.slice(p).map(t + n), f.mapping.slice(p).map(
|
|
1229
|
+
let t = s.positionAt(e, l, o), i = s.positionAt(e, u, o);
|
|
1230
|
+
f.replace(f.mapping.slice(p).map(t + n), f.mapping.slice(p).map(i + n), new r(a.rows[e - c], 0, 0));
|
|
1231
1231
|
}
|
|
1232
1232
|
h(), f.setSelection(new O(f.doc.resolve(n + s.positionAt(c, l, o)), f.doc.resolve(n + s.positionAt(d - 1, u - 1, o)))), t(f);
|
|
1233
1233
|
}
|
|
1234
|
-
var We =
|
|
1234
|
+
var We = t({
|
|
1235
1235
|
ArrowLeft: q("horiz", -1),
|
|
1236
1236
|
ArrowRight: q("horiz", 1),
|
|
1237
1237
|
ArrowUp: q("vert", -1),
|
|
@@ -1251,15 +1251,15 @@ function K(e, t, n) {
|
|
|
1251
1251
|
function q(e, t) {
|
|
1252
1252
|
return (n, r, i) => {
|
|
1253
1253
|
if (!i) return !1;
|
|
1254
|
-
let
|
|
1255
|
-
if (
|
|
1256
|
-
if (e != "horiz" && !
|
|
1257
|
-
let
|
|
1258
|
-
if (
|
|
1259
|
-
if (e == "horiz") return K(n, r,
|
|
1254
|
+
let a = n.selection;
|
|
1255
|
+
if (a instanceof O) return K(n, r, c.near(a.$headCell, t));
|
|
1256
|
+
if (e != "horiz" && !a.empty) return !1;
|
|
1257
|
+
let o = Je(i, e, t);
|
|
1258
|
+
if (o == null) return !1;
|
|
1259
|
+
if (e == "horiz") return K(n, r, c.near(n.doc.resolve(a.head + t), t));
|
|
1260
1260
|
{
|
|
1261
|
-
let i = n.doc.resolve(
|
|
1262
|
-
return
|
|
1261
|
+
let i = n.doc.resolve(o), a = E(i, e, t), s;
|
|
1262
|
+
return s = a ? c.near(a, 1) : t < 0 ? c.near(n.doc.resolve(i.before(-1)), -1) : c.near(n.doc.resolve(i.after(-1)), 1), K(n, r, s);
|
|
1263
1263
|
}
|
|
1264
1264
|
};
|
|
1265
1265
|
}
|
|
@@ -1281,20 +1281,20 @@ function Ge(e, t) {
|
|
|
1281
1281
|
let n = e.state.doc, r = x(n.resolve(t));
|
|
1282
1282
|
return r ? (e.dispatch(e.state.tr.setSelection(new O(r))), !0) : !1;
|
|
1283
1283
|
}
|
|
1284
|
-
function Ke(t, n
|
|
1285
|
-
if (!S(
|
|
1286
|
-
let
|
|
1287
|
-
if (
|
|
1288
|
-
|
|
1284
|
+
function Ke(e, t, n) {
|
|
1285
|
+
if (!S(e.state)) return !1;
|
|
1286
|
+
let r = Le(n), i = e.state.selection;
|
|
1287
|
+
if (i instanceof O) {
|
|
1288
|
+
r ||= {
|
|
1289
1289
|
width: 1,
|
|
1290
1290
|
height: 1,
|
|
1291
|
-
rows: [
|
|
1291
|
+
rows: [d.from(G(y(e.state.schema).cell, n))]
|
|
1292
1292
|
};
|
|
1293
|
-
let
|
|
1294
|
-
return
|
|
1295
|
-
} else if (
|
|
1296
|
-
let
|
|
1297
|
-
return Ue(
|
|
1293
|
+
let t = i.$anchorCell.node(-1), a = i.$anchorCell.start(-1), o = m.get(t).rectBetween(i.$anchorCell.pos - a, i.$headCell.pos - a);
|
|
1294
|
+
return r = ze(r, o.right - o.left, o.bottom - o.top), Ue(e.state, e.dispatch, a, o, r), !0;
|
|
1295
|
+
} else if (r) {
|
|
1296
|
+
let t = C(e.state), n = t.start(-1);
|
|
1297
|
+
return Ue(e.state, e.dispatch, n, m.get(t.node(-1)).findCell(t.pos - n), r), !0;
|
|
1298
1298
|
} else return !1;
|
|
1299
1299
|
}
|
|
1300
1300
|
function qe(e, t) {
|
|
@@ -1324,14 +1324,14 @@ function qe(e, t) {
|
|
|
1324
1324
|
}
|
|
1325
1325
|
e.root.addEventListener("mouseup", a), e.root.addEventListener("dragstart", a), e.root.addEventListener("mousemove", o);
|
|
1326
1326
|
}
|
|
1327
|
-
function Je(e, t,
|
|
1328
|
-
if (!(e.state.selection instanceof
|
|
1329
|
-
let { $head:
|
|
1330
|
-
for (let
|
|
1331
|
-
let a =
|
|
1332
|
-
if ((
|
|
1327
|
+
function Je(e, t, n) {
|
|
1328
|
+
if (!(e.state.selection instanceof a)) return null;
|
|
1329
|
+
let { $head: r } = e.state.selection;
|
|
1330
|
+
for (let i = r.depth - 1; i >= 0; i--) {
|
|
1331
|
+
let a = r.node(i);
|
|
1332
|
+
if ((n < 0 ? r.index(i) : r.indexAfter(i)) != (n < 0 ? 0 : a.childCount)) return null;
|
|
1333
1333
|
if (a.type.spec.tableRole == "cell" || a.type.spec.tableRole == "header_cell") {
|
|
1334
|
-
let a =
|
|
1334
|
+
let a = r.before(i), o = t == "vert" ? n > 0 ? "down" : "up" : n > 0 ? "right" : "left";
|
|
1335
1335
|
return e.endOfTextblock(o) ? a : null;
|
|
1336
1336
|
}
|
|
1337
1337
|
}
|
|
@@ -1383,15 +1383,15 @@ function Z(e, t, n, r, i, a) {
|
|
|
1383
1383
|
s ? (n.style.width = o + "px", n.style.minWidth = "") : (n.style.width = "", n.style.minWidth = o + "px");
|
|
1384
1384
|
}
|
|
1385
1385
|
}
|
|
1386
|
-
var Q = new
|
|
1387
|
-
function Xe({ handleWidth: e = 5, cellMinWidth: t = 25, defaultCellMinWidth: n = 100, View:
|
|
1388
|
-
let
|
|
1386
|
+
var Q = new i("tableColumnResizing");
|
|
1387
|
+
function Xe({ handleWidth: e = 5, cellMinWidth: t = 25, defaultCellMinWidth: n = 100, View: r = Ye, lastColumnResizable: i = !0 } = {}) {
|
|
1388
|
+
let a = new o({
|
|
1389
1389
|
key: Q,
|
|
1390
1390
|
state: {
|
|
1391
1391
|
init(e, t) {
|
|
1392
|
-
var
|
|
1393
|
-
let
|
|
1394
|
-
return
|
|
1392
|
+
var i;
|
|
1393
|
+
let o = (i = a.spec) == null || (i = i.props) == null ? void 0 : i.nodeViews, s = y(t.schema).table.name;
|
|
1394
|
+
return r && o && (o[s] = (e, t) => new r(e, n, t)), new Ze(-1, !1);
|
|
1395
1395
|
},
|
|
1396
1396
|
apply(e, t) {
|
|
1397
1397
|
return t.apply(e);
|
|
@@ -1404,7 +1404,7 @@ function Xe({ handleWidth: e = 5, cellMinWidth: t = 25, defaultCellMinWidth: n =
|
|
|
1404
1404
|
},
|
|
1405
1405
|
handleDOMEvents: {
|
|
1406
1406
|
mousemove: (t, n) => {
|
|
1407
|
-
Qe(t, n, e,
|
|
1407
|
+
Qe(t, n, e, i);
|
|
1408
1408
|
},
|
|
1409
1409
|
mouseleave: (e) => {
|
|
1410
1410
|
$e(e);
|
|
@@ -1420,7 +1420,7 @@ function Xe({ handleWidth: e = 5, cellMinWidth: t = 25, defaultCellMinWidth: n =
|
|
|
1420
1420
|
nodeViews: {}
|
|
1421
1421
|
}
|
|
1422
1422
|
});
|
|
1423
|
-
return
|
|
1423
|
+
return a;
|
|
1424
1424
|
}
|
|
1425
1425
|
var Ze = class e {
|
|
1426
1426
|
constructor(e, t) {
|
|
@@ -1537,21 +1537,21 @@ function $(e, t, n, r) {
|
|
|
1537
1537
|
function st(e) {
|
|
1538
1538
|
return Array(e).fill(0);
|
|
1539
1539
|
}
|
|
1540
|
-
function ct(
|
|
1541
|
-
let
|
|
1542
|
-
if (!
|
|
1543
|
-
let
|
|
1544
|
-
for (let
|
|
1545
|
-
let r =
|
|
1546
|
-
if ((
|
|
1547
|
-
let
|
|
1548
|
-
|
|
1540
|
+
function ct(t, r) {
|
|
1541
|
+
let i = [], a = t.doc.resolve(r), o = a.node(-1);
|
|
1542
|
+
if (!o) return e.empty;
|
|
1543
|
+
let s = m.get(o), c = a.start(-1), l = s.colCount(a.pos - c) + a.nodeAfter.attrs.colspan - 1;
|
|
1544
|
+
for (let e = 0; e < s.height; e++) {
|
|
1545
|
+
let r = l + e * s.width;
|
|
1546
|
+
if ((l == s.width - 1 || s.map[r] != s.map[r + 1]) && (e == 0 || s.map[r] != s.map[r - s.width])) {
|
|
1547
|
+
let e = s.map[r], a = c + e + o.nodeAt(e).nodeSize - 1, l = document.createElement("div");
|
|
1548
|
+
l.className = "column-resize-handle", Q.getState(t)?.dragging && i.push(n.node(c + e, c + e + o.nodeAt(e).nodeSize, { class: "column-resize-dragging" })), i.push(n.widget(a, l));
|
|
1549
1549
|
}
|
|
1550
1550
|
}
|
|
1551
|
-
return
|
|
1551
|
+
return e.create(t.doc, i);
|
|
1552
1552
|
}
|
|
1553
1553
|
function lt({ allowTableNodeSelection: e = !1 } = {}) {
|
|
1554
|
-
return new
|
|
1554
|
+
return new o({
|
|
1555
1555
|
key: b,
|
|
1556
1556
|
state: {
|
|
1557
1557
|
init() {
|