@pie-element/shared-editor-runtime 0.1.3-next.20261019151920 → 0.1.3
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/browser/{dist-C_bRf4Tj.js → dist-B13vL46C.js} +3 -3
- package/dist/browser/{dist-C_bRf4Tj.js.map → dist-B13vL46C.js.map} +1 -1
- package/dist/browser/{dist-1Ah9gEL8.js → dist-BJ6RUDuR.js} +929 -768
- package/dist/browser/dist-BJ6RUDuR.js.map +1 -0
- package/dist/browser/{dist-COqKtKEY.js → dist-ZwQctakt.js} +3 -3
- package/dist/browser/{dist-COqKtKEY.js.map → dist-ZwQctakt.js.map} +1 -1
- package/dist/browser/{dist-C2dWnbCz.js → dist-j5lICNjP.js} +3 -3
- package/dist/browser/{dist-C2dWnbCz.js.map → dist-j5lICNjP.js.map} +1 -1
- package/dist/browser/tiptap-core/index.js +1 -1
- package/dist/browser/tiptap-extension-character-count/index.js +2 -2
- package/dist/browser/tiptap-extension-character-count/index.js.map +1 -1
- package/dist/browser/tiptap-extension-image/index.js +2 -2
- package/dist/browser/tiptap-extension-image/index.js.map +1 -1
- package/dist/browser/tiptap-extension-list-item/index.js +2 -2
- package/dist/browser/tiptap-extension-list-item/index.js.map +1 -1
- package/dist/browser/tiptap-extension-placeholder/index.js +2 -2
- package/dist/browser/tiptap-extension-placeholder/index.js.map +1 -1
- package/dist/browser/tiptap-extension-subscript/index.js +2 -2
- package/dist/browser/tiptap-extension-subscript/index.js.map +1 -1
- package/dist/browser/tiptap-extension-superscript/index.js +2 -2
- package/dist/browser/tiptap-extension-superscript/index.js.map +1 -1
- package/dist/browser/tiptap-extension-table/index.js +1 -1
- package/dist/browser/tiptap-extension-table-cell/index.js +2 -2
- package/dist/browser/tiptap-extension-table-cell/index.js.map +1 -1
- package/dist/browser/tiptap-extension-table-header/index.js +2 -2
- package/dist/browser/tiptap-extension-table-header/index.js.map +1 -1
- package/dist/browser/tiptap-extension-table-row/index.js +2 -2
- package/dist/browser/tiptap-extension-table-row/index.js.map +1 -1
- package/dist/browser/tiptap-extension-text-align/index.js +2 -2
- package/dist/browser/tiptap-extension-text-align/index.js.map +1 -1
- package/dist/browser/tiptap-extension-text-style/index.js +2 -2
- package/dist/browser/tiptap-extension-text-style/index.js.map +1 -1
- package/dist/browser/tiptap-extensions/index.js +1 -1
- package/dist/browser/tiptap-starter-kit/index.js +5 -5
- package/dist/browser/tiptap-starter-kit/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/browser/dist-1Ah9gEL8.js.map +0 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { C as e, D as t, E as n, O as r, S as i, T as a, _ as o, a as s, b as c, c as l, d as u, f as d, g as f, h as p, i as m, k as h, m as g, n as _, o as v, p as y, r as b, t as x, u as ee, v as S, w as C, x as te, y as
|
|
2
|
-
//#region ../../../node_modules/.bun/@tiptap+core@3.
|
|
3
|
-
var
|
|
1
|
+
import { C as e, D as t, E as n, O as r, S as i, T as a, _ as o, a as s, b as c, c as l, d as u, f as d, g as f, h as p, i as m, k as h, m as g, n as _, o as v, p as y, r as b, t as x, u as ee, v as S, w as C, x as te, y as ne } from "./dist-BVA3Sgbc.js";
|
|
2
|
+
//#region ../../../node_modules/.bun/@tiptap+core@3.32.0+25ef31ca716a1493/node_modules/@tiptap/core/dist/rolldown-runtime-D7D4PA-g.js
|
|
3
|
+
var re = Object.defineProperty, w = (e, t) => {
|
|
4
4
|
let n = {};
|
|
5
|
-
for (var r in e)
|
|
5
|
+
for (var r in e) re(n, r, {
|
|
6
6
|
get: e[r],
|
|
7
7
|
enumerable: !0
|
|
8
8
|
});
|
|
9
|
-
return t ||
|
|
9
|
+
return t || re(n, Symbol.toStringTag, { value: "Module" }), n;
|
|
10
10
|
}, ie = (e, t) => !e.selection.empty && (t && t(e.tr.deleteSelection().scrollIntoView()), !0);
|
|
11
11
|
function ae(e, t) {
|
|
12
12
|
let { $cursor: n } = e.selection;
|
|
@@ -137,7 +137,7 @@ var _e = (e, t) => {
|
|
|
137
137
|
if (r) {
|
|
138
138
|
if (n.node.isTextblock || !p(e.doc, n.from)) return !1;
|
|
139
139
|
i = n.from;
|
|
140
|
-
} else if (i =
|
|
140
|
+
} else if (i = ne(e.doc, n.from, -1), i == null) return !1;
|
|
141
141
|
if (t) {
|
|
142
142
|
let n = e.tr.join(i);
|
|
143
143
|
r && n.setSelection(b.create(n.doc, i - e.doc.resolve(i).nodeBefore.nodeSize)), t(n.scrollIntoView());
|
|
@@ -148,7 +148,7 @@ var _e = (e, t) => {
|
|
|
148
148
|
if (n instanceof b) {
|
|
149
149
|
if (n.node.isTextblock || !p(e.doc, n.to)) return !1;
|
|
150
150
|
r = n.to;
|
|
151
|
-
} else if (r =
|
|
151
|
+
} else if (r = ne(e.doc, n.to, 1), r == null) return !1;
|
|
152
152
|
return t && t(e.tr.join(r).scrollIntoView()), !0;
|
|
153
153
|
}, ye = (e, t) => {
|
|
154
154
|
let { $from: n, $to: r } = e.selection, i = n.blockRange(r), a = i && c(i);
|
|
@@ -411,106 +411,106 @@ var T = function(e) {
|
|
|
411
411
|
}, Je = function(e) {
|
|
412
412
|
let t = e.assignedSlot || e.parentNode;
|
|
413
413
|
return t && t.nodeType == 11 ? t.host : t;
|
|
414
|
-
}, Ye = null,
|
|
414
|
+
}, Ye = null, E = function(e, t, n) {
|
|
415
415
|
let r = Ye ||= document.createRange();
|
|
416
416
|
return r.setEnd(e, n ?? e.nodeValue.length), r.setStart(e, t || 0), r;
|
|
417
|
-
},
|
|
417
|
+
}, Xe = function() {
|
|
418
418
|
Ye = null;
|
|
419
|
-
},
|
|
420
|
-
return n && (
|
|
421
|
-
},
|
|
422
|
-
function
|
|
419
|
+
}, Ze = function(e, t, n, r) {
|
|
420
|
+
return n && ($e(e, t, n, r, -1) || $e(e, t, n, r, 1));
|
|
421
|
+
}, Qe = /^(img|br|input|textarea|hr)$/i;
|
|
422
|
+
function $e(e, t, n, r, i) {
|
|
423
423
|
for (;;) {
|
|
424
424
|
if (e == n && t == r) return !0;
|
|
425
|
-
if (t == (i < 0 ? 0 :
|
|
425
|
+
if (t == (i < 0 ? 0 : D(e))) {
|
|
426
426
|
let n = e.parentNode;
|
|
427
|
-
if (!n || !
|
|
427
|
+
if (!n || !O(n) || it(e) || Qe.test(e.nodeName) || e.contentEditable == "false") return !1;
|
|
428
428
|
t = T(e) + (i < 0 ? 0 : 1), e = n;
|
|
429
|
-
} else if (
|
|
429
|
+
} else if (O(e)) {
|
|
430
430
|
let n = e.childNodes[t + (i < 0 ? -1 : 0)];
|
|
431
|
-
if (
|
|
431
|
+
if (O(n) && n.contentEditable == "false") {
|
|
432
432
|
if (n.pmViewDesc?.ignoreForSelection) t += i;
|
|
433
433
|
else return !1;
|
|
434
|
-
} else e = n, t = i < 0 ?
|
|
434
|
+
} else e = n, t = i < 0 ? D(e) : 0;
|
|
435
435
|
} else return !1;
|
|
436
436
|
}
|
|
437
437
|
}
|
|
438
|
-
function
|
|
438
|
+
function D(e) {
|
|
439
439
|
return e.nodeType == 3 ? e.nodeValue.length : e.childNodes.length;
|
|
440
440
|
}
|
|
441
|
-
function
|
|
441
|
+
function O(e) {
|
|
442
442
|
return e.nodeType == 1;
|
|
443
443
|
}
|
|
444
|
-
function
|
|
444
|
+
function k(e) {
|
|
445
445
|
return e.nodeType == 3;
|
|
446
446
|
}
|
|
447
|
-
function
|
|
448
|
-
return t ? e.contains(
|
|
447
|
+
function et(e, t) {
|
|
448
|
+
return t ? e.contains(O(t) ? t : t.parentNode) : !1;
|
|
449
449
|
}
|
|
450
|
-
function
|
|
450
|
+
function tt(e, t) {
|
|
451
451
|
for (;;) {
|
|
452
|
-
if (
|
|
453
|
-
if (
|
|
452
|
+
if (k(e) && t) return e;
|
|
453
|
+
if (O(e) && t > 0) {
|
|
454
454
|
if (e.contentEditable == "false") return null;
|
|
455
|
-
e = e.childNodes[t - 1], t =
|
|
456
|
-
} else if (e.parentNode && !
|
|
455
|
+
e = e.childNodes[t - 1], t = D(e);
|
|
456
|
+
} else if (e.parentNode && !it(e)) t = T(e), e = e.parentNode;
|
|
457
457
|
else return null;
|
|
458
458
|
}
|
|
459
459
|
}
|
|
460
|
-
function
|
|
460
|
+
function nt(e, t) {
|
|
461
461
|
for (;;) {
|
|
462
|
-
if (
|
|
463
|
-
if (
|
|
462
|
+
if (k(e) && t < e.nodeValue.length) return e;
|
|
463
|
+
if (O(e) && t < e.childNodes.length) {
|
|
464
464
|
if (e.contentEditable == "false") return null;
|
|
465
465
|
e = e.childNodes[t], t = 0;
|
|
466
|
-
} else if (e.parentNode && !
|
|
466
|
+
} else if (e.parentNode && !it(e)) t = T(e) + 1, e = e.parentNode;
|
|
467
467
|
else return null;
|
|
468
468
|
}
|
|
469
469
|
}
|
|
470
|
-
function
|
|
471
|
-
for (let r = t == 0, i = t ==
|
|
470
|
+
function rt(e, t, n) {
|
|
471
|
+
for (let r = t == 0, i = t == D(e); r || i;) {
|
|
472
472
|
if (e == n) return !0;
|
|
473
473
|
let t = T(e);
|
|
474
474
|
if (e = e.parentNode, !e) return !1;
|
|
475
|
-
r &&= t == 0, i &&= t ==
|
|
475
|
+
r &&= t == 0, i &&= t == D(e);
|
|
476
476
|
}
|
|
477
477
|
}
|
|
478
|
-
function
|
|
478
|
+
function it(e) {
|
|
479
479
|
let t;
|
|
480
480
|
for (let n = e; n && !(t = n.pmViewDesc); n = n.parentNode);
|
|
481
481
|
return t && t.node && t.node.isBlock && (t.dom == e || t.contentDOM == e);
|
|
482
482
|
}
|
|
483
|
-
var
|
|
484
|
-
return e.focusNode &&
|
|
483
|
+
var at = function(e) {
|
|
484
|
+
return e.focusNode && Ze(e.focusNode, e.focusOffset, e.anchorNode, e.anchorOffset);
|
|
485
485
|
};
|
|
486
|
-
function
|
|
486
|
+
function ot(e, t) {
|
|
487
487
|
let n = document.createEvent("Event");
|
|
488
488
|
return n.initEvent("keydown", !0, !0), n.keyCode = e, n.key = n.code = t, n;
|
|
489
489
|
}
|
|
490
|
-
function
|
|
490
|
+
function st(e) {
|
|
491
491
|
let t = e.activeElement;
|
|
492
492
|
for (; t && t.shadowRoot;) t = t.shadowRoot.activeElement;
|
|
493
493
|
return t;
|
|
494
494
|
}
|
|
495
|
-
function
|
|
495
|
+
function ct(e, t, n) {
|
|
496
496
|
if (e.caretPositionFromPoint) try {
|
|
497
497
|
let r = e.caretPositionFromPoint(t, n);
|
|
498
498
|
if (r) return {
|
|
499
499
|
node: r.offsetNode,
|
|
500
|
-
offset: Math.min(
|
|
500
|
+
offset: Math.min(D(r.offsetNode), r.offset)
|
|
501
501
|
};
|
|
502
502
|
} catch {}
|
|
503
503
|
if (e.caretRangeFromPoint) {
|
|
504
504
|
let r = e.caretRangeFromPoint(t, n);
|
|
505
505
|
if (r) return {
|
|
506
506
|
node: r.startContainer,
|
|
507
|
-
offset: Math.min(
|
|
507
|
+
offset: Math.min(D(r.startContainer), r.startOffset)
|
|
508
508
|
};
|
|
509
509
|
}
|
|
510
510
|
}
|
|
511
|
-
var
|
|
512
|
-
|
|
513
|
-
var
|
|
511
|
+
var A = typeof navigator < "u" ? navigator : null, lt = typeof document < "u" ? document : null, ut = A && A.userAgent || "", dt = /Edge\/(\d+)/.exec(ut), ft = /MSIE \d/.exec(ut), pt = /Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(ut), j = !!(ft || pt || dt), mt = ft ? document.documentMode : pt ? +pt[1] : dt ? +dt[1] : 0, M = !j && /gecko\/(\d+)/i.test(ut);
|
|
512
|
+
M && +(/Firefox\/(\d+)/.exec(ut) || [0, 0])[1];
|
|
513
|
+
var ht = !j && /Chrome\/(\d+)/.exec(ut), N = !!ht, gt = ht ? +ht[1] : 0, P = !j && !!A && /Apple Computer/.test(A.vendor), _t = P && (/Mobile\/\w+/.test(ut) || !!A && A.maxTouchPoints > 2), F = _t || (A ? /Mac/.test(A.platform) : !1), vt = A ? /Win/.test(A.platform) : !1, yt = /Android \d/.test(ut), bt = !!lt && "webkitFontSmoothing" in lt.documentElement.style, xt = bt ? +(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent) || [0, 0])[1] : 0;
|
|
514
514
|
function St(e) {
|
|
515
515
|
let t = e.defaultView && e.defaultView.visualViewport;
|
|
516
516
|
return t ? {
|
|
@@ -541,7 +541,7 @@ function wt(e, t, n) {
|
|
|
541
541
|
if (!zt(t) && t.left == 0) return;
|
|
542
542
|
let r = e.someProp("scrollThreshold") || 0, i = e.someProp("scrollMargin") || 5, a = e.dom.ownerDocument;
|
|
543
543
|
for (let o = n || e.dom; o;) {
|
|
544
|
-
if (!
|
|
544
|
+
if (!O(o)) {
|
|
545
545
|
o = Je(o);
|
|
546
546
|
continue;
|
|
547
547
|
}
|
|
@@ -614,8 +614,8 @@ function jt(e, t) {
|
|
|
614
614
|
let n, r = 2e8, i, a = 0, o = t.top, s = t.top, c, l;
|
|
615
615
|
for (let u = e.firstChild, d = 0; u; u = u.nextSibling, d++) {
|
|
616
616
|
let e;
|
|
617
|
-
if (
|
|
618
|
-
else if (
|
|
617
|
+
if (O(u)) e = u.getClientRects();
|
|
618
|
+
else if (k(u)) e = E(u).getClientRects();
|
|
619
619
|
else continue;
|
|
620
620
|
for (let f = 0; f < e.length; f++) {
|
|
621
621
|
let p = e[f];
|
|
@@ -623,10 +623,10 @@ function jt(e, t) {
|
|
|
623
623
|
o = Math.max(p.bottom, o), s = Math.min(p.top, s);
|
|
624
624
|
let e = p.left > t.left ? p.left - t.left : p.right < t.left ? t.left - p.right : 0;
|
|
625
625
|
if (e < r) {
|
|
626
|
-
n = u, r = e, i = e &&
|
|
626
|
+
n = u, r = e, i = e && k(n) ? {
|
|
627
627
|
left: p.right < t.left ? p.right : p.left,
|
|
628
628
|
top: t.top
|
|
629
|
-
} : t,
|
|
629
|
+
} : t, O(u) && e && (a = d + +(t.left >= (p.left + p.right) / 2));
|
|
630
630
|
continue;
|
|
631
631
|
}
|
|
632
632
|
} else p.top > t.top && !c && p.left <= t.left && p.right >= t.left && (c = u, l = {
|
|
@@ -636,7 +636,7 @@ function jt(e, t) {
|
|
|
636
636
|
!n && (t.left >= p.right && t.top >= p.top || t.left >= p.left && t.top >= p.bottom) && (a = d + 1);
|
|
637
637
|
}
|
|
638
638
|
}
|
|
639
|
-
return !n && c && (n = c, i = l, r = 0), n &&
|
|
639
|
+
return !n && c && (n = c, i = l, r = 0), n && k(n) ? Mt(n, i) : !n || r ? {
|
|
640
640
|
node: e,
|
|
641
641
|
offset: a
|
|
642
642
|
} : jt(n, i);
|
|
@@ -668,7 +668,7 @@ function Pt(e, t) {
|
|
|
668
668
|
}
|
|
669
669
|
function Ft(e, t, n) {
|
|
670
670
|
let { node: r, offset: i } = jt(t, n), a = -1;
|
|
671
|
-
if (
|
|
671
|
+
if (O(r) && !r.firstChild) {
|
|
672
672
|
let e = r.getBoundingClientRect();
|
|
673
673
|
a = e.left != e.right && n.left > (e.left + e.right) / 2 ? 1 : -1;
|
|
674
674
|
}
|
|
@@ -679,7 +679,7 @@ function It(e, t, n, r) {
|
|
|
679
679
|
for (let n = t, a = !1; n != e.dom;) {
|
|
680
680
|
let t = e.docView.nearestDesc(n, !0), o;
|
|
681
681
|
if (!t) return null;
|
|
682
|
-
if (
|
|
682
|
+
if (O(t.dom) && (t.node.isBlock && t.parent || !t.contentDOM) && ((o = t.dom.getBoundingClientRect()).width || o.height) && (t.node.isBlock && t.parent && !/^T(R|BODY|HEAD|FOOT)$/.test(t.dom.nodeName) && (!a && o.left > r.left || o.top > r.top ? i = t.posBefore : (!a && o.right < r.left || o.bottom < r.top) && (i = t.posAfter), a = !0), !t.contentDOM && i < 0 && !t.node.isText)) return (t.node.isBlock ? r.top < (o.top + o.bottom) / 2 : r.left < (o.left + o.right) / 2) ? t.posBefore : t.posAfter;
|
|
683
683
|
n = t.dom.parentNode;
|
|
684
684
|
}
|
|
685
685
|
return i > -1 ? i : e.docView.posFromDOM(t, n, -1);
|
|
@@ -688,7 +688,7 @@ function Lt(e, t, n) {
|
|
|
688
688
|
let r = e.childNodes.length;
|
|
689
689
|
if (r && n.top < n.bottom) for (let i = Math.max(0, Math.min(r - 1, Math.floor(r * (t.top - n.top) / (n.bottom - n.top)) - 2)), a = i;;) {
|
|
690
690
|
let n = e.childNodes[a];
|
|
691
|
-
if (
|
|
691
|
+
if (O(n)) {
|
|
692
692
|
let e = n.getClientRects();
|
|
693
693
|
for (let r = 0; r < e.length; r++) {
|
|
694
694
|
let i = e[r];
|
|
@@ -700,21 +700,21 @@ function Lt(e, t, n) {
|
|
|
700
700
|
return e;
|
|
701
701
|
}
|
|
702
702
|
function Rt(e, t) {
|
|
703
|
-
let n = e.dom.ownerDocument, r, i = 0, a =
|
|
703
|
+
let n = e.dom.ownerDocument, r, i = 0, a = ct(n, t.left, t.top);
|
|
704
704
|
a && ({node: r, offset: i} = a);
|
|
705
705
|
let o = (e.root.elementFromPoint ? e.root : n).elementFromPoint(t.left, t.top), s;
|
|
706
706
|
if (!o || !e.dom.contains(o)) {
|
|
707
707
|
let n = e.dom.getBoundingClientRect();
|
|
708
708
|
if (!Nt(t, n) || (o = Lt(e.dom, t, n), !o)) return null;
|
|
709
709
|
}
|
|
710
|
-
if (
|
|
710
|
+
if (P) for (let e = o; r && e; e = Je(e)) e.draggable && (r = void 0);
|
|
711
711
|
if (o = Pt(o, t), r) {
|
|
712
|
-
if (
|
|
712
|
+
if (M && O(r) && (i = Math.min(i, r.childNodes.length), i < r.childNodes.length)) {
|
|
713
713
|
let e = r.childNodes[i], n;
|
|
714
714
|
e.nodeName == "IMG" && (n = e.getBoundingClientRect()).right <= t.left && n.bottom > t.top && i++;
|
|
715
715
|
}
|
|
716
716
|
let n;
|
|
717
|
-
bt && i &&
|
|
717
|
+
bt && i && O(r) && O(n = r.childNodes[i - 1]) && n.contentEditable == "false" && n.getBoundingClientRect().top >= t.top && i--, r == e.dom && i == r.childNodes.length - 1 && O(r.lastChild) && t.top > r.lastChild.getBoundingClientRect().bottom ? s = e.state.doc.content.size : (i == 0 || !O(r) || r.childNodes[i - 1].nodeName != "BR") && (s = It(e, r, i, t));
|
|
718
718
|
}
|
|
719
719
|
s ??= Ft(e, o, t);
|
|
720
720
|
let c = e.docView.nearestDesc(o, !0);
|
|
@@ -736,14 +736,14 @@ function Bt(e, t) {
|
|
|
736
736
|
}
|
|
737
737
|
var Vt = /[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;
|
|
738
738
|
function Ht(e, t, n) {
|
|
739
|
-
let { node: r, offset: i, atom: a } = e.docView.domFromPos(t, n < 0 ? -1 : 1), o = bt ||
|
|
740
|
-
if (
|
|
739
|
+
let { node: r, offset: i, atom: a } = e.docView.domFromPos(t, n < 0 ? -1 : 1), o = bt || M;
|
|
740
|
+
if (k(r)) {
|
|
741
741
|
if (o && (Vt.test(r.nodeValue) || (n < 0 ? !i : i == r.nodeValue.length))) {
|
|
742
|
-
let e = Bt(
|
|
743
|
-
if (
|
|
744
|
-
let t = Bt(
|
|
742
|
+
let e = Bt(E(r, i, i), n);
|
|
743
|
+
if (M && i && /\s/.test(r.nodeValue[i - 1]) && i < r.nodeValue.length) {
|
|
744
|
+
let t = Bt(E(r, i - 1, i - 1), -1);
|
|
745
745
|
if (t.top == e.top) {
|
|
746
|
-
let n = Bt(
|
|
746
|
+
let n = Bt(E(r, i, i + 1), -1);
|
|
747
747
|
if (n.top != e.top) return Ut(n, n.left < t.left);
|
|
748
748
|
}
|
|
749
749
|
}
|
|
@@ -751,31 +751,31 @@ function Ht(e, t, n) {
|
|
|
751
751
|
}
|
|
752
752
|
{
|
|
753
753
|
let e = i, t = i, a = n < 0 ? 1 : -1;
|
|
754
|
-
return n < 0 && !i ? (t++, a = -1) : n >= 0 && i == r.nodeValue.length ? (e--, a = 1) : n < 0 ? e-- : t++, Ut(Bt(
|
|
754
|
+
return n < 0 && !i ? (t++, a = -1) : n >= 0 && i == r.nodeValue.length ? (e--, a = 1) : n < 0 ? e-- : t++, Ut(Bt(E(r, e, t), a), a < 0);
|
|
755
755
|
}
|
|
756
756
|
}
|
|
757
757
|
if (!e.state.doc.resolve(t - (a || 0)).parent.inlineContent) {
|
|
758
|
-
if (a == null && i && (n < 0 || i ==
|
|
758
|
+
if (a == null && i && (n < 0 || i == D(r))) {
|
|
759
759
|
let e = r.childNodes[i - 1];
|
|
760
|
-
if (
|
|
760
|
+
if (O(e)) return Wt(e.getBoundingClientRect(), !1);
|
|
761
761
|
}
|
|
762
|
-
if (a == null && i <
|
|
762
|
+
if (a == null && i < D(r)) {
|
|
763
763
|
let e = r.childNodes[i];
|
|
764
|
-
if (
|
|
764
|
+
if (O(e)) return Wt(e.getBoundingClientRect(), !0);
|
|
765
765
|
}
|
|
766
766
|
return Wt(r.getBoundingClientRect(), n >= 0);
|
|
767
767
|
}
|
|
768
|
-
if (a == null && i && (n < 0 || i ==
|
|
769
|
-
let e = r.childNodes[i - 1], t =
|
|
768
|
+
if (a == null && i && (n < 0 || i == D(r))) {
|
|
769
|
+
let e = r.childNodes[i - 1], t = k(e) ? E(e, D(e) - +!o) : O(e) && (e.nodeName != "BR" || !e.nextSibling) ? e : null;
|
|
770
770
|
if (t) return Ut(Bt(t, 1), !1);
|
|
771
771
|
}
|
|
772
|
-
if (a == null && i <
|
|
772
|
+
if (a == null && i < D(r)) {
|
|
773
773
|
let e = r.childNodes[i];
|
|
774
774
|
for (; e.pmViewDesc && e.pmViewDesc.ignoreForCoords;) e = e.nextSibling;
|
|
775
|
-
let t = e ?
|
|
775
|
+
let t = e ? k(e) ? E(e, 0, +!o) : O(e) ? e : null : null;
|
|
776
776
|
if (t) return Ut(Bt(t, -1), !0);
|
|
777
777
|
}
|
|
778
|
-
return Ut(Bt(
|
|
778
|
+
return Ut(Bt(k(r) ? E(r) : r, -n), n >= 0);
|
|
779
779
|
}
|
|
780
780
|
function Ut(e, t) {
|
|
781
781
|
if (e.width == 0) return e;
|
|
@@ -822,8 +822,8 @@ function Kt(e, t, n) {
|
|
|
822
822
|
let r = Ht(e, i.pos, 1);
|
|
823
823
|
for (let e = t.firstChild; e; e = e.nextSibling) {
|
|
824
824
|
let t;
|
|
825
|
-
if (
|
|
826
|
-
else if (
|
|
825
|
+
if (O(e)) t = e.getClientRects();
|
|
826
|
+
else if (k(e)) t = E(e, 0, e.nodeValue.length).getClientRects();
|
|
827
827
|
else continue;
|
|
828
828
|
for (let e = 0; e < t.length; e++) {
|
|
829
829
|
let i = t[e];
|
|
@@ -841,7 +841,7 @@ function Jt(e, t, n) {
|
|
|
841
841
|
return s ? !qt.test(r.parent.textContent) || !s.modify ? n == "left" || n == "backward" ? a : o : Gt(e, t, () => {
|
|
842
842
|
let { focusNode: t, focusOffset: i, anchorNode: a, anchorOffset: o } = e.domSelectionRange(), c = s.caretBidiLevel;
|
|
843
843
|
s.modify("move", n, "character");
|
|
844
|
-
let l = r.depth ? e.docView.domAfterPos(r.before()) : e.dom, { focusNode: u, focusOffset: d } = e.domSelectionRange(), f = u && !
|
|
844
|
+
let l = r.depth ? e.docView.domAfterPos(r.before()) : e.dom, { focusNode: u, focusOffset: d } = e.domSelectionRange(), f = u && !et(l, u) || t == u && i == d;
|
|
845
845
|
try {
|
|
846
846
|
s.collapse(a, o), t && (t != a || i != o) && s.extend && s.extend(t, i);
|
|
847
847
|
} catch {}
|
|
@@ -906,7 +906,7 @@ var L = 0, $t = 1, en = 2, R = 3, tn = class {
|
|
|
906
906
|
return this.posAtStart + this.size - 2 * this.border;
|
|
907
907
|
}
|
|
908
908
|
localPosFromDOM(e, t, n) {
|
|
909
|
-
if (this.contentDOM &&
|
|
909
|
+
if (this.contentDOM && et(this.contentDOM, e)) {
|
|
910
910
|
if (n < 0) {
|
|
911
911
|
let n, r;
|
|
912
912
|
if (e == this.contentDOM) n = e.childNodes[t - 1];
|
|
@@ -953,7 +953,7 @@ var L = 0, $t = 1, en = 2, R = 3, tn = class {
|
|
|
953
953
|
for (let n = !0, r = e; r; r = r.parentNode) {
|
|
954
954
|
let i = this.getDesc(r), a;
|
|
955
955
|
if (i && (!t || i.node)) {
|
|
956
|
-
if (n && (a = i.nodeDOM) && !(
|
|
956
|
+
if (n && (a = i.nodeDOM) && !(O(a) ? et(a, e) : a == e)) n = !1;
|
|
957
957
|
else return i;
|
|
958
958
|
}
|
|
959
959
|
}
|
|
@@ -1078,7 +1078,7 @@ var L = 0, $t = 1, en = 2, R = 3, tn = class {
|
|
|
1078
1078
|
}
|
|
1079
1079
|
domAfterPos(e) {
|
|
1080
1080
|
let { node: t, offset: n } = this.domFromPos(e, 0);
|
|
1081
|
-
if (!
|
|
1081
|
+
if (!O(t) || n == t.childNodes.length) throw RangeError("No node after pos " + e);
|
|
1082
1082
|
return t.childNodes[n];
|
|
1083
1083
|
}
|
|
1084
1084
|
setSelection(e, t, n, r = !1) {
|
|
@@ -1089,9 +1089,9 @@ var L = 0, $t = 1, en = 2, R = 3, tn = class {
|
|
|
1089
1089
|
s = l;
|
|
1090
1090
|
}
|
|
1091
1091
|
let o = this.domFromPos(e, e ? -1 : 1), s = t == e ? o : this.domFromPos(t, t ? -1 : 1), c = n.root.getSelection(), l = n.domSelectionRange(), u = !1;
|
|
1092
|
-
if ((
|
|
1092
|
+
if ((M || P) && e == t) {
|
|
1093
1093
|
let { node: e, offset: t } = o;
|
|
1094
|
-
if (
|
|
1094
|
+
if (k(e)) {
|
|
1095
1095
|
if (u = !!(t && e.nodeValue[t - 1] == "\n"), u && t == e.nodeValue.length) for (let t = e, n; t; t = t.parentNode) {
|
|
1096
1096
|
if (n = t.nextSibling) {
|
|
1097
1097
|
n.nodeName == "BR" && (o = s = {
|
|
@@ -1108,13 +1108,13 @@ var L = 0, $t = 1, en = 2, R = 3, tn = class {
|
|
|
1108
1108
|
u = n && (n.nodeName == "BR" || n.contentEditable == "false");
|
|
1109
1109
|
}
|
|
1110
1110
|
}
|
|
1111
|
-
if (
|
|
1111
|
+
if (M && l.focusNode && l.focusNode != s.node && O(l.focusNode)) {
|
|
1112
1112
|
let e = l.focusNode.childNodes[l.focusOffset];
|
|
1113
1113
|
e && e.contentEditable == "false" && (r = !0);
|
|
1114
1114
|
}
|
|
1115
|
-
if (!(r || u &&
|
|
1115
|
+
if (!(r || u && P) && Ze(o.node, o.offset, l.anchorNode, l.anchorOffset) && Ze(s.node, s.offset, l.focusNode, l.focusOffset)) return;
|
|
1116
1116
|
let d = !1;
|
|
1117
|
-
if ((c.extend || e == t) && !(u &&
|
|
1117
|
+
if ((c.extend || e == t) && !(u && M)) {
|
|
1118
1118
|
c.collapse(o.node, o.offset);
|
|
1119
1119
|
try {
|
|
1120
1120
|
e != t && c.extend(s.node, s.offset), d = !0;
|
|
@@ -1176,7 +1176,7 @@ var L = 0, $t = 1, en = 2, R = 3, tn = class {
|
|
|
1176
1176
|
if (!i) return r;
|
|
1177
1177
|
if (i.parent) return i.parent.posBeforeChild(i);
|
|
1178
1178
|
})), !t.type.spec.raw) {
|
|
1179
|
-
let e =
|
|
1179
|
+
let e = O(a) ? a : document.createElement("span");
|
|
1180
1180
|
e != a && e.appendChild(a), e.hasAttribute("contenteditable") || (e.contentEditable = "false"), e.classList.add("ProseMirror-widget");
|
|
1181
1181
|
}
|
|
1182
1182
|
super(e, [], a, null), this.widget = t, this.widget = t, i = this;
|
|
@@ -1273,7 +1273,7 @@ var L = 0, $t = 1, en = 2, R = 3, tn = class {
|
|
|
1273
1273
|
}, i, a), d = u && u.dom, f = u && u.contentDOM;
|
|
1274
1274
|
if (r.isText) {
|
|
1275
1275
|
if (!d) d = document.createTextNode(r.text);
|
|
1276
|
-
else if (!
|
|
1276
|
+
else if (!k(d)) throw RangeError("Text must be rendered as a DOM text node");
|
|
1277
1277
|
} else if (!d) {
|
|
1278
1278
|
let t = e.renderSpec(document, r.type.spec.toDOM(r), null, r.attrs);
|
|
1279
1279
|
({dom: d, contentDOM: f} = t);
|
|
@@ -1299,7 +1299,7 @@ var L = 0, $t = 1, en = 2, R = 3, tn = class {
|
|
|
1299
1299
|
}
|
|
1300
1300
|
}
|
|
1301
1301
|
if (!t.contentElement) {
|
|
1302
|
-
let n = e && e.find((t) =>
|
|
1302
|
+
let n = e && e.find((t) => O(t) && e.indexOf(t.parentNode) < 0 && this.dom.contains(t));
|
|
1303
1303
|
n ? t.contentElement = n : t.getContent = () => C.empty;
|
|
1304
1304
|
}
|
|
1305
1305
|
}
|
|
@@ -1322,7 +1322,7 @@ var L = 0, $t = 1, en = 2, R = 3, tn = class {
|
|
|
1322
1322
|
c.syncToMarks(t.marks, n, e, d), u && t.isAtom && !t.isText && c.addHackNode("IMG", c.top);
|
|
1323
1323
|
let f;
|
|
1324
1324
|
c.findNodeMatch(t, a, o, d) || s && e.state.selection.from > r && e.state.selection.to < r + t.nodeSize && (f = c.findIndexWithChild(i.node)) > -1 && c.updateNodeAt(t, a, o, f, e) || c.updateNextNode(t, a, o, e, d, r) || c.addNode(t, a, o, e, r), r += t.nodeSize, l && (u = t.isAtom && !t.isText);
|
|
1325
|
-
}), c.syncToMarks([], n, e, 0), this.node.isTextblock && c.addTextblockHacks(), c.destroyRest(), (c.changed || this.dirty == en) && (o && this.protectLocalComposition(e, o), dn(this.contentDOM, this.children, e),
|
|
1325
|
+
}), c.syncToMarks([], n, e, 0), this.node.isTextblock && c.addTextblockHacks(), c.destroyRest(), (c.changed || this.dirty == en) && (o && this.protectLocalComposition(e, o), dn(this.contentDOM, this.children, e), _t && wn(this.dom));
|
|
1326
1326
|
}
|
|
1327
1327
|
localCompositionInfo(e, t) {
|
|
1328
1328
|
let { from: n, to: r } = e.state.selection;
|
|
@@ -1362,14 +1362,14 @@ var L = 0, $t = 1, en = 2, R = 3, tn = class {
|
|
|
1362
1362
|
}
|
|
1363
1363
|
updateOuterDeco(e) {
|
|
1364
1364
|
if (vn(e, this.outerDeco)) return;
|
|
1365
|
-
let t = !
|
|
1365
|
+
let t = !O(this.nodeDOM), n = this.dom;
|
|
1366
1366
|
this.dom = hn(this.dom, this.nodeDOM, mn(this.outerDeco, this.node, t), mn(e, this.node, t)), this.dom != n && (n.pmViewDesc = void 0, this.dom.pmViewDesc = this), this.outerDeco = e;
|
|
1367
1367
|
}
|
|
1368
1368
|
selectNode() {
|
|
1369
|
-
|
|
1369
|
+
O(this.nodeDOM) && (this.nodeDOM.classList.add("ProseMirror-selectednode"), (this.contentDOM || !this.node.type.spec.draggable) && (this.nodeDOM.draggable = !0));
|
|
1370
1370
|
}
|
|
1371
1371
|
deselectNode() {
|
|
1372
|
-
|
|
1372
|
+
O(this.nodeDOM) && (this.nodeDOM.classList.remove("ProseMirror-selectednode"), (this.contentDOM || !this.node.type.spec.draggable) && this.nodeDOM.removeAttribute("draggable"));
|
|
1373
1373
|
}
|
|
1374
1374
|
get domAtom() {
|
|
1375
1375
|
return this.node.isAtom;
|
|
@@ -1533,7 +1533,7 @@ function gn(e, t, n) {
|
|
|
1533
1533
|
}
|
|
1534
1534
|
}
|
|
1535
1535
|
function _n(e, t, n) {
|
|
1536
|
-
return hn(e, e, pn, mn(t, n, !
|
|
1536
|
+
return hn(e, e, pn, mn(t, n, !O(e)));
|
|
1537
1537
|
}
|
|
1538
1538
|
function vn(e, t) {
|
|
1539
1539
|
if (e.length != t.length) return !1;
|
|
@@ -1652,7 +1652,7 @@ var bn = class {
|
|
|
1652
1652
|
addTextblockHacks() {
|
|
1653
1653
|
let e = this.top.children[this.index - 1], t = this.top;
|
|
1654
1654
|
for (; e instanceof an;) t = e, e = t.children[t.children.length - 1];
|
|
1655
|
-
(!e || !(e instanceof cn) || /\n$/.test(e.node.text) || this.view.requiresGeckoHackNode && /\s$/.test(e.node.text)) && ((
|
|
1655
|
+
(!e || !(e instanceof cn) || /\n$/.test(e.node.text) || this.view.requiresGeckoHackNode && /\s$/.test(e.node.text)) && ((P || N) && e && e.dom.contentEditable == "false" && this.addHackNode("IMG", t), this.addHackNode("BR", this.top));
|
|
1656
1656
|
}
|
|
1657
1657
|
addHackNode(e, t) {
|
|
1658
1658
|
if (t == this.top && this.index < t.children.length && t.children[this.index].matchesHack(e)) this.index++;
|
|
@@ -1664,7 +1664,7 @@ var bn = class {
|
|
|
1664
1664
|
}
|
|
1665
1665
|
}
|
|
1666
1666
|
isLocked(e) {
|
|
1667
|
-
return this.lock && (e == this.lock ||
|
|
1667
|
+
return this.lock && (e == this.lock || O(e) && e.contains(this.lock.parentNode));
|
|
1668
1668
|
}
|
|
1669
1669
|
};
|
|
1670
1670
|
function xn(e, t) {
|
|
@@ -1773,17 +1773,17 @@ function Dn(e, t = null) {
|
|
|
1773
1773
|
let i = e.docView.nearestDesc(n.focusNode), a = i && i.size == 0, o = e.docView.posFromDOM(n.focusNode, n.focusOffset, 1);
|
|
1774
1774
|
if (o < 0) return null;
|
|
1775
1775
|
let s = r.resolve(o), c, l;
|
|
1776
|
-
if (
|
|
1776
|
+
if (at(n)) {
|
|
1777
1777
|
for (c = o; i && !i.node;) i = i.parent;
|
|
1778
|
-
if (i && i.node.isAtom && b.isSelectable(i.node) && i.parent && !(i.node.isInline &&
|
|
1778
|
+
if (i && i.node.isAtom && b.isSelectable(i.node) && i.parent && !(i.node.isInline && rt(n.focusNode, n.focusOffset, i.dom))) {
|
|
1779
1779
|
let e = i.posBefore;
|
|
1780
1780
|
l = new b(o == e ? s : r.resolve(e));
|
|
1781
|
-
} else if (
|
|
1781
|
+
} else if (M && t == "key" && o > e.state.selection.to && O(n.focusNode) && n.focusOffset == n.focusNode.childNodes.length && i && i.posAtStart > e.state.selection.to) for (let e = n.focusNode;; e = e.parentNode) {
|
|
1782
1782
|
if (getComputedStyle(e).overflow != "visible") {
|
|
1783
1783
|
l = v.findFrom(r.resolve(i.posAtStart), 1);
|
|
1784
1784
|
break;
|
|
1785
1785
|
}
|
|
1786
|
-
if (e == i.dom || e.nextSibling || !e.parentNode || !
|
|
1786
|
+
if (e == i.dom || e.nextSibling || !e.parentNode || !O(e.parentNode)) break;
|
|
1787
1787
|
}
|
|
1788
1788
|
} else {
|
|
1789
1789
|
if (n instanceof e.dom.ownerDocument.defaultView.Selection && n.rangeCount > 1) {
|
|
@@ -1811,9 +1811,9 @@ function z(e, t = !1) {
|
|
|
1811
1811
|
let n = e.state.selection;
|
|
1812
1812
|
if (Fn(e, n), !On(e)) return;
|
|
1813
1813
|
let r = e.input.mouseDown;
|
|
1814
|
-
if (!t &&
|
|
1814
|
+
if (!t && N && r) {
|
|
1815
1815
|
let t = e.domSelectionRange(), n = e.domObserver.currentSelection;
|
|
1816
|
-
if (t.anchorNode && n.anchorNode &&
|
|
1816
|
+
if (t.anchorNode && n.anchorNode && Ze(t.anchorNode, t.anchorOffset, n.anchorNode, n.anchorOffset) && r.delaySelUpdate()) {
|
|
1817
1817
|
e.domObserver.setCurSelection();
|
|
1818
1818
|
return;
|
|
1819
1819
|
}
|
|
@@ -1825,17 +1825,17 @@ function z(e, t = !1) {
|
|
|
1825
1825
|
}
|
|
1826
1826
|
e.domObserver.setCurSelection(), e.domObserver.connectSelection();
|
|
1827
1827
|
}
|
|
1828
|
-
var kn =
|
|
1828
|
+
var kn = P || N && gt < 63;
|
|
1829
1829
|
function An(e, t) {
|
|
1830
1830
|
let { node: n, offset: r } = e.docView.domFromPos(t, 0), i = r < n.childNodes.length ? n.childNodes[r] : null, a = r ? n.childNodes[r - 1] : null;
|
|
1831
|
-
if (
|
|
1831
|
+
if (P && i && i.contentEditable == "false") return jn(i);
|
|
1832
1832
|
if ((!i || i.contentEditable == "false") && (!a || a.contentEditable == "false")) {
|
|
1833
1833
|
if (i) return jn(i);
|
|
1834
1834
|
if (a) return jn(a);
|
|
1835
1835
|
}
|
|
1836
1836
|
}
|
|
1837
1837
|
function jn(e) {
|
|
1838
|
-
return e.contentEditable = "true",
|
|
1838
|
+
return e.contentEditable = "true", P && e.draggable && (e.draggable = !1, e.wasDraggable = !0), e;
|
|
1839
1839
|
}
|
|
1840
1840
|
function Mn(e) {
|
|
1841
1841
|
e.contentEditable = "false", e.wasDraggable &&= (e.draggable = !0, null);
|
|
@@ -1854,7 +1854,7 @@ function Pn(e) {
|
|
|
1854
1854
|
let t = e.domSelection();
|
|
1855
1855
|
if (!t) return;
|
|
1856
1856
|
let n = e.cursorWrapper.dom, r = n.nodeName == "IMG";
|
|
1857
|
-
r ? t.collapse(n.parentNode, T(n) + 1) : t.collapse(n, 0), !r && !e.state.selection.visible &&
|
|
1857
|
+
r ? t.collapse(n.parentNode, T(n) + 1) : t.collapse(n, 0), !r && !e.state.selection.visible && j && mt <= 11 && (n.disabled = !0, n.disabled = !1);
|
|
1858
1858
|
}
|
|
1859
1859
|
function Fn(e, t) {
|
|
1860
1860
|
if (t instanceof b) {
|
|
@@ -1875,14 +1875,14 @@ function zn(e) {
|
|
|
1875
1875
|
let t = e.domSelectionRange();
|
|
1876
1876
|
if (!t.anchorNode) return !1;
|
|
1877
1877
|
try {
|
|
1878
|
-
return
|
|
1878
|
+
return et(e.dom, t.anchorNode) && (e.editable || et(e.dom, t.focusNode));
|
|
1879
1879
|
} catch {
|
|
1880
1880
|
return !1;
|
|
1881
1881
|
}
|
|
1882
1882
|
}
|
|
1883
1883
|
function Bn(e) {
|
|
1884
1884
|
let t = e.docView.domFromPos(e.state.selection.anchor, 0), n = e.domSelectionRange();
|
|
1885
|
-
return
|
|
1885
|
+
return Ze(t.node, t.offset, n.anchorNode, n.anchorOffset);
|
|
1886
1886
|
}
|
|
1887
1887
|
function Vn(e, t) {
|
|
1888
1888
|
let { $anchor: n, $head: r } = e.selection, i = t > 0 ? n.max(r) : n.min(r), a = i.parent.inlineContent ? i.depth ? e.doc.resolve(t > 0 ? i.after() : i.before()) : null : i;
|
|
@@ -1905,7 +1905,7 @@ function Un(e, t, n) {
|
|
|
1905
1905
|
let n = Vn(e.state, t);
|
|
1906
1906
|
return n && n instanceof b ? Hn(e, n) : !1;
|
|
1907
1907
|
}
|
|
1908
|
-
if (!(
|
|
1908
|
+
if (!(F && n.indexOf("m") > -1)) {
|
|
1909
1909
|
let n = r.$head, i = n.textOffset ? null : t < 0 ? n.nodeBefore : n.nodeAfter, a;
|
|
1910
1910
|
if (!i || i.isText) return !1;
|
|
1911
1911
|
let o = t < 0 ? n.pos - i.nodeSize : n.pos;
|
|
@@ -1919,7 +1919,7 @@ function Un(e, t, n) {
|
|
|
1919
1919
|
}
|
|
1920
1920
|
function Wn(e, t) {
|
|
1921
1921
|
let n = e.pmViewDesc;
|
|
1922
|
-
return n ? n.size == 0 && (t < 0 || e.nextSibling || e.nodeName != "BR") :
|
|
1922
|
+
return n ? n.size == 0 && (t < 0 || e.nextSibling || e.nodeName != "BR") : O(e) && e.contentEditable == "false";
|
|
1923
1923
|
}
|
|
1924
1924
|
function Gn(e, t) {
|
|
1925
1925
|
return t < 0 ? Kn(e) : qn(e);
|
|
@@ -1928,17 +1928,17 @@ function Kn(e) {
|
|
|
1928
1928
|
let t = e.domSelectionRange(), n = t.focusNode, r = t.focusOffset;
|
|
1929
1929
|
if (!n) return;
|
|
1930
1930
|
let i, a, o = !1;
|
|
1931
|
-
for (
|
|
1932
|
-
if (!
|
|
1931
|
+
for (M && O(n) && r < D(n) && Wn(n.childNodes[r], -1) && (o = !0);;) if (r > 0) {
|
|
1932
|
+
if (!O(n)) break;
|
|
1933
1933
|
let e = n.childNodes[r - 1];
|
|
1934
1934
|
if (Wn(e, -1)) i = n, a = --r;
|
|
1935
|
-
else if (
|
|
1935
|
+
else if (k(e)) n = e, r = n.nodeValue.length;
|
|
1936
1936
|
else break;
|
|
1937
1937
|
} else if (Jn(n)) break;
|
|
1938
1938
|
else {
|
|
1939
1939
|
let t = n.previousSibling;
|
|
1940
1940
|
for (; t && Wn(t, -1);) i = n.parentNode, a = T(t), t = t.previousSibling;
|
|
1941
|
-
if (t) n = t, r =
|
|
1941
|
+
if (t) n = t, r = D(n);
|
|
1942
1942
|
else {
|
|
1943
1943
|
if (n = n.parentNode, n == e.dom) break;
|
|
1944
1944
|
r = 0;
|
|
@@ -1949,9 +1949,9 @@ function Kn(e) {
|
|
|
1949
1949
|
function qn(e) {
|
|
1950
1950
|
let t = e.domSelectionRange(), n = t.focusNode, r = t.focusOffset;
|
|
1951
1951
|
if (!n) return;
|
|
1952
|
-
let i =
|
|
1952
|
+
let i = D(n), a, o;
|
|
1953
1953
|
for (;;) if (r < i) {
|
|
1954
|
-
if (!
|
|
1954
|
+
if (!O(n)) break;
|
|
1955
1955
|
let e = n.childNodes[r];
|
|
1956
1956
|
if (Wn(e, 1)) a = n, o = ++r;
|
|
1957
1957
|
else break;
|
|
@@ -1959,7 +1959,7 @@ function qn(e) {
|
|
|
1959
1959
|
else {
|
|
1960
1960
|
let t = n.nextSibling;
|
|
1961
1961
|
for (; t && Wn(t, 1);) a = t.parentNode, o = T(t) + 1, t = t.nextSibling;
|
|
1962
|
-
if (t) n = t, r = 0, i =
|
|
1962
|
+
if (t) n = t, r = 0, i = D(n);
|
|
1963
1963
|
else {
|
|
1964
1964
|
if (n = n.parentNode, n == e.dom) break;
|
|
1965
1965
|
r = i = 0;
|
|
@@ -1972,31 +1972,31 @@ function Jn(e) {
|
|
|
1972
1972
|
return t && t.node && t.node.isBlock;
|
|
1973
1973
|
}
|
|
1974
1974
|
function Yn(e, t) {
|
|
1975
|
-
for (; e && t == e.childNodes.length && !
|
|
1975
|
+
for (; e && t == e.childNodes.length && !it(e);) t = T(e) + 1, e = e.parentNode;
|
|
1976
1976
|
for (; e && t < e.childNodes.length;) {
|
|
1977
1977
|
let n = e.childNodes[t];
|
|
1978
|
-
if (
|
|
1979
|
-
if (
|
|
1978
|
+
if (k(n)) return n;
|
|
1979
|
+
if (O(n) && n.contentEditable == "false") break;
|
|
1980
1980
|
e = n, t = 0;
|
|
1981
1981
|
}
|
|
1982
1982
|
}
|
|
1983
1983
|
function Xn(e, t) {
|
|
1984
|
-
for (; e && !t && !
|
|
1984
|
+
for (; e && !t && !it(e);) t = T(e), e = e.parentNode;
|
|
1985
1985
|
for (; e && t;) {
|
|
1986
1986
|
let n = e.childNodes[t - 1];
|
|
1987
|
-
if (
|
|
1988
|
-
if (
|
|
1987
|
+
if (k(n)) return n;
|
|
1988
|
+
if (O(n) && n.contentEditable == "false") break;
|
|
1989
1989
|
e = n, t = e.childNodes.length;
|
|
1990
1990
|
}
|
|
1991
1991
|
}
|
|
1992
1992
|
function Zn(e, t, n) {
|
|
1993
|
-
if (!
|
|
1993
|
+
if (!k(t)) {
|
|
1994
1994
|
let e, r;
|
|
1995
1995
|
(r = Yn(t, n)) ? (t = r, n = 0) : (e = Xn(t, n)) && (t = e, n = e.nodeValue.length);
|
|
1996
1996
|
}
|
|
1997
1997
|
let r = e.domSelection();
|
|
1998
1998
|
if (!r) return;
|
|
1999
|
-
if (
|
|
1999
|
+
if (at(r)) {
|
|
2000
2000
|
let e = document.createRange();
|
|
2001
2001
|
e.setEnd(t, n), e.setStart(t, n), r.removeAllRanges(), r.addRange(e);
|
|
2002
2002
|
} else r.extend && r.extend(t, n);
|
|
@@ -2008,7 +2008,7 @@ function Zn(e, t, n) {
|
|
|
2008
2008
|
}
|
|
2009
2009
|
function Qn(e, t) {
|
|
2010
2010
|
let n = e.state.doc.resolve(t);
|
|
2011
|
-
if (!(
|
|
2011
|
+
if (!(N || vt) && n.parent.inlineContent) {
|
|
2012
2012
|
let r = e.coordsAtPos(t);
|
|
2013
2013
|
if (t > n.start()) {
|
|
2014
2014
|
let n = e.coordsAtPos(t - 1), i = (n.top + n.bottom) / 2;
|
|
@@ -2023,7 +2023,7 @@ function Qn(e, t) {
|
|
|
2023
2023
|
}
|
|
2024
2024
|
function $n(e, t, n) {
|
|
2025
2025
|
let r = e.state.selection;
|
|
2026
|
-
if (r instanceof l && !r.empty || n.indexOf("s") > -1 ||
|
|
2026
|
+
if (r instanceof l && !r.empty || n.indexOf("s") > -1 || F && n.indexOf("m") > -1) return !1;
|
|
2027
2027
|
let { $from: i, $to: a } = r;
|
|
2028
2028
|
if (!i.parent.inlineContent || e.endOfTextblock(t < 0 ? "up" : "down")) {
|
|
2029
2029
|
let n = Vn(e.state, t);
|
|
@@ -2052,9 +2052,9 @@ function tr(e, t, n) {
|
|
|
2052
2052
|
e.domObserver.stop(), t.contentEditable = n, e.domObserver.start();
|
|
2053
2053
|
}
|
|
2054
2054
|
function nr(e) {
|
|
2055
|
-
if (!
|
|
2055
|
+
if (!P || e.state.selection.$head.parentOffset > 0) return !1;
|
|
2056
2056
|
let { focusNode: t, focusOffset: n } = e.domSelectionRange();
|
|
2057
|
-
if (t &&
|
|
2057
|
+
if (t && O(t) && n == 0 && t.firstChild && O(t.firstChild) && t.firstChild.contentEditable == "false") {
|
|
2058
2058
|
let n = t.firstChild;
|
|
2059
2059
|
tr(e, n, "true"), setTimeout(() => tr(e, n, "false"), 20);
|
|
2060
2060
|
}
|
|
@@ -2066,18 +2066,18 @@ function rr(e) {
|
|
|
2066
2066
|
}
|
|
2067
2067
|
function ir(e, t) {
|
|
2068
2068
|
let n = t.keyCode, r = rr(t);
|
|
2069
|
-
if (n == 8 ||
|
|
2070
|
-
if (n == 46 && !t.shiftKey ||
|
|
2069
|
+
if (n == 8 || F && n == 72 && r == "c") return er(e, -1) || Gn(e, -1);
|
|
2070
|
+
if (n == 46 && !t.shiftKey || F && n == 68 && r == "c") return er(e, 1) || Gn(e, 1);
|
|
2071
2071
|
if (n == 13 || n == 27) return !0;
|
|
2072
|
-
if (n == 37 ||
|
|
2072
|
+
if (n == 37 || F && n == 66 && r == "c") {
|
|
2073
2073
|
let t = n == 37 ? Qn(e, e.state.selection.from) == "ltr" ? -1 : 1 : -1;
|
|
2074
2074
|
return Un(e, t, r) || Gn(e, t);
|
|
2075
2075
|
}
|
|
2076
|
-
if (n == 39 ||
|
|
2076
|
+
if (n == 39 || F && n == 70 && r == "c") {
|
|
2077
2077
|
let t = n == 39 ? Qn(e, e.state.selection.from) == "ltr" ? 1 : -1 : 1;
|
|
2078
2078
|
return Un(e, t, r) || Gn(e, t);
|
|
2079
2079
|
}
|
|
2080
|
-
return n == 38 ||
|
|
2080
|
+
return n == 38 || F && n == 80 && r == "c" ? $n(e, -1, r) || Gn(e, -1) : n == 40 || F && n == 78 && r == "c" ? nr(e) || $n(e, 1, r) || Gn(e, 1) : !(r != (F ? "m" : "c") || n != 66 && n != 73 && n != 89 && n != 90);
|
|
2081
2081
|
}
|
|
2082
2082
|
function ar(t, n) {
|
|
2083
2083
|
t.someProp("transformCopied", (e) => {
|
|
@@ -2092,7 +2092,7 @@ function ar(t, n) {
|
|
|
2092
2092
|
let s = t.someProp("clipboardSerializer") || e.fromSchema(t.state.schema), c = hr(), l = c.createElement("div");
|
|
2093
2093
|
l.appendChild(s.serializeFragment(i, { document: c }));
|
|
2094
2094
|
let u = l.firstChild, d, f = 0;
|
|
2095
|
-
for (; u &&
|
|
2095
|
+
for (; u && O(u) && (d = mr[u.nodeName.toLowerCase()]);) {
|
|
2096
2096
|
for (let e = d.length - 1; e >= 0; e--) {
|
|
2097
2097
|
let t = c.createElement(d[e]);
|
|
2098
2098
|
for (; l.firstChild;) t.appendChild(l.firstChild);
|
|
@@ -2100,7 +2100,7 @@ function ar(t, n) {
|
|
|
2100
2100
|
}
|
|
2101
2101
|
u = l.firstChild;
|
|
2102
2102
|
}
|
|
2103
|
-
return u &&
|
|
2103
|
+
return u && O(u) && u.setAttribute("data-pm-slice", `${a} ${o}${f ? ` -${f}` : ""} ${JSON.stringify(r)}`), {
|
|
2104
2104
|
dom: l,
|
|
2105
2105
|
text: t.someProp("clipboardTextSerializer", (e) => e(n, t)) || n.content.textBetween(0, n.content.size, "\n\n"),
|
|
2106
2106
|
slice: n
|
|
@@ -2131,7 +2131,7 @@ function or(t, n, r, a, o) {
|
|
|
2131
2131
|
let d = c && c.querySelector("[data-pm-slice]"), f = d && /^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(d.getAttribute("data-pm-slice") || "");
|
|
2132
2132
|
if (f && f[3]) for (let e = +f[3]; e > 0; e--) {
|
|
2133
2133
|
let e = c.firstChild;
|
|
2134
|
-
for (; e && !
|
|
2134
|
+
for (; e && !O(e);) e = e.nextSibling;
|
|
2135
2135
|
if (!e) break;
|
|
2136
2136
|
c = e;
|
|
2137
2137
|
}
|
|
@@ -2246,7 +2246,7 @@ function vr(e) {
|
|
|
2246
2246
|
return r;
|
|
2247
2247
|
}
|
|
2248
2248
|
function yr(e) {
|
|
2249
|
-
let t = e.querySelectorAll(
|
|
2249
|
+
let t = e.querySelectorAll(N ? "span:not([class]):not([style])" : "span.Apple-converted-space");
|
|
2250
2250
|
for (let n = 0; n < t.length; n++) {
|
|
2251
2251
|
let r = t[n];
|
|
2252
2252
|
r.childNodes.length == 1 && r.textContent == "\xA0" && r.parentNode && r.parentNode.replaceChild(e.ownerDocument.createTextNode(" "), r);
|
|
@@ -2294,7 +2294,7 @@ function Cr(e) {
|
|
|
2294
2294
|
Dr(e, t) && !Er(e, t) && (e.editable || !(t.type in V)) && n(e, t);
|
|
2295
2295
|
}, xr[t] ? { passive: !0 } : void 0);
|
|
2296
2296
|
}
|
|
2297
|
-
|
|
2297
|
+
P && e.dom.addEventListener("input", () => null), Tr(e);
|
|
2298
2298
|
}
|
|
2299
2299
|
function H(e, t) {
|
|
2300
2300
|
e.input.lastSelectionOrigin = t, e.input.lastSelectionTime = Date.now();
|
|
@@ -2326,11 +2326,11 @@ function Or(e, t) {
|
|
|
2326
2326
|
}
|
|
2327
2327
|
V.keydown = (e, t) => {
|
|
2328
2328
|
let n = t;
|
|
2329
|
-
if (e.input.shiftKey = n.keyCode == 16 || n.shiftKey, !Gr(e) && (e.input.lastKeyCode = n.keyCode, e.input.lastKeyCodeTime = Date.now(), !(
|
|
2330
|
-
if (n.keyCode != 229 && e.domObserver.forceFlush(),
|
|
2329
|
+
if (e.input.shiftKey = n.keyCode == 16 || n.shiftKey, !Gr(e) && (e.input.lastKeyCode = n.keyCode, e.input.lastKeyCodeTime = Date.now(), !(yt && N && n.keyCode == 13))) {
|
|
2330
|
+
if (n.keyCode != 229 && e.domObserver.forceFlush(), _t && n.keyCode == 13 && !n.ctrlKey && !n.altKey && !n.metaKey) {
|
|
2331
2331
|
let t = Date.now();
|
|
2332
2332
|
e.input.lastIOSEnter = t, e.input.lastIOSEnterFallbackTimeout = setTimeout(() => {
|
|
2333
|
-
e.input.lastIOSEnter == t && (e.someProp("handleKeyDown", (t) => t(e,
|
|
2333
|
+
e.input.lastIOSEnter == t && (e.someProp("handleKeyDown", (t) => t(e, ot(13, "Enter"))), e.input.lastIOSEnter = 0);
|
|
2334
2334
|
}, 200);
|
|
2335
2335
|
} else e.someProp("handleKeyDown", (t) => t(e, n)) || ir(e, n) ? n.preventDefault() : H(e, "key");
|
|
2336
2336
|
}
|
|
@@ -2338,7 +2338,7 @@ V.keydown = (e, t) => {
|
|
|
2338
2338
|
t.keyCode == 16 && (e.input.shiftKey = !1);
|
|
2339
2339
|
}, V.keypress = (e, t) => {
|
|
2340
2340
|
let n = t;
|
|
2341
|
-
if (Gr(e) || !n.charCode || n.ctrlKey && !n.altKey ||
|
|
2341
|
+
if (Gr(e) || !n.charCode || n.ctrlKey && !n.altKey || F && n.metaKey) return;
|
|
2342
2342
|
if (e.someProp("handleKeyPress", (t) => t(e, n))) {
|
|
2343
2343
|
n.preventDefault();
|
|
2344
2344
|
return;
|
|
@@ -2417,7 +2417,7 @@ function zr(e, t, n) {
|
|
|
2417
2417
|
function Br(e) {
|
|
2418
2418
|
return Zr(e);
|
|
2419
2419
|
}
|
|
2420
|
-
var Vr =
|
|
2420
|
+
var Vr = F ? "metaKey" : "ctrlKey";
|
|
2421
2421
|
B.mousedown = (e, t) => {
|
|
2422
2422
|
let n = t;
|
|
2423
2423
|
e.input.shiftKey = n.shiftKey;
|
|
@@ -2458,13 +2458,13 @@ var Hr = class {
|
|
|
2458
2458
|
i = n.parent, a = n.depth ? n.before() : 0;
|
|
2459
2459
|
}
|
|
2460
2460
|
let o = r ? null : n.target, s = o ? e.docView.nearestDesc(o, !0) : null;
|
|
2461
|
-
this.target = s &&
|
|
2461
|
+
this.target = s && O(s.nodeDOM) ? s.nodeDOM : null;
|
|
2462
2462
|
let { selection: c } = e.state;
|
|
2463
2463
|
n.button == 0 && (i.type.spec.draggable && i.type.spec.selectable !== !1 || c instanceof b && c.from <= a && c.to > a) && (this.mightDrag = {
|
|
2464
2464
|
node: i,
|
|
2465
2465
|
pos: a,
|
|
2466
2466
|
addAttr: !(!this.target || this.target.draggable),
|
|
2467
|
-
setUneditable: !!(this.target &&
|
|
2467
|
+
setUneditable: !!(this.target && M && !this.target.hasAttribute("contentEditable"))
|
|
2468
2468
|
}), this.target && this.mightDrag && (this.mightDrag.addAttr || this.mightDrag.setUneditable) && (this.view.domObserver.stop(), this.mightDrag.addAttr && (this.target.draggable = !0), this.mightDrag.setUneditable && setTimeout(() => {
|
|
2469
2469
|
this.view.input.mouseDown == this && this.target.setAttribute("contentEditable", "false");
|
|
2470
2470
|
}, 20), this.view.domObserver.start()), H(e, "pointer");
|
|
@@ -2477,7 +2477,7 @@ var Hr = class {
|
|
|
2477
2477
|
up(e) {
|
|
2478
2478
|
if (this.done(), !this.view.dom.contains(e.target)) return;
|
|
2479
2479
|
let t = this.pos;
|
|
2480
|
-
this.view.state.doc != this.startDoc && (t = this.view.posAtCoords(kr(e))), this.updateAllowDefault(e), this.allowDefault || !t ? H(this.view, "pointer") : Fr(this.view, t.pos, t.inside, e, this.selectNode) ? e.preventDefault() : e.button == 0 && (this.flushed ||
|
|
2480
|
+
this.view.state.doc != this.startDoc && (t = this.view.posAtCoords(kr(e))), this.updateAllowDefault(e), this.allowDefault || !t ? H(this.view, "pointer") : Fr(this.view, t.pos, t.inside, e, this.selectNode) ? e.preventDefault() : e.button == 0 && (this.flushed || P && this.mightDrag && !this.mightDrag.node.isAtom || N && !this.view.state.selection.visible && Math.min(Math.abs(t.pos - this.view.state.selection.from), Math.abs(t.pos - this.view.state.selection.to)) <= 2) ? (Mr(this.view, v.near(this.view.state.doc.resolve(t.pos))), e.preventDefault()) : H(this.view, "pointer");
|
|
2481
2481
|
}
|
|
2482
2482
|
move(e) {
|
|
2483
2483
|
this.updateAllowDefault(e), H(this.view, "pointer"), super.move(e);
|
|
@@ -2510,20 +2510,20 @@ B.touchstart = (e) => {
|
|
|
2510
2510
|
e.input.lastTouch = Date.now(), H(e, "pointer");
|
|
2511
2511
|
}, B.contextmenu = (e) => Br(e);
|
|
2512
2512
|
function Gr(e, t) {
|
|
2513
|
-
return e.composing ? !0 :
|
|
2513
|
+
return e.composing ? !0 : P && Math.abs(Date.now() - e.input.compositionEndedAt) < 500 ? (e.input.compositionEndedAt = -2e8, !0) : !1;
|
|
2514
2514
|
}
|
|
2515
|
-
var Kr =
|
|
2515
|
+
var Kr = yt ? 5e3 : -1;
|
|
2516
2516
|
V.compositionstart = V.compositionupdate = (e) => {
|
|
2517
2517
|
if (!e.composing) {
|
|
2518
2518
|
e.domObserver.flush();
|
|
2519
2519
|
let { state: t } = e, n = t.selection.$to;
|
|
2520
|
-
if (t.selection instanceof l && t.selection.empty && (t.storedMarks || !n.textOffset && n.parentOffset && n.nodeBefore.marks.some((e) => e.type.spec.inclusive === !1) ||
|
|
2521
|
-
else if (Zr(e, !t.selection.empty),
|
|
2520
|
+
if (t.selection instanceof l && t.selection.empty && (t.storedMarks || !n.textOffset && n.parentOffset && n.nodeBefore.marks.some((e) => e.type.spec.inclusive === !1) || N && vt && qr(e))) e.markCursor = e.state.storedMarks || n.marks(), Zr(e, !0), e.markCursor = null;
|
|
2521
|
+
else if (Zr(e, !t.selection.empty), M && t.selection.empty && n.parentOffset && !n.textOffset && n.nodeBefore.marks.length) {
|
|
2522
2522
|
let t = e.domSelectionRange();
|
|
2523
|
-
for (let n = t.focusNode, r = t.focusOffset; n &&
|
|
2523
|
+
for (let n = t.focusNode, r = t.focusOffset; n && O(n) && r != 0;) {
|
|
2524
2524
|
let t = r < 0 ? n.lastChild : n.childNodes[r - 1];
|
|
2525
2525
|
if (!t) break;
|
|
2526
|
-
if (
|
|
2526
|
+
if (k(t)) {
|
|
2527
2527
|
let n = e.domSelection();
|
|
2528
2528
|
n && n.collapse(t, t.nodeValue.length);
|
|
2529
2529
|
break;
|
|
@@ -2537,9 +2537,9 @@ V.compositionstart = V.compositionupdate = (e) => {
|
|
|
2537
2537
|
};
|
|
2538
2538
|
function qr(e) {
|
|
2539
2539
|
let { focusNode: t, focusOffset: n } = e.domSelectionRange();
|
|
2540
|
-
if (!t || !
|
|
2540
|
+
if (!t || !O(t) || n >= t.childNodes.length) return !1;
|
|
2541
2541
|
let r = t.childNodes[n];
|
|
2542
|
-
return
|
|
2542
|
+
return O(r) && r.contentEditable == "false";
|
|
2543
2543
|
}
|
|
2544
2544
|
V.compositionend = (e, t) => {
|
|
2545
2545
|
e.composing && (e.input.composing = !1, e.input.compositionEndedAt = Date.now(), e.input.compositionPendingChanges = e.domObserver.pendingRecords().length ? e.input.compositionID : 0, e.input.compositionNode = null, e.input.badSafariComposition ? e.domObserver.forceFlush() : e.input.compositionPendingChanges && Promise.resolve().then(() => e.domObserver.flush()), e.input.compositionID++, Jr(e, 20));
|
|
@@ -2553,7 +2553,7 @@ function Yr(e) {
|
|
|
2553
2553
|
function Xr(e) {
|
|
2554
2554
|
let t = e.domSelectionRange();
|
|
2555
2555
|
if (!t.focusNode) return null;
|
|
2556
|
-
let n =
|
|
2556
|
+
let n = tt(t.focusNode, t.focusOffset), r = nt(t.focusNode, t.focusOffset);
|
|
2557
2557
|
if (n && r && n != r) {
|
|
2558
2558
|
let t = r.pmViewDesc, i = e.domObserver.lastChangedTextNode;
|
|
2559
2559
|
if (n == i || r == i) return i;
|
|
@@ -2566,7 +2566,7 @@ function Xr(e) {
|
|
|
2566
2566
|
return n || r;
|
|
2567
2567
|
}
|
|
2568
2568
|
function Zr(e, t = !1) {
|
|
2569
|
-
if (!(
|
|
2569
|
+
if (!(yt && e.domObserver.flushingSoon >= 0)) {
|
|
2570
2570
|
if (e.domObserver.forceFlush(), Yr(e), t || e.docView && e.docView.dirty) {
|
|
2571
2571
|
let n = Dn(e), r = e.state.selection;
|
|
2572
2572
|
return n && !n.eq(r) ? e.dispatch(e.state.tr.setSelection(n)) : (e.markCursor || t) && !r.$from.node(r.$from.sharedDepth(r.to)).inlineContent ? e.dispatch(e.state.tr.deleteSelection()) : e.updateState(e.state), !0;
|
|
@@ -2583,7 +2583,7 @@ function Qr(e, t) {
|
|
|
2583
2583
|
n.parentNode && n.parentNode.removeChild(n), e.focus();
|
|
2584
2584
|
}, 50);
|
|
2585
2585
|
}
|
|
2586
|
-
var $r =
|
|
2586
|
+
var $r = j && mt < 15 || _t && xt < 604;
|
|
2587
2587
|
B.copy = V.cut = (e, t) => {
|
|
2588
2588
|
let n = t, r = e.state.selection, i = n.type == "cut";
|
|
2589
2589
|
if (r.empty) return;
|
|
@@ -2617,7 +2617,7 @@ function ri(e) {
|
|
|
2617
2617
|
}
|
|
2618
2618
|
V.paste = (e, t) => {
|
|
2619
2619
|
let n = t;
|
|
2620
|
-
if (e.composing && !
|
|
2620
|
+
if (e.composing && !yt) return;
|
|
2621
2621
|
let r = $r ? null : n.clipboardData, i = e.input.shiftKey && e.input.lastKeyCode != 45;
|
|
2622
2622
|
r && ni(e, ri(r), r.getData("text/html"), i, n) ? n.preventDefault() : ti(e, n);
|
|
2623
2623
|
};
|
|
@@ -2625,7 +2625,7 @@ var ii = class {
|
|
|
2625
2625
|
constructor(e, t, n) {
|
|
2626
2626
|
this.slice = e, this.move = t, this.node = n;
|
|
2627
2627
|
}
|
|
2628
|
-
}, ai =
|
|
2628
|
+
}, ai = F ? "altKey" : "ctrlKey";
|
|
2629
2629
|
function oi(e, t) {
|
|
2630
2630
|
let n;
|
|
2631
2631
|
return e.someProp("dragCopies", (e) => {
|
|
@@ -2638,13 +2638,13 @@ B.dragstart = (e, t) => {
|
|
|
2638
2638
|
let i = e.state.selection, a = i.empty ? null : e.posAtCoords(kr(n)), o;
|
|
2639
2639
|
if (!(a && a.pos >= i.from && a.pos <= (i instanceof b ? i.to - 1 : i.to))) {
|
|
2640
2640
|
if (r && r.mightDrag) o = b.create(e.state.doc, r.mightDrag.pos);
|
|
2641
|
-
else if (n.target &&
|
|
2641
|
+
else if (n.target && O(n.target)) {
|
|
2642
2642
|
let t = e.docView.nearestDesc(n.target, !0);
|
|
2643
2643
|
t && t.node.type.spec.draggable && t != e.docView && (o = b.create(e.state.doc, t.posBefore));
|
|
2644
2644
|
}
|
|
2645
2645
|
}
|
|
2646
2646
|
let { dom: s, text: c, slice: l } = ar(e, (o || e.state.selection).content());
|
|
2647
|
-
(!n.dataTransfer.files.length || !
|
|
2647
|
+
(!n.dataTransfer.files.length || !N || gt > 120) && n.dataTransfer.clearData(), n.dataTransfer.setData($r ? "Text" : "text/html", s.innerHTML), n.dataTransfer.effectAllowed = "copyMove", $r || n.dataTransfer.setData("text/plain", c), e.dragging = new ii(l, oi(e, n), o);
|
|
2648
2648
|
}, B.dragend = (e) => {
|
|
2649
2649
|
let t = e.dragging;
|
|
2650
2650
|
window.setTimeout(() => {
|
|
@@ -2697,11 +2697,11 @@ B.focus = (e) => {
|
|
|
2697
2697
|
let n = t;
|
|
2698
2698
|
e.focused &&= (e.domObserver.stop(), e.dom.classList.remove("ProseMirror-focused"), e.domObserver.start(), n.relatedTarget && e.dom.contains(n.relatedTarget) && e.domObserver.currentSelection.clear(), !1);
|
|
2699
2699
|
}, B.beforeinput = (e, t) => {
|
|
2700
|
-
if (
|
|
2700
|
+
if (yt && t.inputType == "deleteContentBackward") {
|
|
2701
2701
|
e.domObserver.flushSoon();
|
|
2702
2702
|
let { domChangeCount: t } = e.input;
|
|
2703
2703
|
setTimeout(() => {
|
|
2704
|
-
if (e.input.domChangeCount != t || (e.dom.blur(), e.focus(), e.someProp("handleKeyDown", (t) => t(e,
|
|
2704
|
+
if (e.input.domChangeCount != t || (e.dom.blur(), e.focus(), e.someProp("handleKeyDown", (t) => t(e, ot(8, "Backspace"))))) return;
|
|
2705
2705
|
let { $cursor: n } = e.state.selection;
|
|
2706
2706
|
n && n.pos > 0 && e.dispatch(e.state.tr.delete(n.pos - 1, n.pos).scrollIntoView());
|
|
2707
2707
|
}, 50);
|
|
@@ -3080,7 +3080,7 @@ var Ti = {
|
|
|
3080
3080
|
attributes: !0,
|
|
3081
3081
|
attributeOldValue: !0,
|
|
3082
3082
|
subtree: !0
|
|
3083
|
-
}, Ei =
|
|
3083
|
+
}, Ei = j && mt <= 11, Di = class {
|
|
3084
3084
|
constructor() {
|
|
3085
3085
|
this.anchorNode = null, this.anchorOffset = 0, this.focusNode = null, this.focusOffset = 0;
|
|
3086
3086
|
}
|
|
@@ -3097,7 +3097,7 @@ var Ti = {
|
|
|
3097
3097
|
constructor(e, t) {
|
|
3098
3098
|
this.view = e, this.handleDOMChange = t, this.queue = [], this.flushingSoon = -1, this.observer = null, this.currentSelection = new Di(), this.onCharData = null, this.suppressingSelectionUpdates = !1, this.lastChangedTextNode = null, this.observer = window.MutationObserver && new window.MutationObserver((t) => {
|
|
3099
3099
|
for (let e = 0; e < t.length; e++) this.queue.push(t[e]);
|
|
3100
|
-
|
|
3100
|
+
j && mt <= 11 && t.some((e) => e.type == "childList" && e.removedNodes.length || e.type == "characterData" && e.oldValue.length > e.target.nodeValue.length) ? this.flushSoon() : P && e.composing && t.some((e) => e.type == "childList" && e.target.nodeName == "TR") ? (e.input.badSafariComposition = !0, this.flushSoon()) : this.flush();
|
|
3101
3101
|
}), Ei && (this.onCharData = (e) => {
|
|
3102
3102
|
this.queue.push({
|
|
3103
3103
|
target: e.target,
|
|
@@ -3140,9 +3140,9 @@ var Ti = {
|
|
|
3140
3140
|
onSelectionChange() {
|
|
3141
3141
|
if (Rn(this.view)) {
|
|
3142
3142
|
if (this.suppressingSelectionUpdates) return z(this.view);
|
|
3143
|
-
if (
|
|
3143
|
+
if (j && mt <= 11 && !this.view.state.selection.empty) {
|
|
3144
3144
|
let e = this.view.domSelectionRange();
|
|
3145
|
-
if (e.focusNode &&
|
|
3145
|
+
if (e.focusNode && Ze(e.focusNode, e.focusOffset, e.anchorNode, e.anchorOffset)) return this.flushSoon();
|
|
3146
3146
|
}
|
|
3147
3147
|
this.flush();
|
|
3148
3148
|
}
|
|
@@ -3161,7 +3161,7 @@ var Ti = {
|
|
|
3161
3161
|
let r = n && this.view.docView.nearestDesc(n);
|
|
3162
3162
|
if (r && r.ignoreMutation({
|
|
3163
3163
|
type: "selection",
|
|
3164
|
-
target:
|
|
3164
|
+
target: k(n) ? n.parentNode : n
|
|
3165
3165
|
})) return this.setCurSelection(), !0;
|
|
3166
3166
|
}
|
|
3167
3167
|
pendingRecords() {
|
|
@@ -3178,10 +3178,10 @@ var Ti = {
|
|
|
3178
3178
|
let n = this.registerMutation(t[e], s);
|
|
3179
3179
|
n && (i = i < 0 ? n.from : Math.min(n.from, i), a = a < 0 ? n.to : Math.max(n.to, a), n.typeOver && (o = !0));
|
|
3180
3180
|
}
|
|
3181
|
-
if (s.some((e) => e.nodeName == "BR") && (e.input.lastKeyCode == 8 || e.input.lastKeyCode == 46 ||
|
|
3181
|
+
if (s.some((e) => e.nodeName == "BR") && (e.input.lastKeyCode == 8 || e.input.lastKeyCode == 46 || N && (e.composing || e.input.compositionEndedAt > Date.now() - 50) && t.some((e) => e.type == "childList" && e.removedNodes.length))) {
|
|
3182
3182
|
for (let e of s) if (e.nodeName == "BR" && e.parentNode) {
|
|
3183
3183
|
let t = e.nextSibling;
|
|
3184
|
-
for (; t &&
|
|
3184
|
+
for (; t && O(t);) {
|
|
3185
3185
|
if (t.contentEditable == "false") {
|
|
3186
3186
|
e.parentNode.removeChild(e);
|
|
3187
3187
|
break;
|
|
@@ -3189,7 +3189,7 @@ var Ti = {
|
|
|
3189
3189
|
t = t.firstChild;
|
|
3190
3190
|
}
|
|
3191
3191
|
}
|
|
3192
|
-
} else if (
|
|
3192
|
+
} else if (M && s.length) {
|
|
3193
3193
|
let t = s.filter((e) => e.nodeName == "BR");
|
|
3194
3194
|
if (t.length == 2) {
|
|
3195
3195
|
let [e, n] = t;
|
|
@@ -3203,7 +3203,7 @@ var Ti = {
|
|
|
3203
3203
|
}
|
|
3204
3204
|
}
|
|
3205
3205
|
let c = null;
|
|
3206
|
-
i < 0 && r && e.input.lastFocus > Date.now() - 200 && Math.max(e.input.lastTouch, e.input.lastClick.time) < Date.now() - 300 &&
|
|
3206
|
+
i < 0 && r && e.input.lastFocus > Date.now() - 200 && Math.max(e.input.lastTouch, e.input.lastClick.time) < Date.now() - 300 && at(n) && (c = Dn(e)) && c.eq(v.near(e.state.doc.resolve(0), 1)) ? (e.input.lastFocus = 0, z(e), this.currentSelection.set(n), e.scrollToSelection()) : (i > -1 || r) && (i > -1 && (e.docView.markDirty(i, a), ji(e)), e.input.badSafariComposition && (e.input.badSafariComposition = !1, Fi(e, s)), this.handleDOMChange(i, a, o, s), e.docView && e.docView.dirty ? e.updateState(e.state) : this.currentSelection.eq(n) || z(e), this.currentSelection.set(n));
|
|
3207
3207
|
}
|
|
3208
3208
|
registerMutation(e, t) {
|
|
3209
3209
|
if (t.indexOf(e.target) > -1) return null;
|
|
@@ -3212,14 +3212,14 @@ var Ti = {
|
|
|
3212
3212
|
if (e.type == "childList") {
|
|
3213
3213
|
for (let n = 0; n < e.addedNodes.length; n++) {
|
|
3214
3214
|
let r = e.addedNodes[n];
|
|
3215
|
-
t.push(r),
|
|
3215
|
+
t.push(r), k(r) && (this.lastChangedTextNode = r);
|
|
3216
3216
|
}
|
|
3217
3217
|
if (n.contentDOM && n.contentDOM != n.dom && !n.contentDOM.contains(e.target)) return {
|
|
3218
3218
|
from: n.posBefore,
|
|
3219
3219
|
to: n.posAfter
|
|
3220
3220
|
};
|
|
3221
3221
|
let r = e.previousSibling, i = e.nextSibling;
|
|
3222
|
-
if (
|
|
3222
|
+
if (j && mt <= 11 && e.addedNodes.length) for (let t = 0; t < e.addedNodes.length; t++) {
|
|
3223
3223
|
let { previousSibling: n, nextSibling: a } = e.addedNodes[t];
|
|
3224
3224
|
(!n || Array.prototype.indexOf.call(e.addedNodes, n) < 0) && (r = n), (!a || Array.prototype.indexOf.call(e.addedNodes, a) < 0) && (i = a);
|
|
3225
3225
|
}
|
|
@@ -3245,13 +3245,13 @@ function ji(e) {
|
|
|
3245
3245
|
"nowrap",
|
|
3246
3246
|
"pre-line"
|
|
3247
3247
|
].indexOf(getComputedStyle(e.dom).whiteSpace) !== -1)) {
|
|
3248
|
-
if (e.requiresGeckoHackNode =
|
|
3248
|
+
if (e.requiresGeckoHackNode = M, Ai) return;
|
|
3249
3249
|
console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."), Ai = !0;
|
|
3250
3250
|
}
|
|
3251
3251
|
}
|
|
3252
3252
|
function Mi(e, t) {
|
|
3253
3253
|
let n = t.startContainer, r = t.startOffset, i = t.endContainer, a = t.endOffset, o = e.domAtPos(e.state.selection.anchor);
|
|
3254
|
-
return
|
|
3254
|
+
return Ze(o.node, o.offset, i, a) && ([n, r, i, a] = [
|
|
3255
3255
|
i,
|
|
3256
3256
|
a,
|
|
3257
3257
|
n,
|
|
@@ -3290,7 +3290,7 @@ function Fi(e, t) {
|
|
|
3290
3290
|
let a = t;
|
|
3291
3291
|
for (;;) {
|
|
3292
3292
|
let e = a.firstChild;
|
|
3293
|
-
if (!e || !
|
|
3293
|
+
if (!e || !O(e) || e.contentEditable == "false" || /^(BR|IMG)$/.test(e.nodeName)) break;
|
|
3294
3294
|
a = e;
|
|
3295
3295
|
}
|
|
3296
3296
|
a.insertBefore(i, a.firstChild), n == i && e.domSelection().collapse(i, r);
|
|
@@ -3299,13 +3299,13 @@ function Fi(e, t) {
|
|
|
3299
3299
|
}
|
|
3300
3300
|
function Ii(e, t, n, r) {
|
|
3301
3301
|
let { node: a, fromOffset: o, toOffset: s, from: c, to: l } = e.docView.parseRange(t, n), u = e.domSelectionRange(), d, f = u.anchorNode;
|
|
3302
|
-
if (f &&
|
|
3302
|
+
if (f && et(e.dom, f) && (d = [{
|
|
3303
3303
|
node: f,
|
|
3304
3304
|
offset: u.anchorOffset
|
|
3305
|
-
}],
|
|
3305
|
+
}], at(u) || d.push({
|
|
3306
3306
|
node: u.focusNode,
|
|
3307
3307
|
offset: u.focusOffset
|
|
3308
|
-
})),
|
|
3308
|
+
})), N && e.input.lastKeyCode === 8) for (let e = s; e > o; e--) {
|
|
3309
3309
|
let t = a.childNodes[e - 1], n = t.pmViewDesc;
|
|
3310
3310
|
if (t.nodeName == "BR" && !n) {
|
|
3311
3311
|
s = e;
|
|
@@ -3342,11 +3342,11 @@ var Li = (e) => (t) => {
|
|
|
3342
3342
|
let n = t.pmViewDesc;
|
|
3343
3343
|
if (n) return n.parseRule(e);
|
|
3344
3344
|
if (t.nodeName == "BR" && t.parentNode) {
|
|
3345
|
-
if (
|
|
3345
|
+
if (P && /^(ul|ol)$/i.test(t.parentNode.nodeName)) {
|
|
3346
3346
|
let e = document.createElement("div");
|
|
3347
3347
|
return e.appendChild(document.createElement("li")), { skip: e };
|
|
3348
3348
|
}
|
|
3349
|
-
if (t.parentNode.lastChild == t ||
|
|
3349
|
+
if (t.parentNode.lastChild == t || P && /^(tr|table)$/i.test(t.parentNode.nodeName)) return { ignore: !0 };
|
|
3350
3350
|
} else if (t.nodeName == "IMG" && t.getAttribute("mark-placeholder")) return { ignore: !0 };
|
|
3351
3351
|
return null;
|
|
3352
3352
|
}, Ri = /^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;
|
|
@@ -3355,7 +3355,7 @@ function zi(e, t, n, r, i) {
|
|
|
3355
3355
|
if (e.input.compositionPendingChanges = 0, t < 0) {
|
|
3356
3356
|
let t = e.input.lastSelectionTime > Date.now() - 50 ? e.input.lastSelectionOrigin : null, n = Dn(e, t);
|
|
3357
3357
|
if (n && !e.state.selection.eq(n)) {
|
|
3358
|
-
if (
|
|
3358
|
+
if (N && yt && e.input.lastKeyCode === 13 && Date.now() - 100 < e.input.lastKeyCodeTime && e.someProp("handleKeyDown", (t) => t(e, ot(13, "Enter")))) return;
|
|
3359
3359
|
let r = e.state.tr.setSelection(n);
|
|
3360
3360
|
t == "pointer" ? r.setMeta("pointer", !0) : t == "key" && r.scrollIntoView(), a && r.setMeta("composition", a), e.dispatch(r);
|
|
3361
3361
|
}
|
|
@@ -3366,7 +3366,7 @@ function zi(e, t, n, r, i) {
|
|
|
3366
3366
|
let c = e.state.selection, u = Ii(e, t, n, i), d = e.state.doc, f = d.slice(u.from, u.to), p, m;
|
|
3367
3367
|
e.input.lastKeyCode === 8 && Date.now() - 100 < e.input.lastKeyCodeTime ? (p = e.state.selection.to, m = "end") : (p = e.state.selection.from, m = "start"), e.input.lastKeyCode = null;
|
|
3368
3368
|
let h = Gi(f.content, u.doc.content, u.from, p, m);
|
|
3369
|
-
if (h && e.input.domChangeCount++, (
|
|
3369
|
+
if (h && e.input.domChangeCount++, (_t && e.input.lastIOSEnter > Date.now() - 225 || yt) && i.some((e) => O(e) && !Ri.test(e.nodeName)) && (!h || h.endA >= h.endB) && e.someProp("handleKeyDown", (t) => t(e, ot(13, "Enter")))) {
|
|
3370
3370
|
e.input.lastIOSEnter = 0;
|
|
3371
3371
|
return;
|
|
3372
3372
|
}
|
|
@@ -3387,32 +3387,32 @@ function zi(e, t, n, r, i) {
|
|
|
3387
3387
|
return;
|
|
3388
3388
|
}
|
|
3389
3389
|
}
|
|
3390
|
-
e.state.selection.from < e.state.selection.to && h.start == h.endB && e.state.selection instanceof l && (h.start > e.state.selection.from && h.start <= e.state.selection.from + 2 && e.state.selection.from >= u.from ? h.start = e.state.selection.from : h.endA < e.state.selection.to && h.endA >= e.state.selection.to - 2 && e.state.selection.to <= u.to && (h.endB += e.state.selection.to - h.endA, h.endA = e.state.selection.to)),
|
|
3390
|
+
e.state.selection.from < e.state.selection.to && h.start == h.endB && e.state.selection instanceof l && (h.start > e.state.selection.from && h.start <= e.state.selection.from + 2 && e.state.selection.from >= u.from ? h.start = e.state.selection.from : h.endA < e.state.selection.to && h.endA >= e.state.selection.to - 2 && e.state.selection.to <= u.to && (h.endB += e.state.selection.to - h.endA, h.endA = e.state.selection.to)), j && mt <= 11 && h.endB == h.start + 1 && h.endA == h.start && h.start > u.from && u.doc.textBetween(h.start - u.from - 1, h.start - u.from + 1) == " \xA0" && (h.start--, h.endA--, h.endB--);
|
|
3391
3391
|
let g = u.doc.resolveNoCache(h.start - u.from), _ = u.doc.resolveNoCache(h.endB - u.from), v = d.resolve(h.start), y = g.sameParent(_) && g.parent.inlineContent && v.end() >= h.endA;
|
|
3392
|
-
if ((
|
|
3392
|
+
if ((_t && e.input.lastIOSEnter > Date.now() - 225 && (!y || i.some((e) => e.nodeName == "DIV" || e.nodeName == "P")) || !y && Ui(u.doc, g.pos, _.pos)) && e.someProp("handleKeyDown", (t) => t(e, ot(13, "Enter")))) {
|
|
3393
3393
|
e.input.lastIOSEnter = 0;
|
|
3394
3394
|
return;
|
|
3395
3395
|
}
|
|
3396
|
-
if (e.state.selection.anchor > h.start && Hi(d, h.start, h.endA, g, _) && e.someProp("handleKeyDown", (t) => t(e,
|
|
3397
|
-
|
|
3396
|
+
if (e.state.selection.anchor > h.start && Hi(d, h.start, h.endA, g, _) && e.someProp("handleKeyDown", (t) => t(e, ot(8, "Backspace")))) {
|
|
3397
|
+
yt && N && e.domObserver.suppressSelectionUpdates();
|
|
3398
3398
|
return;
|
|
3399
3399
|
}
|
|
3400
|
-
|
|
3400
|
+
N && h.endB == h.start && (e.input.lastChromeDelete = Date.now()), yt && !y && g.start() != _.start() && _.parentOffset == 0 && g.depth == _.depth && u.sel && u.sel.anchor == u.sel.head && u.sel.head == h.endA && (h.endB -= 2, _ = u.doc.resolveNoCache(h.endB - u.from), setTimeout(() => {
|
|
3401
3401
|
e.someProp("handleKeyDown", function(t) {
|
|
3402
|
-
return t(e,
|
|
3402
|
+
return t(e, ot(13, "Enter"));
|
|
3403
3403
|
});
|
|
3404
3404
|
}, 20));
|
|
3405
3405
|
let b = h.start, x = h.endA, ee = (t) => {
|
|
3406
3406
|
let n = t || e.state.tr.replace(b, x, u.doc.slice(h.start - u.from, h.endB - u.from));
|
|
3407
3407
|
if (u.sel) {
|
|
3408
3408
|
let t = Bi(e, n.doc, u.sel);
|
|
3409
|
-
t && !(
|
|
3409
|
+
t && !(N && e.composing && t.empty && (h.start != h.endB || e.input.lastChromeDelete < Date.now() - 100) && (t.head == b || t.head == n.mapping.map(x) - 1) || j && t.empty && t.head == b) && n.setSelection(t);
|
|
3410
3410
|
}
|
|
3411
3411
|
return a && n.setMeta("composition", a), n.scrollIntoView();
|
|
3412
3412
|
}, S;
|
|
3413
3413
|
if (y) {
|
|
3414
3414
|
if (g.pos == _.pos) {
|
|
3415
|
-
|
|
3415
|
+
j && mt <= 11 && g.parentOffset == 0 && (e.domObserver.suppressSelectionUpdates(), setTimeout(() => z(e), 20));
|
|
3416
3416
|
let t = ee(e.state.tr.delete(b, x)), n = d.resolve(h.start).marksAcross(d.resolve(h.endA));
|
|
3417
3417
|
n && t.ensureMarks(n), e.dispatch(t);
|
|
3418
3418
|
} else if (h.endA == h.endB && (S = Vi(g.parent.content.cut(g.parentOffset, _.parentOffset), v.parent.content.cut(v.parentOffset, h.endA - v.start())))) {
|
|
@@ -3533,9 +3533,9 @@ var Ki = class {
|
|
|
3533
3533
|
let u = c == "preserve" && i && this.dom.style.overflowAnchor == null && Tt(this);
|
|
3534
3534
|
if (i) {
|
|
3535
3535
|
this.domObserver.stop();
|
|
3536
|
-
let t = l && (
|
|
3536
|
+
let t = l && (j || N) && !this.composing && !n.selection.empty && !e.selection.empty && Xi(n.selection, e.selection);
|
|
3537
3537
|
if (l) {
|
|
3538
|
-
let n =
|
|
3538
|
+
let n = N ? this.trackWrites = this.domSelectionRange().focusNode : null;
|
|
3539
3539
|
this.composing && (this.input.compositionNode = Xr(this)), (r || !this.docView.update(e.doc, s, o, this)) && (this.docView.updateOuterDeco(s), this.docView.destroy(), this.docView = sn(e.doc, s, o, this.dom, this)), n && (!this.trackWrites || !this.dom.contains(this.trackWrites)) && (t = !0);
|
|
3540
3540
|
}
|
|
3541
3541
|
let i = this.input.mouseDown;
|
|
@@ -3545,10 +3545,10 @@ var Ki = class {
|
|
|
3545
3545
|
}
|
|
3546
3546
|
scrollToSelection() {
|
|
3547
3547
|
let e = this.domSelectionRange().focusNode;
|
|
3548
|
-
if (e &&
|
|
3548
|
+
if (e && et(this.dom, e) && !this.someProp("handleScrollToSelection", (e) => e(this))) {
|
|
3549
3549
|
if (this.state.selection instanceof b) {
|
|
3550
3550
|
let t = this.docView.domAfterPos(this.state.selection.from);
|
|
3551
|
-
|
|
3551
|
+
O(t) && wt(this, t.getBoundingClientRect(), e);
|
|
3552
3552
|
} else wt(this, this.coordsAtPos(this.state.selection.head, 1), e);
|
|
3553
3553
|
}
|
|
3554
3554
|
}
|
|
@@ -3595,7 +3595,7 @@ var Ki = class {
|
|
|
3595
3595
|
}
|
|
3596
3596
|
}
|
|
3597
3597
|
hasFocus() {
|
|
3598
|
-
if (
|
|
3598
|
+
if (j) {
|
|
3599
3599
|
let e = this.root.activeElement;
|
|
3600
3600
|
if (e == this.dom) return !0;
|
|
3601
3601
|
if (!e || !this.dom.contains(e)) return !1;
|
|
@@ -3651,7 +3651,7 @@ var Ki = class {
|
|
|
3651
3651
|
return ar(this, e);
|
|
3652
3652
|
}
|
|
3653
3653
|
destroy() {
|
|
3654
|
-
this.docView && (wr(this), this.destroyPluginViews(), this.mounted ? (this.docView.update(this.state.doc, [], wi(this), this), this.dom.textContent = "") : this.dom.parentNode && this.dom.parentNode.removeChild(this.dom), this.docView.destroy(), this.docView = null,
|
|
3654
|
+
this.docView && (wr(this), this.destroyPluginViews(), this.mounted ? (this.docView.update(this.state.doc, [], wi(this), this), this.dom.textContent = "") : this.dom.parentNode && this.dom.parentNode.removeChild(this.dom), this.docView.destroy(), this.docView = null, Xe());
|
|
3655
3655
|
}
|
|
3656
3656
|
get isDestroyed() {
|
|
3657
3657
|
return this.docView == null;
|
|
@@ -3661,7 +3661,7 @@ var Ki = class {
|
|
|
3661
3661
|
}
|
|
3662
3662
|
domSelectionRange() {
|
|
3663
3663
|
let e = this.dom.isConnected !== !1 && this.domSelection();
|
|
3664
|
-
return e ?
|
|
3664
|
+
return e ? P && this.root.nodeType === 11 && st(this.dom.ownerDocument) == this.dom && Ni(this, e) || e : {
|
|
3665
3665
|
focusNode: null,
|
|
3666
3666
|
focusOffset: 0,
|
|
3667
3667
|
anchorNode: null,
|
|
@@ -3985,7 +3985,8 @@ var ha = /* @__PURE__ */ function(e) {
|
|
|
3985
3985
|
}
|
|
3986
3986
|
rebased(t, n) {
|
|
3987
3987
|
if (!this.eventCount) return this;
|
|
3988
|
-
|
|
3988
|
+
n = Math.min(this.items.length, n);
|
|
3989
|
+
let r = [], i = this.items.length - n, a = t.mapping, o = t.steps.length, s = this.eventCount;
|
|
3989
3990
|
this.items.forEach((e) => {
|
|
3990
3991
|
e.selection && s--;
|
|
3991
3992
|
}, i);
|
|
@@ -4146,7 +4147,7 @@ function La(e) {
|
|
|
4146
4147
|
return e.getMeta(ja) != null;
|
|
4147
4148
|
}
|
|
4148
4149
|
//#endregion
|
|
4149
|
-
//#region ../../../node_modules/.bun/@tiptap+core@3.
|
|
4150
|
+
//#region ../../../node_modules/.bun/@tiptap+core@3.32.0+25ef31ca716a1493/node_modules/@tiptap/core/dist/index.js
|
|
4150
4151
|
function Ra(e) {
|
|
4151
4152
|
let { state: t, transaction: n } = e, { selection: r } = n, { doc: i } = n, { storedMarks: a } = n;
|
|
4152
4153
|
return {
|
|
@@ -4583,14 +4584,14 @@ var To = (e = {}) => ({ tr: t, dispatch: n, editor: r }) => {
|
|
|
4583
4584
|
return !r || !i ? !1 : !r.type.spec.isolating && !i.type.spec.isolating;
|
|
4584
4585
|
}, jo = () => ({ state: e, dispatch: t, tr: n }) => {
|
|
4585
4586
|
try {
|
|
4586
|
-
let r =
|
|
4587
|
+
let r = ne(e.doc, e.selection.$from.pos, -1);
|
|
4587
4588
|
return r == null || !Ao(e.doc, r) ? !1 : (n.join(r, 2), t && t(n), !0);
|
|
4588
4589
|
} catch {
|
|
4589
4590
|
return !1;
|
|
4590
4591
|
}
|
|
4591
4592
|
}, Mo = () => ({ state: e, dispatch: t, tr: n }) => {
|
|
4592
4593
|
try {
|
|
4593
|
-
let r =
|
|
4594
|
+
let r = ne(e.doc, e.selection.$from.pos, 1);
|
|
4594
4595
|
return r == null || !Ao(e.doc, r) ? !1 : (n.join(r, 2), t && t(n), !0);
|
|
4595
4596
|
} catch {
|
|
4596
4597
|
return !1;
|
|
@@ -4770,24 +4771,97 @@ function ls(t, n) {
|
|
|
4770
4771
|
let r = e.fromSchema(n).serializeFragment(t), i = document.implementation.createHTMLDocument().createElement("div");
|
|
4771
4772
|
return i.appendChild(r), i.innerHTML;
|
|
4772
4773
|
}
|
|
4773
|
-
function us(e) {
|
|
4774
|
-
|
|
4774
|
+
function us(e, t) {
|
|
4775
|
+
let n = /* @__PURE__ */ new Map();
|
|
4776
|
+
for (let t of e) {
|
|
4777
|
+
let e = n.get(t.type) ?? /* @__PURE__ */ new Map();
|
|
4778
|
+
e.set(t.name, t), n.set(t.type, e);
|
|
4779
|
+
}
|
|
4780
|
+
return [...Object.values(t.nodes), ...Object.values(t.marks)].flatMap((e) => Object.entries(e.spec.attrs ?? {}).map(([t, r]) => {
|
|
4781
|
+
let i = n.get(e.name)?.get(t), a = Object.hasOwn(r, "default");
|
|
4782
|
+
return {
|
|
4783
|
+
type: e.name,
|
|
4784
|
+
name: t,
|
|
4785
|
+
attribute: {
|
|
4786
|
+
rendered: !0,
|
|
4787
|
+
renderHTML: null,
|
|
4788
|
+
parseHTML: null,
|
|
4789
|
+
keepOnSplit: !0,
|
|
4790
|
+
...i?.attribute,
|
|
4791
|
+
default: r.default,
|
|
4792
|
+
isRequired: !a,
|
|
4793
|
+
validate: r.validate
|
|
4794
|
+
}
|
|
4795
|
+
};
|
|
4796
|
+
}));
|
|
4775
4797
|
}
|
|
4776
|
-
|
|
4777
|
-
|
|
4798
|
+
var ds = {
|
|
4799
|
+
content: "string",
|
|
4800
|
+
marks: "string",
|
|
4801
|
+
group: "string",
|
|
4802
|
+
inline: "boolean",
|
|
4803
|
+
atom: "boolean",
|
|
4804
|
+
selectable: "boolean",
|
|
4805
|
+
draggable: "boolean",
|
|
4806
|
+
code: "boolean",
|
|
4807
|
+
whitespace: ["pre", "normal"],
|
|
4808
|
+
definingAsContext: "boolean",
|
|
4809
|
+
definingForContent: "boolean",
|
|
4810
|
+
defining: "boolean",
|
|
4811
|
+
isolating: "boolean",
|
|
4812
|
+
linebreakReplacement: "boolean"
|
|
4813
|
+
}, fs = {
|
|
4814
|
+
inclusive: "boolean",
|
|
4815
|
+
excludes: "string",
|
|
4816
|
+
group: "string",
|
|
4817
|
+
spanning: "boolean",
|
|
4818
|
+
code: "boolean"
|
|
4819
|
+
};
|
|
4820
|
+
function ps(e, t, n) {
|
|
4821
|
+
return Object.fromEntries(Object.entries(t).flatMap(([t, r]) => {
|
|
4822
|
+
let i = e[t];
|
|
4823
|
+
if (i === void 0) return [];
|
|
4824
|
+
if (!(typeof r == "string" ? typeof i === r : typeof i == "string" && r.includes(i))) throw RangeError(`Invalid schemaSpec field '${n}.${t}'`);
|
|
4825
|
+
return [[t, i]];
|
|
4826
|
+
}));
|
|
4778
4827
|
}
|
|
4779
|
-
function
|
|
4780
|
-
return
|
|
4828
|
+
function ms(e, t, n, r) {
|
|
4829
|
+
return {
|
|
4830
|
+
...Object.fromEntries(Object.entries(t).filter(([e]) => e !== "attrs" && !Object.hasOwn(r, e))),
|
|
4831
|
+
...ps(n, r, e),
|
|
4832
|
+
attrs: n.attrs
|
|
4833
|
+
};
|
|
4781
4834
|
}
|
|
4782
|
-
function
|
|
4835
|
+
function hs(e, t, n) {
|
|
4836
|
+
for (let r of Object.keys(t)) if (!Object.hasOwn(e, r)) throw RangeError(`schemaSpec requires a local ${n} extension named '${r}'`);
|
|
4837
|
+
for (let r of Object.keys(e)) if (!Object.hasOwn(t, r)) throw RangeError(`Local ${n} extension '${r}' is not in schemaSpec`);
|
|
4838
|
+
}
|
|
4839
|
+
function gs(e, t) {
|
|
4840
|
+
hs(e.nodes, t.nodes, "node"), hs(e.marks, t.marks, "mark");
|
|
4841
|
+
let n = t.spec.nodes, r = t.spec.marks;
|
|
4842
|
+
return t.spec.nodes.forEach((t, r) => {
|
|
4843
|
+
n = n.update(t, ms(t, e.nodes[t], r, ds));
|
|
4844
|
+
}), t.spec.marks.forEach((t, n) => {
|
|
4845
|
+
r = r.update(t, ms(t, e.marks[t], n, fs));
|
|
4846
|
+
}), {
|
|
4847
|
+
topNode: t.topNodeType.name,
|
|
4848
|
+
nodes: n,
|
|
4849
|
+
marks: r
|
|
4850
|
+
};
|
|
4851
|
+
}
|
|
4852
|
+
function _s(e) {
|
|
4853
|
+
let t = e.filter((t, n) => e.indexOf(t) !== n);
|
|
4854
|
+
return Array.from(new Set(t));
|
|
4855
|
+
}
|
|
4856
|
+
function vs(e) {
|
|
4783
4857
|
return {
|
|
4784
4858
|
baseExtensions: e.filter((e) => e.type === "extension"),
|
|
4785
4859
|
nodeExtensions: e.filter((e) => e.type === "node"),
|
|
4786
4860
|
markExtensions: e.filter((e) => e.type === "mark")
|
|
4787
4861
|
};
|
|
4788
4862
|
}
|
|
4789
|
-
function
|
|
4790
|
-
let t = [], { nodeExtensions: n, markExtensions: r } =
|
|
4863
|
+
function ys(e) {
|
|
4864
|
+
let t = [], { nodeExtensions: n, markExtensions: r } = vs(e), i = [...n, ...r], a = {
|
|
4791
4865
|
default: null,
|
|
4792
4866
|
validate: void 0,
|
|
4793
4867
|
rendered: !0,
|
|
@@ -4839,7 +4913,16 @@ function ps(e) {
|
|
|
4839
4913
|
});
|
|
4840
4914
|
}), t;
|
|
4841
4915
|
}
|
|
4842
|
-
function
|
|
4916
|
+
function bs(e) {
|
|
4917
|
+
return typeof e == "function";
|
|
4918
|
+
}
|
|
4919
|
+
function Q(e, t = void 0, ...n) {
|
|
4920
|
+
return bs(e) ? t ? e.bind(t)(...n) : e(...n) : e;
|
|
4921
|
+
}
|
|
4922
|
+
function xs(e = {}) {
|
|
4923
|
+
return Object.keys(e).length === 0 && e.constructor === Object;
|
|
4924
|
+
}
|
|
4925
|
+
function Ss(e) {
|
|
4843
4926
|
let t = [], n = "", r = !1, i = !1, a = 0, o = e.length;
|
|
4844
4927
|
for (let s = 0; s < o; s += 1) {
|
|
4845
4928
|
let o = e[s];
|
|
@@ -4865,8 +4948,8 @@ function ms(e) {
|
|
|
4865
4948
|
}
|
|
4866
4949
|
return n && t.push(n), t;
|
|
4867
4950
|
}
|
|
4868
|
-
function
|
|
4869
|
-
let t = [], n =
|
|
4951
|
+
function Cs(e) {
|
|
4952
|
+
let t = [], n = Ss(e || ""), r = n.length;
|
|
4870
4953
|
for (let e = 0; e < r; e += 1) {
|
|
4871
4954
|
let r = n[e], i = r.indexOf(":");
|
|
4872
4955
|
if (i === -1) continue;
|
|
@@ -4875,7 +4958,7 @@ function hs(e) {
|
|
|
4875
4958
|
}
|
|
4876
4959
|
return t;
|
|
4877
4960
|
}
|
|
4878
|
-
function
|
|
4961
|
+
function ws(...e) {
|
|
4879
4962
|
return e.filter((e) => !!e).reduce((e, t) => {
|
|
4880
4963
|
let n = { ...e };
|
|
4881
4964
|
return Object.entries(t).forEach(([e, t]) => {
|
|
@@ -4890,26 +4973,26 @@ function gs(...e) {
|
|
|
4890
4973
|
let r = t ? String(t).split(" ") : [], i = n[e] ? n[e].split(" ") : [], a = r.filter((e) => !i.includes(e));
|
|
4891
4974
|
n[e] = [...i, ...a].join(" ");
|
|
4892
4975
|
} else if (e === "style") {
|
|
4893
|
-
let r = new Map([...
|
|
4976
|
+
let r = new Map([...Cs(n[e]), ...Cs(t)]);
|
|
4894
4977
|
n[e] = Array.from(r.entries()).map(([e, t]) => `${e}: ${t}`).join("; ");
|
|
4895
4978
|
} else n[e] = t;
|
|
4896
4979
|
}), n;
|
|
4897
4980
|
}, {});
|
|
4898
4981
|
}
|
|
4899
|
-
function
|
|
4900
|
-
return t.filter((t) => t.type === e.type.name).filter((e) => e.attribute.rendered).map((t) => t.attribute.renderHTML ? t.attribute.renderHTML(e.attrs) || {} : { [t.name]: e.attrs[t.name] }).reduce((e, t) =>
|
|
4982
|
+
function Ts(e, t) {
|
|
4983
|
+
return t.filter((t) => t.type === e.type.name).filter((e) => e.attribute.rendered).map((t) => t.attribute.renderHTML ? t.attribute.renderHTML(e.attrs) || {} : { [t.name]: e.attrs[t.name] }).reduce((e, t) => ws(e, t), {});
|
|
4901
4984
|
}
|
|
4902
|
-
function
|
|
4985
|
+
function Es(e) {
|
|
4903
4986
|
return typeof e == "string" ? e.match(/^[+-]?(?:\d*\.)?\d+$/) ? Number(e) : e === "true" || e !== "false" && e : e;
|
|
4904
4987
|
}
|
|
4905
|
-
function
|
|
4988
|
+
function Ds(e, t) {
|
|
4906
4989
|
return "style" in e ? e : {
|
|
4907
4990
|
...e,
|
|
4908
4991
|
getAttrs: (n) => {
|
|
4909
4992
|
let r = e.getAttrs ? e.getAttrs(n) : e.attrs;
|
|
4910
4993
|
if (r === !1) return !1;
|
|
4911
4994
|
let i = t.reduce((e, t) => {
|
|
4912
|
-
let r = t.attribute.parseHTML ? t.attribute.parseHTML(n) :
|
|
4995
|
+
let r = t.attribute.parseHTML ? t.attribute.parseHTML(n) : Es(n.getAttribute(t.name));
|
|
4913
4996
|
return r == null ? e : {
|
|
4914
4997
|
...e,
|
|
4915
4998
|
[t.name]: r
|
|
@@ -4922,111 +5005,114 @@ function ys(e, t) {
|
|
|
4922
5005
|
}
|
|
4923
5006
|
};
|
|
4924
5007
|
}
|
|
4925
|
-
function
|
|
4926
|
-
return Object.fromEntries(Object.entries(e).filter(([e, t]) => e === "attrs" &&
|
|
5008
|
+
function Os(e) {
|
|
5009
|
+
return Object.fromEntries(Object.entries(e).filter(([e, t]) => e === "attrs" && xs(t) ? !1 : t != null));
|
|
4927
5010
|
}
|
|
4928
|
-
function
|
|
5011
|
+
function ks(e) {
|
|
4929
5012
|
var t, n;
|
|
4930
5013
|
let r = {};
|
|
4931
5014
|
return !(e != null && (t = e.attribute) != null && t.isRequired) && "default" in (e?.attribute || {}) && (r.default = e.attribute.default), (e == null || (n = e.attribute) == null ? void 0 : n.validate) !== void 0 && (r.validate = e.attribute.validate), [e.name, r];
|
|
4932
5015
|
}
|
|
4933
|
-
function
|
|
4934
|
-
let
|
|
4935
|
-
|
|
4936
|
-
|
|
4937
|
-
|
|
4938
|
-
|
|
4939
|
-
|
|
4940
|
-
|
|
4941
|
-
|
|
4942
|
-
|
|
4943
|
-
|
|
4944
|
-
|
|
4945
|
-
|
|
4946
|
-
|
|
4947
|
-
|
|
4948
|
-
|
|
4949
|
-
|
|
4950
|
-
|
|
4951
|
-
|
|
4952
|
-
|
|
4953
|
-
|
|
4954
|
-
|
|
4955
|
-
|
|
4956
|
-
|
|
4957
|
-
|
|
4958
|
-
|
|
4959
|
-
|
|
4960
|
-
|
|
4961
|
-
|
|
4962
|
-
|
|
4963
|
-
|
|
4964
|
-
|
|
4965
|
-
|
|
4966
|
-
|
|
4967
|
-
|
|
4968
|
-
|
|
4969
|
-
|
|
4970
|
-
|
|
4971
|
-
|
|
4972
|
-
|
|
4973
|
-
|
|
4974
|
-
|
|
4975
|
-
|
|
4976
|
-
|
|
4977
|
-
|
|
4978
|
-
|
|
4979
|
-
|
|
4980
|
-
|
|
4981
|
-
|
|
4982
|
-
|
|
4983
|
-
|
|
4984
|
-
|
|
4985
|
-
|
|
4986
|
-
|
|
4987
|
-
|
|
4988
|
-
|
|
4989
|
-
|
|
4990
|
-
|
|
4991
|
-
|
|
4992
|
-
|
|
4993
|
-
|
|
4994
|
-
|
|
4995
|
-
|
|
4996
|
-
|
|
4997
|
-
|
|
4998
|
-
|
|
4999
|
-
|
|
5000
|
-
|
|
5001
|
-
|
|
5002
|
-
}
|
|
5016
|
+
function As(e, t, n = ys(e)) {
|
|
5017
|
+
let { nodeExtensions: r, markExtensions: i } = vs(e);
|
|
5018
|
+
return {
|
|
5019
|
+
topNode: r.find((e) => Z(e, "topNode"))?.name,
|
|
5020
|
+
nodes: Object.fromEntries(r.map((r) => {
|
|
5021
|
+
let i = n.filter((e) => e.type === r.name), a = {
|
|
5022
|
+
name: r.name,
|
|
5023
|
+
options: r.options,
|
|
5024
|
+
storage: r.storage,
|
|
5025
|
+
editor: t
|
|
5026
|
+
}, o = Os({
|
|
5027
|
+
...e.reduce((e, t) => {
|
|
5028
|
+
let n = Z(t, "extendNodeSchema", a);
|
|
5029
|
+
return {
|
|
5030
|
+
...e,
|
|
5031
|
+
...n ? n(r) : {}
|
|
5032
|
+
};
|
|
5033
|
+
}, {}),
|
|
5034
|
+
content: Q(Z(r, "content", a)),
|
|
5035
|
+
marks: Q(Z(r, "marks", a)),
|
|
5036
|
+
group: Q(Z(r, "group", a)),
|
|
5037
|
+
inline: Q(Z(r, "inline", a)),
|
|
5038
|
+
atom: Q(Z(r, "atom", a)),
|
|
5039
|
+
selectable: Q(Z(r, "selectable", a)),
|
|
5040
|
+
draggable: Q(Z(r, "draggable", a)),
|
|
5041
|
+
code: Q(Z(r, "code", a)),
|
|
5042
|
+
whitespace: Q(Z(r, "whitespace", a)),
|
|
5043
|
+
linebreakReplacement: Q(Z(r, "linebreakReplacement", a)),
|
|
5044
|
+
defining: Q(Z(r, "defining", a)),
|
|
5045
|
+
isolating: Q(Z(r, "isolating", a)),
|
|
5046
|
+
attrs: Object.fromEntries(i.map(ks))
|
|
5047
|
+
}), s = Q(Z(r, "parseHTML", a));
|
|
5048
|
+
s && (o.parseDOM = s.map((e) => Ds(e, i)));
|
|
5049
|
+
let c = Z(r, "renderHTML", a);
|
|
5050
|
+
c && (o.toDOM = (e) => c({
|
|
5051
|
+
node: e,
|
|
5052
|
+
HTMLAttributes: Ts(e, i)
|
|
5053
|
+
}));
|
|
5054
|
+
let l = Z(r, "renderText", a);
|
|
5055
|
+
return l && (o.toText = l), [r.name, o];
|
|
5056
|
+
})),
|
|
5057
|
+
marks: Object.fromEntries(i.map((r) => {
|
|
5058
|
+
let i = n.filter((e) => e.type === r.name), a = {
|
|
5059
|
+
name: r.name,
|
|
5060
|
+
options: r.options,
|
|
5061
|
+
storage: r.storage,
|
|
5062
|
+
editor: t
|
|
5063
|
+
}, o = Os({
|
|
5064
|
+
...e.reduce((e, t) => {
|
|
5065
|
+
let n = Z(t, "extendMarkSchema", a);
|
|
5066
|
+
return {
|
|
5067
|
+
...e,
|
|
5068
|
+
...n ? n(r) : {}
|
|
5069
|
+
};
|
|
5070
|
+
}, {}),
|
|
5071
|
+
inclusive: Q(Z(r, "inclusive", a)),
|
|
5072
|
+
excludes: Q(Z(r, "excludes", a)),
|
|
5073
|
+
group: Q(Z(r, "group", a)),
|
|
5074
|
+
spanning: Q(Z(r, "spanning", a)),
|
|
5075
|
+
code: Q(Z(r, "code", a)),
|
|
5076
|
+
attrs: Object.fromEntries(i.map(ks))
|
|
5077
|
+
}), s = Q(Z(r, "parseHTML", a));
|
|
5078
|
+
s && (o.parseDOM = s.map((e) => Ds(e, i)));
|
|
5079
|
+
let c = Z(r, "renderHTML", a);
|
|
5080
|
+
return c && (o.toDOM = (e) => c({
|
|
5081
|
+
mark: e,
|
|
5082
|
+
HTMLAttributes: Ts(e, i)
|
|
5083
|
+
})), [r.name, o];
|
|
5084
|
+
}))
|
|
5085
|
+
};
|
|
5003
5086
|
}
|
|
5004
|
-
function
|
|
5005
|
-
|
|
5006
|
-
|
|
5087
|
+
function js(e, t, n) {
|
|
5088
|
+
if (n === void 0) return new r(As(e, t));
|
|
5089
|
+
let i = _s(e.filter((e) => e.type !== "extension").map((e) => e.name));
|
|
5090
|
+
if (i.length) throw RangeError(`Duplicate local schema types: ${i.join(", ")}`);
|
|
5091
|
+
let a = new r(n), o = As(e, t, us(ys(e), a));
|
|
5092
|
+
return new r(gs(o, a));
|
|
5007
5093
|
}
|
|
5008
|
-
function
|
|
5094
|
+
function Ms(e) {
|
|
5009
5095
|
return e.sort((e, t) => {
|
|
5010
5096
|
let n = Z(e, "priority") || 100, r = Z(t, "priority") || 100;
|
|
5011
5097
|
return n > r ? -1 : +(n < r);
|
|
5012
5098
|
});
|
|
5013
5099
|
}
|
|
5014
|
-
function
|
|
5015
|
-
let t =
|
|
5100
|
+
function Ns(e) {
|
|
5101
|
+
let t = Ms(cs(e)), n = _s(t.map((e) => e.name));
|
|
5016
5102
|
return n.length && console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map((e) => `'${e}'`).join(", ")}]. This can lead to issues.`), t;
|
|
5017
5103
|
}
|
|
5018
|
-
function
|
|
5019
|
-
return
|
|
5104
|
+
function Ps(e, t) {
|
|
5105
|
+
return js(Ns(e), t);
|
|
5020
5106
|
}
|
|
5021
|
-
function
|
|
5022
|
-
let r =
|
|
5107
|
+
function Fs(e, t) {
|
|
5108
|
+
let r = Ps(t);
|
|
5023
5109
|
return ls(n.fromJSON(r, e).content, r);
|
|
5024
5110
|
}
|
|
5025
|
-
function
|
|
5026
|
-
let n =
|
|
5111
|
+
function Is(e, t) {
|
|
5112
|
+
let n = Ps(t), r = vo(e);
|
|
5027
5113
|
return i.fromSchema(n).parse(r).toJSON();
|
|
5028
5114
|
}
|
|
5029
|
-
function
|
|
5115
|
+
function Ls(e, t, n) {
|
|
5030
5116
|
let { from: r, to: i } = t, { blockSeparator: a = "\n\n", textSerializers: o = {} } = n || {}, s = "";
|
|
5031
5117
|
return e.nodesBetween(r, i, (e, n, c, l) => {
|
|
5032
5118
|
e.isBlock && n > r && (s += a);
|
|
@@ -5044,26 +5130,26 @@ function ks(e, t, n) {
|
|
|
5044
5130
|
}
|
|
5045
5131
|
}), s;
|
|
5046
5132
|
}
|
|
5047
|
-
function
|
|
5048
|
-
return
|
|
5133
|
+
function Rs(e, t) {
|
|
5134
|
+
return Ls(e, {
|
|
5049
5135
|
from: 0,
|
|
5050
5136
|
to: e.content.size
|
|
5051
5137
|
}, t);
|
|
5052
5138
|
}
|
|
5053
|
-
function
|
|
5139
|
+
function zs(e) {
|
|
5054
5140
|
return Object.fromEntries(Object.entries(e.nodes).filter(([, e]) => e.spec.toText).map(([e, t]) => [e, t.spec.toText]));
|
|
5055
5141
|
}
|
|
5056
|
-
function
|
|
5057
|
-
let { blockSeparator: i = "\n\n", textSerializers: a = {} } = r || {}, o =
|
|
5058
|
-
return
|
|
5142
|
+
function Bs(e, t, r) {
|
|
5143
|
+
let { blockSeparator: i = "\n\n", textSerializers: a = {} } = r || {}, o = Ps(t);
|
|
5144
|
+
return Rs(n.fromJSON(o, e), {
|
|
5059
5145
|
blockSeparator: i,
|
|
5060
5146
|
textSerializers: {
|
|
5061
|
-
...
|
|
5147
|
+
...zs(o),
|
|
5062
5148
|
...a
|
|
5063
5149
|
}
|
|
5064
5150
|
});
|
|
5065
5151
|
}
|
|
5066
|
-
function
|
|
5152
|
+
function Vs(e, t) {
|
|
5067
5153
|
let n = J(t, e.schema), { from: r, to: i } = e.selection, a = [];
|
|
5068
5154
|
e.doc.nodesBetween(r, i, (e) => {
|
|
5069
5155
|
a.push(e);
|
|
@@ -5071,22 +5157,22 @@ function Ns(e, t) {
|
|
|
5071
5157
|
let o = a.reverse().find((e) => e.type.name === n.name);
|
|
5072
5158
|
return o ? { ...o.attrs } : {};
|
|
5073
5159
|
}
|
|
5074
|
-
function
|
|
5160
|
+
function Hs(e, t) {
|
|
5075
5161
|
let n = Uo(typeof t == "string" ? t : t.name, e.schema);
|
|
5076
|
-
return n === "node" ?
|
|
5162
|
+
return n === "node" ? Vs(e, t) : n === "mark" ? ts(e, t) : {};
|
|
5077
5163
|
}
|
|
5078
|
-
function
|
|
5164
|
+
function Us(e, t = JSON.stringify) {
|
|
5079
5165
|
let n = {};
|
|
5080
5166
|
return e.filter((e) => {
|
|
5081
5167
|
let r = t(e);
|
|
5082
5168
|
return Object.prototype.hasOwnProperty.call(n, r) ? !1 : n[r] = !0;
|
|
5083
5169
|
});
|
|
5084
5170
|
}
|
|
5085
|
-
function
|
|
5086
|
-
let t =
|
|
5171
|
+
function Ws(e) {
|
|
5172
|
+
let t = Us(e);
|
|
5087
5173
|
return t.length === 1 ? t : t.filter((e, n) => !t.filter((e, t) => t !== n).some((t) => e.oldRange.from >= t.oldRange.from && e.oldRange.to <= t.oldRange.to && e.newRange.from >= t.newRange.from && e.newRange.to <= t.newRange.to));
|
|
5088
5174
|
}
|
|
5089
|
-
function
|
|
5175
|
+
function Gs(e) {
|
|
5090
5176
|
let { mapping: t, steps: n } = e, r = [];
|
|
5091
5177
|
return t.maps.forEach((e, i) => {
|
|
5092
5178
|
let a = [];
|
|
@@ -5117,9 +5203,9 @@ function Ls(e) {
|
|
|
5117
5203
|
}
|
|
5118
5204
|
});
|
|
5119
5205
|
});
|
|
5120
|
-
}),
|
|
5206
|
+
}), Ws(r);
|
|
5121
5207
|
}
|
|
5122
|
-
function
|
|
5208
|
+
function Ks(e, t = 0) {
|
|
5123
5209
|
let n = e.type === e.type.schema.topNodeType ? 0 : 1, r = t, i = r + e.nodeSize, a = e.marks.map((e) => {
|
|
5124
5210
|
let t = { type: e.type.name };
|
|
5125
5211
|
return Object.keys(e.attrs).length && (t.attrs = { ...e.attrs }), t;
|
|
@@ -5130,10 +5216,10 @@ function Rs(e, t = 0) {
|
|
|
5130
5216
|
};
|
|
5131
5217
|
return Object.keys(o).length && (s.attrs = o), a.length && (s.marks = a), e.content.childCount && (s.content = [], e.forEach((e, r) => {
|
|
5132
5218
|
var i;
|
|
5133
|
-
(i = s.content) == null || i.push(
|
|
5219
|
+
(i = s.content) == null || i.push(Ks(e, t + r + n));
|
|
5134
5220
|
})), e.text && (s.text = e.text), s;
|
|
5135
5221
|
}
|
|
5136
|
-
function
|
|
5222
|
+
function qs(e, t, n) {
|
|
5137
5223
|
let r = [];
|
|
5138
5224
|
return e === t ? n.resolve(e).marks().forEach((t) => {
|
|
5139
5225
|
let i = ao(n.resolve(e), t.type);
|
|
@@ -5149,29 +5235,29 @@ function zs(e, t, n) {
|
|
|
5149
5235
|
})));
|
|
5150
5236
|
}), r;
|
|
5151
5237
|
}
|
|
5152
|
-
var
|
|
5238
|
+
var Js = (e, t, n, r = 20) => {
|
|
5153
5239
|
let i = e.doc.resolve(n), a = r, o = null;
|
|
5154
5240
|
for (; a > 0 && o === null;) {
|
|
5155
5241
|
let e = i.node(a);
|
|
5156
5242
|
e?.type.name === t ? o = e : --a;
|
|
5157
5243
|
}
|
|
5158
5244
|
return [o, a];
|
|
5159
|
-
},
|
|
5245
|
+
}, Ys = (e) => {
|
|
5160
5246
|
let t = e.depth - 1;
|
|
5161
5247
|
if (t < 0) return null;
|
|
5162
5248
|
let n = e.index(t);
|
|
5163
5249
|
return n === 0 ? null : e.node(t).child(n - 1);
|
|
5164
5250
|
};
|
|
5165
|
-
function
|
|
5251
|
+
function Xs(e, t) {
|
|
5166
5252
|
return t.nodes[e] || t.marks[e] || null;
|
|
5167
5253
|
}
|
|
5168
|
-
function
|
|
5254
|
+
function Zs(e, t, n) {
|
|
5169
5255
|
return Object.fromEntries(Object.entries(n).filter(([n]) => {
|
|
5170
5256
|
let r = e.find((e) => e.type === t && e.name === n);
|
|
5171
5257
|
return r ? r.attribute.keepOnSplit : !1;
|
|
5172
5258
|
}));
|
|
5173
5259
|
}
|
|
5174
|
-
var
|
|
5260
|
+
var Qs = (e, t = 500) => {
|
|
5175
5261
|
let n = "", r = e.parentOffset;
|
|
5176
5262
|
return e.parent.nodesBetween(Math.max(0, r - t), r, (e, t, i, a) => {
|
|
5177
5263
|
var o;
|
|
@@ -5184,7 +5270,7 @@ var Ws = (e, t = 500) => {
|
|
|
5184
5270
|
n += e.isAtom && !e.isText ? s : s.slice(0, Math.max(0, r - t));
|
|
5185
5271
|
}), n;
|
|
5186
5272
|
};
|
|
5187
|
-
function
|
|
5273
|
+
function $s(e, t, n = {}) {
|
|
5188
5274
|
let { empty: r, ranges: i } = e.selection, a = t ? Y(t, e.schema) : null;
|
|
5189
5275
|
if (r) return !!(e.storedMarks || e.selection.$from.marks()).filter((e) => !a || a.name === e.type.name).find((e) => no(e.attrs, n, { strict: !1 }));
|
|
5190
5276
|
let o = 0, s = [];
|
|
@@ -5204,12 +5290,12 @@ function Gs(e, t, n = {}) {
|
|
|
5204
5290
|
let c = s.filter((e) => !a || a.name === e.mark.type.name).filter((e) => no(e.mark.attrs, n, { strict: !1 })).reduce((e, t) => e + t.to - t.from, 0), l = s.filter((e) => !a || e.mark.type !== a && e.mark.type.excludes(a)).reduce((e, t) => e + t.to - t.from, 0);
|
|
5205
5291
|
return (c > 0 ? c + l : c) >= o;
|
|
5206
5292
|
}
|
|
5207
|
-
function
|
|
5208
|
-
if (!t) return Ro(e, null, n) ||
|
|
5293
|
+
function ec(e, t, n = {}) {
|
|
5294
|
+
if (!t) return Ro(e, null, n) || $s(e, null, n);
|
|
5209
5295
|
let r = Uo(t, e.schema);
|
|
5210
|
-
return r === "node" ? Ro(e, t, n) : r === "mark" &&
|
|
5296
|
+
return r === "node" ? Ro(e, t, n) : r === "mark" && $s(e, t, n);
|
|
5211
5297
|
}
|
|
5212
|
-
var
|
|
5298
|
+
var tc = (e, t) => {
|
|
5213
5299
|
let { $from: n, $to: r, $anchor: i } = e.selection;
|
|
5214
5300
|
if (t) {
|
|
5215
5301
|
let n = ss((e) => e.type.name === t)(e.selection);
|
|
@@ -5218,15 +5304,15 @@ var qs = (e, t) => {
|
|
|
5218
5304
|
return i.pos + 1 === r.end();
|
|
5219
5305
|
}
|
|
5220
5306
|
return !(r.parentOffset < r.parent.nodeSize - 2 || n.pos !== r.pos);
|
|
5221
|
-
},
|
|
5307
|
+
}, nc = (e) => {
|
|
5222
5308
|
let { $from: t, $to: n } = e.selection;
|
|
5223
5309
|
return !(t.parentOffset > 0 || t.pos !== n.pos);
|
|
5224
5310
|
};
|
|
5225
|
-
function
|
|
5311
|
+
function rc(e, t) {
|
|
5226
5312
|
return Array.isArray(t) ? t.some((t) => (typeof t == "string" ? t : t.name) === e.name) : t;
|
|
5227
5313
|
}
|
|
5228
|
-
function
|
|
5229
|
-
let { nodeExtensions: n } =
|
|
5314
|
+
function ic(e, t) {
|
|
5315
|
+
let { nodeExtensions: n } = vs(t), r = n.find((t) => t.name === e);
|
|
5230
5316
|
if (!r) return !1;
|
|
5231
5317
|
let i = Q(Z(r, "group", {
|
|
5232
5318
|
name: r.name,
|
|
@@ -5235,7 +5321,7 @@ function Xs(e, t) {
|
|
|
5235
5321
|
}));
|
|
5236
5322
|
return typeof i == "string" && i.split(" ").includes("list");
|
|
5237
5323
|
}
|
|
5238
|
-
function
|
|
5324
|
+
function ac(e, { checkChildren: t = !0, ignoreWhitespace: n = !1 } = {}) {
|
|
5239
5325
|
if (n) {
|
|
5240
5326
|
if (e.type.name === "hardBreak") return !0;
|
|
5241
5327
|
if (e.isText) return !/\S/.test(e.text ?? "");
|
|
@@ -5246,7 +5332,7 @@ function Zs(e, { checkChildren: t = !0, ignoreWhitespace: n = !1 } = {}) {
|
|
|
5246
5332
|
if (t) {
|
|
5247
5333
|
let r = !0;
|
|
5248
5334
|
return e.content.forEach((e) => {
|
|
5249
|
-
r !== !1 && (
|
|
5335
|
+
r !== !1 && (ac(e, {
|
|
5250
5336
|
ignoreWhitespace: n,
|
|
5251
5337
|
checkChildren: t
|
|
5252
5338
|
}) || (r = !1));
|
|
@@ -5254,98 +5340,98 @@ function Zs(e, { checkChildren: t = !0, ignoreWhitespace: n = !1 } = {}) {
|
|
|
5254
5340
|
}
|
|
5255
5341
|
return !1;
|
|
5256
5342
|
}
|
|
5257
|
-
function
|
|
5343
|
+
function oc(e) {
|
|
5258
5344
|
return e instanceof b;
|
|
5259
5345
|
}
|
|
5260
|
-
function
|
|
5346
|
+
function sc({ selection: e, pos: t, nodeSize: n, selectedOnTextSelection: r = !1 }) {
|
|
5261
5347
|
let { from: i, to: a } = e;
|
|
5262
5348
|
return !!(i <= t && a >= t + n || r && co(e) && i > t && a < t + n);
|
|
5263
5349
|
}
|
|
5264
|
-
function
|
|
5350
|
+
function cc(e) {
|
|
5265
5351
|
if (typeof e != "object" || !e) return !1;
|
|
5266
5352
|
let t = e;
|
|
5267
5353
|
return typeof t.apply == "function" && typeof t.getMap == "function" && typeof t.invert == "function" && typeof t.map == "function" && typeof t.merge == "function" && typeof t.toJSON == "function";
|
|
5268
5354
|
}
|
|
5269
|
-
function
|
|
5355
|
+
function lc(e) {
|
|
5270
5356
|
if (typeof e != "object" || !e) return !1;
|
|
5271
5357
|
let t = e;
|
|
5272
|
-
if (!
|
|
5358
|
+
if (!cc(t)) return !1;
|
|
5273
5359
|
let n = t.toJSON();
|
|
5274
5360
|
return !(typeof n != "object" || !n || n.stepType !== "addMark");
|
|
5275
5361
|
}
|
|
5276
|
-
function
|
|
5362
|
+
function uc(e) {
|
|
5277
5363
|
if (typeof e != "object" || !e) return !1;
|
|
5278
5364
|
let t = e;
|
|
5279
|
-
if (!
|
|
5365
|
+
if (!cc(t)) return !1;
|
|
5280
5366
|
let n = t.toJSON();
|
|
5281
5367
|
return !(typeof n != "object" || !n || n.stepType !== "addNodeMark");
|
|
5282
5368
|
}
|
|
5283
|
-
function
|
|
5369
|
+
function dc(e) {
|
|
5284
5370
|
if (typeof e != "object" || !e) return !1;
|
|
5285
5371
|
let t = e;
|
|
5286
|
-
if (!
|
|
5372
|
+
if (!cc(t)) return !1;
|
|
5287
5373
|
let n = t.toJSON();
|
|
5288
5374
|
return !(typeof n != "object" || !n || n.stepType !== "attr");
|
|
5289
5375
|
}
|
|
5290
|
-
function
|
|
5376
|
+
function fc(e) {
|
|
5291
5377
|
return typeof e != "object" || !e ? !1 : "forEachCell" in e && typeof e.forEachCell == "function";
|
|
5292
5378
|
}
|
|
5293
|
-
function
|
|
5379
|
+
function pc(e) {
|
|
5294
5380
|
if (typeof e != "object" || !e) return !1;
|
|
5295
5381
|
let t = e;
|
|
5296
|
-
if (!
|
|
5382
|
+
if (!cc(t)) return !1;
|
|
5297
5383
|
let n = t.toJSON();
|
|
5298
5384
|
return !(typeof n != "object" || !n || n.stepType !== "docAttr");
|
|
5299
5385
|
}
|
|
5300
|
-
function
|
|
5386
|
+
function mc(e) {
|
|
5301
5387
|
if (typeof e != "object" || !e) return !1;
|
|
5302
5388
|
let t = e;
|
|
5303
5389
|
return !(!Array.isArray(t.content) || typeof t.size != "number" || typeof t.nodesBetween != "function" || typeof t.descendants != "function" || typeof t.textBetween != "function" || typeof t.append != "function" || typeof t.cut != "function" || typeof t.eq != "function" || typeof t.child != "function" || typeof t.forEach != "function");
|
|
5304
5390
|
}
|
|
5305
|
-
function
|
|
5391
|
+
function hc(e) {
|
|
5306
5392
|
return typeof e != "object" || !e ? !1 : "node" in e && e.node != null;
|
|
5307
5393
|
}
|
|
5308
|
-
function
|
|
5394
|
+
function gc(e) {
|
|
5309
5395
|
if (typeof e != "object" || !e) return !1;
|
|
5310
5396
|
let t = e;
|
|
5311
|
-
if (!
|
|
5397
|
+
if (!cc(t)) return !1;
|
|
5312
5398
|
let n = t.toJSON();
|
|
5313
5399
|
return !(typeof n != "object" || !n || n.stepType !== "removeMark");
|
|
5314
5400
|
}
|
|
5315
|
-
function
|
|
5401
|
+
function _c(e) {
|
|
5316
5402
|
if (typeof e != "object" || !e) return !1;
|
|
5317
5403
|
let t = e;
|
|
5318
|
-
if (!
|
|
5404
|
+
if (!cc(t)) return !1;
|
|
5319
5405
|
let n = t.toJSON();
|
|
5320
5406
|
return !(typeof n != "object" || !n || n.stepType !== "removeNodeMark");
|
|
5321
5407
|
}
|
|
5322
|
-
function
|
|
5408
|
+
function vc(e) {
|
|
5323
5409
|
if (typeof e != "object" || !e) return !1;
|
|
5324
5410
|
let t = e;
|
|
5325
|
-
if (!
|
|
5411
|
+
if (!cc(t)) return !1;
|
|
5326
5412
|
let n = t.toJSON();
|
|
5327
5413
|
return !(typeof n != "object" || !n || n.stepType !== "replaceAround");
|
|
5328
5414
|
}
|
|
5329
|
-
function
|
|
5415
|
+
function yc(e) {
|
|
5330
5416
|
if (typeof e != "object" || !e) return !1;
|
|
5331
5417
|
let t = e;
|
|
5332
|
-
if (!
|
|
5418
|
+
if (!cc(t)) return !1;
|
|
5333
5419
|
let n = t.toJSON();
|
|
5334
5420
|
return !(typeof n != "object" || !n || n.stepType !== "replace");
|
|
5335
5421
|
}
|
|
5336
|
-
function
|
|
5422
|
+
function bc(e) {
|
|
5337
5423
|
if (typeof e != "object" || !e) return !1;
|
|
5338
5424
|
let t = e, n = Number.isInteger(t.openStart) && t.openStart >= 0, r = Number.isInteger(t.openEnd) && t.openEnd >= 0, i = typeof t.size == "number" && typeof t.eq == "function" && typeof t.toJSON == "function";
|
|
5339
5425
|
if (!n || !r || !i) return !1;
|
|
5340
5426
|
let a = t.content;
|
|
5341
|
-
return !(typeof a != "object" || !a || !
|
|
5427
|
+
return !(typeof a != "object" || !a || !mc(a));
|
|
5342
5428
|
}
|
|
5343
|
-
function
|
|
5429
|
+
function xc(e) {
|
|
5344
5430
|
if (typeof e != "object" || !e) return !1;
|
|
5345
5431
|
let t = e, n = t.doc !== null && typeof t.doc == "object" && t.failed === null, r = typeof t.failed == "string" && t.doc === null;
|
|
5346
5432
|
return !(!n && !r);
|
|
5347
5433
|
}
|
|
5348
|
-
var
|
|
5434
|
+
var Sc = class e {
|
|
5349
5435
|
constructor(e) {
|
|
5350
5436
|
this.position = e;
|
|
5351
5437
|
}
|
|
@@ -5356,17 +5442,17 @@ var mc = class e {
|
|
|
5356
5442
|
return { position: this.position };
|
|
5357
5443
|
}
|
|
5358
5444
|
};
|
|
5359
|
-
function
|
|
5445
|
+
function Cc(e, t) {
|
|
5360
5446
|
let n = t.mapping.mapResult(e.position);
|
|
5361
5447
|
return {
|
|
5362
|
-
position: new
|
|
5448
|
+
position: new Sc(n.pos),
|
|
5363
5449
|
mapResult: n
|
|
5364
5450
|
};
|
|
5365
5451
|
}
|
|
5366
|
-
function
|
|
5367
|
-
return new
|
|
5452
|
+
function wc(e) {
|
|
5453
|
+
return new Sc(e);
|
|
5368
5454
|
}
|
|
5369
|
-
function
|
|
5455
|
+
function Tc(e, t, n) {
|
|
5370
5456
|
let r = e.state.doc.content.size, i = X(t, 0, r), a = X(n, 0, r), o = e.coordsAtPos(i), s = e.coordsAtPos(a, -1), c = Math.min(o.top, s.top), l = Math.max(o.bottom, s.bottom), u = Math.min(o.left, s.left), d = Math.max(o.right, s.right), f = {
|
|
5371
5457
|
top: c,
|
|
5372
5458
|
bottom: l,
|
|
@@ -5382,7 +5468,7 @@ function _c(e, t, n) {
|
|
|
5382
5468
|
toJSON: () => f
|
|
5383
5469
|
};
|
|
5384
5470
|
}
|
|
5385
|
-
function
|
|
5471
|
+
function Ec({ json: e, validMarks: t, validNodes: n, options: r, rewrittenContent: i = [] }) {
|
|
5386
5472
|
return e.marks && Array.isArray(e.marks) && (e.marks = e.marks.filter((e) => {
|
|
5387
5473
|
if (e == null) return !1;
|
|
5388
5474
|
let n = typeof e == "string" ? e : e.type;
|
|
@@ -5390,7 +5476,7 @@ function vc({ json: e, validMarks: t, validNodes: n, options: r, rewrittenConten
|
|
|
5390
5476
|
original: JSON.parse(JSON.stringify(e)),
|
|
5391
5477
|
unsupported: n
|
|
5392
5478
|
}), !1);
|
|
5393
|
-
})), e.content && Array.isArray(e.content) && (e.content = e.content.map((e) => e == null ? null :
|
|
5479
|
+
})), e.content && Array.isArray(e.content) && (e.content = e.content.map((e) => e == null ? null : Ec({
|
|
5394
5480
|
json: e,
|
|
5395
5481
|
validMarks: t,
|
|
5396
5482
|
validNodes: n,
|
|
@@ -5410,15 +5496,15 @@ function vc({ json: e, validMarks: t, validNodes: n, options: r, rewrittenConten
|
|
|
5410
5496
|
rewrittenContent: i
|
|
5411
5497
|
};
|
|
5412
5498
|
}
|
|
5413
|
-
function
|
|
5414
|
-
return
|
|
5499
|
+
function Dc(e, t, n) {
|
|
5500
|
+
return Ec({
|
|
5415
5501
|
json: e,
|
|
5416
5502
|
validNodes: new Set(Object.keys(t.nodes)),
|
|
5417
5503
|
validMarks: new Set(Object.keys(t.marks)),
|
|
5418
5504
|
options: n
|
|
5419
5505
|
});
|
|
5420
5506
|
}
|
|
5421
|
-
function
|
|
5507
|
+
function Oc(e, t, n) {
|
|
5422
5508
|
let { selection: r } = t, i = null;
|
|
5423
5509
|
if (co(r) && (i = r.$cursor), i) {
|
|
5424
5510
|
let t = e.storedMarks ?? i.marks();
|
|
@@ -5437,7 +5523,7 @@ function bc(e, t, n) {
|
|
|
5437
5523
|
}), i;
|
|
5438
5524
|
});
|
|
5439
5525
|
}
|
|
5440
|
-
var
|
|
5526
|
+
var kc = (e, t = {}) => ({ tr: n, state: r, dispatch: i }) => {
|
|
5441
5527
|
let { selection: a } = n, { empty: o, ranges: s } = a, c = Y(e, r.schema);
|
|
5442
5528
|
if (i) {
|
|
5443
5529
|
if (o) {
|
|
@@ -5459,8 +5545,8 @@ var xc = (e, t = {}) => ({ tr: n, state: r, dispatch: i }) => {
|
|
|
5459
5545
|
});
|
|
5460
5546
|
});
|
|
5461
5547
|
}
|
|
5462
|
-
return
|
|
5463
|
-
},
|
|
5548
|
+
return Oc(r, n, c);
|
|
5549
|
+
}, Ac = (e, t) => ({ tr: n }) => (n.setMeta(e, t), !0), jc = (e, t = {}) => ({ state: n, dispatch: r, chain: i }) => {
|
|
5464
5550
|
let a = J(e, n.schema), o;
|
|
5465
5551
|
return n.selection.$anchor.sameParent(n.selection.$head) && (o = n.selection.$anchor.parent.attrs), a.isTextblock ? i().command(({ commands: e }) => Fe(a, {
|
|
5466
5552
|
...o,
|
|
@@ -5469,13 +5555,13 @@ var xc = (e, t = {}) => ({ tr: n, state: r, dispatch: i }) => {
|
|
|
5469
5555
|
...o,
|
|
5470
5556
|
...t
|
|
5471
5557
|
})(e, r)).run() : (console.warn("[tiptap warn]: Currently \"setNode()\" only supports text block nodes."), !1);
|
|
5472
|
-
},
|
|
5558
|
+
}, Mc = (e) => ({ tr: t, dispatch: n }) => {
|
|
5473
5559
|
if (n) {
|
|
5474
5560
|
let { doc: n } = t, r = X(e, 0, n.content.size), i = b.create(n, r);
|
|
5475
5561
|
t.setSelection(i);
|
|
5476
5562
|
}
|
|
5477
5563
|
return !0;
|
|
5478
|
-
},
|
|
5564
|
+
}, Nc = (e, t) => ({ tr: n, state: r, dispatch: i }) => {
|
|
5479
5565
|
let { selection: a } = r, o, s;
|
|
5480
5566
|
return typeof t == "number" ? (o = t, s = t) : t && "from" in t && "to" in t ? (o = t.from, s = t.to) : (o = a.from, s = a.to), i && n.doc.nodesBetween(o, s, (t, r) => {
|
|
5481
5567
|
t.isText || n.setNodeMarkup(r, void 0, {
|
|
@@ -5483,7 +5569,7 @@ var xc = (e, t = {}) => ({ tr: n, state: r, dispatch: i }) => {
|
|
|
5483
5569
|
dir: e
|
|
5484
5570
|
});
|
|
5485
5571
|
}), !0;
|
|
5486
|
-
},
|
|
5572
|
+
}, Pc = (e) => ({ tr: t, dispatch: n }) => {
|
|
5487
5573
|
if (n) {
|
|
5488
5574
|
let { doc: n } = t, { from: r, to: i } = typeof e == "number" ? {
|
|
5489
5575
|
from: e,
|
|
@@ -5492,17 +5578,17 @@ var xc = (e, t = {}) => ({ tr: n, state: r, dispatch: i }) => {
|
|
|
5492
5578
|
t.setSelection(u);
|
|
5493
5579
|
}
|
|
5494
5580
|
return !0;
|
|
5495
|
-
},
|
|
5496
|
-
function
|
|
5581
|
+
}, Fc = (e) => ({ state: t, dispatch: n }) => qe(J(e, t.schema))(t, n);
|
|
5582
|
+
function Ic(e, t) {
|
|
5497
5583
|
let n = e.storedMarks || e.selection.$to.parentOffset && e.selection.$from.marks();
|
|
5498
5584
|
if (n) {
|
|
5499
5585
|
let r = n.filter((e) => t?.includes(e.type.name));
|
|
5500
5586
|
e.tr.ensureMarks(r);
|
|
5501
5587
|
}
|
|
5502
5588
|
}
|
|
5503
|
-
var
|
|
5504
|
-
let { selection: a, doc: o } = t, { $from: s, $to: c } = a, u = i.extensionManager.attributes, d =
|
|
5505
|
-
if (a instanceof b && a.node.isBlock) return !s.parentOffset || !f(o, s.pos) ? !1 : (r && (e &&
|
|
5589
|
+
var Lc = ({ keepMarks: e = !0 } = {}) => ({ tr: t, state: n, dispatch: r, editor: i }) => {
|
|
5590
|
+
let { selection: a, doc: o } = t, { $from: s, $to: c } = a, u = i.extensionManager.attributes, d = Zs(u, s.node().type.name, s.node().attrs);
|
|
5591
|
+
if (a instanceof b && a.node.isBlock) return !s.parentOffset || !f(o, s.pos) ? !1 : (r && (e && Ic(n, i.extensionManager.splittableMarks), t.split(s.pos).scrollIntoView()), !0);
|
|
5506
5592
|
if (!s.parent.isBlock) return !1;
|
|
5507
5593
|
let p = c.parentOffset === c.parent.content.size, m = s.depth === 0 ? void 0 : wo(s.node(-1).contentMatchAt(s.indexAfter(-1))), h = p && m ? [{
|
|
5508
5594
|
type: m,
|
|
@@ -5522,10 +5608,10 @@ var kc = ({ keepMarks: e = !0 } = {}) => ({ tr: t, state: n, dispatch: r, editor
|
|
|
5522
5608
|
s.node(-1).canReplaceWith(r.index(), r.index() + 1, m) && t.setNodeMarkup(t.mapping.slice(e).map(s.before()), m);
|
|
5523
5609
|
}
|
|
5524
5610
|
}
|
|
5525
|
-
e &&
|
|
5611
|
+
e && Ic(n, i.extensionManager.splittableMarks), t.scrollIntoView();
|
|
5526
5612
|
}
|
|
5527
5613
|
return x;
|
|
5528
|
-
},
|
|
5614
|
+
}, Rc = (e, t = {}) => ({ tr: n, state: r, dispatch: i, editor: a }) => {
|
|
5529
5615
|
let o = J(e, r.schema), { $from: s, $to: c } = r.selection, u = r.selection.node;
|
|
5530
5616
|
if (u && u.isBlock || s.depth < 2 || !s.sameParent(c)) return !1;
|
|
5531
5617
|
let d = s.node(-1);
|
|
@@ -5537,7 +5623,7 @@ var kc = ({ keepMarks: e = !0 } = {}) => ({ tr: t, state: n, dispatch: r, editor
|
|
|
5537
5623
|
let e = C.empty, r = s.index(-1) ? 1 : s.index(-2) ? 2 : 3;
|
|
5538
5624
|
for (let t = s.depth - r; t >= s.depth - 3; --t) e = C.from(s.node(t).copy(e));
|
|
5539
5625
|
let i = s.indexAfter(-1) < s.node(-2).childCount ? 1 : s.indexAfter(-2) < s.node(-3).childCount ? 2 : 3, a = {
|
|
5540
|
-
...
|
|
5626
|
+
...Zs(p, s.node().type.name, s.node().attrs),
|
|
5541
5627
|
...t
|
|
5542
5628
|
}, c = o.contentMatch.defaultType?.createAndFill(a) || void 0;
|
|
5543
5629
|
e = e.append(C.from(o.createAndFill(null, c) || void 0));
|
|
@@ -5552,10 +5638,10 @@ var kc = ({ keepMarks: e = !0 } = {}) => ({ tr: t, state: n, dispatch: r, editor
|
|
|
5552
5638
|
return !0;
|
|
5553
5639
|
}
|
|
5554
5640
|
let m = c.pos === s.end() ? d.contentMatchAt(0).defaultType : null, g = {
|
|
5555
|
-
...
|
|
5641
|
+
...Zs(p, d.type.name, d.attrs),
|
|
5556
5642
|
...t
|
|
5557
5643
|
}, _ = {
|
|
5558
|
-
...
|
|
5644
|
+
...Zs(p, s.node().type.name, s.node().attrs),
|
|
5559
5645
|
...t
|
|
5560
5646
|
}, v = s.parentOffset === 0 && s.index(-1) === 0, y = s.before(-1);
|
|
5561
5647
|
n.delete(s.pos, c.pos);
|
|
@@ -5578,65 +5664,137 @@ var kc = ({ keepMarks: e = !0 } = {}) => ({ tr: t, state: n, dispatch: r, editor
|
|
|
5578
5664
|
}
|
|
5579
5665
|
return !0;
|
|
5580
5666
|
};
|
|
5581
|
-
function
|
|
5667
|
+
function zc(e, t, n) {
|
|
5668
|
+
if (!e.validContent(t)) return null;
|
|
5669
|
+
try {
|
|
5670
|
+
return e.create(n, t);
|
|
5671
|
+
} catch {
|
|
5672
|
+
return null;
|
|
5673
|
+
}
|
|
5674
|
+
}
|
|
5675
|
+
function Bc(e, t) {
|
|
5676
|
+
if (e.pendingContent.length === 0) return !0;
|
|
5677
|
+
let n = zc(t, C.from(e.pendingContent));
|
|
5678
|
+
return n ? (e.items.push(n), e.pendingContent = [], !0) : !1;
|
|
5679
|
+
}
|
|
5680
|
+
function Vc(e, t, n) {
|
|
5681
|
+
return n.validContent(C.from([...t.pendingContent, e])) ? (t.pendingContent.push(e), !0) : !Bc(t, n) || !n.validContent(C.from(e)) ? !1 : (t.pendingContent.push(e), !0);
|
|
5682
|
+
}
|
|
5683
|
+
function Hc(e, t, n, r) {
|
|
5684
|
+
let i = r(e, n);
|
|
5685
|
+
if (!i) return !1;
|
|
5686
|
+
let a = zc(n.listType, C.from(i), e.attrs);
|
|
5687
|
+
return a ? n.itemType.validContent(C.from([...t.pendingContent, a])) ? (t.pendingContent.push(a), !0) : Bc(t, n.itemType) ? (t.items.push(...i), !0) : !1 : !1;
|
|
5688
|
+
}
|
|
5689
|
+
function Uc(e, t, n) {
|
|
5690
|
+
let r = {
|
|
5691
|
+
items: [],
|
|
5692
|
+
pendingContent: []
|
|
5693
|
+
};
|
|
5694
|
+
for (let i = 0; i < e.childCount; i += 1) {
|
|
5695
|
+
let a = e.child(i);
|
|
5696
|
+
if (!(t.isListNode(a) ? Hc(a, r, t, n) : Vc(a, r, t.itemType))) return null;
|
|
5697
|
+
}
|
|
5698
|
+
return Bc(r, t.itemType) ? r.items : null;
|
|
5699
|
+
}
|
|
5700
|
+
function Wc(e, t) {
|
|
5701
|
+
let n = [];
|
|
5702
|
+
for (let r = 0; r < e.childCount; r += 1) {
|
|
5703
|
+
let i = Uc(e.child(r), t, Wc);
|
|
5704
|
+
if (!i) return null;
|
|
5705
|
+
n.push(...i);
|
|
5706
|
+
}
|
|
5707
|
+
return n;
|
|
5708
|
+
}
|
|
5709
|
+
function Gc(e, t) {
|
|
5710
|
+
let n = null;
|
|
5711
|
+
return e.descendants((e, r) => e !== t || (n = r, !1)), n;
|
|
5712
|
+
}
|
|
5713
|
+
function Kc(e) {
|
|
5582
5714
|
return !e || e === "1" ? null : e;
|
|
5583
5715
|
}
|
|
5584
|
-
function
|
|
5585
|
-
return
|
|
5716
|
+
function qc(e, t) {
|
|
5717
|
+
return Kc(e) === Kc(t);
|
|
5586
5718
|
}
|
|
5587
|
-
var
|
|
5719
|
+
var Jc = (e, t) => {
|
|
5588
5720
|
let n = ss((e) => e.type === t)(e.selection);
|
|
5589
5721
|
if (!n) return !0;
|
|
5590
5722
|
let r = e.doc.resolve(Math.max(0, n.pos - 1)).before(n.depth);
|
|
5591
5723
|
if (r === void 0) return !0;
|
|
5592
5724
|
let i = e.doc.nodeAt(r);
|
|
5593
|
-
return !(n.node.type === i?.type && p(e.doc, n.pos)) || !
|
|
5594
|
-
},
|
|
5725
|
+
return !(n.node.type === i?.type && p(e.doc, n.pos)) || !qc(n.node.attrs.type, i?.attrs.type) || e.join(n.pos), !0;
|
|
5726
|
+
}, Yc = (e, t) => {
|
|
5595
5727
|
let n = ss((e) => e.type === t)(e.selection);
|
|
5596
5728
|
if (!n) return !0;
|
|
5597
5729
|
let r = e.doc.resolve(n.start).after(n.depth);
|
|
5598
5730
|
if (r === void 0) return !0;
|
|
5599
5731
|
let i = e.doc.nodeAt(r);
|
|
5600
|
-
return !(n.node.type === i?.type && p(e.doc, r)) || !
|
|
5732
|
+
return !(n.node.type === i?.type && p(e.doc, r)) || !qc(n.node.attrs.type, i?.attrs.type) || e.join(r), !0;
|
|
5601
5733
|
};
|
|
5602
|
-
function
|
|
5734
|
+
function Xc(e) {
|
|
5603
5735
|
let t = e.doc, n = t.firstChild;
|
|
5604
5736
|
if (!n) return null;
|
|
5605
5737
|
let r = t.resolve(1), i = t.resolve(n.nodeSize - 1);
|
|
5606
5738
|
return l.between(r, i);
|
|
5607
5739
|
}
|
|
5608
|
-
var
|
|
5609
|
-
let { extensions:
|
|
5610
|
-
if (!
|
|
5611
|
-
let
|
|
5612
|
-
node:
|
|
5740
|
+
var Zc = (e, t, n, r = {}) => ({ editor: i, tr: a, state: o, dispatch: s, chain: c, commands: u, can: d }) => {
|
|
5741
|
+
let { extensions: f, splittableMarks: p } = i.extensionManager, m = J(e, o.schema), h = J(t, o.schema), { selection: g, storedMarks: _ } = o, { $from: v, $to: y } = g, b = v.blockRange(y), x = _ || g.$to.parentOffset && g.$from.marks();
|
|
5742
|
+
if (!b) return !1;
|
|
5743
|
+
let ee = ss((e) => ic(e.type.name, f))(g), S = g.from === 0 && g.to === o.doc.content.size, te = o.doc.content.content, ne = te.length === 1 ? te[0] : null, re = S && ne && ic(ne.type.name, f) ? {
|
|
5744
|
+
node: ne,
|
|
5613
5745
|
pos: 0,
|
|
5614
5746
|
depth: 0
|
|
5615
|
-
} : null, w =
|
|
5616
|
-
if ((
|
|
5617
|
-
if (w.node.type ===
|
|
5618
|
-
let n =
|
|
5747
|
+
} : null, w = ee ?? re, ie = !!ee && b.depth >= 1 && b.depth - ee.depth <= 1, ae = !!re;
|
|
5748
|
+
if ((ie || ae) && w) {
|
|
5749
|
+
if (w.node.type === m) return S && ae ? c().command(({ tr: e, dispatch: t }) => {
|
|
5750
|
+
let n = Xc(e);
|
|
5619
5751
|
return n ? (e.setSelection(n), t && t(e), !0) : !1;
|
|
5620
|
-
}).liftListItem(
|
|
5621
|
-
if (
|
|
5622
|
-
|
|
5623
|
-
|
|
5624
|
-
|
|
5625
|
-
|
|
5626
|
-
|
|
5627
|
-
|
|
5752
|
+
}).liftListItem(h).run() : u.liftListItem(h);
|
|
5753
|
+
if (ic(w.node.type.name, f) && m.validContent(w.node.content)) return c().command(() => (a.setNodeMarkup(w.pos, m), !0)).command(() => Jc(a, m)).command(() => Yc(a, m)).run();
|
|
5754
|
+
if (ic(w.node.type.name, f)) {
|
|
5755
|
+
let e = w.node.firstChild?.type;
|
|
5756
|
+
if (e && e !== h) {
|
|
5757
|
+
let e = Wc(w.node, {
|
|
5758
|
+
listType: m,
|
|
5759
|
+
itemType: h,
|
|
5760
|
+
isListNode: (e) => ic(e.type.name, f)
|
|
5761
|
+
}), t = e ? C.from(e) : null;
|
|
5762
|
+
return !t || !m.validContent(t) ? !1 : c().command(() => {
|
|
5763
|
+
let { $anchor: e, $head: n } = a.selection, i = e.parent, o = n.parent, s = e.parentOffset, c = n.parentOffset, u;
|
|
5764
|
+
try {
|
|
5765
|
+
u = m.create(r, t);
|
|
5766
|
+
} catch {
|
|
5767
|
+
return !1;
|
|
5768
|
+
}
|
|
5769
|
+
if (a.replaceWith(w.pos, w.pos + w.node.nodeSize, u), i.inlineContent && o.inlineContent) {
|
|
5770
|
+
let e = Gc(u, i), t = Gc(u, o);
|
|
5771
|
+
if (e !== null && t !== null) {
|
|
5772
|
+
let n = w.pos + e + 2 + s, r = w.pos + t + 2 + c;
|
|
5773
|
+
a.setSelection(l.create(a.doc, n, r));
|
|
5774
|
+
}
|
|
5775
|
+
}
|
|
5776
|
+
return !0;
|
|
5777
|
+
}).command(() => Jc(a, m)).command(() => Yc(a, m)).run();
|
|
5778
|
+
}
|
|
5779
|
+
}
|
|
5780
|
+
}
|
|
5781
|
+
return !n || !x || !s ? c().command(() => d().wrapInList(m, r) ? !0 : u.clearNodes()).wrapInList(m, r).command(() => Jc(a, m)).command(() => Yc(a, m)).run() : c().command(() => {
|
|
5782
|
+
let e = d().wrapInList(m, r), t = x.filter((e) => p.includes(e.type.name));
|
|
5783
|
+
return a.ensureMarks(t), e ? !0 : u.clearNodes();
|
|
5784
|
+
}).wrapInList(m, r).command(() => Jc(a, m)).command(() => Yc(a, m)).run();
|
|
5785
|
+
}, Qc = (e, t = {}, n = {}) => ({ state: r, commands: i }) => {
|
|
5628
5786
|
let { extendEmptyMarkRange: a = !1 } = n, o = Y(e, r.schema);
|
|
5629
|
-
return
|
|
5630
|
-
},
|
|
5787
|
+
return $s(r, o, t) ? i.unsetMark(o, { extendEmptyMarkRange: a }) : i.setMark(o, t);
|
|
5788
|
+
}, $c = (e, t, n = {}) => ({ state: r, commands: i }) => {
|
|
5631
5789
|
let a = J(e, r.schema), o = J(t, r.schema), s = Ro(r, a, n), c;
|
|
5632
5790
|
return r.selection.$anchor.sameParent(r.selection.$head) && (c = r.selection.$anchor.parent.attrs), s ? i.setNode(o, c) : i.setNode(a, {
|
|
5633
5791
|
...c,
|
|
5634
5792
|
...n
|
|
5635
5793
|
});
|
|
5636
|
-
},
|
|
5794
|
+
}, el = (e, t = {}) => ({ state: n, commands: r }) => {
|
|
5637
5795
|
let i = J(e, n.schema);
|
|
5638
5796
|
return Ro(n, i, t) ? r.lift(i) : r.wrapIn(i, t);
|
|
5639
|
-
},
|
|
5797
|
+
}, tl = () => ({ state: e, dispatch: t }) => {
|
|
5640
5798
|
let n = e.plugins;
|
|
5641
5799
|
for (let r = 0; r < n.length; r += 1) {
|
|
5642
5800
|
let i = n[r], a;
|
|
@@ -5653,7 +5811,7 @@ var Ic = (e, t, n, r = {}) => ({ editor: i, tr: a, state: o, dispatch: s, chain:
|
|
|
5653
5811
|
}
|
|
5654
5812
|
}
|
|
5655
5813
|
return !1;
|
|
5656
|
-
},
|
|
5814
|
+
}, nl = (e = {}) => ({ tr: t, dispatch: n, editor: r }) => {
|
|
5657
5815
|
let { ignoreClearable: i = !1 } = e, { selection: a } = t, { empty: o, ranges: s } = a;
|
|
5658
5816
|
if (o) return !0;
|
|
5659
5817
|
let { nonClearableMarks: c } = r.extensionManager;
|
|
@@ -5664,7 +5822,7 @@ var Ic = (e, t, n, r = {}) => ({ editor: i, tr: a, state: o, dispatch: s, chain:
|
|
|
5664
5822
|
});
|
|
5665
5823
|
}
|
|
5666
5824
|
return !0;
|
|
5667
|
-
},
|
|
5825
|
+
}, rl = (e, t = {}) => ({ tr: n, state: r, dispatch: i }) => {
|
|
5668
5826
|
let { extendEmptyMarkRange: a = !1 } = t, { selection: o } = n, s = Y(e, r.schema), { $from: c, empty: l, ranges: u } = o;
|
|
5669
5827
|
if (!i) return !0;
|
|
5670
5828
|
if (l && a) {
|
|
@@ -5674,14 +5832,14 @@ var Ic = (e, t, n, r = {}) => ({ editor: i, tr: a, state: o, dispatch: s, chain:
|
|
|
5674
5832
|
n.removeMark(e.$from.pos, e.$to.pos, s);
|
|
5675
5833
|
});
|
|
5676
5834
|
return n.removeStoredMark(s), !0;
|
|
5677
|
-
},
|
|
5835
|
+
}, il = (e) => ({ tr: t, state: n, dispatch: r }) => {
|
|
5678
5836
|
let { selection: i } = n, a, o;
|
|
5679
5837
|
return typeof e == "number" ? (a = e, o = e) : e && "from" in e && "to" in e ? (a = e.from, o = e.to) : (a = i.from, o = i.to), r && t.doc.nodesBetween(a, o, (e, n) => {
|
|
5680
5838
|
if (e.isText) return;
|
|
5681
5839
|
let r = { ...e.attrs };
|
|
5682
5840
|
delete r.dir, t.setNodeMarkup(n, void 0, r);
|
|
5683
5841
|
}), !0;
|
|
5684
|
-
},
|
|
5842
|
+
}, al = (e, t = {}) => ({ tr: n, state: r, dispatch: i }) => {
|
|
5685
5843
|
let a = null, o = null, s = Uo(typeof e == "string" ? e : e.name, r.schema);
|
|
5686
5844
|
if (!s) return !1;
|
|
5687
5845
|
s === "node" && (a = J(e, r.schema)), s === "mark" && (o = Y(e, r.schema));
|
|
@@ -5713,10 +5871,10 @@ var Ic = (e, t, n, r = {}) => ({ editor: i, tr: a, state: o, dispatch: s, chain:
|
|
|
5713
5871
|
}));
|
|
5714
5872
|
}));
|
|
5715
5873
|
}), c;
|
|
5716
|
-
},
|
|
5874
|
+
}, ol = new s("__tiptap_decorations__"), sl = (e) => ({ tr: t, dispatch: n }) => (n && t.setMeta(ol, {
|
|
5717
5875
|
type: "force",
|
|
5718
5876
|
name: e
|
|
5719
|
-
}), !0),
|
|
5877
|
+
}), !0), cl = (e, t = {}) => ({ state: n, dispatch: r }) => Pe(J(e, n.schema), t)(n, r), ll = (e, t = {}) => ({ state: n, dispatch: r }) => Ve(J(e, n.schema), t)(n, r), ul = /* @__PURE__ */ w({
|
|
5720
5878
|
blur: () => Ba,
|
|
5721
5879
|
clearContent: () => Va,
|
|
5722
5880
|
clearNodes: () => Ha,
|
|
@@ -5758,41 +5916,41 @@ var Ic = (e, t, n, r = {}) => ({ editor: i, tr: a, state: o, dispatch: s, chain:
|
|
|
5758
5916
|
selectTextblockEnd: () => Zo,
|
|
5759
5917
|
selectTextblockStart: () => Qo,
|
|
5760
5918
|
setContent: () => es,
|
|
5761
|
-
setMark: () =>
|
|
5762
|
-
setMeta: () =>
|
|
5763
|
-
setNode: () =>
|
|
5764
|
-
setNodeSelection: () =>
|
|
5765
|
-
setTextDirection: () =>
|
|
5766
|
-
setTextSelection: () =>
|
|
5767
|
-
sinkListItem: () =>
|
|
5768
|
-
splitBlock: () =>
|
|
5769
|
-
splitListItem: () =>
|
|
5770
|
-
toggleList: () =>
|
|
5771
|
-
toggleMark: () =>
|
|
5772
|
-
toggleNode: () =>
|
|
5773
|
-
toggleWrap: () =>
|
|
5774
|
-
undoInputRule: () =>
|
|
5775
|
-
unsetAllMarks: () =>
|
|
5776
|
-
unsetMark: () =>
|
|
5777
|
-
unsetTextDirection: () =>
|
|
5778
|
-
updateAttributes: () =>
|
|
5779
|
-
updateDecorations: () =>
|
|
5780
|
-
wrapIn: () =>
|
|
5781
|
-
wrapInList: () =>
|
|
5782
|
-
}),
|
|
5783
|
-
function
|
|
5784
|
-
|
|
5919
|
+
setMark: () => kc,
|
|
5920
|
+
setMeta: () => Ac,
|
|
5921
|
+
setNode: () => jc,
|
|
5922
|
+
setNodeSelection: () => Mc,
|
|
5923
|
+
setTextDirection: () => Nc,
|
|
5924
|
+
setTextSelection: () => Pc,
|
|
5925
|
+
sinkListItem: () => Fc,
|
|
5926
|
+
splitBlock: () => Lc,
|
|
5927
|
+
splitListItem: () => Rc,
|
|
5928
|
+
toggleList: () => Zc,
|
|
5929
|
+
toggleMark: () => Qc,
|
|
5930
|
+
toggleNode: () => $c,
|
|
5931
|
+
toggleWrap: () => el,
|
|
5932
|
+
undoInputRule: () => tl,
|
|
5933
|
+
unsetAllMarks: () => nl,
|
|
5934
|
+
unsetMark: () => rl,
|
|
5935
|
+
unsetTextDirection: () => il,
|
|
5936
|
+
updateAttributes: () => al,
|
|
5937
|
+
updateDecorations: () => sl,
|
|
5938
|
+
wrapIn: () => cl,
|
|
5939
|
+
wrapInList: () => ll
|
|
5940
|
+
}), dl = /* @__PURE__ */ new WeakMap();
|
|
5941
|
+
function fl(e, t) {
|
|
5942
|
+
dl.set(e, (dl.get(e) ?? 0) + 1);
|
|
5785
5943
|
try {
|
|
5786
5944
|
return t();
|
|
5787
5945
|
} finally {
|
|
5788
|
-
let t = (
|
|
5789
|
-
t > 0 ?
|
|
5946
|
+
let t = (dl.get(e) ?? 1) - 1;
|
|
5947
|
+
t > 0 ? dl.set(e, t) : dl.delete(e);
|
|
5790
5948
|
}
|
|
5791
5949
|
}
|
|
5792
|
-
function
|
|
5793
|
-
return
|
|
5950
|
+
function pl(e) {
|
|
5951
|
+
return dl.has(e);
|
|
5794
5952
|
}
|
|
5795
|
-
var
|
|
5953
|
+
var ml = class {
|
|
5796
5954
|
constructor() {
|
|
5797
5955
|
this.callbacks = {};
|
|
5798
5956
|
}
|
|
@@ -5816,44 +5974,44 @@ var $c = class {
|
|
|
5816
5974
|
removeAllListeners() {
|
|
5817
5975
|
this.callbacks = {};
|
|
5818
5976
|
}
|
|
5819
|
-
},
|
|
5820
|
-
function
|
|
5977
|
+
}, hl = typeof process < "u" && !1;
|
|
5978
|
+
function gl(e) {
|
|
5821
5979
|
return e.kind === "widget";
|
|
5822
5980
|
}
|
|
5823
|
-
function
|
|
5981
|
+
function _l(e, t) {
|
|
5824
5982
|
let n = [], r = /* @__PURE__ */ new Set();
|
|
5825
|
-
for (let i of e) i.kind === "widget" &&
|
|
5983
|
+
for (let i of e) i.kind === "widget" && gl(i) && r.add(i.key), n.push(i.toPMDecoration(t));
|
|
5826
5984
|
return {
|
|
5827
5985
|
decorations: n,
|
|
5828
5986
|
widgetKeys: r
|
|
5829
5987
|
};
|
|
5830
5988
|
}
|
|
5831
|
-
function
|
|
5832
|
-
let { decorations: r, widgetKeys: i } =
|
|
5989
|
+
function vl(e, t, n) {
|
|
5990
|
+
let { decorations: r, widgetKeys: i } = _l(t, n);
|
|
5833
5991
|
return {
|
|
5834
5992
|
set: W.create(e, r),
|
|
5835
5993
|
widgetKeys: i
|
|
5836
5994
|
};
|
|
5837
5995
|
}
|
|
5838
|
-
function
|
|
5996
|
+
function yl({ position: e, from: t, to: n, docSize: r }) {
|
|
5839
5997
|
return e < t ? !1 : e < n || e === n && n === r;
|
|
5840
5998
|
}
|
|
5841
|
-
function
|
|
5842
|
-
return e.filter((e) =>
|
|
5999
|
+
function bl({ decorations: e, from: t, to: n, docSize: r, extensionName: i, warnedExtensions: a }) {
|
|
6000
|
+
return e.filter((e) => yl({
|
|
5843
6001
|
position: e.anchor,
|
|
5844
6002
|
from: t,
|
|
5845
6003
|
to: n,
|
|
5846
6004
|
docSize: r
|
|
5847
6005
|
}) ? !0 : (e.anchor === n || a.has(i) || (a.add(i), console.warn(`[tiptap warn]: Extension "${i}" returned a decoration outside the requested range [${t}, ${n}). It was ignored.`)), !1));
|
|
5848
6006
|
}
|
|
5849
|
-
function
|
|
6007
|
+
function xl(e) {
|
|
5850
6008
|
let t = e.spec?.key;
|
|
5851
6009
|
return typeof t == "string" ? t : void 0;
|
|
5852
6010
|
}
|
|
5853
|
-
function
|
|
6011
|
+
function Sl(e) {
|
|
5854
6012
|
let t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map();
|
|
5855
6013
|
for (let r of e.find()) {
|
|
5856
|
-
let e =
|
|
6014
|
+
let e = xl(r);
|
|
5857
6015
|
if (!e) continue;
|
|
5858
6016
|
let i = r.spec.extensionName ?? "unknown", a = t.get(e) ?? /* @__PURE__ */ new Set();
|
|
5859
6017
|
a.add(i), t.set(e, a), n.set(e, (n.get(e) ?? 0) + 1);
|
|
@@ -5863,18 +6021,18 @@ function sl(e) {
|
|
|
5863
6021
|
extensions: t
|
|
5864
6022
|
})).filter(({ key: e }) => (n.get(e) ?? 0) > 1);
|
|
5865
6023
|
}
|
|
5866
|
-
function
|
|
6024
|
+
function Cl(e) {
|
|
5867
6025
|
return e.jsonID === "attr";
|
|
5868
6026
|
}
|
|
5869
|
-
function
|
|
6027
|
+
function wl(e) {
|
|
5870
6028
|
let t = !1;
|
|
5871
6029
|
if (e.getMap().forEach(() => {
|
|
5872
6030
|
t = !0;
|
|
5873
|
-
}), t ||
|
|
6031
|
+
}), t || Cl(e)) return !0;
|
|
5874
6032
|
let n = e;
|
|
5875
6033
|
return typeof n.from == "number" && typeof n.to == "number";
|
|
5876
6034
|
}
|
|
5877
|
-
function
|
|
6035
|
+
function Tl(e, t) {
|
|
5878
6036
|
let n = null, r = 0, i = 0;
|
|
5879
6037
|
for (let a = 0; a < e.childCount && !(i > t.to); a += 1) {
|
|
5880
6038
|
let o = i + e.child(a).nodeSize;
|
|
@@ -5885,11 +6043,11 @@ function ul(e, t) {
|
|
|
5885
6043
|
to: r
|
|
5886
6044
|
};
|
|
5887
6045
|
}
|
|
5888
|
-
function
|
|
5889
|
-
if (e.steps.some((e) => !
|
|
5890
|
-
let n =
|
|
6046
|
+
function El(e, t) {
|
|
6047
|
+
if (e.steps.some((e) => !wl(e))) return { type: "full" };
|
|
6048
|
+
let n = Gs(e).map(({ newRange: e }) => e);
|
|
5891
6049
|
e.steps.forEach((t, r) => {
|
|
5892
|
-
if (!
|
|
6050
|
+
if (!Cl(t)) return;
|
|
5893
6051
|
let i = e.mapping.slice(r);
|
|
5894
6052
|
n.push({
|
|
5895
6053
|
from: i.map(t.pos, -1),
|
|
@@ -5898,7 +6056,7 @@ function dl(e, t) {
|
|
|
5898
6056
|
});
|
|
5899
6057
|
let r = [];
|
|
5900
6058
|
for (let e of n) {
|
|
5901
|
-
let n =
|
|
6059
|
+
let n = Tl(t, e);
|
|
5902
6060
|
n && r.push(n);
|
|
5903
6061
|
}
|
|
5904
6062
|
r.sort((e, t) => e.from - t.from);
|
|
@@ -5912,29 +6070,29 @@ function dl(e, t) {
|
|
|
5912
6070
|
ranges: i
|
|
5913
6071
|
};
|
|
5914
6072
|
}
|
|
5915
|
-
function
|
|
6073
|
+
function Dl(e, t, n, r) {
|
|
5916
6074
|
return e.map(t, n, { onRemove: (e) => {
|
|
5917
6075
|
let t = e?.key;
|
|
5918
6076
|
typeof t == "string" && r.delete(t);
|
|
5919
6077
|
} });
|
|
5920
6078
|
}
|
|
5921
|
-
function
|
|
6079
|
+
function Ol(e, t, n) {
|
|
5922
6080
|
let r = t.decorationSetsByExtension[e] ?? W.empty, i = new Set(t.widgetKeysByExtension[e] ?? []);
|
|
5923
6081
|
return {
|
|
5924
|
-
set:
|
|
6082
|
+
set: Dl(r, n.mapping, n.doc, i),
|
|
5925
6083
|
widgetKeys: i
|
|
5926
6084
|
};
|
|
5927
6085
|
}
|
|
5928
|
-
function
|
|
6086
|
+
function kl(e, t) {
|
|
5929
6087
|
let n = Object.values(t).flatMap((e) => e.find());
|
|
5930
6088
|
return W.create(e, n);
|
|
5931
6089
|
}
|
|
5932
|
-
function
|
|
6090
|
+
function Al(e) {
|
|
5933
6091
|
let t = /* @__PURE__ */ new Set();
|
|
5934
6092
|
for (let n of Object.values(e)) for (let e of n) t.add(e);
|
|
5935
6093
|
return t;
|
|
5936
6094
|
}
|
|
5937
|
-
function
|
|
6095
|
+
function jl(e, t) {
|
|
5938
6096
|
switch (t.update ?? "document") {
|
|
5939
6097
|
case "document":
|
|
5940
6098
|
if (t.createInRange) throw Error(`[tiptap error]: Extension "${e}" provides createInRange() but does not use the "changedRanges" decoration update strategy.`);
|
|
@@ -5949,26 +6107,26 @@ function gl(e, t) {
|
|
|
5949
6107
|
default: throw Error(`[tiptap error]: Extension "${e}" uses an unknown decoration update strategy. Expected "document", "changedRanges", or "manual".`);
|
|
5950
6108
|
}
|
|
5951
6109
|
}
|
|
5952
|
-
function
|
|
6110
|
+
function Ml(e, t, n) {
|
|
5953
6111
|
return n ? !0 : e.update === "manual" ? !1 : e.shouldUpdate ? e.shouldUpdate(t) : t.tr.docChanged;
|
|
5954
6112
|
}
|
|
5955
|
-
var
|
|
5956
|
-
function
|
|
6113
|
+
var Nl = /* @__PURE__ */ new Set();
|
|
6114
|
+
function Pl(e) {
|
|
5957
6115
|
var t;
|
|
5958
|
-
return ((t = e.extensionManager) == null || (t = t.decorationManager) == null ? void 0 : t.liveWidgetKeys()) ??
|
|
6116
|
+
return ((t = e.extensionManager) == null || (t = t.decorationManager) == null ? void 0 : t.liveWidgetKeys()) ?? Nl;
|
|
5959
6117
|
}
|
|
5960
|
-
var
|
|
6118
|
+
var Fl = class {
|
|
5961
6119
|
constructor(e) {
|
|
5962
6120
|
this.warnedWidgetKeys = /* @__PURE__ */ new Set(), this.warnedOutOfRangeExtensions = /* @__PURE__ */ new Set(), this.handleBeforeTransaction = ({ nextState: e }) => {
|
|
5963
|
-
let t =
|
|
6121
|
+
let t = ol.getState(e);
|
|
5964
6122
|
t && this.warnDuplicateWidgetKeys(t);
|
|
5965
|
-
}, this.editor = e.editor, this.entries = this.resolveEntries(e.entries), this.entries.forEach(({ name: e, spec: t }) =>
|
|
6123
|
+
}, this.editor = e.editor, this.entries = this.resolveEntries(e.entries), this.entries.forEach(({ name: e, spec: t }) => jl(e, t)), this.plugin = this.entries.length > 0 ? this.createPlugin() : null, this.editor.on("beforeTransaction", this.handleBeforeTransaction);
|
|
5966
6124
|
}
|
|
5967
6125
|
destroy() {
|
|
5968
6126
|
this.editor.off("beforeTransaction", this.handleBeforeTransaction);
|
|
5969
6127
|
}
|
|
5970
6128
|
liveWidgetKeys() {
|
|
5971
|
-
return
|
|
6129
|
+
return ol.getState(this.editor.state)?.widgetKeys ?? Nl;
|
|
5972
6130
|
}
|
|
5973
6131
|
get mountedView() {
|
|
5974
6132
|
return this.editor.isDestroyed ? null : this.editor.view;
|
|
@@ -5987,7 +6145,7 @@ var bl = class {
|
|
|
5987
6145
|
createPlugin() {
|
|
5988
6146
|
let { editor: e, entries: t } = this;
|
|
5989
6147
|
return new m({
|
|
5990
|
-
key:
|
|
6148
|
+
key: ol,
|
|
5991
6149
|
state: {
|
|
5992
6150
|
init: (e, n) => {
|
|
5993
6151
|
let r = {}, i = {};
|
|
@@ -5999,22 +6157,22 @@ var bl = class {
|
|
|
5999
6157
|
decorationSetsByExtension: r,
|
|
6000
6158
|
widgetKeysByExtension: i,
|
|
6001
6159
|
mergedDecorationSet: this.buildMergedSet(n.doc, r),
|
|
6002
|
-
widgetKeys:
|
|
6160
|
+
widgetKeys: Al(i)
|
|
6003
6161
|
};
|
|
6004
6162
|
return this.warnDuplicateWidgetKeys(a), a;
|
|
6005
6163
|
},
|
|
6006
6164
|
apply: (n, r, i, a) => {
|
|
6007
|
-
let o = n.getMeta(
|
|
6008
|
-
return
|
|
6165
|
+
let o = n.getMeta(ol), s = o?.type === "force" && !o.name, c = o?.type === "force" ? o.name : void 0, l = {}, u = {}, d = /* @__PURE__ */ new Set();
|
|
6166
|
+
return fl(e, () => {
|
|
6009
6167
|
for (let { name: o, spec: f } of t) {
|
|
6010
6168
|
let t = s || c === o;
|
|
6011
|
-
if (!
|
|
6169
|
+
if (!Ml(f, {
|
|
6012
6170
|
editor: e,
|
|
6013
6171
|
tr: n,
|
|
6014
6172
|
oldState: i,
|
|
6015
6173
|
newState: a
|
|
6016
6174
|
}, t)) {
|
|
6017
|
-
let e =
|
|
6175
|
+
let e = Ol(o, r, n);
|
|
6018
6176
|
l[o] = e.set, u[o] = e.widgetKeys;
|
|
6019
6177
|
} else if (f.update === "changedRanges" && n.docChanged && !t) {
|
|
6020
6178
|
let e = this.applyChangedRangesRecompute(o, f, r, n, a);
|
|
@@ -6034,34 +6192,34 @@ var bl = class {
|
|
|
6034
6192
|
decorationSetsByExtension: l,
|
|
6035
6193
|
recomputedNames: d
|
|
6036
6194
|
}),
|
|
6037
|
-
widgetKeys:
|
|
6195
|
+
widgetKeys: Al(u)
|
|
6038
6196
|
};
|
|
6039
6197
|
}
|
|
6040
6198
|
},
|
|
6041
6199
|
props: { decorations(e) {
|
|
6042
|
-
return
|
|
6200
|
+
return ol.getState(e)?.mergedDecorationSet ?? W.empty;
|
|
6043
6201
|
} }
|
|
6044
6202
|
});
|
|
6045
6203
|
}
|
|
6046
6204
|
applyChangedRangesRecompute(e, t, n, r, i) {
|
|
6047
|
-
let a =
|
|
6205
|
+
let a = El(r, i.doc);
|
|
6048
6206
|
return a.type === "full" ? this.buildFullSet(e, t, i) : this.rebuildRanges(e, t, n, r, i, a.ranges);
|
|
6049
6207
|
}
|
|
6050
6208
|
rebuildRanges(e, t, n, r, i, a) {
|
|
6051
|
-
let o = n.decorationSetsByExtension[e] ?? W.empty, s = new Set(n.widgetKeysByExtension[e] ?? []), c =
|
|
6209
|
+
let o = n.decorationSetsByExtension[e] ?? W.empty, s = new Set(n.widgetKeysByExtension[e] ?? []), c = Dl(o, r.mapping, r.doc, s), l = i.doc.content.size;
|
|
6052
6210
|
for (let { from: n, to: r } of a) {
|
|
6053
|
-
let a = c.find(n, r).filter((e) =>
|
|
6211
|
+
let a = c.find(n, r).filter((e) => yl({
|
|
6054
6212
|
position: e.from,
|
|
6055
6213
|
from: n,
|
|
6056
6214
|
to: r,
|
|
6057
6215
|
docSize: l
|
|
6058
6216
|
}));
|
|
6059
6217
|
for (let e of a) {
|
|
6060
|
-
let t =
|
|
6218
|
+
let t = xl(e);
|
|
6061
6219
|
t && s.delete(t);
|
|
6062
6220
|
}
|
|
6063
6221
|
c = c.remove(a);
|
|
6064
|
-
let { decorations: o, widgetKeys: u } =
|
|
6222
|
+
let { decorations: o, widgetKeys: u } = _l(bl({
|
|
6065
6223
|
decorations: this.runCreate(e, "createInRange", () => t.createInRange({
|
|
6066
6224
|
editor: this.editor,
|
|
6067
6225
|
state: i,
|
|
@@ -6089,7 +6247,7 @@ var bl = class {
|
|
|
6089
6247
|
state: n,
|
|
6090
6248
|
view: this.mountedView
|
|
6091
6249
|
}));
|
|
6092
|
-
return
|
|
6250
|
+
return vl(n.doc, r, e);
|
|
6093
6251
|
}
|
|
6094
6252
|
runCreate(e, t, n) {
|
|
6095
6253
|
try {
|
|
@@ -6099,12 +6257,12 @@ var bl = class {
|
|
|
6099
6257
|
}
|
|
6100
6258
|
}
|
|
6101
6259
|
warnDuplicateWidgetKeys(e) {
|
|
6102
|
-
if (!
|
|
6260
|
+
if (!hl) return;
|
|
6103
6261
|
if (e.widgetKeys.size === 0) {
|
|
6104
6262
|
this.warnedWidgetKeys.clear();
|
|
6105
6263
|
return;
|
|
6106
6264
|
}
|
|
6107
|
-
let t =
|
|
6265
|
+
let t = Sl(e.mergedDecorationSet), n = new Set(t.map(({ key: e }) => e));
|
|
6108
6266
|
for (let { key: e, extensions: n } of t) {
|
|
6109
6267
|
if (this.warnedWidgetKeys.has(e)) continue;
|
|
6110
6268
|
let t = Array.from(n).map((e) => `"${e}"`).join(", ");
|
|
@@ -6114,19 +6272,19 @@ var bl = class {
|
|
|
6114
6272
|
}
|
|
6115
6273
|
buildMergedSet(e, t) {
|
|
6116
6274
|
let n = Object.keys(t);
|
|
6117
|
-
return n.length === 1 ? t[n[0]] :
|
|
6275
|
+
return n.length === 1 ? t[n[0]] : kl(e, t);
|
|
6118
6276
|
}
|
|
6119
6277
|
mergeAfterApply({ entries: e, previous: t, tr: n, decorationSetsByExtension: r, recomputedNames: i }) {
|
|
6120
|
-
return e.length === 1 ? r[e[0].name] : i.size === 0 ? t.mergedDecorationSet.map(n.mapping, n.doc) :
|
|
6278
|
+
return e.length === 1 ? r[e[0].name] : i.size === 0 ? t.mergedDecorationSet.map(n.mapping, n.doc) : kl(n.doc, r);
|
|
6121
6279
|
}
|
|
6122
6280
|
};
|
|
6123
|
-
function
|
|
6281
|
+
function Il(e, t) {
|
|
6124
6282
|
if (e === t) return !0;
|
|
6125
6283
|
if (!e || !t) return !1;
|
|
6126
6284
|
let n = Object.keys(e), r = Object.keys(t);
|
|
6127
6285
|
return n.length === r.length && n.every((n) => Object.prototype.hasOwnProperty.call(t, n) && Object.is(e[n], t[n]));
|
|
6128
6286
|
}
|
|
6129
|
-
function
|
|
6287
|
+
function Ll(e, t) {
|
|
6130
6288
|
let { selection: n } = e, { $from: r } = n;
|
|
6131
6289
|
if (n instanceof b) {
|
|
6132
6290
|
let e = r.index();
|
|
@@ -6140,16 +6298,16 @@ function Sl(e, t) {
|
|
|
6140
6298
|
}
|
|
6141
6299
|
return !1;
|
|
6142
6300
|
}
|
|
6143
|
-
function
|
|
6301
|
+
function Rl(e, t, n) {
|
|
6144
6302
|
let r = document.querySelector(`style[data-tiptap-style${n ? `-${n}` : ""}]`);
|
|
6145
6303
|
if (r !== null) return r;
|
|
6146
6304
|
let i = document.createElement("style");
|
|
6147
6305
|
return t && i.setAttribute("nonce", t), i.setAttribute(`data-tiptap-style${n ? `-${n}` : ""}`, ""), i.innerHTML = e, document.getElementsByTagName("head")[0].appendChild(i), i;
|
|
6148
6306
|
}
|
|
6149
|
-
function
|
|
6307
|
+
function zl(e) {
|
|
6150
6308
|
return e.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&");
|
|
6151
6309
|
}
|
|
6152
|
-
function
|
|
6310
|
+
function Bl(e, t) {
|
|
6153
6311
|
let n = e.getAttribute("style");
|
|
6154
6312
|
if (!n) return null;
|
|
6155
6313
|
let r = n.split(";").map((e) => e.trim()).filter(Boolean), i = t.toLowerCase();
|
|
@@ -6159,16 +6317,16 @@ function Tl(e, t) {
|
|
|
6159
6317
|
}
|
|
6160
6318
|
return null;
|
|
6161
6319
|
}
|
|
6162
|
-
var
|
|
6320
|
+
var Vl = {
|
|
6163
6321
|
lt: "<",
|
|
6164
6322
|
gt: ">",
|
|
6165
6323
|
quot: "\"",
|
|
6166
6324
|
amp: "&"
|
|
6167
6325
|
};
|
|
6168
|
-
function
|
|
6169
|
-
return e.replace(/&(?:#(\d{1,7})|#[xX]([0-9a-fA-F]{1,6})|(lt|gt|quot|amp));/g, (e, t, n, r) => t === void 0 ? n === void 0 ?
|
|
6326
|
+
function Hl(e) {
|
|
6327
|
+
return e.replace(/&(?:#(\d{1,7})|#[xX]([0-9a-fA-F]{1,6})|(lt|gt|quot|amp));/g, (e, t, n, r) => t === void 0 ? n === void 0 ? Vl[r] : Wl(parseInt(n, 16)) : Wl(Number(t)));
|
|
6170
6328
|
}
|
|
6171
|
-
var
|
|
6329
|
+
var Ul = /* @__PURE__ */ new Map([
|
|
6172
6330
|
[128, 8364],
|
|
6173
6331
|
[130, 8218],
|
|
6174
6332
|
[131, 402],
|
|
@@ -6197,69 +6355,69 @@ var Ol = /* @__PURE__ */ new Map([
|
|
|
6197
6355
|
[158, 382],
|
|
6198
6356
|
[159, 376]
|
|
6199
6357
|
]);
|
|
6200
|
-
function
|
|
6201
|
-
return e === 0 || e > 1114111 || e >= 55296 && e <= 57343 ? "�" : String.fromCodePoint(
|
|
6358
|
+
function Wl(e) {
|
|
6359
|
+
return e === 0 || e > 1114111 || e >= 55296 && e <= 57343 ? "�" : String.fromCodePoint(Ul.get(e) ?? e);
|
|
6202
6360
|
}
|
|
6203
|
-
function
|
|
6361
|
+
function Gl(e) {
|
|
6204
6362
|
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
6205
6363
|
}
|
|
6206
|
-
function
|
|
6364
|
+
function Kl() {
|
|
6207
6365
|
return typeof navigator < "u" && /Firefox/.test(navigator.userAgent);
|
|
6208
6366
|
}
|
|
6209
|
-
function
|
|
6367
|
+
function ql(e) {
|
|
6210
6368
|
return typeof e == "number";
|
|
6211
6369
|
}
|
|
6212
|
-
function
|
|
6370
|
+
function Jl(e) {
|
|
6213
6371
|
return Object.prototype.toString.call(e).slice(8, -1);
|
|
6214
6372
|
}
|
|
6215
|
-
function
|
|
6216
|
-
return
|
|
6373
|
+
function Yl(e) {
|
|
6374
|
+
return Jl(e) === "Object" && e.constructor === Object && Object.getPrototypeOf(e) === Object.prototype;
|
|
6217
6375
|
}
|
|
6218
|
-
function
|
|
6376
|
+
function Xl(e) {
|
|
6219
6377
|
return typeof e == "string";
|
|
6220
6378
|
}
|
|
6221
|
-
function
|
|
6379
|
+
function Zl(e) {
|
|
6222
6380
|
return typeof e == "string" && e.trim().length > 0 && !/[;{}]/.test(e);
|
|
6223
6381
|
}
|
|
6224
|
-
function
|
|
6382
|
+
function Ql(e) {
|
|
6225
6383
|
return /\s/.test(e);
|
|
6226
6384
|
}
|
|
6227
|
-
function
|
|
6385
|
+
function $l(e) {
|
|
6228
6386
|
return /^[a-zA-Z]$/.test(e);
|
|
6229
6387
|
}
|
|
6230
|
-
function
|
|
6388
|
+
function eu(e) {
|
|
6231
6389
|
return /^\w$/.test(e);
|
|
6232
6390
|
}
|
|
6233
|
-
function
|
|
6234
|
-
for (; t < e.length &&
|
|
6391
|
+
function tu(e, t) {
|
|
6392
|
+
for (; t < e.length && Ql(e[t]);) t += 1;
|
|
6235
6393
|
return t;
|
|
6236
6394
|
}
|
|
6237
|
-
function
|
|
6238
|
-
for (; t < e.length && !
|
|
6395
|
+
function nu(e, t) {
|
|
6396
|
+
for (; t < e.length && !Ql(e[t]);) t += 1;
|
|
6239
6397
|
return t;
|
|
6240
6398
|
}
|
|
6241
|
-
function
|
|
6242
|
-
for (; t < e.length && (
|
|
6399
|
+
function ru(e, t, n) {
|
|
6400
|
+
for (; t < e.length && (eu(e[t]) || n && e[t] === "-");) t += 1;
|
|
6243
6401
|
return t;
|
|
6244
6402
|
}
|
|
6245
|
-
function
|
|
6246
|
-
let n = e[t], r = t + 1, i =
|
|
6247
|
-
return i === r ? { nextIndex:
|
|
6403
|
+
function iu(e, t) {
|
|
6404
|
+
let n = e[t], r = t + 1, i = ru(e, r, !0);
|
|
6405
|
+
return i === r ? { nextIndex: nu(e, i) } : {
|
|
6248
6406
|
token: {
|
|
6249
6407
|
type: n === "." ? "class" : "id",
|
|
6250
6408
|
name: e.slice(r, i)
|
|
6251
6409
|
},
|
|
6252
|
-
nextIndex:
|
|
6410
|
+
nextIndex: nu(e, i)
|
|
6253
6411
|
};
|
|
6254
6412
|
}
|
|
6255
|
-
function
|
|
6413
|
+
function au(e, t) {
|
|
6256
6414
|
let n = e.indexOf(e[t], t + 1);
|
|
6257
|
-
return { nextIndex:
|
|
6415
|
+
return { nextIndex: nu(e, n === -1 ? t : n + 1) };
|
|
6258
6416
|
}
|
|
6259
|
-
function
|
|
6260
|
-
let i = r ?
|
|
6417
|
+
function ou(e, t, n, r) {
|
|
6418
|
+
let i = r ? tu(e, n) : n;
|
|
6261
6419
|
if (e[i] !== "=") return;
|
|
6262
|
-
i = r ?
|
|
6420
|
+
i = r ? tu(e, i + 1) : i + 1;
|
|
6263
6421
|
let a = e[i];
|
|
6264
6422
|
if (a !== "\"" && a !== "'") return;
|
|
6265
6423
|
let o = e.indexOf(a, i + 1);
|
|
@@ -6269,34 +6427,34 @@ function Gl(e, t, n, r) {
|
|
|
6269
6427
|
name: t,
|
|
6270
6428
|
value: e.slice(i + 1, o)
|
|
6271
6429
|
},
|
|
6272
|
-
nextIndex:
|
|
6430
|
+
nextIndex: nu(e, o + 1)
|
|
6273
6431
|
};
|
|
6274
6432
|
}
|
|
6275
|
-
function
|
|
6276
|
-
let r = n === "pandoc", i =
|
|
6433
|
+
function su(e, t, n) {
|
|
6434
|
+
let r = n === "pandoc", i = ru(e, t + 1, r), a = e.slice(t, i), o = ou(e, a, i, r);
|
|
6277
6435
|
if (o) return o;
|
|
6278
|
-
let s = i === e.length ||
|
|
6436
|
+
let s = i === e.length || Ql(e[i]);
|
|
6279
6437
|
return {
|
|
6280
6438
|
token: r && s ? {
|
|
6281
6439
|
type: "boolean",
|
|
6282
6440
|
name: a
|
|
6283
6441
|
} : void 0,
|
|
6284
|
-
nextIndex: n === "shortcode" ?
|
|
6442
|
+
nextIndex: n === "shortcode" ? nu(e, i) : i
|
|
6285
6443
|
};
|
|
6286
6444
|
}
|
|
6287
|
-
function
|
|
6445
|
+
function cu(e, t, n) {
|
|
6288
6446
|
let r = e[t];
|
|
6289
|
-
return n === "pandoc" && (r === "." || r === "#") ?
|
|
6447
|
+
return n === "pandoc" && (r === "." || r === "#") ? iu(e, t) : r === "\"" || r === "'" ? au(e, t) : (n === "pandoc" ? $l(r) : eu(r)) ? su(e, t, n) : { nextIndex: nu(e, t) };
|
|
6290
6448
|
}
|
|
6291
|
-
function
|
|
6449
|
+
function lu(e, t) {
|
|
6292
6450
|
let n = [], r = 0;
|
|
6293
|
-
for (; r < e.length && (r =
|
|
6294
|
-
let i =
|
|
6451
|
+
for (; r < e.length && (r = tu(e, r), !(r >= e.length));) {
|
|
6452
|
+
let i = cu(e, r, t);
|
|
6295
6453
|
i.token && n.push(i.token), r = i.nextIndex;
|
|
6296
6454
|
}
|
|
6297
6455
|
return n;
|
|
6298
6456
|
}
|
|
6299
|
-
function
|
|
6457
|
+
function uu(e) {
|
|
6300
6458
|
let t = {}, n = e.filter((e) => e.type === "class").map((e) => e.name), r = e.find((e) => e.type === "id");
|
|
6301
6459
|
return n.length > 0 && (t.class = n.join(" ")), r && (t.id = r.name), e.forEach((e) => {
|
|
6302
6460
|
e.type === "keyValue" && (t[e.name] = e.value);
|
|
@@ -6304,18 +6462,18 @@ function Yl(e) {
|
|
|
6304
6462
|
e.type === "boolean" && (t[e.name] = !0);
|
|
6305
6463
|
}), t;
|
|
6306
6464
|
}
|
|
6307
|
-
function
|
|
6308
|
-
return e?.trim() ?
|
|
6465
|
+
function du(e) {
|
|
6466
|
+
return e?.trim() ? uu(lu(e, "pandoc")) : {};
|
|
6309
6467
|
}
|
|
6310
|
-
function
|
|
6468
|
+
function fu(e) {
|
|
6311
6469
|
if (!e || Object.keys(e).length === 0) return "";
|
|
6312
6470
|
let t = [];
|
|
6313
6471
|
return e.class && String(e.class).split(/\s+/).filter(Boolean).forEach((e) => t.push(`.${e}`)), e.id && t.push(`#${e.id}`), Object.entries(e).forEach(([e, n]) => {
|
|
6314
6472
|
e !== "class" && e !== "id" && (n === !0 ? t.push(e) : n !== !1 && n != null && t.push(`${e}="${String(n)}"`));
|
|
6315
6473
|
}), t.join(" ");
|
|
6316
6474
|
}
|
|
6317
|
-
function
|
|
6318
|
-
let { nodeName: t, name: n, parseAttributes: r =
|
|
6475
|
+
function pu(e) {
|
|
6476
|
+
let { nodeName: t, name: n, parseAttributes: r = du, serializeAttributes: i = fu, defaultAttributes: a = {}, requiredAttributes: o = [], allowedAttributes: s } = e, c = n || t, l = (e) => {
|
|
6319
6477
|
if (!s) return e;
|
|
6320
6478
|
let t = {};
|
|
6321
6479
|
return s.forEach((n) => {
|
|
@@ -6354,8 +6512,8 @@ function Ql(e) {
|
|
|
6354
6512
|
}
|
|
6355
6513
|
};
|
|
6356
6514
|
}
|
|
6357
|
-
function
|
|
6358
|
-
let { nodeName: t, name: n, getContent: r, parseAttributes: i =
|
|
6515
|
+
function mu(e) {
|
|
6516
|
+
let { nodeName: t, name: n, getContent: r, parseAttributes: i = du, serializeAttributes: a = fu, defaultAttributes: o = {}, content: s = "block", allowedAttributes: c } = e, l = n || t, u = (e) => {
|
|
6359
6517
|
if (!c) return e;
|
|
6360
6518
|
let t = {};
|
|
6361
6519
|
return c.forEach((n) => {
|
|
@@ -6427,17 +6585,17 @@ function $l(e) {
|
|
|
6427
6585
|
}
|
|
6428
6586
|
};
|
|
6429
6587
|
}
|
|
6430
|
-
function
|
|
6588
|
+
function hu(e) {
|
|
6431
6589
|
let t = {};
|
|
6432
|
-
return
|
|
6590
|
+
return lu(e, "shortcode").forEach((e) => {
|
|
6433
6591
|
e.type === "keyValue" && (t[e.name] = e.value);
|
|
6434
6592
|
}), t;
|
|
6435
6593
|
}
|
|
6436
|
-
function
|
|
6594
|
+
function gu(e) {
|
|
6437
6595
|
return Object.entries(e).filter(([, e]) => e != null).map(([e, t]) => `${e}="${t}"`).join(" ");
|
|
6438
6596
|
}
|
|
6439
|
-
function
|
|
6440
|
-
let { nodeName: t, name: n, getContent: r, parseAttributes: i =
|
|
6597
|
+
function _u(e) {
|
|
6598
|
+
let { nodeName: t, name: n, getContent: r, parseAttributes: i = hu, serializeAttributes: a = gu, defaultAttributes: o = {}, selfClosing: s = !1, allowedAttributes: c } = e, l = n || t, u = (e) => {
|
|
6441
6599
|
if (!c) return e;
|
|
6442
6600
|
let t = {};
|
|
6443
6601
|
return c.forEach((n) => {
|
|
@@ -6494,7 +6652,7 @@ function nu(e) {
|
|
|
6494
6652
|
}
|
|
6495
6653
|
};
|
|
6496
6654
|
}
|
|
6497
|
-
function
|
|
6655
|
+
function vu(e, t, n) {
|
|
6498
6656
|
let r = e.split("\n"), i = [], a = "", o = 0, s = t.baseIndentSize || 2;
|
|
6499
6657
|
for (; o < r.length;) {
|
|
6500
6658
|
let e = r[o], u = e.match(t.itemPattern);
|
|
@@ -6538,13 +6696,13 @@ function ru(e, t, n) {
|
|
|
6538
6696
|
raw: a
|
|
6539
6697
|
};
|
|
6540
6698
|
}
|
|
6541
|
-
var
|
|
6542
|
-
function
|
|
6699
|
+
var yu = 4;
|
|
6700
|
+
function bu(e) {
|
|
6543
6701
|
let t = 0;
|
|
6544
|
-
for (let n of e) t = n === " " ? t +
|
|
6702
|
+
for (let n of e) t = n === " " ? t + yu - t % yu : t + 1;
|
|
6545
6703
|
return t;
|
|
6546
6704
|
}
|
|
6547
|
-
function
|
|
6705
|
+
function xu(e, t, n, r, i) {
|
|
6548
6706
|
if (!e || !Array.isArray(e.content)) return "";
|
|
6549
6707
|
let a = typeof n == "function" ? n(r) : n, [o, ...s] = e.content, c = `${a}${t.renderChildren([o])}`;
|
|
6550
6708
|
return s && s.length > 0 && s.forEach((e, n) => {
|
|
@@ -6552,40 +6710,40 @@ function ou(e, t, n, r, i) {
|
|
|
6552
6710
|
if (r != null) {
|
|
6553
6711
|
let n = (e) => {
|
|
6554
6712
|
if (!i?.alignNestedToPrefix) return t.indent(e);
|
|
6555
|
-
let n = t.indent(""), r =
|
|
6556
|
-
return (
|
|
6713
|
+
let n = t.indent(""), r = bu(a);
|
|
6714
|
+
return (bu(n) >= r ? n : " ".repeat(r)) + e;
|
|
6557
6715
|
}, o = r.split("\n").map((e) => n(e || "")).join("\n");
|
|
6558
6716
|
c += e.type === "paragraph" ? `\n\n${o}` : `\n${o}`;
|
|
6559
6717
|
}
|
|
6560
6718
|
}), c;
|
|
6561
6719
|
}
|
|
6562
|
-
var
|
|
6563
|
-
createAtomBlockMarkdownSpec: () =>
|
|
6564
|
-
createBlockMarkdownSpec: () =>
|
|
6565
|
-
createInlineMarkdownSpec: () =>
|
|
6566
|
-
parseAttributes: () =>
|
|
6567
|
-
parseIndentedBlocks: () =>
|
|
6568
|
-
renderNestedMarkdownContent: () =>
|
|
6569
|
-
serializeAttributes: () =>
|
|
6720
|
+
var Su = /* @__PURE__ */ w({
|
|
6721
|
+
createAtomBlockMarkdownSpec: () => pu,
|
|
6722
|
+
createBlockMarkdownSpec: () => mu,
|
|
6723
|
+
createInlineMarkdownSpec: () => _u,
|
|
6724
|
+
parseAttributes: () => du,
|
|
6725
|
+
parseIndentedBlocks: () => vu,
|
|
6726
|
+
renderNestedMarkdownContent: () => xu,
|
|
6727
|
+
serializeAttributes: () => fu
|
|
6570
6728
|
});
|
|
6571
|
-
function
|
|
6729
|
+
function Cu(e) {
|
|
6572
6730
|
return typeof e.type == "string" ? e.type : e.type.name;
|
|
6573
6731
|
}
|
|
6574
|
-
function
|
|
6732
|
+
function wu(e, t) {
|
|
6575
6733
|
if (e.length !== t.length) return !1;
|
|
6576
6734
|
let n = Array.from({ length: t.length }, () => !1);
|
|
6577
6735
|
return e.every((e) => {
|
|
6578
|
-
let r =
|
|
6736
|
+
let r = Cu(e), i = t.findIndex((t, i) => !n[i] && r === Cu(t) && Il(e.attrs, t.attrs));
|
|
6579
6737
|
return i !== -1 && (n[i] = !0, !0);
|
|
6580
6738
|
});
|
|
6581
6739
|
}
|
|
6582
|
-
function
|
|
6740
|
+
function Tu(e, t) {
|
|
6583
6741
|
let n = { ...e };
|
|
6584
|
-
return
|
|
6585
|
-
|
|
6742
|
+
return Yl(e) && Yl(t) && Object.keys(t).forEach((r) => {
|
|
6743
|
+
Yl(t[r]) && Yl(e[r]) ? n[r] = Tu(e[r], t[r]) : n[r] = t[r];
|
|
6586
6744
|
}), n;
|
|
6587
6745
|
}
|
|
6588
|
-
function
|
|
6746
|
+
function Eu(e, t, n = {}) {
|
|
6589
6747
|
let { state: r } = t, { doc: i, tr: a } = r, o = e;
|
|
6590
6748
|
i.descendants((t, r) => {
|
|
6591
6749
|
let i = a.mapping.map(r), s = a.mapping.map(r) + t.nodeSize, c = null;
|
|
@@ -6605,7 +6763,7 @@ function du(e, t, n = {}) {
|
|
|
6605
6763
|
}
|
|
6606
6764
|
}), a.docChanged && t.view.dispatch(a);
|
|
6607
6765
|
}
|
|
6608
|
-
var
|
|
6766
|
+
var Du = class {
|
|
6609
6767
|
constructor(e, t, n) {
|
|
6610
6768
|
this.component = e, this.editor = t.editor, this.options = { ...n }, this.mark = t.mark, this.HTMLAttributes = t.HTMLAttributes;
|
|
6611
6769
|
}
|
|
@@ -6616,23 +6774,23 @@ var fu = class {
|
|
|
6616
6774
|
return null;
|
|
6617
6775
|
}
|
|
6618
6776
|
updateAttributes(e, t) {
|
|
6619
|
-
|
|
6777
|
+
Eu(t || this.mark, this.editor, e);
|
|
6620
6778
|
}
|
|
6621
6779
|
ignoreMutation(e) {
|
|
6622
6780
|
return !this.dom || !this.contentDOM ? !0 : typeof this.options.ignoreMutation == "function" ? this.options.ignoreMutation({ mutation: e }) : e.type === "selection" || this.contentDOM.contains(e.target) && e.type === "childList" && (fo() || uo()) && this.editor.isFocused && [...Array.from(e.addedNodes), ...Array.from(e.removedNodes)].every((e) => e.isContentEditable) ? !1 : this.contentDOM === e.target && e.type === "attributes" || !this.contentDOM.contains(e.target);
|
|
6623
6781
|
}
|
|
6624
|
-
},
|
|
6782
|
+
}, Ou = class {
|
|
6625
6783
|
constructor(e) {
|
|
6626
6784
|
this.find = e.find, this.handler = e.handler, this.undoable = e.undoable ?? !0;
|
|
6627
6785
|
}
|
|
6628
|
-
},
|
|
6786
|
+
}, ku = (e, t) => {
|
|
6629
6787
|
if (to(t)) return t.exec(e);
|
|
6630
6788
|
let n = t(e);
|
|
6631
6789
|
if (!n) return null;
|
|
6632
6790
|
let r = [n.text];
|
|
6633
6791
|
return r.index = n.index, r.input = e, r.data = n.data, n.replaceWith && (n.text.includes(n.replaceWith) || console.warn("[tiptap warn]: \"inputRuleMatch.replaceWith\" must be part of \"inputRuleMatch.text\"."), r.push(n.replaceWith)), r;
|
|
6634
6792
|
};
|
|
6635
|
-
function
|
|
6793
|
+
function Au(e) {
|
|
6636
6794
|
let { editor: t, from: n, to: r, text: i, insertText: a } = e;
|
|
6637
6795
|
if (!a) return {
|
|
6638
6796
|
inputTransaction: null,
|
|
@@ -6648,8 +6806,8 @@ function hu(e) {
|
|
|
6648
6806
|
}).tr
|
|
6649
6807
|
};
|
|
6650
6808
|
}
|
|
6651
|
-
function
|
|
6652
|
-
let { editor: t, from: n, to: r, text: i, rule: a, match: o, plugin: s, insertText: c } = e, { view: l } = t, { inputTransaction: u, tr: d } =
|
|
6809
|
+
function ju(e) {
|
|
6810
|
+
let { editor: t, from: n, to: r, text: i, rule: a, match: o, plugin: s, insertText: c } = e, { view: l } = t, { inputTransaction: u, tr: d } = Au({
|
|
6653
6811
|
editor: t,
|
|
6654
6812
|
from: n,
|
|
6655
6813
|
to: r,
|
|
@@ -6679,21 +6837,21 @@ function gu(e) {
|
|
|
6679
6837
|
text: i
|
|
6680
6838
|
}), l.dispatch(d)), !0);
|
|
6681
6839
|
}
|
|
6682
|
-
function
|
|
6840
|
+
function Mu(e, t, n) {
|
|
6683
6841
|
let r = t[0].length - n.length;
|
|
6684
6842
|
if (r <= 0) return !0;
|
|
6685
6843
|
let i = e.parentOffset - r;
|
|
6686
6844
|
return i >= 0 && e.parent.textBetween(i, e.parentOffset) === t[0].slice(0, r);
|
|
6687
6845
|
}
|
|
6688
|
-
function
|
|
6846
|
+
function Nu(e) {
|
|
6689
6847
|
let { editor: t, from: n, to: r, text: i, rules: a, plugin: o, insertText: s } = e, { view: c } = t;
|
|
6690
6848
|
if (c.composing) return !1;
|
|
6691
6849
|
let l = c.state.doc.resolve(n);
|
|
6692
6850
|
if (l.parent.type.spec.code || (l.nodeBefore || l.nodeAfter)?.marks.find((e) => e.type.spec.code)) return !1;
|
|
6693
|
-
let u =
|
|
6851
|
+
let u = Qs(l) + i;
|
|
6694
6852
|
for (let e of a) {
|
|
6695
|
-
let a =
|
|
6696
|
-
if (a &&
|
|
6853
|
+
let a = ku(u, e.find);
|
|
6854
|
+
if (a && Mu(l, a, i) && ju({
|
|
6697
6855
|
editor: t,
|
|
6698
6856
|
from: n,
|
|
6699
6857
|
to: r,
|
|
@@ -6706,7 +6864,7 @@ function vu(e) {
|
|
|
6706
6864
|
}
|
|
6707
6865
|
return !1;
|
|
6708
6866
|
}
|
|
6709
|
-
function
|
|
6867
|
+
function Pu(e) {
|
|
6710
6868
|
let { editor: t, rules: n } = e, r = new m({
|
|
6711
6869
|
state: {
|
|
6712
6870
|
init() {
|
|
@@ -6720,7 +6878,7 @@ function yu(e) {
|
|
|
6720
6878
|
let { text: e } = s;
|
|
6721
6879
|
e = typeof e == "string" ? e : ls(C.from(e), a.schema);
|
|
6722
6880
|
let { from: i } = s, o = i + e.length;
|
|
6723
|
-
|
|
6881
|
+
Nu({
|
|
6724
6882
|
editor: t,
|
|
6725
6883
|
from: i,
|
|
6726
6884
|
to: o,
|
|
@@ -6733,7 +6891,7 @@ function yu(e) {
|
|
|
6733
6891
|
},
|
|
6734
6892
|
props: {
|
|
6735
6893
|
handleTextInput(e, i, a, o) {
|
|
6736
|
-
return
|
|
6894
|
+
return Nu({
|
|
6737
6895
|
editor: t,
|
|
6738
6896
|
from: i,
|
|
6739
6897
|
to: a,
|
|
@@ -6745,7 +6903,7 @@ function yu(e) {
|
|
|
6745
6903
|
},
|
|
6746
6904
|
handleDOMEvents: { compositionend: (e) => (setTimeout(() => {
|
|
6747
6905
|
let { $cursor: i } = e.state.selection;
|
|
6748
|
-
i &&
|
|
6906
|
+
i && Nu({
|
|
6749
6907
|
editor: t,
|
|
6750
6908
|
from: i.pos,
|
|
6751
6909
|
to: i.pos,
|
|
@@ -6757,7 +6915,7 @@ function yu(e) {
|
|
|
6757
6915
|
handleKeyDown(e, i) {
|
|
6758
6916
|
if (i.key !== "Enter") return !1;
|
|
6759
6917
|
let { $cursor: a } = e.state.selection;
|
|
6760
|
-
return a ?
|
|
6918
|
+
return a ? Nu({
|
|
6761
6919
|
editor: t,
|
|
6762
6920
|
from: a.pos,
|
|
6763
6921
|
to: a.pos,
|
|
@@ -6771,7 +6929,7 @@ function yu(e) {
|
|
|
6771
6929
|
});
|
|
6772
6930
|
return r;
|
|
6773
6931
|
}
|
|
6774
|
-
var
|
|
6932
|
+
var Fu = class {
|
|
6775
6933
|
constructor(e = {}) {
|
|
6776
6934
|
this.type = "extendable", this.parent = null, this.child = null, this.name = "", this.config = { name: this.name }, this.config = {
|
|
6777
6935
|
...this.config,
|
|
@@ -6790,7 +6948,7 @@ var bu = class {
|
|
|
6790
6948
|
configure(e = {}) {
|
|
6791
6949
|
let t = this.extend({
|
|
6792
6950
|
...this.config,
|
|
6793
|
-
addOptions: () =>
|
|
6951
|
+
addOptions: () => Tu(this.options, e)
|
|
6794
6952
|
});
|
|
6795
6953
|
return t.name = this.name, t.parent = this.parent, this.child = null, t;
|
|
6796
6954
|
}
|
|
@@ -6801,7 +6959,7 @@ var bu = class {
|
|
|
6801
6959
|
});
|
|
6802
6960
|
return t.parent = this, this.child = t, t.name = "name" in e ? e.name : t.parent.name, t;
|
|
6803
6961
|
}
|
|
6804
|
-
},
|
|
6962
|
+
}, Iu = class e extends Fu {
|
|
6805
6963
|
constructor(...e) {
|
|
6806
6964
|
super(...e), this.type = "mark";
|
|
6807
6965
|
}
|
|
@@ -6826,11 +6984,11 @@ var bu = class {
|
|
|
6826
6984
|
let t = typeof e == "function" ? e() : e;
|
|
6827
6985
|
return super.extend(t);
|
|
6828
6986
|
}
|
|
6829
|
-
},
|
|
6987
|
+
}, Lu = class {
|
|
6830
6988
|
constructor(e) {
|
|
6831
6989
|
this.find = e.find, this.handler = e.handler;
|
|
6832
6990
|
}
|
|
6833
|
-
},
|
|
6991
|
+
}, Ru = (e, t, n) => {
|
|
6834
6992
|
if (to(t)) return [...e.matchAll(t)];
|
|
6835
6993
|
let r = t(e, n);
|
|
6836
6994
|
return r ? r.map((t) => {
|
|
@@ -6838,7 +6996,7 @@ var bu = class {
|
|
|
6838
6996
|
return n.index = t.index, n.input = e, n.data = t.data, t.replaceWith && (t.text.includes(t.replaceWith) || console.warn("[tiptap warn]: \"pasteRuleMatch.replaceWith\" must be part of \"pasteRuleMatch.text\"."), n.push(t.replaceWith)), n;
|
|
6839
6997
|
}) : [];
|
|
6840
6998
|
};
|
|
6841
|
-
function
|
|
6999
|
+
function zu(e) {
|
|
6842
7000
|
let { editor: t, state: n, from: r, to: i, rule: a, pasteEvent: o, dropEvent: s } = e, { commands: c, chain: l, can: u } = new za({
|
|
6843
7001
|
editor: t,
|
|
6844
7002
|
state: n
|
|
@@ -6847,7 +7005,7 @@ function wu(e) {
|
|
|
6847
7005
|
var f;
|
|
6848
7006
|
if ((f = e.type) != null && (f = f.spec) != null && f.code || !(e.isText || e.isTextblock || e.isInline)) return;
|
|
6849
7007
|
let p = e.content?.size ?? e.nodeSize ?? 0, m = Math.max(r, t), h = Math.min(i, t + p);
|
|
6850
|
-
m >= h ||
|
|
7008
|
+
m >= h || Ru(e.isText ? e.text || "" : e.textBetween(m - t, h - t, void 0, ""), a.find, o).forEach((e) => {
|
|
6851
7009
|
if (e.index === void 0) return;
|
|
6852
7010
|
let t = m + e.index + 1, r = t + e[0].length, i = {
|
|
6853
7011
|
from: n.tr.mapping.map(t),
|
|
@@ -6866,12 +7024,12 @@ function wu(e) {
|
|
|
6866
7024
|
});
|
|
6867
7025
|
}), d.every((e) => e !== null);
|
|
6868
7026
|
}
|
|
6869
|
-
var
|
|
7027
|
+
var Bu = null, Vu = (e) => {
|
|
6870
7028
|
var t;
|
|
6871
7029
|
let n = new ClipboardEvent("paste", { clipboardData: new DataTransfer() });
|
|
6872
7030
|
return (t = n.clipboardData) == null || t.setData("text/html", e), n;
|
|
6873
7031
|
};
|
|
6874
|
-
function
|
|
7032
|
+
function Hu(e) {
|
|
6875
7033
|
let { editor: t, rules: n } = e, r = null, i = !1, a = !1, o = typeof ClipboardEvent < "u" ? new ClipboardEvent("paste") : null, s;
|
|
6876
7034
|
try {
|
|
6877
7035
|
s = typeof DragEvent < "u" ? new DragEvent("drop") : null;
|
|
@@ -6883,7 +7041,7 @@ function Du(e) {
|
|
|
6883
7041
|
state: e,
|
|
6884
7042
|
transaction: c
|
|
6885
7043
|
});
|
|
6886
|
-
if (
|
|
7044
|
+
if (zu({
|
|
6887
7045
|
editor: t,
|
|
6888
7046
|
state: l,
|
|
6889
7047
|
from: Math.max(n - 1, 0),
|
|
@@ -6901,13 +7059,13 @@ function Du(e) {
|
|
|
6901
7059
|
}
|
|
6902
7060
|
};
|
|
6903
7061
|
return t.on("destroy", () => {
|
|
6904
|
-
|
|
7062
|
+
Bu === t && (Bu = null);
|
|
6905
7063
|
}), n.map((e) => new m({
|
|
6906
7064
|
view(e) {
|
|
6907
7065
|
let n = (n) => {
|
|
6908
|
-
r = e.dom.parentElement?.contains(n.target) ? e.dom.parentElement : null, r && (
|
|
7066
|
+
r = e.dom.parentElement?.contains(n.target) ? e.dom.parentElement : null, r && (Bu = t);
|
|
6909
7067
|
}, i = () => {
|
|
6910
|
-
|
|
7068
|
+
Bu &&= null;
|
|
6911
7069
|
};
|
|
6912
7070
|
return window.addEventListener("dragstart", n), window.addEventListener("dragend", i), { destroy() {
|
|
6913
7071
|
window.removeEventListener("dragstart", n), window.removeEventListener("dragend", i);
|
|
@@ -6916,7 +7074,7 @@ function Du(e) {
|
|
|
6916
7074
|
props: { handleDOMEvents: {
|
|
6917
7075
|
drop: (e, t) => {
|
|
6918
7076
|
if (a = r === e.dom.parentElement, s = t, !a) {
|
|
6919
|
-
let e =
|
|
7077
|
+
let e = Bu;
|
|
6920
7078
|
e?.isEditable && setTimeout(() => {
|
|
6921
7079
|
if (e.isDestroyed) return;
|
|
6922
7080
|
let t = e.state.selection;
|
|
@@ -6939,7 +7097,7 @@ function Du(e) {
|
|
|
6939
7097
|
if (f) {
|
|
6940
7098
|
let { text: t } = d;
|
|
6941
7099
|
t = typeof t == "string" ? t : ls(C.from(t), r.schema);
|
|
6942
|
-
let { from: n } = d, i = n + t.length, a =
|
|
7100
|
+
let { from: n } = d, i = n + t.length, a = Vu(t);
|
|
6943
7101
|
return c({
|
|
6944
7102
|
rule: e,
|
|
6945
7103
|
state: r,
|
|
@@ -6949,7 +7107,7 @@ function Du(e) {
|
|
|
6949
7107
|
});
|
|
6950
7108
|
}
|
|
6951
7109
|
let p = n.doc.content.findDiffStart(r.doc.content), m = n.doc.content.findDiffEnd(r.doc.content);
|
|
6952
|
-
if (
|
|
7110
|
+
if (ql(p) && m && p !== m.b) return c({
|
|
6953
7111
|
rule: e,
|
|
6954
7112
|
state: r,
|
|
6955
7113
|
from: p,
|
|
@@ -6959,9 +7117,9 @@ function Du(e) {
|
|
|
6959
7117
|
}
|
|
6960
7118
|
}));
|
|
6961
7119
|
}
|
|
6962
|
-
var
|
|
7120
|
+
var Uu = class {
|
|
6963
7121
|
constructor(e, t) {
|
|
6964
|
-
this.splittableMarks = [], this.nonClearableMarks = [], this.decorationManager = null, this.editor = t, this.baseExtensions = e, this.extensions =
|
|
7122
|
+
this.splittableMarks = [], this.nonClearableMarks = [], this.decorationManager = null, this.editor = t, this.baseExtensions = e, this.extensions = Ns(e), this.hasSchemaSpec = t.options.schemaSpec !== void 0, this.schema = js(this.extensions, t, t.options.schemaSpec), this.setupExtensions();
|
|
6965
7123
|
}
|
|
6966
7124
|
get commands() {
|
|
6967
7125
|
return this.extensions.reduce((e, t) => {
|
|
@@ -6970,7 +7128,7 @@ var Ou = class {
|
|
|
6970
7128
|
options: t.options,
|
|
6971
7129
|
storage: this.editor.extensionStorage[t.name],
|
|
6972
7130
|
editor: this.editor,
|
|
6973
|
-
type:
|
|
7131
|
+
type: Xs(t.name, this.schema)
|
|
6974
7132
|
});
|
|
6975
7133
|
return n ? {
|
|
6976
7134
|
...e,
|
|
@@ -6979,15 +7137,15 @@ var Ou = class {
|
|
|
6979
7137
|
}, {});
|
|
6980
7138
|
}
|
|
6981
7139
|
get plugins() {
|
|
6982
|
-
let { editor: e } = this, t =
|
|
7140
|
+
let { editor: e } = this, t = Ms([...this.extensions].reverse()).flatMap((t) => {
|
|
6983
7141
|
let n = {
|
|
6984
7142
|
name: t.name,
|
|
6985
7143
|
options: t.options,
|
|
6986
7144
|
storage: this.editor.extensionStorage[t.name],
|
|
6987
7145
|
editor: e,
|
|
6988
|
-
type:
|
|
7146
|
+
type: Xs(t.name, this.schema)
|
|
6989
7147
|
}, r = [], i = Z(t, "addKeyboardShortcuts", n), a = {};
|
|
6990
|
-
if (t.type === "mark" && Z(t, "exitable", n) && (a.ArrowRight = () =>
|
|
7148
|
+
if (t.type === "mark" && Z(t, "exitable", n) && (a.ArrowRight = () => Iu.handleExit({
|
|
6991
7149
|
editor: e,
|
|
6992
7150
|
mark: t
|
|
6993
7151
|
})), i) {
|
|
@@ -7000,10 +7158,10 @@ var Ou = class {
|
|
|
7000
7158
|
let o = da(a);
|
|
7001
7159
|
r.push(o);
|
|
7002
7160
|
let s = Z(t, "addInputRules", n);
|
|
7003
|
-
if (
|
|
7161
|
+
if (rc(t, e.options.enableInputRules) && s) {
|
|
7004
7162
|
let t = s();
|
|
7005
7163
|
if (t && t.length) {
|
|
7006
|
-
let n =
|
|
7164
|
+
let n = Pu({
|
|
7007
7165
|
editor: e,
|
|
7008
7166
|
rules: t
|
|
7009
7167
|
}), i = Array.isArray(n) ? n : [n];
|
|
@@ -7011,10 +7169,10 @@ var Ou = class {
|
|
|
7011
7169
|
}
|
|
7012
7170
|
}
|
|
7013
7171
|
let c = Z(t, "addPasteRules", n);
|
|
7014
|
-
if (
|
|
7172
|
+
if (rc(t, e.options.enablePasteRules) && c) {
|
|
7015
7173
|
let t = c();
|
|
7016
7174
|
if (t && t.length) {
|
|
7017
|
-
let n =
|
|
7175
|
+
let n = Hu({
|
|
7018
7176
|
editor: e,
|
|
7019
7177
|
rules: t
|
|
7020
7178
|
});
|
|
@@ -7041,22 +7199,23 @@ var Ou = class {
|
|
|
7041
7199
|
options: e.options,
|
|
7042
7200
|
storage: this.editor.extensionStorage[e.name],
|
|
7043
7201
|
editor: t,
|
|
7044
|
-
type:
|
|
7202
|
+
type: Xs(e.name, this.schema)
|
|
7045
7203
|
});
|
|
7046
7204
|
r && n.push({
|
|
7047
7205
|
name: e.name,
|
|
7048
7206
|
addDecorations: r
|
|
7049
7207
|
});
|
|
7050
|
-
}), this.decorationManager = new
|
|
7208
|
+
}), this.decorationManager = new Fl({
|
|
7051
7209
|
editor: t,
|
|
7052
7210
|
entries: n
|
|
7053
7211
|
}), this.decorationManager.plugin;
|
|
7054
7212
|
}
|
|
7055
7213
|
get attributes() {
|
|
7056
|
-
|
|
7214
|
+
let e = ys(this.extensions);
|
|
7215
|
+
return this.hasSchemaSpec ? us(e, this.schema) : e;
|
|
7057
7216
|
}
|
|
7058
7217
|
get nodeViews() {
|
|
7059
|
-
let { editor: e } = this, { nodeExtensions: t } =
|
|
7218
|
+
let { editor: e } = this, { nodeExtensions: t } = vs(this.extensions);
|
|
7060
7219
|
return Object.fromEntries(t.filter((e) => !!Z(e, "addNodeView")).map((t) => {
|
|
7061
7220
|
let n = this.attributes.filter((e) => e.type === t.name), r = Z(t, "addNodeView", {
|
|
7062
7221
|
name: t.name,
|
|
@@ -7068,7 +7227,7 @@ var Ou = class {
|
|
|
7068
7227
|
if (!r) return [];
|
|
7069
7228
|
let i = r();
|
|
7070
7229
|
return i ? [t.name, (r, a, o, s, c) => {
|
|
7071
|
-
let l =
|
|
7230
|
+
let l = Ts(r, n);
|
|
7072
7231
|
return i({
|
|
7073
7232
|
node: r,
|
|
7074
7233
|
view: a,
|
|
@@ -7084,13 +7243,13 @@ var Ou = class {
|
|
|
7084
7243
|
}
|
|
7085
7244
|
dispatchTransaction(e) {
|
|
7086
7245
|
let { editor: t } = this;
|
|
7087
|
-
return
|
|
7246
|
+
return Ms([...this.extensions].reverse()).reduceRight((e, n) => {
|
|
7088
7247
|
let r = {
|
|
7089
7248
|
name: n.name,
|
|
7090
7249
|
options: n.options,
|
|
7091
7250
|
storage: this.editor.extensionStorage[n.name],
|
|
7092
7251
|
editor: t,
|
|
7093
|
-
type:
|
|
7252
|
+
type: Xs(n.name, this.schema)
|
|
7094
7253
|
}, i = Z(n, "dispatchTransaction", r);
|
|
7095
7254
|
return i ? (t) => {
|
|
7096
7255
|
i.call(r, {
|
|
@@ -7102,13 +7261,13 @@ var Ou = class {
|
|
|
7102
7261
|
}
|
|
7103
7262
|
transformPastedHTML(e) {
|
|
7104
7263
|
let { editor: t } = this;
|
|
7105
|
-
return
|
|
7264
|
+
return Ms([...this.extensions]).reduce((e, n) => {
|
|
7106
7265
|
let r = {
|
|
7107
7266
|
name: n.name,
|
|
7108
7267
|
options: n.options,
|
|
7109
7268
|
storage: this.editor.extensionStorage[n.name],
|
|
7110
7269
|
editor: t,
|
|
7111
|
-
type:
|
|
7270
|
+
type: Xs(n.name, this.schema)
|
|
7112
7271
|
}, i = Z(n, "transformPastedHTML", r);
|
|
7113
7272
|
return i ? (t, n) => {
|
|
7114
7273
|
let a = e(t, n);
|
|
@@ -7117,7 +7276,7 @@ var Ou = class {
|
|
|
7117
7276
|
}, e || ((e) => e));
|
|
7118
7277
|
}
|
|
7119
7278
|
get markViews() {
|
|
7120
|
-
let { editor: e } = this, { markExtensions: t } =
|
|
7279
|
+
let { editor: e } = this, { markExtensions: t } = vs(this.extensions);
|
|
7121
7280
|
return Object.fromEntries(t.filter((e) => !!Z(e, "addMarkView")).map((t) => {
|
|
7122
7281
|
let n = this.attributes.filter((e) => e.type === t.name), r = Z(t, "addMarkView", {
|
|
7123
7282
|
name: t.name,
|
|
@@ -7127,7 +7286,7 @@ var Ou = class {
|
|
|
7127
7286
|
type: Y(t.name, this.schema)
|
|
7128
7287
|
});
|
|
7129
7288
|
return r ? [t.name, (i, a, o) => {
|
|
7130
|
-
let s =
|
|
7289
|
+
let s = Ts(i, n);
|
|
7131
7290
|
return r()({
|
|
7132
7291
|
mark: i,
|
|
7133
7292
|
view: a,
|
|
@@ -7136,7 +7295,7 @@ var Ou = class {
|
|
|
7136
7295
|
extension: t,
|
|
7137
7296
|
HTMLAttributes: s,
|
|
7138
7297
|
updateAttributes: (t) => {
|
|
7139
|
-
|
|
7298
|
+
Eu(i, e, t);
|
|
7140
7299
|
}
|
|
7141
7300
|
});
|
|
7142
7301
|
}] : [];
|
|
@@ -7160,7 +7319,7 @@ var Ou = class {
|
|
|
7160
7319
|
options: e.options,
|
|
7161
7320
|
storage: this.editor.extensionStorage[e.name],
|
|
7162
7321
|
editor: this.editor,
|
|
7163
|
-
type:
|
|
7322
|
+
type: Xs(e.name, this.schema)
|
|
7164
7323
|
};
|
|
7165
7324
|
e.type === "mark" && ((Q(Z(e, "keepOnSplit", t)) ?? !0) && this.splittableMarks.push(e.name), (Q(Z(e, "clearable", t)) ?? !0) || this.nonClearableMarks.push(e.name));
|
|
7166
7325
|
let n = Z(e, "onBeforeCreate", t), r = Z(e, "onCreate", t), i = Z(e, "onUpdate", t), a = Z(e, "onSelectionUpdate", t), o = Z(e, "onTransaction", t), s = Z(e, "onFocus", t), c = Z(e, "onBlur", t), l = Z(e, "onDestroy", t);
|
|
@@ -7168,8 +7327,8 @@ var Ou = class {
|
|
|
7168
7327
|
});
|
|
7169
7328
|
}
|
|
7170
7329
|
};
|
|
7171
|
-
|
|
7172
|
-
var $ = class e extends
|
|
7330
|
+
Uu.resolve = Ns, Uu.sort = Ms, Uu.flatten = cs;
|
|
7331
|
+
var $ = class e extends Fu {
|
|
7173
7332
|
constructor(...e) {
|
|
7174
7333
|
super(...e), this.type = "extension";
|
|
7175
7334
|
}
|
|
@@ -7184,7 +7343,7 @@ var $ = class e extends bu {
|
|
|
7184
7343
|
let t = typeof e == "function" ? e() : e;
|
|
7185
7344
|
return super.extend(t);
|
|
7186
7345
|
}
|
|
7187
|
-
},
|
|
7346
|
+
}, Wu = $.create({
|
|
7188
7347
|
name: "clipboardTextSerializer",
|
|
7189
7348
|
addOptions() {
|
|
7190
7349
|
return { blockSeparator: void 0 };
|
|
@@ -7193,23 +7352,23 @@ var $ = class e extends bu {
|
|
|
7193
7352
|
return [new m({
|
|
7194
7353
|
key: new s("clipboardTextSerializer"),
|
|
7195
7354
|
props: { clipboardTextSerializer: () => {
|
|
7196
|
-
let { editor: e } = this, { state: t, schema: n } = e, { doc: r, selection: i } = t, a =
|
|
7355
|
+
let { editor: e } = this, { state: t, schema: n } = e, { doc: r, selection: i } = t, a = zs(n), { blockSeparator: o } = this.options, s = {
|
|
7197
7356
|
...o === void 0 ? {} : { blockSeparator: o },
|
|
7198
7357
|
textSerializers: a
|
|
7199
7358
|
};
|
|
7200
|
-
return [...i.ranges].sort((e, t) => e.$from.pos - t.$from.pos).map(({ $from: e, $to: t }) =>
|
|
7359
|
+
return [...i.ranges].sort((e, t) => e.$from.pos - t.$from.pos).map(({ $from: e, $to: t }) => Ls(r, {
|
|
7201
7360
|
from: e.pos,
|
|
7202
7361
|
to: t.pos
|
|
7203
7362
|
}, s)).join(o ?? "\n\n");
|
|
7204
7363
|
} }
|
|
7205
7364
|
})];
|
|
7206
7365
|
}
|
|
7207
|
-
}),
|
|
7366
|
+
}), Gu = $.create({
|
|
7208
7367
|
name: "commands",
|
|
7209
7368
|
addCommands() {
|
|
7210
|
-
return { ...
|
|
7369
|
+
return { ...ul };
|
|
7211
7370
|
}
|
|
7212
|
-
}),
|
|
7371
|
+
}), Ku = $.create({
|
|
7213
7372
|
name: "delete",
|
|
7214
7373
|
onUpdate({ transaction: e, appendedTransactions: t }) {
|
|
7215
7374
|
var n;
|
|
@@ -7217,7 +7376,7 @@ var $ = class e extends bu {
|
|
|
7217
7376
|
var n, r;
|
|
7218
7377
|
if (((n = this.editor.options.coreExtensionOptions) == null || (n = n.delete) == null || (r = n.filterTransaction) == null ? void 0 : r.call(n, e)) ?? e.getMeta("y-sync$")) return;
|
|
7219
7378
|
let i = ns(e.before, [e, ...t]);
|
|
7220
|
-
|
|
7379
|
+
Gs(i).forEach((t) => {
|
|
7221
7380
|
i.mapping.mapResult(t.oldRange.from).deletedAfter && i.mapping.mapResult(t.oldRange.to).deletedBefore && i.before.nodesBetween(t.oldRange.from, t.oldRange.to, (n, r) => {
|
|
7222
7381
|
let a = r + n.nodeSize - 2, o = t.oldRange.from <= r && a <= t.oldRange.to;
|
|
7223
7382
|
this.editor.emit("delete", {
|
|
@@ -7263,7 +7422,7 @@ var $ = class e extends bu {
|
|
|
7263
7422
|
};
|
|
7264
7423
|
((n = this.editor.options.coreExtensionOptions) == null || (n = n.delete) == null ? void 0 : n.async) ?? !0 ? setTimeout(r, 0) : r();
|
|
7265
7424
|
}
|
|
7266
|
-
}),
|
|
7425
|
+
}), qu = $.create({
|
|
7267
7426
|
name: "drop",
|
|
7268
7427
|
addProseMirrorPlugins() {
|
|
7269
7428
|
return [new m({
|
|
@@ -7278,7 +7437,7 @@ var $ = class e extends bu {
|
|
|
7278
7437
|
} }
|
|
7279
7438
|
})];
|
|
7280
7439
|
}
|
|
7281
|
-
}),
|
|
7440
|
+
}), Ju = $.create({
|
|
7282
7441
|
name: "editable",
|
|
7283
7442
|
addProseMirrorPlugins() {
|
|
7284
7443
|
return [new m({
|
|
@@ -7286,12 +7445,12 @@ var $ = class e extends bu {
|
|
|
7286
7445
|
props: { editable: () => this.editor.options.editable }
|
|
7287
7446
|
})];
|
|
7288
7447
|
}
|
|
7289
|
-
}),
|
|
7448
|
+
}), Yu = new s("focusEvents"), Xu = $.create({
|
|
7290
7449
|
name: "focusEvents",
|
|
7291
7450
|
addProseMirrorPlugins() {
|
|
7292
7451
|
let { editor: e } = this;
|
|
7293
7452
|
return [new m({
|
|
7294
|
-
key:
|
|
7453
|
+
key: Yu,
|
|
7295
7454
|
props: { handleDOMEvents: {
|
|
7296
7455
|
focus: (t, n) => {
|
|
7297
7456
|
e.isFocused = !0;
|
|
@@ -7306,7 +7465,7 @@ var $ = class e extends bu {
|
|
|
7306
7465
|
} }
|
|
7307
7466
|
})];
|
|
7308
7467
|
}
|
|
7309
|
-
}),
|
|
7468
|
+
}), Zu = $.create({
|
|
7310
7469
|
name: "keymap",
|
|
7311
7470
|
addKeyboardShortcuts() {
|
|
7312
7471
|
let e = () => this.editor.commands.first(({ commands: e }) => [
|
|
@@ -7358,7 +7517,7 @@ var $ = class e extends bu {
|
|
|
7358
7517
|
let r = e.some((e) => e.docChanged) && !t.doc.eq(n.doc), i = e.some((e) => e.getMeta("preventClearDocument"));
|
|
7359
7518
|
if (!r || i) return;
|
|
7360
7519
|
let { empty: a, from: o, to: s } = t.selection, c = v.atStart(t.doc).from, l = v.atEnd(t.doc).to;
|
|
7361
|
-
if (a || o !== c || s !== l || !
|
|
7520
|
+
if (a || o !== c || s !== l || !ac(n.doc)) return;
|
|
7362
7521
|
let u = n.tr, d = Ra({
|
|
7363
7522
|
state: n,
|
|
7364
7523
|
transaction: u
|
|
@@ -7370,7 +7529,7 @@ var $ = class e extends bu {
|
|
|
7370
7529
|
}
|
|
7371
7530
|
})];
|
|
7372
7531
|
}
|
|
7373
|
-
}),
|
|
7532
|
+
}), Qu = $.create({
|
|
7374
7533
|
name: "paste",
|
|
7375
7534
|
addProseMirrorPlugins() {
|
|
7376
7535
|
return [new m({
|
|
@@ -7384,7 +7543,7 @@ var $ = class e extends bu {
|
|
|
7384
7543
|
} }
|
|
7385
7544
|
})];
|
|
7386
7545
|
}
|
|
7387
|
-
}),
|
|
7546
|
+
}), $u = $.create({
|
|
7388
7547
|
name: "tabindex",
|
|
7389
7548
|
addOptions() {
|
|
7390
7549
|
return { value: void 0 };
|
|
@@ -7395,14 +7554,14 @@ var $ = class e extends bu {
|
|
|
7395
7554
|
props: { attributes: () => !this.editor.isEditable && this.options.value === void 0 ? {} : { tabindex: this.options.value ?? "0" } }
|
|
7396
7555
|
})];
|
|
7397
7556
|
}
|
|
7398
|
-
}),
|
|
7557
|
+
}), ed = $.create({
|
|
7399
7558
|
name: "textDirection",
|
|
7400
7559
|
addOptions() {
|
|
7401
7560
|
return { direction: void 0 };
|
|
7402
7561
|
},
|
|
7403
7562
|
addGlobalAttributes() {
|
|
7404
7563
|
if (!this.options.direction) return [];
|
|
7405
|
-
let { nodeExtensions: e } =
|
|
7564
|
+
let { nodeExtensions: e } = vs(this.extensions);
|
|
7406
7565
|
return [{
|
|
7407
7566
|
types: e.filter((e) => e.name !== "text").map((e) => e.name),
|
|
7408
7567
|
attributes: { dir: {
|
|
@@ -7424,34 +7583,36 @@ var $ = class e extends bu {
|
|
|
7424
7583
|
} }
|
|
7425
7584
|
})];
|
|
7426
7585
|
}
|
|
7427
|
-
}),
|
|
7428
|
-
ClipboardTextSerializer: () =>
|
|
7429
|
-
Commands: () =>
|
|
7430
|
-
Delete: () =>
|
|
7431
|
-
Drop: () =>
|
|
7432
|
-
Editable: () =>
|
|
7433
|
-
FocusEvents: () =>
|
|
7434
|
-
Keymap: () =>
|
|
7435
|
-
Paste: () =>
|
|
7436
|
-
Tabindex: () =>
|
|
7437
|
-
TextDirection: () =>
|
|
7438
|
-
focusEventsPluginKey: () =>
|
|
7439
|
-
}),
|
|
7440
|
-
function
|
|
7441
|
-
if (
|
|
7442
|
-
|
|
7586
|
+
}), td = /* @__PURE__ */ w({
|
|
7587
|
+
ClipboardTextSerializer: () => Wu,
|
|
7588
|
+
Commands: () => Gu,
|
|
7589
|
+
Delete: () => Ku,
|
|
7590
|
+
Drop: () => qu,
|
|
7591
|
+
Editable: () => Ju,
|
|
7592
|
+
FocusEvents: () => Xu,
|
|
7593
|
+
Keymap: () => Zu,
|
|
7594
|
+
Paste: () => Qu,
|
|
7595
|
+
Tabindex: () => $u,
|
|
7596
|
+
TextDirection: () => ed,
|
|
7597
|
+
focusEventsPluginKey: () => Yu
|
|
7598
|
+
}), nd = !1;
|
|
7599
|
+
function rd(e) {
|
|
7600
|
+
if (nd) return;
|
|
7601
|
+
nd = !0;
|
|
7443
7602
|
let t;
|
|
7444
7603
|
try {
|
|
7445
|
-
|
|
7604
|
+
let n = y.fromJSON(e, {
|
|
7446
7605
|
from: 0,
|
|
7447
7606
|
to: 0
|
|
7448
|
-
})
|
|
7607
|
+
});
|
|
7608
|
+
if (!yc(n)) return;
|
|
7609
|
+
t = n.slice.content;
|
|
7449
7610
|
} catch {
|
|
7450
7611
|
return;
|
|
7451
7612
|
}
|
|
7452
7613
|
t instanceof C || console.warn("[tiptap warn]: prosemirror-model is loaded more than once. Wrapping and splitting nodes will fail. Deduplicate it in your lock file, or alias it to a single copy in your bundler.");
|
|
7453
7614
|
}
|
|
7454
|
-
var
|
|
7615
|
+
var id = class e {
|
|
7455
7616
|
get name() {
|
|
7456
7617
|
return this.node.type.name;
|
|
7457
7618
|
}
|
|
@@ -7573,7 +7734,7 @@ var Uu = class e {
|
|
|
7573
7734
|
...e
|
|
7574
7735
|
}), this.editor.view.dispatch(t);
|
|
7575
7736
|
}
|
|
7576
|
-
},
|
|
7737
|
+
}, ad = ".ProseMirror {\n position: relative;\n}\n\n.ProseMirror {\n word-wrap: break-word;\n white-space: pre-wrap;\n white-space: break-spaces;\n -webkit-font-variant-ligatures: none;\n font-variant-ligatures: none;\n font-feature-settings: \"liga\" 0; /* the above doesn't seem to work in Edge */\n}\n\n.ProseMirror [contenteditable=\"false\"] {\n white-space: normal;\n}\n\n.ProseMirror [contenteditable=\"false\"] [contenteditable=\"true\"] {\n white-space: pre-wrap;\n}\n\n.ProseMirror pre {\n white-space: pre-wrap;\n}\n\nimg.ProseMirror-separator {\n display: inline !important;\n border: none !important;\n margin: 0 !important;\n width: 0 !important;\n height: 0 !important;\n}\n\n.ProseMirror-gapcursor {\n display: none;\n pointer-events: none;\n position: absolute;\n margin: 0;\n}\n\n.ProseMirror-gapcursor:after {\n content: \"\";\n display: block;\n position: absolute;\n top: -2px;\n width: 20px;\n border-top: 1px solid black;\n animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;\n}\n\n@keyframes ProseMirror-cursor-blink {\n to {\n visibility: hidden;\n }\n}\n\n.ProseMirror-hideselection *::selection {\n background: transparent;\n}\n\n.ProseMirror-hideselection *::-moz-selection {\n background: transparent;\n}\n\n.ProseMirror-hideselection * {\n caret-color: transparent;\n}\n\n.ProseMirror-focused .ProseMirror-gapcursor {\n display: block;\n}", od = class extends ml {
|
|
7577
7738
|
constructor(e = {}) {
|
|
7578
7739
|
super(), this.css = null, this.className = "tiptap", this.editorView = null, this.isFocused = !1, this.destroyed = !1, this.isInitialized = !1, this.extensionStorage = {}, this.instanceId = Math.random().toString(36).slice(2, 9), this.hasWarnedStaleDecorationRead = !1, this.options = {
|
|
7579
7740
|
element: typeof document < "u" ? document.createElement("div") : null,
|
|
@@ -7610,8 +7771,8 @@ var Uu = class e {
|
|
|
7610
7771
|
onDelete: () => null,
|
|
7611
7772
|
enableExtensionDispatchTransaction: !0
|
|
7612
7773
|
}, this.isCapturingTransaction = !1, this.capturedTransaction = null, this.utils = {
|
|
7613
|
-
getUpdatedPosition:
|
|
7614
|
-
createMappablePosition:
|
|
7774
|
+
getUpdatedPosition: Cc,
|
|
7775
|
+
createMappablePosition: wc
|
|
7615
7776
|
}, this.setOptions(e), this.createExtensionManager(), this.createCommandManager(), this.createSchema(), this.on("beforeCreate", this.options.onBeforeCreate), this.emit("beforeCreate", { editor: this }), this.on("mount", this.options.onMount), this.on("unmount", this.options.onUnmount), this.on("contentError", this.options.onContentError), this.on("create", this.options.onCreate), this.on("update", this.options.onUpdate), this.on("selectionUpdate", this.options.onSelectionUpdate), this.on("transaction", this.options.onTransaction), this.on("focus", this.options.onFocus), this.on("blur", this.options.onBlur), this.on("destroy", this.options.onDestroy), this.on("drop", ({ event: e, slice: t, moved: n }) => this.options.onDrop(e, t, n)), this.on("paste", ({ event: e, slice: t }) => this.options.onPaste(e, t)), this.on("delete", this.options.onDelete);
|
|
7616
7777
|
let t = this.createDoc();
|
|
7617
7778
|
if (!this.editorState) {
|
|
@@ -7622,7 +7783,7 @@ var Uu = class e {
|
|
|
7622
7783
|
selection: e || void 0
|
|
7623
7784
|
});
|
|
7624
7785
|
}
|
|
7625
|
-
|
|
7786
|
+
rd(this.schema), this.options.element && this.mount(this.options.element);
|
|
7626
7787
|
}
|
|
7627
7788
|
mount(e) {
|
|
7628
7789
|
if (typeof document > "u") throw Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");
|
|
@@ -7656,7 +7817,7 @@ var Uu = class e {
|
|
|
7656
7817
|
return this.commandManager ? this.commandManager.can() : za.createFallbackCan();
|
|
7657
7818
|
}
|
|
7658
7819
|
injectCSS() {
|
|
7659
|
-
this.options.injectCSS && typeof document < "u" && (this.css =
|
|
7820
|
+
this.options.injectCSS && typeof document < "u" && (this.css = Rl(ad, this.options.injectNonce));
|
|
7660
7821
|
}
|
|
7661
7822
|
setOptions(e = {}) {
|
|
7662
7823
|
this.options = {
|
|
@@ -7698,10 +7859,10 @@ var Uu = class e {
|
|
|
7698
7859
|
} });
|
|
7699
7860
|
}
|
|
7700
7861
|
get state() {
|
|
7701
|
-
return
|
|
7862
|
+
return hl && !this.hasWarnedStaleDecorationRead && pl(this) && (this.hasWarnedStaleDecorationRead = !0, console.warn("[tiptap warn]: `editor.state` was read while decoration `create()` was running. It returns the pre-transaction document. Use the `state` argument passed to `create()` instead. Helpers like `editor.isActive()` read `editor.state` too, so pass `state` to their standalone versions instead of calling them on the editor.")), this.editorView && (this.editorState = this.view.state), this.editorState;
|
|
7702
7863
|
}
|
|
7703
7864
|
registerPlugin(e, t) {
|
|
7704
|
-
let n =
|
|
7865
|
+
let n = bs(t) ? t(e, [...this.state.plugins]) : [...this.state.plugins, e], r = this.state.reconfigure({ plugins: n });
|
|
7705
7866
|
return this.view.updateState(r), r;
|
|
7706
7867
|
}
|
|
7707
7868
|
unregisterPlugin(e) {
|
|
@@ -7717,22 +7878,22 @@ var Uu = class e {
|
|
|
7717
7878
|
createExtensionManager() {
|
|
7718
7879
|
var e, t;
|
|
7719
7880
|
let n = [...this.options.enableCoreExtensions ? [
|
|
7720
|
-
|
|
7721
|
-
|
|
7722
|
-
|
|
7723
|
-
|
|
7724
|
-
|
|
7725
|
-
|
|
7726
|
-
|
|
7727
|
-
|
|
7728
|
-
|
|
7729
|
-
|
|
7881
|
+
Ju,
|
|
7882
|
+
Wu.configure({ blockSeparator: (e = this.options.coreExtensionOptions) == null || (e = e.clipboardTextSerializer) == null ? void 0 : e.blockSeparator }),
|
|
7883
|
+
Gu,
|
|
7884
|
+
Xu,
|
|
7885
|
+
Zu,
|
|
7886
|
+
$u.configure({ value: (t = this.options.coreExtensionOptions) == null || (t = t.tabindex) == null ? void 0 : t.value }),
|
|
7887
|
+
qu,
|
|
7888
|
+
Qu,
|
|
7889
|
+
Ku,
|
|
7890
|
+
ed.configure({ direction: this.options.textDirection })
|
|
7730
7891
|
].filter((e) => typeof this.options.enableCoreExtensions != "object" || this.options.enableCoreExtensions[e.name] !== !1) : [], ...this.options.extensions].filter((e) => [
|
|
7731
7892
|
"extension",
|
|
7732
7893
|
"node",
|
|
7733
7894
|
"mark"
|
|
7734
7895
|
].includes(e?.type));
|
|
7735
|
-
this.extensionManager = new
|
|
7896
|
+
this.extensionManager = new Uu(n, this);
|
|
7736
7897
|
}
|
|
7737
7898
|
createCommandManager() {
|
|
7738
7899
|
this.commandManager = new za({ editor: this });
|
|
@@ -7763,7 +7924,7 @@ var Uu = class e {
|
|
|
7763
7924
|
}
|
|
7764
7925
|
getEditorViewAttributes() {
|
|
7765
7926
|
let e = this.options.editorProps?.attributes;
|
|
7766
|
-
return
|
|
7927
|
+
return bs(e) ? (t) => ({
|
|
7767
7928
|
role: "textbox",
|
|
7768
7929
|
...e(t)
|
|
7769
7930
|
}) : {
|
|
@@ -7841,11 +8002,11 @@ var Uu = class e {
|
|
|
7841
8002
|
});
|
|
7842
8003
|
}
|
|
7843
8004
|
getAttributes(e) {
|
|
7844
|
-
return
|
|
8005
|
+
return Hs(this.state, e);
|
|
7845
8006
|
}
|
|
7846
8007
|
isActive(e, t) {
|
|
7847
8008
|
let n = typeof e == "string" ? e : null, r = typeof e == "string" ? t : e;
|
|
7848
|
-
return
|
|
8009
|
+
return ec(this.state, n, r);
|
|
7849
8010
|
}
|
|
7850
8011
|
getJSON() {
|
|
7851
8012
|
return this.state.doc.toJSON();
|
|
@@ -7855,16 +8016,16 @@ var Uu = class e {
|
|
|
7855
8016
|
}
|
|
7856
8017
|
getText(e) {
|
|
7857
8018
|
let { blockSeparator: t = "\n\n", textSerializers: n = {} } = e || {};
|
|
7858
|
-
return
|
|
8019
|
+
return Rs(this.state.doc, {
|
|
7859
8020
|
blockSeparator: t,
|
|
7860
8021
|
textSerializers: {
|
|
7861
|
-
...
|
|
8022
|
+
...zs(this.schema),
|
|
7862
8023
|
...n
|
|
7863
8024
|
}
|
|
7864
8025
|
});
|
|
7865
8026
|
}
|
|
7866
8027
|
get isEmpty() {
|
|
7867
|
-
return
|
|
8028
|
+
return ac(this.state.doc);
|
|
7868
8029
|
}
|
|
7869
8030
|
destroy() {
|
|
7870
8031
|
this.destroyed || (this.destroyed = !0, this.emit("destroy"), this.unmount(), this.removeAllListeners(), this.extensionManager.destroy(), this.extensionManager = null, this.schema = null, this.commandManager = null, this.extensionStorage = {});
|
|
@@ -7880,23 +8041,23 @@ var Uu = class e {
|
|
|
7880
8041
|
}
|
|
7881
8042
|
$pos(e) {
|
|
7882
8043
|
let t = this.state.doc.resolve(e), n = e > 0 && t.nodeAfter && !t.nodeAfter.isText && t.nodeAfter.isAtom ? t.nodeAfter : null;
|
|
7883
|
-
return new
|
|
8044
|
+
return new id(t, this, !1, n);
|
|
7884
8045
|
}
|
|
7885
8046
|
get $doc() {
|
|
7886
8047
|
return this.$pos(0);
|
|
7887
8048
|
}
|
|
7888
|
-
},
|
|
8049
|
+
}, sd = class {
|
|
7889
8050
|
static Inline(e, t, n = {}, r) {
|
|
7890
|
-
return new
|
|
8051
|
+
return new cd(e, t, n, r);
|
|
7891
8052
|
}
|
|
7892
8053
|
static Node(e, t, n = {}, r) {
|
|
7893
|
-
return new
|
|
8054
|
+
return new ld(e, t, n, r);
|
|
7894
8055
|
}
|
|
7895
8056
|
static Widget(e, t, n) {
|
|
7896
8057
|
let { key: r, ...i } = n;
|
|
7897
|
-
return new
|
|
8058
|
+
return new ud(e, t, r, i);
|
|
7898
8059
|
}
|
|
7899
|
-
},
|
|
8060
|
+
}, cd = class extends sd {
|
|
7900
8061
|
constructor(e, t, n = {}, r) {
|
|
7901
8062
|
super(), this.kind = "inline", this.from = e, this.to = t, this.attrs = n, this.spec = r;
|
|
7902
8063
|
}
|
|
@@ -7910,7 +8071,7 @@ var Uu = class e {
|
|
|
7910
8071
|
} : this.spec;
|
|
7911
8072
|
return U.inline(this.from, this.to, this.attrs, t);
|
|
7912
8073
|
}
|
|
7913
|
-
},
|
|
8074
|
+
}, ld = class extends sd {
|
|
7914
8075
|
constructor(e, t, n = {}, r) {
|
|
7915
8076
|
super(), this.kind = "node", this.from = e, this.to = t, this.attrs = n, this.spec = r;
|
|
7916
8077
|
}
|
|
@@ -7924,7 +8085,7 @@ var Uu = class e {
|
|
|
7924
8085
|
} : this.spec;
|
|
7925
8086
|
return U.node(this.from, this.to, this.attrs, t);
|
|
7926
8087
|
}
|
|
7927
|
-
},
|
|
8088
|
+
}, ud = class extends sd {
|
|
7928
8089
|
constructor(e, t, n, r) {
|
|
7929
8090
|
super(), this.kind = "widget", this.pos = e, this.render = t, this.key = n, this.spec = r;
|
|
7930
8091
|
}
|
|
@@ -7943,7 +8104,7 @@ var Uu = class e {
|
|
|
7943
8104
|
return U.widget(this.pos, this.render, t);
|
|
7944
8105
|
}
|
|
7945
8106
|
};
|
|
7946
|
-
function
|
|
8107
|
+
function dd(e, t) {
|
|
7947
8108
|
let n = e, r = n[t];
|
|
7948
8109
|
if (!r) {
|
|
7949
8110
|
r = {
|
|
@@ -7959,7 +8120,7 @@ function Xu(e, t) {
|
|
|
7959
8120
|
}
|
|
7960
8121
|
return r;
|
|
7961
8122
|
}
|
|
7962
|
-
function
|
|
8123
|
+
function fd(e) {
|
|
7963
8124
|
e.flushScheduled = !1;
|
|
7964
8125
|
for (let [t, n] of e.pendingProps) {
|
|
7965
8126
|
let r = e.renderers.get(t);
|
|
@@ -7967,13 +8128,13 @@ function Zu(e) {
|
|
|
7967
8128
|
}
|
|
7968
8129
|
e.pendingProps.clear();
|
|
7969
8130
|
}
|
|
7970
|
-
function
|
|
7971
|
-
let { editor: t, pos: n, key: r, props: i, cacheKey: a, context: o, create: s, materialize: c, side: l, relaxedSide: u, marks: d, stopEvent: f, ignoreSelection: p, destroy: m } = e, h =
|
|
8131
|
+
function pd(e) {
|
|
8132
|
+
let { editor: t, pos: n, key: r, props: i, cacheKey: a, context: o, create: s, materialize: c, side: l, relaxedSide: u, marks: d, stopEvent: f, ignoreSelection: p, destroy: m } = e, h = dd(t, a);
|
|
7972
8133
|
if (h.renderers.has(r)) {
|
|
7973
8134
|
let e = h.pendingProps.get(r) ?? h.props.get(r);
|
|
7974
|
-
(!e || !
|
|
8135
|
+
(!e || !Il(e, i)) && (h.pendingProps.set(r, i), h.flushScheduled || (h.flushScheduled = !0, queueMicrotask(() => fd(h))));
|
|
7975
8136
|
}
|
|
7976
|
-
return
|
|
8137
|
+
return sd.Widget(n, (e, t) => {
|
|
7977
8138
|
let n = {
|
|
7978
8139
|
...i,
|
|
7979
8140
|
...o(t)
|
|
@@ -7987,7 +8148,7 @@ function Qu(e) {
|
|
|
7987
8148
|
stopEvent: f,
|
|
7988
8149
|
ignoreSelection: p,
|
|
7989
8150
|
destroy: (e) => {
|
|
7990
|
-
if (!
|
|
8151
|
+
if (!Pl(t).has(r)) try {
|
|
7991
8152
|
var n;
|
|
7992
8153
|
(n = h.renderers.get(r)) == null || n.destroy(), h.renderers.delete(r), h.props.delete(r), h.pendingProps.delete(r);
|
|
7993
8154
|
} finally {
|
|
@@ -7996,8 +8157,8 @@ function Qu(e) {
|
|
|
7996
8157
|
}
|
|
7997
8158
|
});
|
|
7998
8159
|
}
|
|
7999
|
-
function
|
|
8000
|
-
return new
|
|
8160
|
+
function md(e) {
|
|
8161
|
+
return new Ou({
|
|
8001
8162
|
find: e.find,
|
|
8002
8163
|
handler: ({ state: t, range: n, match: r }) => {
|
|
8003
8164
|
let i = Q(e.getAttributes, void 0, r);
|
|
@@ -8005,7 +8166,7 @@ function $u(e) {
|
|
|
8005
8166
|
let { tr: a } = t, o = r[r.length - 1], s = r[0];
|
|
8006
8167
|
if (o) {
|
|
8007
8168
|
let r = s.search(/\S/), c = n.from + s.indexOf(o), l = c + o.length;
|
|
8008
|
-
if (
|
|
8169
|
+
if (qs(n.from, n.to, t.doc).filter((t) => t.mark.type.excluded.find((n) => n === e.type && n !== t.mark.type)).filter((e) => e.to > c).length) return null;
|
|
8009
8170
|
l < n.to && a.delete(l, n.to), c > n.from && a.delete(n.from + r, c);
|
|
8010
8171
|
let u = n.from + r + o.length;
|
|
8011
8172
|
a.addMark(n.from + r, u, e.type.create(i || {})), a.removeStoredMark(e.type);
|
|
@@ -8014,8 +8175,8 @@ function $u(e) {
|
|
|
8014
8175
|
undoable: e.undoable
|
|
8015
8176
|
});
|
|
8016
8177
|
}
|
|
8017
|
-
function
|
|
8018
|
-
return new
|
|
8178
|
+
function hd(e) {
|
|
8179
|
+
return new Ou({
|
|
8019
8180
|
find: e.find,
|
|
8020
8181
|
handler: ({ state: t, range: n, match: r }) => {
|
|
8021
8182
|
let i = Q(e.getAttributes, void 0, r) || {}, { tr: a } = t, o = n.from, s = n.to, c = e.type.create(i);
|
|
@@ -8033,8 +8194,8 @@ function ed(e) {
|
|
|
8033
8194
|
undoable: e.undoable
|
|
8034
8195
|
});
|
|
8035
8196
|
}
|
|
8036
|
-
function
|
|
8037
|
-
return new
|
|
8197
|
+
function gd(e) {
|
|
8198
|
+
return new Ou({
|
|
8038
8199
|
find: e.find,
|
|
8039
8200
|
handler: ({ state: t, range: n, match: r }) => {
|
|
8040
8201
|
let i = t.doc.resolve(n.from), a = Q(e.getAttributes, void 0, r) || {};
|
|
@@ -8044,8 +8205,8 @@ function td(e) {
|
|
|
8044
8205
|
undoable: e.undoable
|
|
8045
8206
|
});
|
|
8046
8207
|
}
|
|
8047
|
-
function
|
|
8048
|
-
return new
|
|
8208
|
+
function _d(e) {
|
|
8209
|
+
return new Ou({
|
|
8049
8210
|
find: e.find,
|
|
8050
8211
|
handler: ({ state: t, range: n, match: r }) => {
|
|
8051
8212
|
let i = e.replace, a = n.from, o = n.to;
|
|
@@ -8060,8 +8221,8 @@ function nd(e) {
|
|
|
8060
8221
|
undoable: e.undoable
|
|
8061
8222
|
});
|
|
8062
8223
|
}
|
|
8063
|
-
function
|
|
8064
|
-
return new
|
|
8224
|
+
function vd(e) {
|
|
8225
|
+
return new Ou({
|
|
8065
8226
|
find: e.find,
|
|
8066
8227
|
handler: ({ state: t, range: n, match: r, chain: i }) => {
|
|
8067
8228
|
let a = Q(e.getAttributes, void 0, r) || {}, o = t.tr.delete(n.from, n.to), s = o.doc.resolve(n.from).blockRange(), c = s && S(s, e.type, a);
|
|
@@ -8083,49 +8244,49 @@ function rd(e) {
|
|
|
8083
8244
|
undoable: e.undoable
|
|
8084
8245
|
});
|
|
8085
8246
|
}
|
|
8086
|
-
var
|
|
8087
|
-
function
|
|
8247
|
+
var yd = /* @__PURE__ */ new WeakSet(), bd = /* @__PURE__ */ new WeakSet();
|
|
8248
|
+
function xd(e) {
|
|
8088
8249
|
let t = e;
|
|
8089
|
-
return
|
|
8250
|
+
return yd.add(t), t;
|
|
8090
8251
|
}
|
|
8091
|
-
function
|
|
8092
|
-
return Array.isArray(e) &&
|
|
8252
|
+
function Sd(e) {
|
|
8253
|
+
return Array.isArray(e) && yd.has(e);
|
|
8093
8254
|
}
|
|
8094
|
-
function
|
|
8095
|
-
return e.flatMap((e) => e == null ? [] : Array.isArray(e) &&
|
|
8255
|
+
function Cd(e) {
|
|
8256
|
+
return e.flatMap((e) => e == null ? [] : Array.isArray(e) && bd.has(e) && !Sd(e) ? Cd(e) : [e]);
|
|
8096
8257
|
}
|
|
8097
|
-
function
|
|
8098
|
-
return
|
|
8258
|
+
function wd(e) {
|
|
8259
|
+
return bd.add(e.children), e.children;
|
|
8099
8260
|
}
|
|
8100
|
-
function
|
|
8261
|
+
function Td(e, t) {
|
|
8101
8262
|
if (e === "slot") return 0;
|
|
8102
8263
|
if (e instanceof Function) {
|
|
8103
8264
|
let n = e(t);
|
|
8104
|
-
return Array.isArray(n) && !
|
|
8265
|
+
return Array.isArray(n) && !Sd(n) && !bd.has(n) ? xd(n) : n;
|
|
8105
8266
|
}
|
|
8106
8267
|
let { children: n, ...r } = t ?? {};
|
|
8107
8268
|
if (e === "svg") throw Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");
|
|
8108
8269
|
if (Array.isArray(n)) {
|
|
8109
|
-
if (
|
|
8270
|
+
if (Sd(n)) return xd([
|
|
8110
8271
|
e,
|
|
8111
8272
|
r,
|
|
8112
8273
|
n
|
|
8113
8274
|
]);
|
|
8114
|
-
if (n.length === 0) return
|
|
8115
|
-
let t =
|
|
8116
|
-
return t.length === 0 ?
|
|
8275
|
+
if (n.length === 0) return xd([e, r]);
|
|
8276
|
+
let t = Cd(n);
|
|
8277
|
+
return t.length === 0 ? xd([e, r]) : xd([
|
|
8117
8278
|
e,
|
|
8118
8279
|
r,
|
|
8119
8280
|
...t
|
|
8120
8281
|
]);
|
|
8121
8282
|
}
|
|
8122
|
-
return
|
|
8283
|
+
return xd(n == null ? [e, r] : [
|
|
8123
8284
|
e,
|
|
8124
8285
|
r,
|
|
8125
8286
|
n
|
|
8126
8287
|
]);
|
|
8127
8288
|
}
|
|
8128
|
-
var
|
|
8289
|
+
var Ed = (e, t) => Td(e, t), Dd = (e) => "touches" in e, Od = class {
|
|
8129
8290
|
constructor(e) {
|
|
8130
8291
|
var t;
|
|
8131
8292
|
this.directions = [
|
|
@@ -8215,7 +8376,7 @@ var dd = (e, t) => ud(e, t), fd = (e) => "touches" in e, pd = class {
|
|
|
8215
8376
|
e ? (this.element.style.width = `${e}px`, this.initialWidth = e) : this.initialWidth = this.element.offsetWidth, t ? (this.element.style.height = `${t}px`, this.initialHeight = t) : this.initialHeight = this.element.offsetHeight, this.initialWidth > 0 && this.initialHeight > 0 && (this.aspectRatio = this.initialWidth / this.initialHeight);
|
|
8216
8377
|
}
|
|
8217
8378
|
handleResizeStart(e, t) {
|
|
8218
|
-
e.preventDefault(), e.stopPropagation(), this.isResizing = !0, this.activeHandle = t,
|
|
8379
|
+
e.preventDefault(), e.stopPropagation(), this.isResizing = !0, this.activeHandle = t, Dd(e) ? (this.startX = e.touches[0].clientX, this.startY = e.touches[0].clientY) : (this.startX = e.clientX, this.startY = e.clientY), this.startWidth = this.element.offsetWidth, this.startHeight = this.element.offsetHeight, this.startWidth > 0 && this.startHeight > 0 && (this.aspectRatio = this.startWidth / this.startHeight), this.getPos(), this.container.dataset.resizeState = "true", this.classNames.resizing && this.container.classList.add(this.classNames.resizing), document.addEventListener("mousemove", this.handleMouseMove), document.addEventListener("touchmove", this.handleTouchMove), document.addEventListener("mouseup", this.handleMouseUp), document.addEventListener("keydown", this.handleKeyDown), document.addEventListener("keyup", this.handleKeyUp);
|
|
8219
8380
|
}
|
|
8220
8381
|
handleResize(e, t) {
|
|
8221
8382
|
if (!this.activeHandle) return;
|
|
@@ -8255,7 +8416,7 @@ var dd = (e, t) => ud(e, t), fd = (e) => "touches" in e, pd = class {
|
|
|
8255
8416
|
height: e / this.aspectRatio
|
|
8256
8417
|
};
|
|
8257
8418
|
}
|
|
8258
|
-
},
|
|
8419
|
+
}, kd = Od, Ad = class e extends Fu {
|
|
8259
8420
|
constructor(...e) {
|
|
8260
8421
|
super(...e), this.type = "node";
|
|
8261
8422
|
}
|
|
@@ -8270,7 +8431,7 @@ var dd = (e, t) => ud(e, t), fd = (e) => "touches" in e, pd = class {
|
|
|
8270
8431
|
let t = typeof e == "function" ? e() : e;
|
|
8271
8432
|
return super.extend(t);
|
|
8272
8433
|
}
|
|
8273
|
-
},
|
|
8434
|
+
}, jd = class {
|
|
8274
8435
|
constructor(e, t, n) {
|
|
8275
8436
|
this.isDragging = !1, this.component = e, this.editor = t.editor, this.options = {
|
|
8276
8437
|
stopEvent: null,
|
|
@@ -8368,8 +8529,8 @@ var dd = (e, t) => ud(e, t), fd = (e) => "touches" in e, pd = class {
|
|
|
8368
8529
|
});
|
|
8369
8530
|
}
|
|
8370
8531
|
};
|
|
8371
|
-
function
|
|
8372
|
-
return new
|
|
8532
|
+
function Md(e) {
|
|
8533
|
+
return new Lu({
|
|
8373
8534
|
find: e.find,
|
|
8374
8535
|
handler: ({ state: t, range: n, match: r, pasteEvent: i }) => {
|
|
8375
8536
|
let a = Q(e.getAttributes, void 0, r, i);
|
|
@@ -8377,14 +8538,14 @@ function _d(e) {
|
|
|
8377
8538
|
let { tr: o } = t, s = r[r.length - 1], c = r[0], l = n.to;
|
|
8378
8539
|
if (s) {
|
|
8379
8540
|
let i = c.search(/\S/), u = n.from + c.indexOf(s), d = u + s.length;
|
|
8380
|
-
if (
|
|
8541
|
+
if (qs(n.from, n.to, t.doc).filter((t) => t.mark.type.excluded.find((n) => n === e.type && n !== t.mark.type)).filter((e) => e.to > u).length) return null;
|
|
8381
8542
|
d < n.to && o.delete(d, n.to), u > n.from && o.delete(n.from + i, u), l = n.from + i + s.length, o.addMark(n.from + i, l, e.type.create(a || {})), r.index !== void 0 && r.input !== void 0 && r.index + r[0].length >= r.input.length || o.removeStoredMark(e.type);
|
|
8382
8543
|
}
|
|
8383
8544
|
}
|
|
8384
8545
|
});
|
|
8385
8546
|
}
|
|
8386
|
-
function
|
|
8387
|
-
return new
|
|
8547
|
+
function Nd(e) {
|
|
8548
|
+
return new Lu({
|
|
8388
8549
|
find: e.find,
|
|
8389
8550
|
handler({ match: t, chain: n, range: r, pasteEvent: i }) {
|
|
8390
8551
|
let a = Q(e.getAttributes, void 0, t, i), o = Q(e.getContent, void 0, a);
|
|
@@ -8397,8 +8558,8 @@ function vd(e) {
|
|
|
8397
8558
|
}
|
|
8398
8559
|
});
|
|
8399
8560
|
}
|
|
8400
|
-
function
|
|
8401
|
-
return new
|
|
8561
|
+
function Pd(e) {
|
|
8562
|
+
return new Lu({
|
|
8402
8563
|
find: e.find,
|
|
8403
8564
|
handler: ({ state: t, range: n, match: r }) => {
|
|
8404
8565
|
let i = e.replace, a = n.from, o = n.to;
|
|
@@ -8412,7 +8573,7 @@ function yd(e) {
|
|
|
8412
8573
|
}
|
|
8413
8574
|
});
|
|
8414
8575
|
}
|
|
8415
|
-
var
|
|
8576
|
+
var Fd = class {
|
|
8416
8577
|
constructor(e) {
|
|
8417
8578
|
this.transaction = e, this.currentStep = this.transaction.steps.length;
|
|
8418
8579
|
}
|
|
@@ -8428,6 +8589,6 @@ var bd = class {
|
|
|
8428
8589
|
}
|
|
8429
8590
|
};
|
|
8430
8591
|
//#endregion
|
|
8431
|
-
export {
|
|
8592
|
+
export { Bs as $, gc as $t, Ra as A, lo as An, uo as At, vo as B, vd as Bn, Ro as Bt, Il as C, du as Cn, Qs as Ct, ul as D, Us as Dn, Ds as Dt, ns as E, Tc as En, Ed as Et, Rl as F, vs as Fn, Kl as Ft, is as G, fa as Gn, Yl as Gt, zl as H, La as Hn, oc as Ht, pd as I, _d as In, bs as It, as as J, dc as Jt, _s as K, U as Kn, lc as Kt, Hl as L, Pd as Ln, ic as Lt, _u as M, So as Mn, nc as Mt, wc as N, fu as Nn, xs as Nt, pu as O, xu as On, Pu as Ot, bo as P, Ms as Pn, rc as Pt, Is as Q, hc as Qt, wo as R, gd as Rn, Fo as Rt, ud as S, no as Sn, Ls as St, Ll as T, Hu as Tn, Cc as Tt, td as U, Ia as Un, sc as Ut, Gl as V, Na as Vn, ac as Vt, rs as W, Fa as Wn, ql as Wt, Es as X, pc as Xt, cs as Y, fc as Yt, Fs as Z, mc as Zt, jd as _, ws as _n, Xs as _t, od as a, xc as an, ls as at, kd as b, hd as bn, Bl as bt, wd as c, Xl as cn, Y as ct, Sc as d, fo as dn, Vs as dt, _c as en, Hs as et, Iu as f, Pl as fn, J as ft, id as g, wu as gn, js as gt, ld as h, Su as hn, Ps as ht, Fl as i, cc as in, Z as it, $o as j, Dc as jn, tc as jt, mu as k, Ns as kn, ec as kt, cd as l, co as ln, qs as lt, Ad as m, Md as mn, Ts as mt, ol as n, yc as nn, Gs as nt, Fu as o, to as on, ts as ot, Du as p, md as pn, Ys as pt, ss as q, W as qn, uc as qt, sd as r, bc as rn, Ks as rt, $ as s, po as sn, ao as st, za as t, vc as tn, ys as tt, Ou as u, Zl as un, Js as ut, Lu as v, Tu as vn, Uo as vt, Q as w, vu as wn, zs as wt, Fd as x, Nd as xn, Rs as xt, Od as y, X as yn, Zs as yt, Wo as z, Eu as zn, $s as zt };
|
|
8432
8593
|
|
|
8433
|
-
//# sourceMappingURL=dist-
|
|
8594
|
+
//# sourceMappingURL=dist-BJ6RUDuR.js.map
|