@clevertask/scribe 0.0.4 → 0.0.6
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/components/Menu/BubbleMenu.js +1 -1
- package/dist/components/Scribe/extension/extension-link.js +1 -1
- package/dist/components/Scribe/extension/extension-selectedText.js +1 -1
- package/dist/components/Scribe/extension/index.js +1680 -1581
- package/dist/components/Scribe/extension/math-extension.js +921 -918
- package/dist/components/Scribe/extension/slashCommand/index.js +1 -1
- package/dist/components/Scribe/extension/slashCommand/renderItems.js +1 -1
- package/dist/components/Scribe/index.js +2 -1
- package/dist/{index-Bl1eZGET.js → index-B9XP9QDO.js} +1 -1
- package/dist/{index-pCZujIH1.js → index-DzExyr-e.js} +190 -173
- package/dist/utils/html-to-markdown.js +32 -8
- package/package.json +2 -1
|
@@ -327,15 +327,15 @@ class b {
|
|
|
327
327
|
*/
|
|
328
328
|
findIndex(e, t = -1) {
|
|
329
329
|
if (e == 0)
|
|
330
|
-
return
|
|
330
|
+
return St(0, e);
|
|
331
331
|
if (e == this.size)
|
|
332
|
-
return
|
|
332
|
+
return St(this.content.length, e);
|
|
333
333
|
if (e > this.size || e < 0)
|
|
334
334
|
throw new RangeError(`Position ${e} outside of fragment (${this})`);
|
|
335
335
|
for (let n = 0, i = 0; ; n++) {
|
|
336
336
|
let s = this.child(n), o = i + s.nodeSize;
|
|
337
337
|
if (o >= e)
|
|
338
|
-
return o == e || t > 0 ?
|
|
338
|
+
return o == e || t > 0 ? St(n + 1, o) : St(n, i);
|
|
339
339
|
i = o;
|
|
340
340
|
}
|
|
341
341
|
}
|
|
@@ -401,10 +401,10 @@ class b {
|
|
|
401
401
|
}
|
|
402
402
|
b.empty = new b([], 0);
|
|
403
403
|
const sn = { index: 0, offset: 0 };
|
|
404
|
-
function
|
|
404
|
+
function St(r, e) {
|
|
405
405
|
return sn.index = r, sn.offset = e, sn;
|
|
406
406
|
}
|
|
407
|
-
function
|
|
407
|
+
function It(r, e) {
|
|
408
408
|
if (r === e)
|
|
409
409
|
return !0;
|
|
410
410
|
if (!(r && typeof r == "object") || !(e && typeof e == "object"))
|
|
@@ -416,11 +416,11 @@ function At(r, e) {
|
|
|
416
416
|
if (r.length != e.length)
|
|
417
417
|
return !1;
|
|
418
418
|
for (let n = 0; n < r.length; n++)
|
|
419
|
-
if (!
|
|
419
|
+
if (!It(r[n], e[n]))
|
|
420
420
|
return !1;
|
|
421
421
|
} else {
|
|
422
422
|
for (let n in r)
|
|
423
|
-
if (!(n in e) || !
|
|
423
|
+
if (!(n in e) || !It(r[n], e[n]))
|
|
424
424
|
return !1;
|
|
425
425
|
for (let n in e)
|
|
426
426
|
if (!(n in r))
|
|
@@ -482,7 +482,7 @@ let A = class Cn {
|
|
|
482
482
|
another mark.
|
|
483
483
|
*/
|
|
484
484
|
eq(e) {
|
|
485
|
-
return this == e || this.type == e.type &&
|
|
485
|
+
return this == e || this.type == e.type && It(this.attrs, e.attrs);
|
|
486
486
|
}
|
|
487
487
|
/**
|
|
488
488
|
Convert this mark to a JSON-serializeable representation.
|
|
@@ -534,7 +534,7 @@ let A = class Cn {
|
|
|
534
534
|
}
|
|
535
535
|
};
|
|
536
536
|
A.none = [];
|
|
537
|
-
class
|
|
537
|
+
class Rt extends Error {
|
|
538
538
|
}
|
|
539
539
|
class k {
|
|
540
540
|
/**
|
|
@@ -637,9 +637,9 @@ function Ci(r, e, t, n) {
|
|
|
637
637
|
}
|
|
638
638
|
function ro(r, e, t) {
|
|
639
639
|
if (t.openStart > r.depth)
|
|
640
|
-
throw new
|
|
640
|
+
throw new Rt("Inserted content deeper than insertion position");
|
|
641
641
|
if (r.depth - t.openStart != e.depth - t.openEnd)
|
|
642
|
-
throw new
|
|
642
|
+
throw new Rt("Inconsistent open depths");
|
|
643
643
|
return wi(r, e, t, 0);
|
|
644
644
|
}
|
|
645
645
|
function wi(r, e, t, n) {
|
|
@@ -655,11 +655,11 @@ function wi(r, e, t, n) {
|
|
|
655
655
|
let { start: o, end: l } = io(t, r);
|
|
656
656
|
return Pe(s, Ni(r, o, l, e, n));
|
|
657
657
|
}
|
|
658
|
-
else return Pe(s,
|
|
658
|
+
else return Pe(s, vt(r, e, n));
|
|
659
659
|
}
|
|
660
660
|
function Oi(r, e) {
|
|
661
661
|
if (!e.type.compatibleContent(r.type))
|
|
662
|
-
throw new
|
|
662
|
+
throw new Rt("Cannot join " + e.type.name + " onto " + r.type.name);
|
|
663
663
|
}
|
|
664
664
|
function wn(r, e, t) {
|
|
665
665
|
let n = r.node(t);
|
|
@@ -681,13 +681,13 @@ function Pe(r, e) {
|
|
|
681
681
|
}
|
|
682
682
|
function Ni(r, e, t, n, i) {
|
|
683
683
|
let s = r.depth > i && wn(r, e, i + 1), o = n.depth > i && wn(t, n, i + 1), l = [];
|
|
684
|
-
return ot(null, r, i, l), s && o && e.index(i) == t.index(i) ? (Oi(s, o), ve(Pe(s, Ni(r, e, t, n, i + 1)), l)) : (s && ve(Pe(s,
|
|
684
|
+
return ot(null, r, i, l), s && o && e.index(i) == t.index(i) ? (Oi(s, o), ve(Pe(s, Ni(r, e, t, n, i + 1)), l)) : (s && ve(Pe(s, vt(r, e, i + 1)), l), ot(e, t, i, l), o && ve(Pe(o, vt(t, n, i + 1)), l)), ot(n, null, i, l), new b(l);
|
|
685
685
|
}
|
|
686
|
-
function
|
|
686
|
+
function vt(r, e, t) {
|
|
687
687
|
let n = [];
|
|
688
688
|
if (ot(null, r, t, n), r.depth > t) {
|
|
689
689
|
let i = wn(r, e, t + 1);
|
|
690
|
-
ve(Pe(i,
|
|
690
|
+
ve(Pe(i, vt(r, e, t + 1)), n);
|
|
691
691
|
}
|
|
692
692
|
return ot(e, null, t, n), new b(n);
|
|
693
693
|
}
|
|
@@ -885,7 +885,7 @@ class ct {
|
|
|
885
885
|
return e.blockRange(this);
|
|
886
886
|
for (let n = this.depth - (this.parent.inlineContent || this.pos == e.pos ? 1 : 0); n >= 0; n--)
|
|
887
887
|
if (e.pos <= this.end(n) && (!t || t(this.node(n))))
|
|
888
|
-
return new
|
|
888
|
+
return new Pt(this, e, n);
|
|
889
889
|
return null;
|
|
890
890
|
}
|
|
891
891
|
/**
|
|
@@ -953,7 +953,7 @@ class so {
|
|
|
953
953
|
}
|
|
954
954
|
}
|
|
955
955
|
const oo = 12, hr = /* @__PURE__ */ new WeakMap();
|
|
956
|
-
class
|
|
956
|
+
class Pt {
|
|
957
957
|
/**
|
|
958
958
|
Construct a node range. `$from` and `$to` should point into the
|
|
959
959
|
same node until at least the given `depth`, since a node range
|
|
@@ -1112,7 +1112,7 @@ let xe = class On {
|
|
|
1112
1112
|
attributes, and marks.
|
|
1113
1113
|
*/
|
|
1114
1114
|
hasMarkup(e, t, n) {
|
|
1115
|
-
return this.type == e &&
|
|
1115
|
+
return this.type == e && It(this.attrs, t || e.defaultAttrs || lo) && A.sameSet(this.marks, n || A.none);
|
|
1116
1116
|
}
|
|
1117
1117
|
/**
|
|
1118
1118
|
Create a new node with the same markup as this node, containing
|
|
@@ -1364,7 +1364,7 @@ let xe = class On {
|
|
|
1364
1364
|
}
|
|
1365
1365
|
};
|
|
1366
1366
|
xe.prototype.text = void 0;
|
|
1367
|
-
class
|
|
1367
|
+
class Bt extends xe {
|
|
1368
1368
|
/**
|
|
1369
1369
|
@internal
|
|
1370
1370
|
*/
|
|
@@ -1386,10 +1386,10 @@ class Pt extends xe {
|
|
|
1386
1386
|
return this.text.length;
|
|
1387
1387
|
}
|
|
1388
1388
|
mark(e) {
|
|
1389
|
-
return e == this.marks ? this : new
|
|
1389
|
+
return e == this.marks ? this : new Bt(this.type, this.attrs, this.text, e);
|
|
1390
1390
|
}
|
|
1391
1391
|
withText(e) {
|
|
1392
|
-
return e == this.text ? this : new
|
|
1392
|
+
return e == this.text ? this : new Bt(this.type, this.attrs, e, this.marks);
|
|
1393
1393
|
}
|
|
1394
1394
|
cut(e = 0, t = this.text.length) {
|
|
1395
1395
|
return e == 0 && t == this.text.length ? this : this.withText(this.text.slice(e, t));
|
|
@@ -1986,7 +1986,7 @@ class ko {
|
|
|
1986
1986
|
return !this.hasDefault;
|
|
1987
1987
|
}
|
|
1988
1988
|
}
|
|
1989
|
-
class
|
|
1989
|
+
class Ht {
|
|
1990
1990
|
/**
|
|
1991
1991
|
@internal
|
|
1992
1992
|
*/
|
|
@@ -2008,7 +2008,7 @@ class Kt {
|
|
|
2008
2008
|
*/
|
|
2009
2009
|
static compile(e, t) {
|
|
2010
2010
|
let n = /* @__PURE__ */ Object.create(null), i = 0;
|
|
2011
|
-
return e.forEach((s, o) => n[s] = new
|
|
2011
|
+
return e.forEach((s, o) => n[s] = new Ht(s, i++, t, o)), n;
|
|
2012
2012
|
}
|
|
2013
2013
|
/**
|
|
2014
2014
|
When there is a mark of this type in the given set, a new set
|
|
@@ -2050,7 +2050,7 @@ class Bi {
|
|
|
2050
2050
|
let t = this.spec = {};
|
|
2051
2051
|
for (let i in e)
|
|
2052
2052
|
t[i] = e[i];
|
|
2053
|
-
t.nodes = F.from(e.nodes), t.marks = F.from(e.marks || {}), this.nodes = gr.compile(this.spec.nodes, this), this.marks =
|
|
2053
|
+
t.nodes = F.from(e.nodes), t.marks = F.from(e.marks || {}), this.nodes = gr.compile(this.spec.nodes, this), this.marks = Ht.compile(this.spec.marks, this);
|
|
2054
2054
|
let n = /* @__PURE__ */ Object.create(null);
|
|
2055
2055
|
for (let i in this.nodes) {
|
|
2056
2056
|
if (i in this.marks)
|
|
@@ -2092,7 +2092,7 @@ class Bi {
|
|
|
2092
2092
|
*/
|
|
2093
2093
|
text(e, t) {
|
|
2094
2094
|
let n = this.nodes.text;
|
|
2095
|
-
return new
|
|
2095
|
+
return new Bt(n, n.defaultAttrs, e, A.setFrom(t));
|
|
2096
2096
|
}
|
|
2097
2097
|
/**
|
|
2098
2098
|
Create a mark with the given type and attributes.
|
|
@@ -2301,13 +2301,13 @@ const zi = {
|
|
|
2301
2301
|
script: !0,
|
|
2302
2302
|
style: !0,
|
|
2303
2303
|
title: !0
|
|
2304
|
-
}, Fi = { ol: !0, ul: !0 }, ft = 1, Nn = 2,
|
|
2304
|
+
}, Fi = { ol: !0, ul: !0 }, ft = 1, Nn = 2, Tt = 4;
|
|
2305
2305
|
function br(r, e, t) {
|
|
2306
2306
|
return e != null ? (e ? ft : 0) | (e === "full" ? Nn : 0) : r && r.whitespace == "pre" ? ft | Nn : t & -5;
|
|
2307
2307
|
}
|
|
2308
|
-
class
|
|
2308
|
+
class Mt {
|
|
2309
2309
|
constructor(e, t, n, i, s, o) {
|
|
2310
|
-
this.type = e, this.attrs = t, this.marks = n, this.solid = i, this.options = o, this.content = [], this.activeMarks = A.none, this.match = s || (o &
|
|
2310
|
+
this.type = e, this.attrs = t, this.marks = n, this.solid = i, this.options = o, this.content = [], this.activeMarks = A.none, this.match = s || (o & Tt ? null : e.contentMatch);
|
|
2311
2311
|
}
|
|
2312
2312
|
findWrapping(e) {
|
|
2313
2313
|
if (!this.match) {
|
|
@@ -2341,8 +2341,8 @@ class St {
|
|
|
2341
2341
|
class kr {
|
|
2342
2342
|
constructor(e, t, n) {
|
|
2343
2343
|
this.parser = e, this.options = t, this.isOpen = n, this.open = 0, this.localPreserveWS = !1;
|
|
2344
|
-
let i = t.topNode, s, o = br(null, t.preserveWhitespace, 0) | (n ?
|
|
2345
|
-
i ? s = new
|
|
2344
|
+
let i = t.topNode, s, o = br(null, t.preserveWhitespace, 0) | (n ? Tt : 0);
|
|
2345
|
+
i ? s = new Mt(i.type, i.attrs, A.none, !0, t.topMatch || i.type.contentMatch, o) : n ? s = new Mt(null, null, A.none, !0, null, o) : s = new Mt(e.schema.topNodeType, null, A.none, !0, null, o), this.nodes = [s], this.find = t.findPositions, this.needsBlock = !1;
|
|
2346
2346
|
}
|
|
2347
2347
|
get top() {
|
|
2348
2348
|
return this.nodes[this.open];
|
|
@@ -2516,9 +2516,9 @@ class kr {
|
|
|
2516
2516
|
let o = this.top;
|
|
2517
2517
|
o.match = o.match && o.match.matchType(e);
|
|
2518
2518
|
let l = br(e, s, o.options);
|
|
2519
|
-
o.options &
|
|
2519
|
+
o.options & Tt && o.content.length == 0 && (l |= Tt);
|
|
2520
2520
|
let a = A.none;
|
|
2521
|
-
return n = n.filter((c) => (o.type ? o.type.allowsMarkType(c.type) : Sr(c.type, e)) ? (a = c.addToSet(a), !1) : !0), this.nodes.push(new
|
|
2521
|
+
return n = n.filter((c) => (o.type ? o.type.allowsMarkType(c.type) : Sr(c.type, e)) ? (a = c.addToSet(a), !1) : !0), this.nodes.push(new Mt(e, t, a, i, null, l)), this.open++, n;
|
|
2522
2522
|
}
|
|
2523
2523
|
// Make sure all nodes above this.open are finished and added to
|
|
2524
2524
|
// their parents
|
|
@@ -2694,7 +2694,7 @@ class We {
|
|
|
2694
2694
|
@internal
|
|
2695
2695
|
*/
|
|
2696
2696
|
serializeNodeInner(e, t) {
|
|
2697
|
-
let { dom: n, contentDOM: i } =
|
|
2697
|
+
let { dom: n, contentDOM: i } = Et(on(t), this.nodes[e.type.name](e), null, e.attrs);
|
|
2698
2698
|
if (i) {
|
|
2699
2699
|
if (e.isLeaf)
|
|
2700
2700
|
throw new RangeError("Content hole not allowed in a leaf node spec");
|
|
@@ -2722,10 +2722,10 @@ class We {
|
|
|
2722
2722
|
*/
|
|
2723
2723
|
serializeMark(e, t, n = {}) {
|
|
2724
2724
|
let i = this.marks[e.type.name];
|
|
2725
|
-
return i &&
|
|
2725
|
+
return i && Et(on(n), i(e, t), null, e.attrs);
|
|
2726
2726
|
}
|
|
2727
2727
|
static renderSpec(e, t, n = null, i) {
|
|
2728
|
-
return
|
|
2728
|
+
return Et(e, t, n, i);
|
|
2729
2729
|
}
|
|
2730
2730
|
/**
|
|
2731
2731
|
Build a serializer using the [`toDOM`](https://prosemirror.net/docs/ref/#model.NodeSpec.toDOM)
|
|
@@ -2781,7 +2781,7 @@ function No(r) {
|
|
|
2781
2781
|
}
|
|
2782
2782
|
return t(r), e;
|
|
2783
2783
|
}
|
|
2784
|
-
function
|
|
2784
|
+
function Et(r, e, t, n) {
|
|
2785
2785
|
if (typeof e == "string")
|
|
2786
2786
|
return { dom: r.createTextNode(e) };
|
|
2787
2787
|
if (e.nodeType != null)
|
|
@@ -2811,7 +2811,7 @@ function Tt(r, e, t, n) {
|
|
|
2811
2811
|
throw new RangeError("Content hole must be the only child of its parent node");
|
|
2812
2812
|
return { dom: a, contentDOM: a };
|
|
2813
2813
|
} else {
|
|
2814
|
-
let { dom: h, contentDOM: p } =
|
|
2814
|
+
let { dom: h, contentDOM: p } = Et(r, u, t, n);
|
|
2815
2815
|
if (a.appendChild(h), p) {
|
|
2816
2816
|
if (l)
|
|
2817
2817
|
throw new RangeError("Multiple content holes");
|
|
@@ -2831,7 +2831,7 @@ function wr(r) {
|
|
|
2831
2831
|
function Eo(r) {
|
|
2832
2832
|
return (r - (r & Vi)) / $i;
|
|
2833
2833
|
}
|
|
2834
|
-
const Li = 1, Wi = 2,
|
|
2834
|
+
const Li = 1, Wi = 2, Dt = 4, Ji = 8;
|
|
2835
2835
|
class Tn {
|
|
2836
2836
|
/**
|
|
2837
2837
|
@internal
|
|
@@ -2851,13 +2851,13 @@ class Tn {
|
|
|
2851
2851
|
Tells you whether the token before the mapped position was deleted.
|
|
2852
2852
|
*/
|
|
2853
2853
|
get deletedBefore() {
|
|
2854
|
-
return (this.delInfo & (Li |
|
|
2854
|
+
return (this.delInfo & (Li | Dt)) > 0;
|
|
2855
2855
|
}
|
|
2856
2856
|
/**
|
|
2857
2857
|
True when the token after the mapped position was deleted.
|
|
2858
2858
|
*/
|
|
2859
2859
|
get deletedAfter() {
|
|
2860
|
-
return (this.delInfo & (Wi |
|
|
2860
|
+
return (this.delInfo & (Wi | Dt)) > 0;
|
|
2861
2861
|
}
|
|
2862
2862
|
/**
|
|
2863
2863
|
Tells whether any of the steps mapped through deletes across the
|
|
@@ -2865,7 +2865,7 @@ class Tn {
|
|
|
2865
2865
|
position).
|
|
2866
2866
|
*/
|
|
2867
2867
|
get deletedAcross() {
|
|
2868
|
-
return (this.delInfo &
|
|
2868
|
+
return (this.delInfo & Dt) > 0;
|
|
2869
2869
|
}
|
|
2870
2870
|
}
|
|
2871
2871
|
class _ {
|
|
@@ -2908,7 +2908,7 @@ class _ {
|
|
|
2908
2908
|
let u = c ? e == a ? -1 : e == d ? 1 : t : t, h = a + i + (u < 0 ? 0 : f);
|
|
2909
2909
|
if (n)
|
|
2910
2910
|
return h;
|
|
2911
|
-
let p = e == (t < 0 ? a : d) ? null : To(l / 3, e - a), m = e == a ? Wi : e == d ? Li :
|
|
2911
|
+
let p = e == (t < 0 ? a : d) ? null : To(l / 3, e - a), m = e == a ? Wi : e == d ? Li : Dt;
|
|
2912
2912
|
return (t < 0 ? e != a : e != d) && (m |= Ji), new Tn(h, m, p);
|
|
2913
2913
|
}
|
|
2914
2914
|
i += f - c;
|
|
@@ -2965,7 +2965,7 @@ class _ {
|
|
|
2965
2965
|
}
|
|
2966
2966
|
}
|
|
2967
2967
|
_.empty = new _([]);
|
|
2968
|
-
class
|
|
2968
|
+
class zt {
|
|
2969
2969
|
/**
|
|
2970
2970
|
Create a new mapping with the given position maps.
|
|
2971
2971
|
*/
|
|
@@ -2982,7 +2982,7 @@ class Bt {
|
|
|
2982
2982
|
Create a mapping that maps only through a part of this one.
|
|
2983
2983
|
*/
|
|
2984
2984
|
slice(e = 0, t = this.maps.length) {
|
|
2985
|
-
return new
|
|
2985
|
+
return new zt(this._maps, this.mirror, e, t);
|
|
2986
2986
|
}
|
|
2987
2987
|
/**
|
|
2988
2988
|
Add a step map to the end of this mapping. If `mirrors` is
|
|
@@ -3033,7 +3033,7 @@ class Bt {
|
|
|
3033
3033
|
Create an inverted version of this mapping.
|
|
3034
3034
|
*/
|
|
3035
3035
|
invert() {
|
|
3036
|
-
let e = new
|
|
3036
|
+
let e = new zt();
|
|
3037
3037
|
return e.appendMappingInverted(this), e;
|
|
3038
3038
|
}
|
|
3039
3039
|
/**
|
|
@@ -3142,7 +3142,7 @@ class R {
|
|
|
3142
3142
|
try {
|
|
3143
3143
|
return R.ok(e.replace(t, n, i));
|
|
3144
3144
|
} catch (s) {
|
|
3145
|
-
if (s instanceof
|
|
3145
|
+
if (s instanceof Rt)
|
|
3146
3146
|
return R.fail(s.message);
|
|
3147
3147
|
throw s;
|
|
3148
3148
|
}
|
|
@@ -3458,7 +3458,7 @@ function Ao(r, e, t, n) {
|
|
|
3458
3458
|
return;
|
|
3459
3459
|
s++;
|
|
3460
3460
|
let a = null;
|
|
3461
|
-
if (n instanceof
|
|
3461
|
+
if (n instanceof Ht) {
|
|
3462
3462
|
let c = o.marks, f;
|
|
3463
3463
|
for (; f = n.isInSet(c); )
|
|
3464
3464
|
(a || (a = [])).push(f), c = f.removeFromSet(c);
|
|
@@ -3657,7 +3657,7 @@ function Lo(r, e) {
|
|
|
3657
3657
|
function Ki(r, e) {
|
|
3658
3658
|
return !!(r && e && !r.isLeaf && Lo(r, e));
|
|
3659
3659
|
}
|
|
3660
|
-
function
|
|
3660
|
+
function Ut(r, e, t = -1) {
|
|
3661
3661
|
let n = r.resolve(e);
|
|
3662
3662
|
for (let i = n.depth; ; i--) {
|
|
3663
3663
|
let s, o, l = n.index(i);
|
|
@@ -3730,7 +3730,7 @@ function jo(r, e, t) {
|
|
|
3730
3730
|
}
|
|
3731
3731
|
return null;
|
|
3732
3732
|
}
|
|
3733
|
-
function
|
|
3733
|
+
function Gt(r, e, t = e, n = k.empty) {
|
|
3734
3734
|
if (e == t && !n.size)
|
|
3735
3735
|
return null;
|
|
3736
3736
|
let i = r.resolve(e), s = r.resolve(t);
|
|
@@ -4094,7 +4094,7 @@ class Yi {
|
|
|
4094
4094
|
Create a transform that starts with the given document.
|
|
4095
4095
|
*/
|
|
4096
4096
|
constructor(e) {
|
|
4097
|
-
this.doc = e, this.steps = [], this.docs = [], this.mapping = new
|
|
4097
|
+
this.doc = e, this.steps = [], this.docs = [], this.mapping = new zt();
|
|
4098
4098
|
}
|
|
4099
4099
|
/**
|
|
4100
4100
|
The starting document.
|
|
@@ -4138,7 +4138,7 @@ class Yi {
|
|
|
4138
4138
|
given `slice`.
|
|
4139
4139
|
*/
|
|
4140
4140
|
replace(e, t = e, n = k.empty) {
|
|
4141
|
-
let i =
|
|
4141
|
+
let i = Gt(this.doc, e, t, n);
|
|
4142
4142
|
return i && this.step(i), this;
|
|
4143
4143
|
}
|
|
4144
4144
|
/**
|
|
@@ -4523,7 +4523,7 @@ class C extends N {
|
|
|
4523
4523
|
return e instanceof C && e.anchor == this.anchor && e.head == this.head;
|
|
4524
4524
|
}
|
|
4525
4525
|
getBookmark() {
|
|
4526
|
-
return new
|
|
4526
|
+
return new _t(this.anchor, this.head);
|
|
4527
4527
|
}
|
|
4528
4528
|
toJSON() {
|
|
4529
4529
|
return { type: "text", anchor: this.anchor, head: this.head };
|
|
@@ -4564,12 +4564,12 @@ class C extends N {
|
|
|
4564
4564
|
}
|
|
4565
4565
|
}
|
|
4566
4566
|
N.jsonID("text", C);
|
|
4567
|
-
class
|
|
4567
|
+
class _t {
|
|
4568
4568
|
constructor(e, t) {
|
|
4569
4569
|
this.anchor = e, this.head = t;
|
|
4570
4570
|
}
|
|
4571
4571
|
map(e) {
|
|
4572
|
-
return new
|
|
4572
|
+
return new _t(e.map(this.anchor), e.map(this.head));
|
|
4573
4573
|
}
|
|
4574
4574
|
resolve(e) {
|
|
4575
4575
|
return C.between(e.resolve(this.anchor), e.resolve(this.head));
|
|
@@ -4630,7 +4630,7 @@ class Hn {
|
|
|
4630
4630
|
}
|
|
4631
4631
|
map(e) {
|
|
4632
4632
|
let { deleted: t, pos: n } = e.mapResult(this.anchor);
|
|
4633
|
-
return t ? new
|
|
4633
|
+
return t ? new _t(n, n) : new Hn(n);
|
|
4634
4634
|
}
|
|
4635
4635
|
resolve(e) {
|
|
4636
4636
|
let t = e.resolve(this.anchor), n = t.nodeAfter;
|
|
@@ -5204,7 +5204,7 @@ function gt(r) {
|
|
|
5204
5204
|
;
|
|
5205
5205
|
return e && e.node && e.node.isBlock && (e.dom == r || e.contentDOM == r);
|
|
5206
5206
|
}
|
|
5207
|
-
const
|
|
5207
|
+
const Yt = function(r) {
|
|
5208
5208
|
return r.focusNode && $e(r.focusNode, r.focusOffset, r.anchorNode, r.anchorOffset);
|
|
5209
5209
|
};
|
|
5210
5210
|
function De(r, e) {
|
|
@@ -6030,7 +6030,7 @@ class Ce extends bt {
|
|
|
6030
6030
|
} else f || ({ dom: f, contentDOM: d } = We.renderSpec(document, t.type.spec.toDOM(t), null, t.attrs));
|
|
6031
6031
|
!d && !t.isText && f.nodeName != "BR" && (f.hasAttribute("contenteditable") || (f.contentEditable = "false"), t.type.spec.draggable && (f.draggable = !0));
|
|
6032
6032
|
let u = f;
|
|
6033
|
-
return f = us(f, n, t), c ? a = new Ol(e, t, n, i, f, d || null, u, c, s, o + 1) : t.isText ? new
|
|
6033
|
+
return f = us(f, n, t), c ? a = new Ol(e, t, n, i, f, d || null, u, c, s, o + 1) : t.isText ? new Xt(e, t, n, i, f, u, s) : new Ce(e, t, n, i, f, d || null, u, s, o + 1);
|
|
6034
6034
|
}
|
|
6035
6035
|
parseRule() {
|
|
6036
6036
|
if (this.node.type.spec.reparseInView)
|
|
@@ -6053,7 +6053,7 @@ class Ce extends bt {
|
|
|
6053
6053
|
return e;
|
|
6054
6054
|
}
|
|
6055
6055
|
matchesNode(e, t, n) {
|
|
6056
|
-
return this.dirty == Q && e.eq(this.node) &&
|
|
6056
|
+
return this.dirty == Q && e.eq(this.node) && Ft(t, this.outerDeco) && n.eq(this.innerDeco);
|
|
6057
6057
|
}
|
|
6058
6058
|
get size() {
|
|
6059
6059
|
return this.node.nodeSize;
|
|
@@ -6111,7 +6111,7 @@ class Ce extends bt {
|
|
|
6111
6111
|
this.updateOuterDeco(t), this.node = e, this.innerDeco = n, this.contentDOM && this.updateChildren(i, this.posAtStart), this.dirty = Q;
|
|
6112
6112
|
}
|
|
6113
6113
|
updateOuterDeco(e) {
|
|
6114
|
-
if (
|
|
6114
|
+
if (Ft(e, this.outerDeco))
|
|
6115
6115
|
return;
|
|
6116
6116
|
let t = this.nodeDOM.nodeType != 1, n = this.dom;
|
|
6117
6117
|
this.dom = ds(this.dom, this.nodeDOM, vn(this.outerDeco, this.node, t), vn(e, this.node, t)), this.dom != n && (n.pmViewDesc = void 0, this.dom.pmViewDesc = this), this.outerDeco = e;
|
|
@@ -6133,7 +6133,7 @@ function Wr(r, e, t, n, i) {
|
|
|
6133
6133
|
let s = new Ce(void 0, r, e, t, n, n, n, i, 0);
|
|
6134
6134
|
return s.contentDOM && s.updateChildren(i, 0), s;
|
|
6135
6135
|
}
|
|
6136
|
-
class
|
|
6136
|
+
class Xt extends Ce {
|
|
6137
6137
|
constructor(e, t, n, i, s, o, l) {
|
|
6138
6138
|
super(e, t, n, i, s, null, o, l, 0);
|
|
6139
6139
|
}
|
|
@@ -6164,7 +6164,7 @@ class Yt extends Ce {
|
|
|
6164
6164
|
}
|
|
6165
6165
|
slice(e, t, n) {
|
|
6166
6166
|
let i = this.node.cut(e, t), s = document.createTextNode(i.text);
|
|
6167
|
-
return new
|
|
6167
|
+
return new Xt(this.parent, i, this.outerDeco, this.innerDeco, s, s, n);
|
|
6168
6168
|
}
|
|
6169
6169
|
markDirty(e, t) {
|
|
6170
6170
|
super.markDirty(e, t), this.dom != this.nodeDOM && (e == 0 || t == this.nodeDOM.nodeValue.length) && (this.dirty = se);
|
|
@@ -6303,7 +6303,7 @@ function Nl(r, e, t) {
|
|
|
6303
6303
|
function us(r, e, t) {
|
|
6304
6304
|
return ds(r, r, Re, vn(e, t, r.nodeType != 1));
|
|
6305
6305
|
}
|
|
6306
|
-
function
|
|
6306
|
+
function Ft(r, e) {
|
|
6307
6307
|
if (r.length != e.length)
|
|
6308
6308
|
return !1;
|
|
6309
6309
|
for (let t = 0; t < r.length; t++)
|
|
@@ -6405,7 +6405,7 @@ class Tl {
|
|
|
6405
6405
|
let c = this.preMatch.matched.get(a);
|
|
6406
6406
|
if (c != null && c != s)
|
|
6407
6407
|
return !1;
|
|
6408
|
-
let f = a.dom, d, u = this.isLocked(f) && !(e.isText && a.node && a.node.isText && a.nodeDOM.nodeValue == e.text && a.dirty != se &&
|
|
6408
|
+
let f = a.dom, d, u = this.isLocked(f) && !(e.isText && a.node && a.node.isText && a.nodeDOM.nodeValue == e.text && a.dirty != se && Ft(t, a.outerDeco));
|
|
6409
6409
|
if (!u && a.update(e, t, n, i))
|
|
6410
6410
|
return this.destroyBetween(this.index, l), a.dom != f && (this.changed = !0), this.index++, !0;
|
|
6411
6411
|
if (!u && (d = this.recreateWrapper(a, e, t, n, i, o)))
|
|
@@ -6418,7 +6418,7 @@ class Tl {
|
|
|
6418
6418
|
// When a node with content is replaced by a different node with
|
|
6419
6419
|
// identical content, move over its children.
|
|
6420
6420
|
recreateWrapper(e, t, n, i, s, o) {
|
|
6421
|
-
if (e.dirty || t.isAtom || !e.children.length || !e.node.content.eq(t.content) || !
|
|
6421
|
+
if (e.dirty || t.isAtom || !e.children.length || !e.node.content.eq(t.content) || !Ft(n, e.outerDeco) || !i.eq(e.innerDeco))
|
|
6422
6422
|
return null;
|
|
6423
6423
|
let l = Ce.create(this.top, t, n, i, s, o);
|
|
6424
6424
|
if (l.contentDOM) {
|
|
@@ -6449,7 +6449,7 @@ class Tl {
|
|
|
6449
6449
|
for (; e instanceof Le; )
|
|
6450
6450
|
t = e, e = t.children[t.children.length - 1];
|
|
6451
6451
|
(!e || // Empty textblock
|
|
6452
|
-
!(e instanceof
|
|
6452
|
+
!(e instanceof Xt) || /\n$/.test(e.node.text) || this.view.requiresGeckoHackNode && /\s$/.test(e.node.text)) && ((q || W) && e && e.dom.contentEditable == "false" && this.addHackNode("IMG", t), this.addHackNode("BR", this.top));
|
|
6453
6453
|
}
|
|
6454
6454
|
addHackNode(e, t) {
|
|
6455
6455
|
if (t == this.top && this.index < t.children.length && t.children[this.index].matchesHack(e))
|
|
@@ -6589,7 +6589,7 @@ function Gn(r, e = null) {
|
|
|
6589
6589
|
if (o < 0)
|
|
6590
6590
|
return null;
|
|
6591
6591
|
let l = n.resolve(o), a, c;
|
|
6592
|
-
if (
|
|
6592
|
+
if (Yt(t)) {
|
|
6593
6593
|
for (a = o; i && !i.node; )
|
|
6594
6594
|
i = i.parent;
|
|
6595
6595
|
let d = i.node;
|
|
@@ -6743,7 +6743,7 @@ function Gr(r, e, t) {
|
|
|
6743
6743
|
}
|
|
6744
6744
|
}
|
|
6745
6745
|
}
|
|
6746
|
-
function
|
|
6746
|
+
function Vt(r) {
|
|
6747
6747
|
return r.nodeType == 3 ? r.nodeValue.length : r.childNodes.length;
|
|
6748
6748
|
}
|
|
6749
6749
|
function at(r, e) {
|
|
@@ -6758,7 +6758,7 @@ function zl(r) {
|
|
|
6758
6758
|
if (!t)
|
|
6759
6759
|
return;
|
|
6760
6760
|
let i, s, o = !1;
|
|
6761
|
-
for (te && t.nodeType == 1 && n <
|
|
6761
|
+
for (te && t.nodeType == 1 && n < Vt(t) && at(t.childNodes[n], -1) && (o = !0); ; )
|
|
6762
6762
|
if (n > 0) {
|
|
6763
6763
|
if (t.nodeType != 1)
|
|
6764
6764
|
break;
|
|
@@ -6779,7 +6779,7 @@ function zl(r) {
|
|
|
6779
6779
|
for (; l && at(l, -1); )
|
|
6780
6780
|
i = t.parentNode, s = V(l), l = l.previousSibling;
|
|
6781
6781
|
if (l)
|
|
6782
|
-
t = l, n =
|
|
6782
|
+
t = l, n = Vt(t);
|
|
6783
6783
|
else {
|
|
6784
6784
|
if (t = t.parentNode, t == r.dom)
|
|
6785
6785
|
break;
|
|
@@ -6793,7 +6793,7 @@ function Fl(r) {
|
|
|
6793
6793
|
let e = r.domSelectionRange(), t = e.focusNode, n = e.focusOffset;
|
|
6794
6794
|
if (!t)
|
|
6795
6795
|
return;
|
|
6796
|
-
let i =
|
|
6796
|
+
let i = Vt(t), s, o;
|
|
6797
6797
|
for (; ; )
|
|
6798
6798
|
if (n < i) {
|
|
6799
6799
|
if (t.nodeType != 1)
|
|
@@ -6811,7 +6811,7 @@ function Fl(r) {
|
|
|
6811
6811
|
for (; l && at(l, 1); )
|
|
6812
6812
|
s = l.parentNode, o = V(l) + 1, l = l.nextSibling;
|
|
6813
6813
|
if (l)
|
|
6814
|
-
t = l, n = 0, i =
|
|
6814
|
+
t = l, n = 0, i = Vt(t);
|
|
6815
6815
|
else {
|
|
6816
6816
|
if (t = t.parentNode, t == r.dom)
|
|
6817
6817
|
break;
|
|
@@ -6857,7 +6857,7 @@ function zn(r, e, t) {
|
|
|
6857
6857
|
let n = r.domSelection();
|
|
6858
6858
|
if (!n)
|
|
6859
6859
|
return;
|
|
6860
|
-
if (
|
|
6860
|
+
if (Yt(n)) {
|
|
6861
6861
|
let s = document.createRange();
|
|
6862
6862
|
s.setEnd(e, t), s.setStart(e, t), n.removeAllRanges(), n.addRange(s);
|
|
6863
6863
|
} else n.extend && n.extend(e, t);
|
|
@@ -7222,7 +7222,7 @@ H.keypress = (r, e) => {
|
|
|
7222
7222
|
!/[\r\n]/.test(i) && !r.someProp("handleTextInput", (s) => s(r, n.$from.pos, n.$to.pos, i)) && r.dispatch(r.state.tr.insertText(i).scrollIntoView()), t.preventDefault();
|
|
7223
7223
|
}
|
|
7224
7224
|
};
|
|
7225
|
-
function
|
|
7225
|
+
function Zt(r) {
|
|
7226
7226
|
return { left: r.clientX, top: r.clientY };
|
|
7227
7227
|
}
|
|
7228
7228
|
function ta(r, e) {
|
|
@@ -7293,7 +7293,7 @@ function la(r, e, t) {
|
|
|
7293
7293
|
}
|
|
7294
7294
|
}
|
|
7295
7295
|
function Qn(r) {
|
|
7296
|
-
return
|
|
7296
|
+
return $t(r);
|
|
7297
7297
|
}
|
|
7298
7298
|
const Cs = X ? "metaKey" : "ctrlKey";
|
|
7299
7299
|
K.mousedown = (r, e) => {
|
|
@@ -7301,7 +7301,7 @@ K.mousedown = (r, e) => {
|
|
|
7301
7301
|
r.input.shiftKey = t.shiftKey;
|
|
7302
7302
|
let n = Qn(r), i = Date.now(), s = "singleClick";
|
|
7303
7303
|
i - r.input.lastClick.time < 500 && ta(t, r.input.lastClick) && !t[Cs] && (r.input.lastClick.type == "singleClick" ? s = "doubleClick" : r.input.lastClick.type == "doubleClick" && (s = "tripleClick")), r.input.lastClick = { time: i, x: t.clientX, y: t.clientY, type: s };
|
|
7304
|
-
let o = r.posAtCoords(
|
|
7304
|
+
let o = r.posAtCoords(Zt(t));
|
|
7305
7305
|
o && (s == "singleClick" ? (r.input.mouseDown && r.input.mouseDown.done(), r.input.mouseDown = new aa(r, o, t, !!n)) : (s == "doubleClick" ? sa : oa)(r, o.pos, o.inside, t) ? t.preventDefault() : ke(r, "pointer"));
|
|
7306
7306
|
};
|
|
7307
7307
|
class aa {
|
|
@@ -7333,7 +7333,7 @@ class aa {
|
|
|
7333
7333
|
if (this.done(), !this.view.dom.contains(e.target))
|
|
7334
7334
|
return;
|
|
7335
7335
|
let t = this.pos;
|
|
7336
|
-
this.view.state.doc != this.startDoc && (t = this.view.posAtCoords(
|
|
7336
|
+
this.view.state.doc != this.startDoc && (t = this.view.posAtCoords(Zt(e))), this.updateAllowDefault(e), this.allowDefault || !t ? ke(this.view, "pointer") : ia(this.view, t.pos, t.inside, e, this.selectNode) ? e.preventDefault() : e.button == 0 && (this.flushed || // Safari ignores clicks on draggable elements
|
|
7337
7337
|
q && this.mightDrag && !this.mightDrag.node.isAtom || // Chrome will sometimes treat a node selection as a
|
|
7338
7338
|
// cursor, but still report that the node is selected
|
|
7339
7339
|
// when asked through getSelection. You'll then get a
|
|
@@ -7366,8 +7366,8 @@ H.compositionstart = H.compositionupdate = (r) => {
|
|
|
7366
7366
|
r.domObserver.flush();
|
|
7367
7367
|
let { state: e } = r, t = e.selection.$to;
|
|
7368
7368
|
if (e.selection instanceof C && (e.storedMarks || !t.textOffset && t.parentOffset && t.nodeBefore.marks.some((n) => n.type.spec.inclusive === !1)))
|
|
7369
|
-
r.markCursor = r.state.storedMarks || t.marks(),
|
|
7370
|
-
else if (
|
|
7369
|
+
r.markCursor = r.state.storedMarks || t.marks(), $t(r, !0), r.markCursor = null;
|
|
7370
|
+
else if ($t(r, !e.selection.empty), te && e.selection.empty && t.parentOffset && !t.textOffset && t.nodeBefore.marks.length) {
|
|
7371
7371
|
let n = r.domSelectionRange();
|
|
7372
7372
|
for (let i = n.focusNode, s = n.focusOffset; i && i.nodeType == 1 && s != 0; ) {
|
|
7373
7373
|
let o = s < 0 ? i.lastChild : i.childNodes[s - 1];
|
|
@@ -7389,7 +7389,7 @@ H.compositionend = (r, e) => {
|
|
|
7389
7389
|
r.composing && (r.input.composing = !1, r.input.compositionEndedAt = e.timeStamp, r.input.compositionPendingChanges = r.domObserver.pendingRecords().length ? r.input.compositionID : 0, r.input.compositionNode = null, r.input.compositionPendingChanges && Promise.resolve().then(() => r.domObserver.flush()), r.input.compositionID++, Os(r, 20));
|
|
7390
7390
|
};
|
|
7391
7391
|
function Os(r, e) {
|
|
7392
|
-
clearTimeout(r.input.composingTimeout), e > -1 && (r.input.composingTimeout = setTimeout(() =>
|
|
7392
|
+
clearTimeout(r.input.composingTimeout), e > -1 && (r.input.composingTimeout = setTimeout(() => $t(r), e));
|
|
7393
7393
|
}
|
|
7394
7394
|
function Ns(r) {
|
|
7395
7395
|
for (r.composing && (r.input.composing = !1, r.input.compositionEndedAt = da()); r.input.compositionNodes.length > 0; )
|
|
@@ -7418,7 +7418,7 @@ function da() {
|
|
|
7418
7418
|
let r = document.createEvent("Event");
|
|
7419
7419
|
return r.initEvent("event", !0, !0), r.timeStamp;
|
|
7420
7420
|
}
|
|
7421
|
-
function
|
|
7421
|
+
function $t(r, e = !1) {
|
|
7422
7422
|
if (!(ce && r.domObserver.flushingSoon >= 0)) {
|
|
7423
7423
|
if (r.domObserver.forceFlush(), Ns(r), e || r.docView && r.docView.dirty) {
|
|
7424
7424
|
let t = Gn(r);
|
|
@@ -7495,7 +7495,7 @@ K.dragstart = (r, e) => {
|
|
|
7495
7495
|
let t = e, n = r.input.mouseDown;
|
|
7496
7496
|
if (n && n.done(), !t.dataTransfer)
|
|
7497
7497
|
return;
|
|
7498
|
-
let i = r.state.selection, s = i.empty ? null : r.posAtCoords(
|
|
7498
|
+
let i = r.state.selection, s = i.empty ? null : r.posAtCoords(Zt(t)), o;
|
|
7499
7499
|
if (!(s && s.pos >= i.from && s.pos <= (i instanceof S ? i.to - 1 : i.to))) {
|
|
7500
7500
|
if (n && n.mightDrag)
|
|
7501
7501
|
o = S.create(r.state.doc, n.mightDrag.pos);
|
|
@@ -7518,7 +7518,7 @@ H.drop = (r, e) => {
|
|
|
7518
7518
|
let t = e, n = r.dragging;
|
|
7519
7519
|
if (r.dragging = null, !t.dataTransfer)
|
|
7520
7520
|
return;
|
|
7521
|
-
let i = r.posAtCoords(
|
|
7521
|
+
let i = r.posAtCoords(Zt(t));
|
|
7522
7522
|
if (!i)
|
|
7523
7523
|
return;
|
|
7524
7524
|
let s = r.state.doc.resolve(i.pos), o = n && n.slice;
|
|
@@ -7586,7 +7586,7 @@ function pt(r, e) {
|
|
|
7586
7586
|
return !1;
|
|
7587
7587
|
return !0;
|
|
7588
7588
|
}
|
|
7589
|
-
class
|
|
7589
|
+
class Lt {
|
|
7590
7590
|
constructor(e, t) {
|
|
7591
7591
|
this.toDOM = e, this.spec = t || Be, this.side = this.spec.side || 0;
|
|
7592
7592
|
}
|
|
@@ -7598,7 +7598,7 @@ class $t {
|
|
|
7598
7598
|
return !0;
|
|
7599
7599
|
}
|
|
7600
7600
|
eq(e) {
|
|
7601
|
-
return this == e || e instanceof
|
|
7601
|
+
return this == e || e instanceof Lt && (this.spec.key && this.spec.key == e.spec.key || this.toDOM == e.toDOM && pt(this.spec, e.spec));
|
|
7602
7602
|
}
|
|
7603
7603
|
destroy(e) {
|
|
7604
7604
|
this.spec.destroy && this.spec.destroy(e);
|
|
@@ -7679,7 +7679,7 @@ class ee {
|
|
|
7679
7679
|
widget's current document position.
|
|
7680
7680
|
*/
|
|
7681
7681
|
static widget(e, t, n) {
|
|
7682
|
-
return new ee(e, e, new
|
|
7682
|
+
return new ee(e, e, new Lt(t, n));
|
|
7683
7683
|
}
|
|
7684
7684
|
/**
|
|
7685
7685
|
Creates an inline decoration, which adds the given attributes to
|
|
@@ -7713,7 +7713,7 @@ class ee {
|
|
|
7713
7713
|
@internal
|
|
7714
7714
|
*/
|
|
7715
7715
|
get widget() {
|
|
7716
|
-
return this.type instanceof
|
|
7716
|
+
return this.type instanceof Lt;
|
|
7717
7717
|
}
|
|
7718
7718
|
}
|
|
7719
7719
|
const He = [], Be = {};
|
|
@@ -7730,7 +7730,7 @@ class v {
|
|
|
7730
7730
|
you must make a copy if you want need to preserve that.
|
|
7731
7731
|
*/
|
|
7732
7732
|
static create(e, t) {
|
|
7733
|
-
return t.length ?
|
|
7733
|
+
return t.length ? Wt(t, e, 0, Be) : L;
|
|
7734
7734
|
}
|
|
7735
7735
|
/**
|
|
7736
7736
|
Find all decorations in this set which touch the given range
|
|
@@ -7789,7 +7789,7 @@ class v {
|
|
|
7789
7789
|
if (f = Is(t, l, c)) {
|
|
7790
7790
|
for (i || (i = this.children.slice()); s < i.length && i[s] < a; )
|
|
7791
7791
|
s += 3;
|
|
7792
|
-
i[s] == a ? i[s + 2] = i[s + 2].addInner(l, f, c + 1) : i.splice(s, 0, a, a + l.nodeSize,
|
|
7792
|
+
i[s] == a ? i[s + 2] = i[s + 2].addInner(l, f, c + 1) : i.splice(s, 0, a, a + l.nodeSize, Wt(f, l, c + 1, Be)), s += 3;
|
|
7793
7793
|
}
|
|
7794
7794
|
});
|
|
7795
7795
|
let o = As(s ? Rs(t) : t, -n);
|
|
@@ -7985,7 +7985,7 @@ function ga(r, e, t, n, i, s, o) {
|
|
|
7985
7985
|
a = !0;
|
|
7986
7986
|
}
|
|
7987
7987
|
if (a) {
|
|
7988
|
-
let c = ya(l, r, e, t, i, s, o), f =
|
|
7988
|
+
let c = ya(l, r, e, t, i, s, o), f = Wt(c, n, 0, o);
|
|
7989
7989
|
e = f.local;
|
|
7990
7990
|
for (let d = 0; d < l.length; d += 3)
|
|
7991
7991
|
l[d + 1] < 0 && (l.splice(d, 3), d -= 3);
|
|
@@ -8035,13 +8035,13 @@ function Rs(r) {
|
|
|
8035
8035
|
r[t] != null && e.push(r[t]);
|
|
8036
8036
|
return e;
|
|
8037
8037
|
}
|
|
8038
|
-
function
|
|
8038
|
+
function Wt(r, e, t, n) {
|
|
8039
8039
|
let i = [], s = !1;
|
|
8040
8040
|
e.forEach((l, a) => {
|
|
8041
8041
|
let c = Is(r, l, a + t);
|
|
8042
8042
|
if (c) {
|
|
8043
8043
|
s = !0;
|
|
8044
|
-
let f =
|
|
8044
|
+
let f = Wt(c, l, t + a + 1, n);
|
|
8045
8045
|
f != L && i.push(a, a + l.nodeSize, f);
|
|
8046
8046
|
}
|
|
8047
8047
|
});
|
|
@@ -8212,7 +8212,7 @@ class Sa {
|
|
|
8212
8212
|
}
|
|
8213
8213
|
}
|
|
8214
8214
|
let c = null;
|
|
8215
|
-
s < 0 && i && e.input.lastFocus > Date.now() - 200 && Math.max(e.input.lastTouch, e.input.lastClick.time) < Date.now() - 300 &&
|
|
8215
|
+
s < 0 && i && e.input.lastFocus > Date.now() - 200 && Math.max(e.input.lastTouch, e.input.lastClick.time) < Date.now() - 300 && Yt(n) && (c = Gn(e)) && c.eq(N.near(e.state.doc.resolve(0), 1)) ? (e.input.lastFocus = 0, ue(e), this.currentSelection.set(n), e.scrollToSelection()) : (s > -1 || i) && (s > -1 && (e.docView.markDirty(s, o), Ma(e)), this.handleDOMChange(s, o, l, a), e.docView && e.docView.dirty ? e.updateState(e.state) : this.currentSelection.eq(n) || ue(e), this.currentSelection.set(n));
|
|
8216
8216
|
}
|
|
8217
8217
|
registerMutation(e, t) {
|
|
8218
8218
|
if (t.indexOf(e.target) > -1)
|
|
@@ -8281,7 +8281,7 @@ function wa(r, e) {
|
|
|
8281
8281
|
}
|
|
8282
8282
|
function Oa(r, e, t) {
|
|
8283
8283
|
let { node: n, fromOffset: i, toOffset: s, from: o, to: l } = r.docView.parseRange(e, t), a = r.domSelectionRange(), c, f = a.anchorNode;
|
|
8284
|
-
if (f && r.dom.contains(f.nodeType == 1 ? f : f.parentNode) && (c = [{ node: f, offset: a.anchorOffset }],
|
|
8284
|
+
if (f && r.dom.contains(f.nodeType == 1 ? f : f.parentNode) && (c = [{ node: f, offset: a.anchorOffset }], Yt(a) || c.push({ node: a.focusNode, offset: a.focusOffset })), W && r.input.lastKeyCode === 8)
|
|
8285
8285
|
for (let g = s; g > i; g--) {
|
|
8286
8286
|
let y = n.childNodes[g - 1], M = y.pmViewDesc;
|
|
8287
8287
|
if (y.nodeName == "BR" && !M) {
|
|
@@ -8330,8 +8330,8 @@ function Ea(r, e, t, n, i) {
|
|
|
8330
8330
|
if (he && !r.state.selection.eq(he)) {
|
|
8331
8331
|
if (W && ce && r.input.lastKeyCode === 13 && Date.now() - 100 < r.input.lastKeyCodeTime && r.someProp("handleKeyDown", (no) => no(r, De(13, "Enter"))))
|
|
8332
8332
|
return;
|
|
8333
|
-
let
|
|
8334
|
-
T == "pointer" ?
|
|
8333
|
+
let xt = r.state.tr.setSelection(he);
|
|
8334
|
+
T == "pointer" ? xt.setMeta("pointer", !0) : T == "key" && xt.scrollIntoView(), s && xt.setMeta("composition", s), r.dispatch(xt);
|
|
8335
8335
|
}
|
|
8336
8336
|
return;
|
|
8337
8337
|
}
|
|
@@ -8910,7 +8910,7 @@ var Oe = {
|
|
|
8910
8910
|
220: "\\",
|
|
8911
8911
|
221: "]",
|
|
8912
8912
|
222: "'"
|
|
8913
|
-
},
|
|
8913
|
+
}, Jt = {
|
|
8914
8914
|
48: ")",
|
|
8915
8915
|
49: "!",
|
|
8916
8916
|
50: "@",
|
|
@@ -8939,10 +8939,10 @@ var Oe = {
|
|
|
8939
8939
|
for (var $ = 0; $ < 10; $++) Oe[48 + $] = Oe[96 + $] = String($);
|
|
8940
8940
|
for (var $ = 1; $ <= 24; $++) Oe[$ + 111] = "F" + $;
|
|
8941
8941
|
for (var $ = 65; $ <= 90; $++)
|
|
8942
|
-
Oe[$] = String.fromCharCode($ + 32),
|
|
8943
|
-
for (var bn in Oe)
|
|
8942
|
+
Oe[$] = String.fromCharCode($ + 32), Jt[$] = String.fromCharCode($);
|
|
8943
|
+
for (var bn in Oe) Jt.hasOwnProperty(bn) || (Jt[bn] = Oe[bn]);
|
|
8944
8944
|
function Fa(r) {
|
|
8945
|
-
var e = Ba && r.metaKey && r.shiftKey && !r.ctrlKey && !r.altKey || za && r.shiftKey && r.key && r.key.length == 1 || r.key == "Unidentified", t = !e && r.key || (r.shiftKey ?
|
|
8945
|
+
var e = Ba && r.metaKey && r.shiftKey && !r.ctrlKey && !r.altKey || za && r.shiftKey && r.key && r.key.length == 1 || r.key == "Unidentified", t = !e && r.key || (r.shiftKey ? Jt : Oe)[r.keyCode] || r.key || "Unidentified";
|
|
8946
8946
|
return t == "Esc" && (t = "Escape"), t == "Del" && (t = "Delete"), t == "Left" && (t = "ArrowLeft"), t == "Up" && (t = "ArrowUp"), t == "Right" && (t = "ArrowRight"), t == "Down" && (t = "ArrowDown"), t;
|
|
8947
8947
|
}
|
|
8948
8948
|
const Va = typeof navigator < "u" ? /Mac|iP(hone|[oa]d)/.test(navigator.platform) : !1;
|
|
@@ -9019,7 +9019,7 @@ const Ps = (r, e, t) => {
|
|
|
9019
9019
|
return !0;
|
|
9020
9020
|
if (n.parent.content.size == 0 && (et(s, "end") || S.isSelectable(s)))
|
|
9021
9021
|
for (let o = n.depth; ; o--) {
|
|
9022
|
-
let l =
|
|
9022
|
+
let l = Gt(r.doc, n.before(o), n.after(o), k.empty);
|
|
9023
9023
|
if (l && l.slice.size < l.to - l.from) {
|
|
9024
9024
|
if (e) {
|
|
9025
9025
|
let a = r.tr.step(l);
|
|
@@ -9063,7 +9063,7 @@ function Bs(r, e, t) {
|
|
|
9063
9063
|
return !1;
|
|
9064
9064
|
l = f;
|
|
9065
9065
|
}
|
|
9066
|
-
let c =
|
|
9066
|
+
let c = Gt(r.doc, s, a, k.empty);
|
|
9067
9067
|
if (!c || c.from != s || c instanceof P && c.slice.size >= a - s)
|
|
9068
9068
|
return !1;
|
|
9069
9069
|
if (t) {
|
|
@@ -9118,7 +9118,7 @@ const Vs = (r, e, t) => {
|
|
|
9118
9118
|
if (js(r, i, e, 1))
|
|
9119
9119
|
return !0;
|
|
9120
9120
|
if (n.parent.content.size == 0 && (et(s, "start") || S.isSelectable(s))) {
|
|
9121
|
-
let o =
|
|
9121
|
+
let o = Gt(r.doc, n.before(), n.after(), k.empty);
|
|
9122
9122
|
if (o && o.slice.size < o.to - o.from) {
|
|
9123
9123
|
if (e) {
|
|
9124
9124
|
let l = r.tr.step(o);
|
|
@@ -9157,7 +9157,7 @@ const Ka = (r, e) => {
|
|
|
9157
9157
|
if (t.node.isTextblock || !Ne(r.doc, t.from))
|
|
9158
9158
|
return !1;
|
|
9159
9159
|
i = t.from;
|
|
9160
|
-
} else if (i =
|
|
9160
|
+
} else if (i = Ut(r.doc, t.from, -1), i == null)
|
|
9161
9161
|
return !1;
|
|
9162
9162
|
if (e) {
|
|
9163
9163
|
let s = r.tr.join(i);
|
|
@@ -9170,7 +9170,7 @@ const Ka = (r, e) => {
|
|
|
9170
9170
|
if (t.node.isTextblock || !Ne(r.doc, t.to))
|
|
9171
9171
|
return !1;
|
|
9172
9172
|
n = t.to;
|
|
9173
|
-
} else if (n =
|
|
9173
|
+
} else if (n = Ut(r.doc, t.to, 1), n == null)
|
|
9174
9174
|
return !1;
|
|
9175
9175
|
return e && e(r.tr.join(n).scrollIntoView()), !0;
|
|
9176
9176
|
}, Ua = (r, e) => {
|
|
@@ -9376,7 +9376,7 @@ function rc(r, e, t, n = null) {
|
|
|
9376
9376
|
if (e.$from.index(e.depth - 1) == 0)
|
|
9377
9377
|
return !1;
|
|
9378
9378
|
let a = o.resolve(e.start - 2);
|
|
9379
|
-
s = new
|
|
9379
|
+
s = new Pt(a, a, e.depth), e.endIndex < e.parent.childCount && (e = new Pt(e.$from, o.resolve(e.$to.end(e.depth)), e.depth)), i = !0;
|
|
9380
9380
|
}
|
|
9381
9381
|
let l = Kn(s, t, n, e);
|
|
9382
9382
|
return l ? (r && ic(r, e, l, i, t), !0) : !1;
|
|
@@ -9402,7 +9402,7 @@ function sc(r) {
|
|
|
9402
9402
|
}
|
|
9403
9403
|
function oc(r, e, t, n) {
|
|
9404
9404
|
let i = r.tr, s = n.end, o = n.$to.end(n.depth);
|
|
9405
|
-
s < o && (i.step(new B(s - 1, o, s, o, new k(b.from(t.create(null, n.parent.copy())), 1, 0), 1, !0)), n = new
|
|
9405
|
+
s < o && (i.step(new B(s - 1, o, s, o, new k(b.from(t.create(null, n.parent.copy())), 1, 0), 1, !0)), n = new Pt(i.doc.resolve(n.$from.pos), i.doc.resolve(o), n.depth));
|
|
9406
9406
|
const l = tt(n);
|
|
9407
9407
|
if (l == null)
|
|
9408
9408
|
return !1;
|
|
@@ -9441,7 +9441,7 @@ function ac(r) {
|
|
|
9441
9441
|
return !0;
|
|
9442
9442
|
};
|
|
9443
9443
|
}
|
|
9444
|
-
function
|
|
9444
|
+
function Qt(r) {
|
|
9445
9445
|
const { state: e, transaction: t } = r;
|
|
9446
9446
|
let { selection: n } = t, { doc: i } = t, { storedMarks: s } = t;
|
|
9447
9447
|
return {
|
|
@@ -9466,7 +9466,7 @@ function Zt(r) {
|
|
|
9466
9466
|
}
|
|
9467
9467
|
};
|
|
9468
9468
|
}
|
|
9469
|
-
class
|
|
9469
|
+
class en {
|
|
9470
9470
|
constructor(e) {
|
|
9471
9471
|
this.editor = e.editor, this.rawCommands = this.editor.extensionManager.commands, this.customState = e.state;
|
|
9472
9472
|
}
|
|
@@ -9511,7 +9511,7 @@ class Qt {
|
|
|
9511
9511
|
tr: e,
|
|
9512
9512
|
editor: i,
|
|
9513
9513
|
view: o,
|
|
9514
|
-
state:
|
|
9514
|
+
state: Qt({
|
|
9515
9515
|
state: s,
|
|
9516
9516
|
transaction: e
|
|
9517
9517
|
}),
|
|
@@ -9557,7 +9557,7 @@ function x(r, e, t) {
|
|
|
9557
9557
|
parent: r.parent ? x(r.parent, e, t) : null
|
|
9558
9558
|
}) : r.config[e];
|
|
9559
9559
|
}
|
|
9560
|
-
function
|
|
9560
|
+
function tn(r) {
|
|
9561
9561
|
const e = r.filter((i) => i.type === "extension"), t = r.filter((i) => i.type === "node"), n = r.filter((i) => i.type === "mark");
|
|
9562
9562
|
return {
|
|
9563
9563
|
baseExtensions: e,
|
|
@@ -9566,7 +9566,7 @@ function en(r) {
|
|
|
9566
9566
|
};
|
|
9567
9567
|
}
|
|
9568
9568
|
function Ks(r) {
|
|
9569
|
-
const e = [], { nodeExtensions: t, markExtensions: n } =
|
|
9569
|
+
const e = [], { nodeExtensions: t, markExtensions: n } = tn(r), i = [...t, ...n], s = {
|
|
9570
9570
|
default: null,
|
|
9571
9571
|
rendered: !0,
|
|
9572
9572
|
renderHTML: null,
|
|
@@ -9695,7 +9695,7 @@ function pi(r) {
|
|
|
9695
9695
|
}
|
|
9696
9696
|
function hc(r, e) {
|
|
9697
9697
|
var t;
|
|
9698
|
-
const n = Ks(r), { nodeExtensions: i, markExtensions: s } =
|
|
9698
|
+
const n = Ks(r), { nodeExtensions: i, markExtensions: s } = tn(r), o = (t = i.find((c) => x(c, "topNode"))) === null || t === void 0 ? void 0 : t.name, l = Object.fromEntries(i.map((c) => {
|
|
9699
9699
|
const f = n.filter((y) => y.type === c.name), d = {
|
|
9700
9700
|
name: c.name,
|
|
9701
9701
|
options: c.options,
|
|
@@ -9798,7 +9798,7 @@ const pc = (r, e = 500) => {
|
|
|
9798
9798
|
function ar(r) {
|
|
9799
9799
|
return Object.prototype.toString.call(r) === "[object RegExp]";
|
|
9800
9800
|
}
|
|
9801
|
-
class
|
|
9801
|
+
class kt {
|
|
9802
9802
|
constructor(e) {
|
|
9803
9803
|
this.find = e.find, this.handler = e.handler;
|
|
9804
9804
|
}
|
|
@@ -9812,7 +9812,7 @@ const mc = (r, e) => {
|
|
|
9812
9812
|
const n = [t.text];
|
|
9813
9813
|
return n.index = t.index, n.input = r, n.data = t.data, t.replaceWith && (t.text.includes(t.replaceWith) || console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'), n.push(t.replaceWith)), n;
|
|
9814
9814
|
};
|
|
9815
|
-
function
|
|
9815
|
+
function Ct(r) {
|
|
9816
9816
|
var e;
|
|
9817
9817
|
const { editor: t, from: n, to: i, text: s, rules: o, plugin: l } = r, { view: a } = t;
|
|
9818
9818
|
if (a.composing)
|
|
@@ -9831,13 +9831,13 @@ function Mt(r) {
|
|
|
9831
9831
|
const h = mc(d, u.find);
|
|
9832
9832
|
if (!h)
|
|
9833
9833
|
return;
|
|
9834
|
-
const p = a.state.tr, m =
|
|
9834
|
+
const p = a.state.tr, m = Qt({
|
|
9835
9835
|
state: a.state,
|
|
9836
9836
|
transaction: p
|
|
9837
9837
|
}), g = {
|
|
9838
9838
|
from: n - (h[0].length - s.length),
|
|
9839
9839
|
to: i
|
|
9840
|
-
}, { commands: y, chain: M, can: w } = new
|
|
9840
|
+
}, { commands: y, chain: M, can: w } = new en({
|
|
9841
9841
|
editor: t,
|
|
9842
9842
|
state: m
|
|
9843
9843
|
});
|
|
@@ -9871,7 +9871,7 @@ function gc(r) {
|
|
|
9871
9871
|
let { text: f } = a;
|
|
9872
9872
|
typeof f == "string" ? f = f : f = lr(b.from(f), o.schema);
|
|
9873
9873
|
const { from: d } = a, u = d + f.length;
|
|
9874
|
-
|
|
9874
|
+
Ct({
|
|
9875
9875
|
editor: e,
|
|
9876
9876
|
from: d,
|
|
9877
9877
|
to: u,
|
|
@@ -9884,7 +9884,7 @@ function gc(r) {
|
|
|
9884
9884
|
},
|
|
9885
9885
|
props: {
|
|
9886
9886
|
handleTextInput(i, s, o, l) {
|
|
9887
|
-
return
|
|
9887
|
+
return Ct({
|
|
9888
9888
|
editor: e,
|
|
9889
9889
|
from: s,
|
|
9890
9890
|
to: o,
|
|
@@ -9896,7 +9896,7 @@ function gc(r) {
|
|
|
9896
9896
|
handleDOMEvents: {
|
|
9897
9897
|
compositionend: (i) => (setTimeout(() => {
|
|
9898
9898
|
const { $cursor: s } = i.state.selection;
|
|
9899
|
-
s &&
|
|
9899
|
+
s && Ct({
|
|
9900
9900
|
editor: e,
|
|
9901
9901
|
from: s.pos,
|
|
9902
9902
|
to: s.pos,
|
|
@@ -9912,7 +9912,7 @@ function gc(r) {
|
|
|
9912
9912
|
if (s.key !== "Enter")
|
|
9913
9913
|
return !1;
|
|
9914
9914
|
const { $cursor: o } = i.state.selection;
|
|
9915
|
-
return o ?
|
|
9915
|
+
return o ? Ct({
|
|
9916
9916
|
editor: e,
|
|
9917
9917
|
from: o.pos,
|
|
9918
9918
|
to: o.pos,
|
|
@@ -9931,16 +9931,16 @@ function gc(r) {
|
|
|
9931
9931
|
function yc(r) {
|
|
9932
9932
|
return Object.prototype.toString.call(r).slice(8, -1);
|
|
9933
9933
|
}
|
|
9934
|
-
function
|
|
9934
|
+
function wt(r) {
|
|
9935
9935
|
return yc(r) !== "Object" ? !1 : r.constructor === Object && Object.getPrototypeOf(r) === Object.prototype;
|
|
9936
9936
|
}
|
|
9937
9937
|
function nn(r, e) {
|
|
9938
9938
|
const t = { ...r };
|
|
9939
|
-
return
|
|
9940
|
-
|
|
9939
|
+
return wt(r) && wt(e) && Object.keys(e).forEach((n) => {
|
|
9940
|
+
wt(e[n]) && wt(r[n]) ? t[n] = nn(r[n], e[n]) : t[n] = e[n];
|
|
9941
9941
|
}), t;
|
|
9942
9942
|
}
|
|
9943
|
-
class
|
|
9943
|
+
class jt {
|
|
9944
9944
|
constructor(e = {}) {
|
|
9945
9945
|
this.type = "mark", this.name = "mark", this.parent = null, this.child = null, this.config = {
|
|
9946
9946
|
name: this.name,
|
|
@@ -9956,7 +9956,7 @@ class Jt {
|
|
|
9956
9956
|
})) || {};
|
|
9957
9957
|
}
|
|
9958
9958
|
static create(e = {}) {
|
|
9959
|
-
return new
|
|
9959
|
+
return new jt(e);
|
|
9960
9960
|
}
|
|
9961
9961
|
configure(e = {}) {
|
|
9962
9962
|
const t = this.extend({
|
|
@@ -9966,7 +9966,7 @@ class Jt {
|
|
|
9966
9966
|
return t.name = this.name, t.parent = this.parent, t;
|
|
9967
9967
|
}
|
|
9968
9968
|
extend(e = {}) {
|
|
9969
|
-
const t = new
|
|
9969
|
+
const t = new jt(e);
|
|
9970
9970
|
return t.parent = this, this.child = t, t.name = e.name ? e.name : t.parent.name, e.defaultOptions && Object.keys(e.defaultOptions).length > 0 && console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${t.name}".`), t.options = O(x(t, "addOptions", {
|
|
9971
9971
|
name: t.name
|
|
9972
9972
|
})), t.storage = O(x(t, "addStorage", {
|
|
@@ -10004,7 +10004,7 @@ const xc = (r, e, t) => {
|
|
|
10004
10004
|
}) : [];
|
|
10005
10005
|
};
|
|
10006
10006
|
function Sc(r) {
|
|
10007
|
-
const { editor: e, state: t, from: n, to: i, rule: s, pasteEvent: o, dropEvent: l } = r, { commands: a, chain: c, can: f } = new
|
|
10007
|
+
const { editor: e, state: t, from: n, to: i, rule: s, pasteEvent: o, dropEvent: l } = r, { commands: a, chain: c, can: f } = new en({
|
|
10008
10008
|
editor: e,
|
|
10009
10009
|
state: t
|
|
10010
10010
|
}), d = [];
|
|
@@ -10032,7 +10032,7 @@ function Sc(r) {
|
|
|
10032
10032
|
});
|
|
10033
10033
|
}), d.every((h) => h !== null);
|
|
10034
10034
|
}
|
|
10035
|
-
let
|
|
10035
|
+
let Ot = null;
|
|
10036
10036
|
const Mc = (r) => {
|
|
10037
10037
|
var e;
|
|
10038
10038
|
const t = new ClipboardEvent("paste", {
|
|
@@ -10049,7 +10049,7 @@ function Cc(r) {
|
|
|
10049
10049
|
l = null;
|
|
10050
10050
|
}
|
|
10051
10051
|
const a = ({ state: f, from: d, to: u, rule: h, pasteEvt: p }) => {
|
|
10052
|
-
const m = f.tr, g =
|
|
10052
|
+
const m = f.tr, g = Qt({
|
|
10053
10053
|
state: f,
|
|
10054
10054
|
transaction: m
|
|
10055
10055
|
});
|
|
@@ -10075,9 +10075,9 @@ function Cc(r) {
|
|
|
10075
10075
|
view(d) {
|
|
10076
10076
|
const u = (p) => {
|
|
10077
10077
|
var m;
|
|
10078
|
-
n = !((m = d.dom.parentElement) === null || m === void 0) && m.contains(p.target) ? d.dom.parentElement : null, n && (
|
|
10078
|
+
n = !((m = d.dom.parentElement) === null || m === void 0) && m.contains(p.target) ? d.dom.parentElement : null, n && (Ot = e);
|
|
10079
10079
|
}, h = () => {
|
|
10080
|
-
|
|
10080
|
+
Ot && (Ot = null);
|
|
10081
10081
|
};
|
|
10082
10082
|
return window.addEventListener("dragstart", u), window.addEventListener("dragend", h), {
|
|
10083
10083
|
destroy() {
|
|
@@ -10089,7 +10089,7 @@ function Cc(r) {
|
|
|
10089
10089
|
handleDOMEvents: {
|
|
10090
10090
|
drop: (d, u) => {
|
|
10091
10091
|
if (s = n === d.dom.parentElement, l = u, !s) {
|
|
10092
|
-
const h =
|
|
10092
|
+
const h = Ot;
|
|
10093
10093
|
h && setTimeout(() => {
|
|
10094
10094
|
const p = h.state.selection;
|
|
10095
10095
|
p && h.commands.deleteRange({ from: p.from, to: p.to });
|
|
@@ -10209,7 +10209,7 @@ class Ge {
|
|
|
10209
10209
|
type: xn(o.name, this.schema)
|
|
10210
10210
|
}, a = [], c = x(o, "addKeyboardShortcuts", l);
|
|
10211
10211
|
let f = {};
|
|
10212
|
-
if (o.type === "mark" && x(o, "exitable", l) && (f.ArrowRight = () =>
|
|
10212
|
+
if (o.type === "mark" && x(o, "exitable", l) && (f.ArrowRight = () => jt.handleExit({ editor: e, mark: o })), c) {
|
|
10213
10213
|
const m = Object.fromEntries(Object.entries(c()).map(([g, y]) => [g, () => y({ editor: e })]));
|
|
10214
10214
|
f = { ...f, ...m };
|
|
10215
10215
|
}
|
|
@@ -10250,7 +10250,7 @@ class Ge {
|
|
|
10250
10250
|
* @returns An object with all node views where the key is the node name and the value is the node view function
|
|
10251
10251
|
*/
|
|
10252
10252
|
get nodeViews() {
|
|
10253
|
-
const { editor: e } = this, { nodeExtensions: t } =
|
|
10253
|
+
const { editor: e } = this, { nodeExtensions: t } = tn(this.extensions);
|
|
10254
10254
|
return Object.fromEntries(t.filter((n) => !!x(n, "addNodeView")).map((n) => {
|
|
10255
10255
|
const i = this.attributes.filter((a) => a.type === n.name), s = {
|
|
10256
10256
|
name: n.name,
|
|
@@ -10435,12 +10435,12 @@ const Oc = ne.create({
|
|
|
10435
10435
|
const { from: n, to: i } = r;
|
|
10436
10436
|
return t && e.delete(n, i), !0;
|
|
10437
10437
|
}, Bc = () => ({ state: r, dispatch: e }) => nr(r, e), zc = () => ({ commands: r }) => r.keyboardShortcut("Enter"), Fc = () => ({ state: r, dispatch: e }) => Ga(r, e);
|
|
10438
|
-
function
|
|
10438
|
+
function qt(r, e, t = { strict: !0 }) {
|
|
10439
10439
|
const n = Object.keys(e);
|
|
10440
10440
|
return n.length ? n.every((i) => t.strict ? e[i] === r[i] : ar(e[i]) ? e[i].test(r[i]) : e[i] === r[i]) : !0;
|
|
10441
10441
|
}
|
|
10442
10442
|
function _s(r, e, t = {}) {
|
|
10443
|
-
return r.find((n) => n.type === e &&
|
|
10443
|
+
return r.find((n) => n.type === e && qt(
|
|
10444
10444
|
// Only check equality for the attributes that are provided
|
|
10445
10445
|
Object.fromEntries(Object.keys(t).map((i) => [i, n.attrs[i]])),
|
|
10446
10446
|
t
|
|
@@ -10545,11 +10545,11 @@ const Wc = (r = null, e = {}) => ({ editor: t, view: n, tr: i, dispatch: s }) =>
|
|
|
10545
10545
|
}
|
|
10546
10546
|
return r;
|
|
10547
10547
|
};
|
|
10548
|
-
function
|
|
10548
|
+
function Nt(r) {
|
|
10549
10549
|
const e = `<body>${r}</body>`, t = new window.DOMParser().parseFromString(e, "text/html").body;
|
|
10550
10550
|
return Zs(t);
|
|
10551
10551
|
}
|
|
10552
|
-
function
|
|
10552
|
+
function Kt(r, e, t) {
|
|
10553
10553
|
if (r instanceof xe || r instanceof b)
|
|
10554
10554
|
return r;
|
|
10555
10555
|
t = {
|
|
@@ -10567,7 +10567,7 @@ function qt(r, e, t) {
|
|
|
10567
10567
|
} catch (s) {
|
|
10568
10568
|
if (t.errorOnInvalidContent)
|
|
10569
10569
|
throw new Error("[tiptap error]: Invalid JSON content", { cause: s });
|
|
10570
|
-
return console.warn("[tiptap warn]: Invalid content.", "Passed value:", r, "Error:", s),
|
|
10570
|
+
return console.warn("[tiptap warn]: Invalid content.", "Passed value:", r, "Error:", s), Kt("", e, t);
|
|
10571
10571
|
}
|
|
10572
10572
|
if (i) {
|
|
10573
10573
|
if (t.errorOnInvalidContent) {
|
|
@@ -10590,13 +10590,13 @@ function qt(r, e, t) {
|
|
|
10590
10590
|
}
|
|
10591
10591
|
})
|
|
10592
10592
|
});
|
|
10593
|
-
if (t.slice ? Se.fromSchema(a).parseSlice(
|
|
10593
|
+
if (t.slice ? Se.fromSchema(a).parseSlice(Nt(r), t.parseOptions) : Se.fromSchema(a).parse(Nt(r), t.parseOptions), t.errorOnInvalidContent && o)
|
|
10594
10594
|
throw new Error("[tiptap error]: Invalid HTML content", { cause: new Error(`Invalid element found: ${l}`) });
|
|
10595
10595
|
}
|
|
10596
10596
|
const s = Se.fromSchema(e);
|
|
10597
|
-
return t.slice ? s.parseSlice(
|
|
10597
|
+
return t.slice ? s.parseSlice(Nt(r), t.parseOptions).content : s.parse(Nt(r), t.parseOptions);
|
|
10598
10598
|
}
|
|
10599
|
-
return
|
|
10599
|
+
return Kt("", e, t);
|
|
10600
10600
|
}
|
|
10601
10601
|
function qc(r, e, t) {
|
|
10602
10602
|
const n = r.steps.length - 1;
|
|
@@ -10623,7 +10623,7 @@ const Kc = (r) => !("type" in r), Hc = (r, e, t) => ({ tr: n, dispatch: i, edito
|
|
|
10623
10623
|
};
|
|
10624
10624
|
let l;
|
|
10625
10625
|
try {
|
|
10626
|
-
l =
|
|
10626
|
+
l = Kt(e, s.schema, {
|
|
10627
10627
|
parseOptions: {
|
|
10628
10628
|
preserveWhitespace: "full",
|
|
10629
10629
|
...t.parseOptions
|
|
@@ -10664,14 +10664,14 @@ const Kc = (r) => !("type" in r), Hc = (r, e, t) => ({ tr: n, dispatch: i, edito
|
|
|
10664
10664
|
return !0;
|
|
10665
10665
|
}, Uc = () => ({ state: r, dispatch: e }) => Ka(r, e), Gc = () => ({ state: r, dispatch: e }) => Ha(r, e), _c = () => ({ state: r, dispatch: e }) => Ps(r, e), Yc = () => ({ state: r, dispatch: e }) => Vs(r, e), Xc = () => ({ state: r, dispatch: e, tr: t }) => {
|
|
10666
10666
|
try {
|
|
10667
|
-
const n =
|
|
10667
|
+
const n = Ut(r.doc, r.selection.$from.pos, -1);
|
|
10668
10668
|
return n == null ? !1 : (t.join(n, 2), e && e(t), !0);
|
|
10669
10669
|
} catch {
|
|
10670
10670
|
return !1;
|
|
10671
10671
|
}
|
|
10672
10672
|
}, Zc = () => ({ state: r, dispatch: e, tr: t }) => {
|
|
10673
10673
|
try {
|
|
10674
|
-
const n =
|
|
10674
|
+
const n = Ut(r.doc, r.selection.$from.pos, 1);
|
|
10675
10675
|
return n == null ? !1 : (t.join(n, 2), e && e(t), !0);
|
|
10676
10676
|
} catch {
|
|
10677
10677
|
return !1;
|
|
@@ -10731,7 +10731,7 @@ function mt(r, e, t = {}) {
|
|
|
10731
10731
|
to: p
|
|
10732
10732
|
});
|
|
10733
10733
|
});
|
|
10734
|
-
const a = i - n, c = l.filter((d) => o ? o.name === d.node.type.name : !0).filter((d) =>
|
|
10734
|
+
const a = i - n, c = l.filter((d) => o ? o.name === d.node.type.name : !0).filter((d) => qt(d.node.attrs, t, { strict: !1 }));
|
|
10735
10735
|
return s ? !!c.length : c.reduce((d, u) => d + u.to - u.from, 0) >= a;
|
|
10736
10736
|
}
|
|
10737
10737
|
const rf = (r, e = {}) => ({ state: t, dispatch: n }) => {
|
|
@@ -10766,7 +10766,7 @@ const af = (r, e) => ({ tr: t, state: n, dispatch: i }) => {
|
|
|
10766
10766
|
return !0;
|
|
10767
10767
|
}, df = () => ({ state: r, dispatch: e }) => zs(r, e), uf = () => ({ state: r, dispatch: e }) => $s(r, e), hf = () => ({ state: r, dispatch: e }) => Xa(r, e), pf = () => ({ state: r, dispatch: e }) => ec(r, e), mf = () => ({ state: r, dispatch: e }) => Qa(r, e);
|
|
10768
10768
|
function Ln(r, e, t = {}, n = {}) {
|
|
10769
|
-
return
|
|
10769
|
+
return Kt(r, e, {
|
|
10770
10770
|
slice: !1,
|
|
10771
10771
|
parseOptions: t,
|
|
10772
10772
|
errorOnInvalidContent: n.errorOnInvalidContent
|
|
@@ -10909,7 +10909,7 @@ function to(r, e, t) {
|
|
|
10909
10909
|
})));
|
|
10910
10910
|
}), n;
|
|
10911
10911
|
}
|
|
10912
|
-
function
|
|
10912
|
+
function At(r, e, t) {
|
|
10913
10913
|
return Object.fromEntries(Object.entries(t).filter(([n]) => {
|
|
10914
10914
|
const i = r.find((s) => s.type === e && s.name === n);
|
|
10915
10915
|
return i ? i.attribute.keepOnSplit : !1;
|
|
@@ -10918,7 +10918,7 @@ function Dt(r, e, t) {
|
|
|
10918
10918
|
function Wn(r, e, t = {}) {
|
|
10919
10919
|
const { empty: n, ranges: i } = r.selection, s = e ? Ee(e, r.schema) : null;
|
|
10920
10920
|
if (n)
|
|
10921
|
-
return !!(r.storedMarks || r.selection.$from.marks()).filter((d) => s ? s.name === d.type.name : !0).find((d) =>
|
|
10921
|
+
return !!(r.storedMarks || r.selection.$from.marks()).filter((d) => s ? s.name === d.type.name : !0).find((d) => qt(d.attrs, t, { strict: !1 }));
|
|
10922
10922
|
let o = 0;
|
|
10923
10923
|
const l = [];
|
|
10924
10924
|
if (i.forEach(({ $from: d, $to: u }) => {
|
|
@@ -10935,7 +10935,7 @@ function Wn(r, e, t = {}) {
|
|
|
10935
10935
|
});
|
|
10936
10936
|
}), o === 0)
|
|
10937
10937
|
return !1;
|
|
10938
|
-
const a = l.filter((d) => s ? s.name === d.mark.type.name : !0).filter((d) =>
|
|
10938
|
+
const a = l.filter((d) => s ? s.name === d.mark.type.name : !0).filter((d) => qt(d.mark.attrs, t, { strict: !1 })).reduce((d, u) => d + u.to - u.from, 0), c = l.filter((d) => s ? d.mark.type !== s && d.mark.type.excludes(s) : !0).reduce((d, u) => d + u.to - u.from, 0);
|
|
10939
10939
|
return (a > 0 ? a + c : a) >= o;
|
|
10940
10940
|
}
|
|
10941
10941
|
function wf(r, e, t = {}) {
|
|
@@ -10945,7 +10945,7 @@ function wf(r, e, t = {}) {
|
|
|
10945
10945
|
return n === "node" ? mt(r, e, t) : n === "mark" ? Wn(r, e, t) : !1;
|
|
10946
10946
|
}
|
|
10947
10947
|
function bi(r, e) {
|
|
10948
|
-
const { nodeExtensions: t } =
|
|
10948
|
+
const { nodeExtensions: t } = tn(e), n = t.find((o) => o.name === r);
|
|
10949
10949
|
if (!n)
|
|
10950
10950
|
return !1;
|
|
10951
10951
|
const i = {
|
|
@@ -11069,7 +11069,7 @@ function ki(r, e) {
|
|
|
11069
11069
|
}
|
|
11070
11070
|
}
|
|
11071
11071
|
const Rf = ({ keepMarks: r = !0 } = {}) => ({ tr: e, state: t, dispatch: n, editor: i }) => {
|
|
11072
|
-
const { selection: s, doc: o } = e, { $from: l, $to: a } = s, c = i.extensionManager.attributes, f =
|
|
11072
|
+
const { selection: s, doc: o } = e, { $from: l, $to: a } = s, c = i.extensionManager.attributes, f = At(c, l.node().type.name, l.node().attrs);
|
|
11073
11073
|
if (s instanceof S && s.node.isBlock)
|
|
11074
11074
|
return !l.parentOffset || !de(o, l.pos) ? !1 : (n && (r && ki(t, i.extensionManager.splittableMarks), e.split(l.pos).scrollIntoView()), !0);
|
|
11075
11075
|
if (!l.parent.isBlock)
|
|
@@ -11112,7 +11112,7 @@ const Rf = ({ keepMarks: r = !0 } = {}) => ({ tr: e, state: t, dispatch: n, edit
|
|
|
11112
11112
|
for (let j = a.depth - M; j >= a.depth - 3; j -= 1)
|
|
11113
11113
|
y = b.from(a.node(j).copy(y));
|
|
11114
11114
|
const w = a.indexAfter(-1) < a.node(-2).childCount ? 1 : a.indexAfter(-2) < a.node(-3).childCount ? 2 : 3, I = {
|
|
11115
|
-
...
|
|
11115
|
+
...At(u, a.node().type.name, a.node().attrs),
|
|
11116
11116
|
...e
|
|
11117
11117
|
}, E = ((o = l.contentMatch.defaultType) === null || o === void 0 ? void 0 : o.createAndFill(I)) || void 0;
|
|
11118
11118
|
y = y.append(b.from(l.createAndFill(null, E) || void 0));
|
|
@@ -11128,10 +11128,10 @@ const Rf = ({ keepMarks: r = !0 } = {}) => ({ tr: e, state: t, dispatch: n, edit
|
|
|
11128
11128
|
return !0;
|
|
11129
11129
|
}
|
|
11130
11130
|
const h = c.pos === a.end() ? d.contentMatchAt(0).defaultType : null, p = {
|
|
11131
|
-
...
|
|
11131
|
+
...At(u, d.type.name, d.attrs),
|
|
11132
11132
|
...e
|
|
11133
11133
|
}, m = {
|
|
11134
|
-
...
|
|
11134
|
+
...At(u, a.node().type.name, a.node().attrs),
|
|
11135
11135
|
...e
|
|
11136
11136
|
};
|
|
11137
11137
|
t.delete(a.pos, c.pos);
|
|
@@ -11457,10 +11457,10 @@ const Kf = ne.create({
|
|
|
11457
11457
|
const { empty: s, from: o, to: l } = e.selection, a = N.atStart(e.doc).from, c = N.atEnd(e.doc).to;
|
|
11458
11458
|
if (s || !(o === a && l === c) || !ur(t.doc))
|
|
11459
11459
|
return;
|
|
11460
|
-
const u = t.tr, h =
|
|
11460
|
+
const u = t.tr, h = Qt({
|
|
11461
11461
|
state: t,
|
|
11462
11462
|
transaction: u
|
|
11463
|
-
}), { commands: p } = new
|
|
11463
|
+
}), { commands: p } = new en({
|
|
11464
11464
|
editor: this.editor,
|
|
11465
11465
|
state: h
|
|
11466
11466
|
});
|
|
@@ -11854,7 +11854,7 @@ class od extends cc {
|
|
|
11854
11854
|
* Creates an command manager.
|
|
11855
11855
|
*/
|
|
11856
11856
|
createCommandManager() {
|
|
11857
|
-
this.commandManager = new
|
|
11857
|
+
this.commandManager = new en({
|
|
11858
11858
|
editor: this
|
|
11859
11859
|
});
|
|
11860
11860
|
}
|
|
@@ -12053,7 +12053,7 @@ class od extends cc {
|
|
|
12053
12053
|
}
|
|
12054
12054
|
}
|
|
12055
12055
|
function ld(r) {
|
|
12056
|
-
return new
|
|
12056
|
+
return new kt({
|
|
12057
12057
|
find: r.find,
|
|
12058
12058
|
handler: ({ state: e, range: t, match: n }) => {
|
|
12059
12059
|
const i = O(r.getAttributes, void 0, n);
|
|
@@ -12072,7 +12072,7 @@ function ld(r) {
|
|
|
12072
12072
|
});
|
|
12073
12073
|
}
|
|
12074
12074
|
function ad(r) {
|
|
12075
|
-
return new
|
|
12075
|
+
return new kt({
|
|
12076
12076
|
find: r.find,
|
|
12077
12077
|
handler: ({ state: e, range: t, match: n }) => {
|
|
12078
12078
|
const i = O(r.getAttributes, void 0, n) || {}, { tr: s } = e, o = t.from;
|
|
@@ -12093,7 +12093,7 @@ function ad(r) {
|
|
|
12093
12093
|
});
|
|
12094
12094
|
}
|
|
12095
12095
|
function cd(r) {
|
|
12096
|
-
return new
|
|
12096
|
+
return new kt({
|
|
12097
12097
|
find: r.find,
|
|
12098
12098
|
handler: ({ state: e, range: t, match: n }) => {
|
|
12099
12099
|
const i = e.doc.resolve(t.from), s = O(r.getAttributes, void 0, n) || {};
|
|
@@ -12104,7 +12104,23 @@ function cd(r) {
|
|
|
12104
12104
|
});
|
|
12105
12105
|
}
|
|
12106
12106
|
function fd(r) {
|
|
12107
|
-
return new
|
|
12107
|
+
return new kt({
|
|
12108
|
+
find: r.find,
|
|
12109
|
+
handler: ({ state: e, range: t, match: n }) => {
|
|
12110
|
+
let i = r.replace, s = t.from;
|
|
12111
|
+
const o = t.to;
|
|
12112
|
+
if (n[1]) {
|
|
12113
|
+
const l = n[0].lastIndexOf(n[1]);
|
|
12114
|
+
i += n[0].slice(l + n[1].length), s += l;
|
|
12115
|
+
const a = s - o;
|
|
12116
|
+
a > 0 && (i = n[0].slice(l - a, l) + i, s = o);
|
|
12117
|
+
}
|
|
12118
|
+
e.tr.insertText(i, s, o);
|
|
12119
|
+
}
|
|
12120
|
+
});
|
|
12121
|
+
}
|
|
12122
|
+
function dd(r) {
|
|
12123
|
+
return new kt({
|
|
12108
12124
|
find: r.find,
|
|
12109
12125
|
handler: ({ state: e, range: t, match: n, chain: i }) => {
|
|
12110
12126
|
const s = O(r.getAttributes, void 0, n) || {}, o = e.tr.delete(t.from, t.to), a = o.doc.resolve(t.from).blockRange(), c = a && Kn(a, r.type, s);
|
|
@@ -12161,7 +12177,7 @@ class Jn {
|
|
|
12161
12177
|
})), t;
|
|
12162
12178
|
}
|
|
12163
12179
|
}
|
|
12164
|
-
function
|
|
12180
|
+
function ud(r) {
|
|
12165
12181
|
return new kc({
|
|
12166
12182
|
find: r.find,
|
|
12167
12183
|
handler: ({ state: e, range: t, match: n, pasteEvent: i }) => {
|
|
@@ -12179,26 +12195,27 @@ function dd(r) {
|
|
|
12179
12195
|
}
|
|
12180
12196
|
});
|
|
12181
12197
|
}
|
|
12182
|
-
function
|
|
12198
|
+
function hd(r) {
|
|
12183
12199
|
return r.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&");
|
|
12184
12200
|
}
|
|
12185
12201
|
export {
|
|
12186
|
-
|
|
12187
|
-
|
|
12188
|
-
|
|
12202
|
+
fd as A,
|
|
12203
|
+
Ys as B,
|
|
12204
|
+
sd as C,
|
|
12189
12205
|
v as D,
|
|
12190
12206
|
ne as E,
|
|
12191
12207
|
b as F,
|
|
12192
|
-
|
|
12208
|
+
od as G,
|
|
12209
|
+
jt as M,
|
|
12193
12210
|
Jn as N,
|
|
12194
12211
|
oe as P,
|
|
12195
12212
|
N as S,
|
|
12196
12213
|
C as T,
|
|
12197
12214
|
Je as a,
|
|
12198
12215
|
ee as b,
|
|
12199
|
-
|
|
12216
|
+
ud as c,
|
|
12200
12217
|
td as d,
|
|
12201
|
-
|
|
12218
|
+
hd as e,
|
|
12202
12219
|
nd as f,
|
|
12203
12220
|
rd as g,
|
|
12204
12221
|
to as h,
|
|
@@ -12216,8 +12233,8 @@ export {
|
|
|
12216
12233
|
ld as t,
|
|
12217
12234
|
cd as u,
|
|
12218
12235
|
jo as v,
|
|
12219
|
-
|
|
12220
|
-
|
|
12236
|
+
dd as w,
|
|
12237
|
+
zt as x,
|
|
12221
12238
|
id as y,
|
|
12222
12239
|
ur as z
|
|
12223
12240
|
};
|