@grapesjs/studio-sdk-plugins 1.0.8 → 1.0.9
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/dialogComponent/index.cjs.js +4 -4
- package/dist/dialogComponent/index.es.js +27 -28
- package/dist/dialogComponent/index.umd.js +4 -4
- package/dist/fsLightboxComponent/index.cjs.js +2 -2
- package/dist/fsLightboxComponent/index.es.js +51 -52
- package/dist/fsLightboxComponent/index.umd.js +2 -2
- package/dist/index.cjs.d.ts +1 -0
- package/dist/index.cjs.js +22 -22
- package/dist/index.d.ts +1 -0
- package/dist/index.es.d.ts +1 -0
- package/dist/index.es.js +5265 -4605
- package/dist/index.umd.js +22 -22
- package/dist/lightGalleryComponent/index.cjs.d.ts +3 -0
- package/dist/lightGalleryComponent/index.cjs.js +1 -0
- package/dist/lightGalleryComponent/index.d.ts +3 -0
- package/dist/lightGalleryComponent/index.es.d.ts +3 -0
- package/dist/lightGalleryComponent/index.es.js +718 -0
- package/dist/lightGalleryComponent/index.umd.js +1 -0
- package/dist/lightGalleryComponent/types.d.ts +57 -0
- package/dist/lightGalleryComponent/typesSchema.d.ts +3 -0
- package/dist/lightGalleryComponent/utils.d.ts +47 -0
- package/dist/listPagesComponent/index.cjs.js +3 -3
- package/dist/listPagesComponent/index.es.js +32 -33
- package/dist/listPagesComponent/index.umd.js +3 -3
- package/dist/prosemirror/index.cjs.js +8 -8
- package/dist/prosemirror/index.es.js +806 -786
- package/dist/prosemirror/index.umd.js +9 -9
- package/dist/prosemirror/schema.d.ts +1 -1
- package/dist/prosemirror/types.d.ts +5 -0
- package/dist/prosemirror/utils.d.ts +3 -1
- package/dist/tableComponent/index.cjs.js +1 -1
- package/dist/tableComponent/index.es.js +35 -36
- package/dist/tableComponent/index.umd.js +1 -1
- package/dist/utils.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
function z(n) {
|
|
1
|
+
function B(n) {
|
|
3
2
|
this.content = n;
|
|
4
3
|
}
|
|
5
|
-
|
|
6
|
-
constructor:
|
|
4
|
+
B.prototype = {
|
|
5
|
+
constructor: B,
|
|
7
6
|
find: function(n) {
|
|
8
7
|
for (var e = 0; e < this.content.length; e += 2)
|
|
9
8
|
if (this.content[e] === n) return e;
|
|
@@ -22,7 +21,7 @@ z.prototype = {
|
|
|
22
21
|
// given, the key of the binding will be replaced with that key.
|
|
23
22
|
update: function(n, e, t) {
|
|
24
23
|
var r = t && t != n ? this.remove(t) : this, i = r.find(n), s = r.content.slice();
|
|
25
|
-
return i == -1 ? s.push(t || n, e) : (s[i + 1] = e, t && (s[i] = t)), new
|
|
24
|
+
return i == -1 ? s.push(t || n, e) : (s[i + 1] = e, t && (s[i] = t)), new B(s);
|
|
26
25
|
},
|
|
27
26
|
// :: (string) → OrderedMap
|
|
28
27
|
// Return a map with the given key removed, if it existed.
|
|
@@ -30,25 +29,25 @@ z.prototype = {
|
|
|
30
29
|
var e = this.find(n);
|
|
31
30
|
if (e == -1) return this;
|
|
32
31
|
var t = this.content.slice();
|
|
33
|
-
return t.splice(e, 2), new
|
|
32
|
+
return t.splice(e, 2), new B(t);
|
|
34
33
|
},
|
|
35
34
|
// :: (string, any) → OrderedMap
|
|
36
35
|
// Add a new key to the start of the map.
|
|
37
36
|
addToStart: function(n, e) {
|
|
38
|
-
return new
|
|
37
|
+
return new B([n, e].concat(this.remove(n).content));
|
|
39
38
|
},
|
|
40
39
|
// :: (string, any) → OrderedMap
|
|
41
40
|
// Add a new key to the end of the map.
|
|
42
41
|
addToEnd: function(n, e) {
|
|
43
42
|
var t = this.remove(n).content.slice();
|
|
44
|
-
return t.push(n, e), new
|
|
43
|
+
return t.push(n, e), new B(t);
|
|
45
44
|
},
|
|
46
45
|
// :: (string, string, any) → OrderedMap
|
|
47
46
|
// Add a key after the given key. If `place` is not found, the new
|
|
48
47
|
// key is added to the end.
|
|
49
48
|
addBefore: function(n, e, t) {
|
|
50
49
|
var r = this.remove(e), i = r.content.slice(), s = r.find(n);
|
|
51
|
-
return i.splice(s == -1 ? i.length : s, 0, e, t), new
|
|
50
|
+
return i.splice(s == -1 ? i.length : s, 0, e, t), new B(i);
|
|
52
51
|
},
|
|
53
52
|
// :: ((key: string, value: any))
|
|
54
53
|
// Call the given function for each key/value pair in the map, in
|
|
@@ -61,20 +60,20 @@ z.prototype = {
|
|
|
61
60
|
// Create a new map by prepending the keys in this map that don't
|
|
62
61
|
// appear in `map` before the keys in `map`.
|
|
63
62
|
prepend: function(n) {
|
|
64
|
-
return n =
|
|
63
|
+
return n = B.from(n), n.size ? new B(n.content.concat(this.subtract(n).content)) : this;
|
|
65
64
|
},
|
|
66
65
|
// :: (union<Object, OrderedMap>) → OrderedMap
|
|
67
66
|
// Create a new map by appending the keys in this map that don't
|
|
68
67
|
// appear in `map` after the keys in `map`.
|
|
69
68
|
append: function(n) {
|
|
70
|
-
return n =
|
|
69
|
+
return n = B.from(n), n.size ? new B(this.subtract(n).content.concat(n.content)) : this;
|
|
71
70
|
},
|
|
72
71
|
// :: (union<Object, OrderedMap>) → OrderedMap
|
|
73
72
|
// Create a map containing all the keys in this map that don't
|
|
74
73
|
// appear in `map`.
|
|
75
74
|
subtract: function(n) {
|
|
76
75
|
var e = this;
|
|
77
|
-
n =
|
|
76
|
+
n = B.from(n);
|
|
78
77
|
for (var t = 0; t < n.content.length; t += 2)
|
|
79
78
|
e = e.remove(n.content[t]);
|
|
80
79
|
return e;
|
|
@@ -93,13 +92,13 @@ z.prototype = {
|
|
|
93
92
|
return this.content.length >> 1;
|
|
94
93
|
}
|
|
95
94
|
};
|
|
96
|
-
|
|
97
|
-
if (n instanceof
|
|
95
|
+
B.from = function(n) {
|
|
96
|
+
if (n instanceof B) return n;
|
|
98
97
|
var e = [];
|
|
99
98
|
if (n) for (var t in n) e.push(t, n[t]);
|
|
100
|
-
return new
|
|
99
|
+
return new B(e);
|
|
101
100
|
};
|
|
102
|
-
function
|
|
101
|
+
function _i(n, e, t) {
|
|
103
102
|
for (let r = 0; ; r++) {
|
|
104
103
|
if (r == n.childCount || r == e.childCount)
|
|
105
104
|
return n.childCount == e.childCount ? null : t;
|
|
@@ -116,7 +115,7 @@ function Gi(n, e, t) {
|
|
|
116
115
|
return t;
|
|
117
116
|
}
|
|
118
117
|
if (i.content.size || s.content.size) {
|
|
119
|
-
let o =
|
|
118
|
+
let o = _i(i.content, s.content, t + 1);
|
|
120
119
|
if (o != null)
|
|
121
120
|
return o;
|
|
122
121
|
}
|
|
@@ -310,7 +309,7 @@ class y {
|
|
|
310
309
|
fragment differ, or `null` if they are the same.
|
|
311
310
|
*/
|
|
312
311
|
findDiffStart(e, t = 0) {
|
|
313
|
-
return
|
|
312
|
+
return _i(this, e, t);
|
|
314
313
|
}
|
|
315
314
|
/**
|
|
316
315
|
Find the first position, searching from the end, at which this
|
|
@@ -405,7 +404,7 @@ const Sn = { index: 0, offset: 0 };
|
|
|
405
404
|
function Ft(n, e) {
|
|
406
405
|
return Sn.index = n, Sn.offset = e, Sn;
|
|
407
406
|
}
|
|
408
|
-
function
|
|
407
|
+
function _t(n, e) {
|
|
409
408
|
if (n === e)
|
|
410
409
|
return !0;
|
|
411
410
|
if (!(n && typeof n == "object") || !(e && typeof e == "object"))
|
|
@@ -417,11 +416,11 @@ function Gt(n, e) {
|
|
|
417
416
|
if (n.length != e.length)
|
|
418
417
|
return !1;
|
|
419
418
|
for (let r = 0; r < n.length; r++)
|
|
420
|
-
if (!
|
|
419
|
+
if (!_t(n[r], e[r]))
|
|
421
420
|
return !1;
|
|
422
421
|
} else {
|
|
423
422
|
for (let r in n)
|
|
424
|
-
if (!(r in e) || !
|
|
423
|
+
if (!(r in e) || !_t(n[r], e[r]))
|
|
425
424
|
return !1;
|
|
426
425
|
for (let r in e)
|
|
427
426
|
if (!(r in n))
|
|
@@ -429,7 +428,7 @@ function Gt(n, e) {
|
|
|
429
428
|
}
|
|
430
429
|
return !0;
|
|
431
430
|
}
|
|
432
|
-
class
|
|
431
|
+
class N {
|
|
433
432
|
/**
|
|
434
433
|
@internal
|
|
435
434
|
*/
|
|
@@ -483,7 +482,7 @@ class O {
|
|
|
483
482
|
another mark.
|
|
484
483
|
*/
|
|
485
484
|
eq(e) {
|
|
486
|
-
return this == e || this.type == e.type &&
|
|
485
|
+
return this == e || this.type == e.type && _t(this.attrs, e.attrs);
|
|
487
486
|
}
|
|
488
487
|
/**
|
|
489
488
|
Convert this mark to a JSON-serializeable representation.
|
|
@@ -527,17 +526,17 @@ class O {
|
|
|
527
526
|
*/
|
|
528
527
|
static setFrom(e) {
|
|
529
528
|
if (!e || Array.isArray(e) && e.length == 0)
|
|
530
|
-
return
|
|
531
|
-
if (e instanceof
|
|
529
|
+
return N.none;
|
|
530
|
+
if (e instanceof N)
|
|
532
531
|
return [e];
|
|
533
532
|
let t = e.slice();
|
|
534
533
|
return t.sort((r, i) => r.type.rank - i.type.rank), t;
|
|
535
534
|
}
|
|
536
535
|
}
|
|
537
|
-
|
|
536
|
+
N.none = [];
|
|
538
537
|
class Xt extends Error {
|
|
539
538
|
}
|
|
540
|
-
class
|
|
539
|
+
class x {
|
|
541
540
|
/**
|
|
542
541
|
Create a slice. When specifying a non-zero open depth, you must
|
|
543
542
|
make sure that there are nodes of at least that depth at the
|
|
@@ -564,13 +563,13 @@ class k {
|
|
|
564
563
|
*/
|
|
565
564
|
insertAt(e, t) {
|
|
566
565
|
let r = Zi(this.content, e + this.openStart, t);
|
|
567
|
-
return r && new
|
|
566
|
+
return r && new x(r, this.openStart, this.openEnd);
|
|
568
567
|
}
|
|
569
568
|
/**
|
|
570
569
|
@internal
|
|
571
570
|
*/
|
|
572
571
|
removeBetween(e, t) {
|
|
573
|
-
return new
|
|
572
|
+
return new x(Yi(this.content, e + this.openStart, t + this.openStart), this.openStart, this.openEnd);
|
|
574
573
|
}
|
|
575
574
|
/**
|
|
576
575
|
Tests whether this slice is equal to another slice.
|
|
@@ -598,11 +597,11 @@ class k {
|
|
|
598
597
|
*/
|
|
599
598
|
static fromJSON(e, t) {
|
|
600
599
|
if (!t)
|
|
601
|
-
return
|
|
600
|
+
return x.empty;
|
|
602
601
|
let r = t.openStart || 0, i = t.openEnd || 0;
|
|
603
602
|
if (typeof r != "number" || typeof i != "number")
|
|
604
603
|
throw new RangeError("Invalid input for Slice.fromJSON");
|
|
605
|
-
return new
|
|
604
|
+
return new x(y.fromJSON(e, t.content), r, i);
|
|
606
605
|
}
|
|
607
606
|
/**
|
|
608
607
|
Create a slice from a fragment by taking the maximum possible
|
|
@@ -614,10 +613,10 @@ class k {
|
|
|
614
613
|
r++;
|
|
615
614
|
for (let s = e.lastChild; s && !s.isLeaf && (t || !s.type.spec.isolating); s = s.lastChild)
|
|
616
615
|
i++;
|
|
617
|
-
return new
|
|
616
|
+
return new x(e, r, i);
|
|
618
617
|
}
|
|
619
618
|
}
|
|
620
|
-
|
|
619
|
+
x.empty = new x(y.empty, 0, 0);
|
|
621
620
|
function Yi(n, e, t) {
|
|
622
621
|
let { index: r, offset: i } = n.findIndex(e), s = n.maybeChild(r), { index: o, offset: l } = n.findIndex(t);
|
|
623
622
|
if (i == e || s.isText) {
|
|
@@ -662,7 +661,7 @@ function es(n, e) {
|
|
|
662
661
|
if (!e.type.compatibleContent(n.type))
|
|
663
662
|
throw new Xt("Cannot join " + e.type.name + " onto " + n.type.name);
|
|
664
663
|
}
|
|
665
|
-
function
|
|
664
|
+
function Wn(n, e, t) {
|
|
666
665
|
let r = n.node(t);
|
|
667
666
|
return es(r, e.node(t)), r;
|
|
668
667
|
}
|
|
@@ -670,7 +669,7 @@ function $e(n, e) {
|
|
|
670
669
|
let t = e.length - 1;
|
|
671
670
|
t >= 0 && n.isText && n.sameMarkup(e[t]) ? e[t] = n.withText(e[t].text + n.text) : e.push(n);
|
|
672
671
|
}
|
|
673
|
-
function
|
|
672
|
+
function xt(n, e, t, r) {
|
|
674
673
|
let i = (e || n).node(t), s = 0, o = e ? e.index(t) : i.childCount;
|
|
675
674
|
n && (s = n.index(t), n.depth > t ? s++ : n.textOffset && ($e(n.nodeAfter, r), s++));
|
|
676
675
|
for (let l = s; l < o; l++)
|
|
@@ -681,16 +680,16 @@ function We(n, e) {
|
|
|
681
680
|
return n.type.checkContent(e), n.copy(e);
|
|
682
681
|
}
|
|
683
682
|
function ts(n, e, t, r, i) {
|
|
684
|
-
let s = n.depth > i &&
|
|
685
|
-
return
|
|
683
|
+
let s = n.depth > i && Wn(n, e, i + 1), o = r.depth > i && Wn(t, r, i + 1), l = [];
|
|
684
|
+
return xt(null, n, i, l), s && o && e.index(i) == t.index(i) ? (es(s, o), $e(We(s, ts(n, e, t, r, i + 1)), l)) : (s && $e(We(s, Yt(n, e, i + 1)), l), xt(e, t, i, l), o && $e(We(o, Yt(t, r, i + 1)), l)), xt(r, null, i, l), new y(l);
|
|
686
685
|
}
|
|
687
686
|
function Yt(n, e, t) {
|
|
688
687
|
let r = [];
|
|
689
|
-
if (
|
|
690
|
-
let i =
|
|
688
|
+
if (xt(null, n, t, r), n.depth > t) {
|
|
689
|
+
let i = Wn(n, e, t + 1);
|
|
691
690
|
$e(We(i, Yt(n, e, t + 1)), r);
|
|
692
691
|
}
|
|
693
|
-
return
|
|
692
|
+
return xt(e, null, t, r), new y(r);
|
|
694
693
|
}
|
|
695
694
|
function Wo(n, e) {
|
|
696
695
|
let t = e.depth - n.openStart, i = e.node(t).copy(n.content);
|
|
@@ -832,7 +831,7 @@ class Mt {
|
|
|
832
831
|
marks() {
|
|
833
832
|
let e = this.parent, t = this.index();
|
|
834
833
|
if (e.content.size == 0)
|
|
835
|
-
return
|
|
834
|
+
return N.none;
|
|
836
835
|
if (this.textOffset)
|
|
837
836
|
return e.child(t).marks;
|
|
838
837
|
let r = e.maybeChild(t - 1), i = e.maybeChild(t);
|
|
@@ -935,7 +934,7 @@ class Mt {
|
|
|
935
934
|
@internal
|
|
936
935
|
*/
|
|
937
936
|
static resolveCached(e, t) {
|
|
938
|
-
let r =
|
|
937
|
+
let r = Dr.get(e);
|
|
939
938
|
if (r)
|
|
940
939
|
for (let s = 0; s < r.elts.length; s++) {
|
|
941
940
|
let o = r.elts[s];
|
|
@@ -943,7 +942,7 @@ class Mt {
|
|
|
943
942
|
return o;
|
|
944
943
|
}
|
|
945
944
|
else
|
|
946
|
-
|
|
945
|
+
Dr.set(e, r = new Jo());
|
|
947
946
|
let i = r.elts[r.i] = Mt.resolve(e, t);
|
|
948
947
|
return r.i = (r.i + 1) % qo, i;
|
|
949
948
|
}
|
|
@@ -953,7 +952,7 @@ class Jo {
|
|
|
953
952
|
this.elts = [], this.i = 0;
|
|
954
953
|
}
|
|
955
954
|
}
|
|
956
|
-
const qo = 12,
|
|
955
|
+
const qo = 12, Dr = /* @__PURE__ */ new WeakMap();
|
|
957
956
|
class Zt {
|
|
958
957
|
/**
|
|
959
958
|
Construct a node range. `$from` and `$to` should point into the
|
|
@@ -995,11 +994,11 @@ class Zt {
|
|
|
995
994
|
}
|
|
996
995
|
}
|
|
997
996
|
const Ko = /* @__PURE__ */ Object.create(null);
|
|
998
|
-
let Je = class
|
|
997
|
+
let Je = class Jn {
|
|
999
998
|
/**
|
|
1000
999
|
@internal
|
|
1001
1000
|
*/
|
|
1002
|
-
constructor(e, t, r, i =
|
|
1001
|
+
constructor(e, t, r, i = N.none) {
|
|
1003
1002
|
this.type = e, this.attrs = t, this.marks = i, this.content = r || y.empty;
|
|
1004
1003
|
}
|
|
1005
1004
|
/**
|
|
@@ -1113,21 +1112,21 @@ let Je = class Wn {
|
|
|
1113
1112
|
attributes, and marks.
|
|
1114
1113
|
*/
|
|
1115
1114
|
hasMarkup(e, t, r) {
|
|
1116
|
-
return this.type == e &&
|
|
1115
|
+
return this.type == e && _t(this.attrs, t || e.defaultAttrs || Ko) && N.sameSet(this.marks, r || N.none);
|
|
1117
1116
|
}
|
|
1118
1117
|
/**
|
|
1119
1118
|
Create a new node with the same markup as this node, containing
|
|
1120
1119
|
the given content (or empty, if no content is given).
|
|
1121
1120
|
*/
|
|
1122
1121
|
copy(e = null) {
|
|
1123
|
-
return e == this.content ? this : new
|
|
1122
|
+
return e == this.content ? this : new Jn(this.type, this.attrs, e, this.marks);
|
|
1124
1123
|
}
|
|
1125
1124
|
/**
|
|
1126
1125
|
Create a copy of this node, with the given set of marks instead
|
|
1127
1126
|
of the node's own marks.
|
|
1128
1127
|
*/
|
|
1129
1128
|
mark(e) {
|
|
1130
|
-
return e == this.marks ? this : new
|
|
1129
|
+
return e == this.marks ? this : new Jn(this.type, this.attrs, this.content, e);
|
|
1131
1130
|
}
|
|
1132
1131
|
/**
|
|
1133
1132
|
Create a copy of this node with only the content between the
|
|
@@ -1143,9 +1142,9 @@ let Je = class Wn {
|
|
|
1143
1142
|
*/
|
|
1144
1143
|
slice(e, t = this.content.size, r = !1) {
|
|
1145
1144
|
if (e == t)
|
|
1146
|
-
return
|
|
1145
|
+
return x.empty;
|
|
1147
1146
|
let i = this.resolve(e), s = this.resolve(t), o = r ? 0 : i.sharedDepth(t), l = i.start(o), c = i.node(o).content.cut(i.pos - l, s.pos - l);
|
|
1148
|
-
return new
|
|
1147
|
+
return new x(c, i.depth - o, s.depth - o);
|
|
1149
1148
|
}
|
|
1150
1149
|
/**
|
|
1151
1150
|
Replace the part of the document between the given positions with
|
|
@@ -1323,12 +1322,12 @@ let Je = class Wn {
|
|
|
1323
1322
|
*/
|
|
1324
1323
|
check() {
|
|
1325
1324
|
this.type.checkContent(this.content), this.type.checkAttrs(this.attrs);
|
|
1326
|
-
let e =
|
|
1325
|
+
let e = N.none;
|
|
1327
1326
|
for (let t = 0; t < this.marks.length; t++) {
|
|
1328
1327
|
let r = this.marks[t];
|
|
1329
1328
|
r.type.checkAttrs(r.attrs), e = r.addToSet(e);
|
|
1330
1329
|
}
|
|
1331
|
-
if (!
|
|
1330
|
+
if (!N.sameSet(e, this.marks))
|
|
1332
1331
|
throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map((t) => t.type.name)}`);
|
|
1333
1332
|
this.content.forEach((t) => t.check());
|
|
1334
1333
|
}
|
|
@@ -1595,11 +1594,11 @@ function rs(n) {
|
|
|
1595
1594
|
function Uo(n) {
|
|
1596
1595
|
let e = [];
|
|
1597
1596
|
do
|
|
1598
|
-
e.push(
|
|
1597
|
+
e.push(Go(n));
|
|
1599
1598
|
while (n.next && n.next != ")" && n.next != "|");
|
|
1600
1599
|
return e.length == 1 ? e[0] : { type: "seq", exprs: e };
|
|
1601
1600
|
}
|
|
1602
|
-
function
|
|
1601
|
+
function Go(n) {
|
|
1603
1602
|
let e = Yo(n);
|
|
1604
1603
|
for (; ; )
|
|
1605
1604
|
if (n.eat("+"))
|
|
@@ -1609,19 +1608,19 @@ function _o(n) {
|
|
|
1609
1608
|
else if (n.eat("?"))
|
|
1610
1609
|
e = { type: "opt", expr: e };
|
|
1611
1610
|
else if (n.eat("{"))
|
|
1612
|
-
e =
|
|
1611
|
+
e = _o(n, e);
|
|
1613
1612
|
else
|
|
1614
1613
|
break;
|
|
1615
1614
|
return e;
|
|
1616
1615
|
}
|
|
1617
|
-
function
|
|
1616
|
+
function Er(n) {
|
|
1618
1617
|
/\D/.test(n.next) && n.err("Expected number, got '" + n.next + "'");
|
|
1619
1618
|
let e = Number(n.next);
|
|
1620
1619
|
return n.pos++, e;
|
|
1621
1620
|
}
|
|
1622
|
-
function
|
|
1623
|
-
let t =
|
|
1624
|
-
return n.eat(",") && (n.next != "}" ? r =
|
|
1621
|
+
function _o(n, e) {
|
|
1622
|
+
let t = Er(n), r = t;
|
|
1623
|
+
return n.eat(",") && (n.next != "}" ? r = Er(n) : r = -1), n.eat("}") || n.err("Unclosed braced range"), { type: "range", min: t, max: r, expr: e };
|
|
1625
1624
|
}
|
|
1626
1625
|
function Xo(n, e) {
|
|
1627
1626
|
let t = n.nodeTypes, r = t[e];
|
|
@@ -1702,7 +1701,7 @@ function Zo(n) {
|
|
|
1702
1701
|
function is(n, e) {
|
|
1703
1702
|
return e - n;
|
|
1704
1703
|
}
|
|
1705
|
-
function
|
|
1704
|
+
function Rr(n, e) {
|
|
1706
1705
|
let t = [];
|
|
1707
1706
|
return r(e), t.sort(is);
|
|
1708
1707
|
function r(i) {
|
|
@@ -1718,7 +1717,7 @@ function Er(n, e) {
|
|
|
1718
1717
|
}
|
|
1719
1718
|
function Qo(n) {
|
|
1720
1719
|
let e = /* @__PURE__ */ Object.create(null);
|
|
1721
|
-
return t(
|
|
1720
|
+
return t(Rr(n, 0));
|
|
1722
1721
|
function t(r) {
|
|
1723
1722
|
let i = [];
|
|
1724
1723
|
r.forEach((o) => {
|
|
@@ -1728,7 +1727,7 @@ function Qo(n) {
|
|
|
1728
1727
|
let c;
|
|
1729
1728
|
for (let f = 0; f < i.length; f++)
|
|
1730
1729
|
i[f][0] == l && (c = i[f][1]);
|
|
1731
|
-
|
|
1730
|
+
Rr(n, a).forEach((f) => {
|
|
1732
1731
|
c || i.push([l, c = []]), c.indexOf(f) == -1 && c.push(f);
|
|
1733
1732
|
});
|
|
1734
1733
|
});
|
|
@@ -1792,7 +1791,7 @@ function cs(n, e) {
|
|
|
1792
1791
|
t[r] = new nl(n, r, e[r]);
|
|
1793
1792
|
return t;
|
|
1794
1793
|
}
|
|
1795
|
-
let
|
|
1794
|
+
let Ir = class fs {
|
|
1796
1795
|
/**
|
|
1797
1796
|
@internal
|
|
1798
1797
|
*/
|
|
@@ -1871,7 +1870,7 @@ let Rr = class fs {
|
|
|
1871
1870
|
create(e = null, t, r) {
|
|
1872
1871
|
if (this.isText)
|
|
1873
1872
|
throw new Error("NodeType.create can't construct text nodes");
|
|
1874
|
-
return new Je(this, this.computeAttrs(e), y.from(t),
|
|
1873
|
+
return new Je(this, this.computeAttrs(e), y.from(t), N.setFrom(r));
|
|
1875
1874
|
}
|
|
1876
1875
|
/**
|
|
1877
1876
|
Like [`create`](https://prosemirror.net/docs/ref/#model.NodeType.create), but check the given content
|
|
@@ -1879,7 +1878,7 @@ let Rr = class fs {
|
|
|
1879
1878
|
if it doesn't match.
|
|
1880
1879
|
*/
|
|
1881
1880
|
createChecked(e = null, t, r) {
|
|
1882
|
-
return t = y.from(t), this.checkContent(t), new Je(this, this.computeAttrs(e), t,
|
|
1881
|
+
return t = y.from(t), this.checkContent(t), new Je(this, this.computeAttrs(e), t, N.setFrom(r));
|
|
1883
1882
|
}
|
|
1884
1883
|
/**
|
|
1885
1884
|
Like [`create`](https://prosemirror.net/docs/ref/#model.NodeType.create), but see if it is
|
|
@@ -1897,7 +1896,7 @@ let Rr = class fs {
|
|
|
1897
1896
|
t = o.append(t);
|
|
1898
1897
|
}
|
|
1899
1898
|
let i = this.contentMatch.matchFragment(t), s = i && i.fillBefore(y.empty, !0);
|
|
1900
|
-
return s ? new Je(this, e, t.append(s),
|
|
1899
|
+
return s ? new Je(this, e, t.append(s), N.setFrom(r)) : null;
|
|
1901
1900
|
}
|
|
1902
1901
|
/**
|
|
1903
1902
|
Returns true if the given fragment is valid content for this node
|
|
@@ -1953,7 +1952,7 @@ let Rr = class fs {
|
|
|
1953
1952
|
let t;
|
|
1954
1953
|
for (let r = 0; r < e.length; r++)
|
|
1955
1954
|
this.allowsMarkType(e[r].type) ? t && t.push(e[r]) : t || (t = e.slice(0, r));
|
|
1956
|
-
return t ? t.length ? t :
|
|
1955
|
+
return t ? t.length ? t : N.none : e;
|
|
1957
1956
|
}
|
|
1958
1957
|
/**
|
|
1959
1958
|
@internal
|
|
@@ -1994,7 +1993,7 @@ class dn {
|
|
|
1994
1993
|
constructor(e, t, r, i) {
|
|
1995
1994
|
this.name = e, this.rank = t, this.schema = r, this.spec = i, this.attrs = cs(e, i.attrs), this.excluded = null;
|
|
1996
1995
|
let s = ss(this.attrs);
|
|
1997
|
-
this.instance = s ? new
|
|
1996
|
+
this.instance = s ? new N(this, s) : null;
|
|
1998
1997
|
}
|
|
1999
1998
|
/**
|
|
2000
1999
|
Create a mark of this type. `attrs` may be `null` or an object
|
|
@@ -2002,7 +2001,7 @@ class dn {
|
|
|
2002
2001
|
they have defaults, will be added.
|
|
2003
2002
|
*/
|
|
2004
2003
|
create(e = null) {
|
|
2005
|
-
return !e && this.instance ? this.instance : new
|
|
2004
|
+
return !e && this.instance ? this.instance : new N(this, ls(this.attrs, e));
|
|
2006
2005
|
}
|
|
2007
2006
|
/**
|
|
2008
2007
|
@internal
|
|
@@ -2051,7 +2050,7 @@ class rl {
|
|
|
2051
2050
|
let t = this.spec = {};
|
|
2052
2051
|
for (let i in e)
|
|
2053
2052
|
t[i] = e[i];
|
|
2054
|
-
t.nodes =
|
|
2053
|
+
t.nodes = B.from(e.nodes), t.marks = B.from(e.marks || {}), this.nodes = Ir.compile(this.spec.nodes, this), this.marks = dn.compile(this.spec.marks, this);
|
|
2055
2054
|
let r = /* @__PURE__ */ Object.create(null);
|
|
2056
2055
|
for (let i in this.nodes) {
|
|
2057
2056
|
if (i in this.marks)
|
|
@@ -2064,11 +2063,11 @@ class rl {
|
|
|
2064
2063
|
throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");
|
|
2065
2064
|
this.linebreakReplacement = s;
|
|
2066
2065
|
}
|
|
2067
|
-
s.markSet = l == "_" ? null : l ?
|
|
2066
|
+
s.markSet = l == "_" ? null : l ? vr(this, l.split(" ")) : l == "" || !s.inlineContent ? [] : null;
|
|
2068
2067
|
}
|
|
2069
2068
|
for (let i in this.marks) {
|
|
2070
2069
|
let s = this.marks[i], o = s.spec.excludes;
|
|
2071
|
-
s.excluded = o == null ? [s] : o == "" ? [] :
|
|
2070
|
+
s.excluded = o == null ? [s] : o == "" ? [] : vr(this, o.split(" "));
|
|
2072
2071
|
}
|
|
2073
2072
|
this.nodeFromJSON = this.nodeFromJSON.bind(this), this.markFromJSON = this.markFromJSON.bind(this), this.topNodeType = this.nodes[this.spec.topNode || "doc"], this.cached.wrappings = /* @__PURE__ */ Object.create(null);
|
|
2074
2073
|
}
|
|
@@ -2081,7 +2080,7 @@ class rl {
|
|
|
2081
2080
|
node(e, t = null, r, i) {
|
|
2082
2081
|
if (typeof e == "string")
|
|
2083
2082
|
e = this.nodeType(e);
|
|
2084
|
-
else if (e instanceof
|
|
2083
|
+
else if (e instanceof Ir) {
|
|
2085
2084
|
if (e.schema != this)
|
|
2086
2085
|
throw new RangeError("Node type from different schema used (" + e.name + ")");
|
|
2087
2086
|
} else throw new RangeError("Invalid node type: " + e);
|
|
@@ -2093,7 +2092,7 @@ class rl {
|
|
|
2093
2092
|
*/
|
|
2094
2093
|
text(e, t) {
|
|
2095
2094
|
let r = this.nodes.text;
|
|
2096
|
-
return new Qt(r, r.defaultAttrs, e,
|
|
2095
|
+
return new Qt(r, r.defaultAttrs, e, N.setFrom(t));
|
|
2097
2096
|
}
|
|
2098
2097
|
/**
|
|
2099
2098
|
Create a mark with the given type and attributes.
|
|
@@ -2113,7 +2112,7 @@ class rl {
|
|
|
2113
2112
|
bound.
|
|
2114
2113
|
*/
|
|
2115
2114
|
markFromJSON(e) {
|
|
2116
|
-
return
|
|
2115
|
+
return N.fromJSON(this, e);
|
|
2117
2116
|
}
|
|
2118
2117
|
/**
|
|
2119
2118
|
@internal
|
|
@@ -2125,7 +2124,7 @@ class rl {
|
|
|
2125
2124
|
return t;
|
|
2126
2125
|
}
|
|
2127
2126
|
}
|
|
2128
|
-
function
|
|
2127
|
+
function vr(n, e) {
|
|
2129
2128
|
let t = [];
|
|
2130
2129
|
for (let r = 0; r < e.length; r++) {
|
|
2131
2130
|
let i = e[r], s = n.marks[i], o = s;
|
|
@@ -2173,8 +2172,8 @@ class ot {
|
|
|
2173
2172
|
Parse a document from the content of a DOM node.
|
|
2174
2173
|
*/
|
|
2175
2174
|
parse(e, t = {}) {
|
|
2176
|
-
let r = new
|
|
2177
|
-
return r.addAll(e,
|
|
2175
|
+
let r = new Br(this, t, !1);
|
|
2176
|
+
return r.addAll(e, N.none, t.from, t.to), r.finish();
|
|
2178
2177
|
}
|
|
2179
2178
|
/**
|
|
2180
2179
|
Parses the content of the given DOM node, like
|
|
@@ -2185,8 +2184,8 @@ class ot {
|
|
|
2185
2184
|
the left of the input and the end of nodes at the end.
|
|
2186
2185
|
*/
|
|
2187
2186
|
parseSlice(e, t = {}) {
|
|
2188
|
-
let r = new
|
|
2189
|
-
return r.addAll(e,
|
|
2187
|
+
let r = new Br(this, t, !0);
|
|
2188
|
+
return r.addAll(e, N.none, t.from, t.to), x.maxOpen(r.finish());
|
|
2190
2189
|
}
|
|
2191
2190
|
/**
|
|
2192
2191
|
@internal
|
|
@@ -2242,13 +2241,13 @@ class ot {
|
|
|
2242
2241
|
for (let i in e.marks) {
|
|
2243
2242
|
let s = e.marks[i].spec.parseDOM;
|
|
2244
2243
|
s && s.forEach((o) => {
|
|
2245
|
-
r(o =
|
|
2244
|
+
r(o = Vr(o)), o.mark || o.ignore || o.clearMark || (o.mark = i);
|
|
2246
2245
|
});
|
|
2247
2246
|
}
|
|
2248
2247
|
for (let i in e.nodes) {
|
|
2249
2248
|
let s = e.nodes[i].spec.parseDOM;
|
|
2250
2249
|
s && s.forEach((o) => {
|
|
2251
|
-
r(o =
|
|
2250
|
+
r(o = Vr(o)), o.node || o.ignore || o.mark || (o.node = i);
|
|
2252
2251
|
});
|
|
2253
2252
|
}
|
|
2254
2253
|
return t;
|
|
@@ -2302,13 +2301,13 @@ const hs = {
|
|
|
2302
2301
|
script: !0,
|
|
2303
2302
|
style: !0,
|
|
2304
2303
|
title: !0
|
|
2305
|
-
}, ds = { ol: !0, ul: !0 }, en = 1, tn = 2,
|
|
2306
|
-
function
|
|
2307
|
-
return e != null ? (e ? en : 0) | (e === "full" ? tn : 0) : n && n.whitespace == "pre" ? en | tn : t & ~
|
|
2304
|
+
}, ds = { ol: !0, ul: !0 }, en = 1, tn = 2, kt = 4;
|
|
2305
|
+
function zr(n, e, t) {
|
|
2306
|
+
return e != null ? (e ? en : 0) | (e === "full" ? tn : 0) : n && n.whitespace == "pre" ? en | tn : t & ~kt;
|
|
2308
2307
|
}
|
|
2309
2308
|
class Lt {
|
|
2310
2309
|
constructor(e, t, r, i, s, o) {
|
|
2311
|
-
this.type = e, this.attrs = t, this.marks = r, this.solid = i, this.options = o, this.content = [], this.activeMarks =
|
|
2310
|
+
this.type = e, this.attrs = t, this.marks = r, this.solid = i, this.options = o, this.content = [], this.activeMarks = N.none, this.match = s || (o & kt ? null : e.contentMatch);
|
|
2312
2311
|
}
|
|
2313
2312
|
findWrapping(e) {
|
|
2314
2313
|
if (!this.match) {
|
|
@@ -2339,11 +2338,11 @@ class Lt {
|
|
|
2339
2338
|
return this.type ? this.type.inlineContent : this.content.length ? this.content[0].isInline : e.parentNode && !hs.hasOwnProperty(e.parentNode.nodeName.toLowerCase());
|
|
2340
2339
|
}
|
|
2341
2340
|
}
|
|
2342
|
-
class
|
|
2341
|
+
class Br {
|
|
2343
2342
|
constructor(e, t, r) {
|
|
2344
2343
|
this.parser = e, this.options = t, this.isOpen = r, this.open = 0;
|
|
2345
|
-
let i = t.topNode, s, o =
|
|
2346
|
-
i ? s = new Lt(i.type, i.attrs,
|
|
2344
|
+
let i = t.topNode, s, o = zr(null, t.preserveWhitespace, 0) | (r ? kt : 0);
|
|
2345
|
+
i ? s = new Lt(i.type, i.attrs, N.none, !0, t.topMatch || i.type.contentMatch, o) : r ? s = new Lt(null, null, N.none, !0, null, o) : s = new Lt(e.schema.topNodeType, null, N.none, !0, null, o), this.nodes = [s], this.find = t.findPositions, this.needsBlock = !1;
|
|
2347
2346
|
}
|
|
2348
2347
|
get top() {
|
|
2349
2348
|
return this.nodes[this.open];
|
|
@@ -2490,9 +2489,9 @@ class zr {
|
|
|
2490
2489
|
this.closeExtra();
|
|
2491
2490
|
let i = this.top;
|
|
2492
2491
|
i.match && (i.match = i.match.matchType(e.type));
|
|
2493
|
-
let s =
|
|
2492
|
+
let s = N.none;
|
|
2494
2493
|
for (let o of r.concat(e.marks))
|
|
2495
|
-
(i.type ? i.type.allowsMarkType(o.type) :
|
|
2494
|
+
(i.type ? i.type.allowsMarkType(o.type) : Pr(o.type, e.type)) && (s = o.addToSet(s));
|
|
2496
2495
|
return i.content.push(e.mark(s)), !0;
|
|
2497
2496
|
}
|
|
2498
2497
|
return !1;
|
|
@@ -2508,10 +2507,10 @@ class zr {
|
|
|
2508
2507
|
this.closeExtra();
|
|
2509
2508
|
let o = this.top;
|
|
2510
2509
|
o.match = o.match && o.match.matchType(e);
|
|
2511
|
-
let l =
|
|
2512
|
-
o.options &
|
|
2513
|
-
let a =
|
|
2514
|
-
return r = r.filter((c) => (o.type ? o.type.allowsMarkType(c.type) :
|
|
2510
|
+
let l = zr(e, s, o.options);
|
|
2511
|
+
o.options & kt && o.content.length == 0 && (l |= kt);
|
|
2512
|
+
let a = N.none;
|
|
2513
|
+
return r = r.filter((c) => (o.type ? o.type.allowsMarkType(c.type) : Pr(c.type, e)) ? (a = c.addToSet(a), !1) : !0), this.nodes.push(new Lt(e, t, a, i, null, l)), this.open++, r;
|
|
2515
2514
|
}
|
|
2516
2515
|
// Make sure all nodes above this.open are finished and added to
|
|
2517
2516
|
// their parents
|
|
@@ -2612,13 +2611,13 @@ function ll(n) {
|
|
|
2612
2611
|
function al(n, e) {
|
|
2613
2612
|
return (n.matches || n.msMatchesSelector || n.webkitMatchesSelector || n.mozMatchesSelector).call(n, e);
|
|
2614
2613
|
}
|
|
2615
|
-
function
|
|
2614
|
+
function Vr(n) {
|
|
2616
2615
|
let e = {};
|
|
2617
2616
|
for (let t in n)
|
|
2618
2617
|
e[t] = n[t];
|
|
2619
2618
|
return e;
|
|
2620
2619
|
}
|
|
2621
|
-
function
|
|
2620
|
+
function Pr(n, e) {
|
|
2622
2621
|
let t = e.schema.nodes;
|
|
2623
2622
|
for (let r in t) {
|
|
2624
2623
|
let i = t[r];
|
|
@@ -2730,17 +2729,17 @@ class Xe {
|
|
|
2730
2729
|
This can be useful as a base to build a custom serializer from.
|
|
2731
2730
|
*/
|
|
2732
2731
|
static nodesFromSchema(e) {
|
|
2733
|
-
let t =
|
|
2732
|
+
let t = Fr(e.nodes);
|
|
2734
2733
|
return t.text || (t.text = (r) => r.text), t;
|
|
2735
2734
|
}
|
|
2736
2735
|
/**
|
|
2737
2736
|
Gather the serializers in a schema's mark specs into an object.
|
|
2738
2737
|
*/
|
|
2739
2738
|
static marksFromSchema(e) {
|
|
2740
|
-
return
|
|
2739
|
+
return Fr(e.marks);
|
|
2741
2740
|
}
|
|
2742
2741
|
}
|
|
2743
|
-
function
|
|
2742
|
+
function Fr(n) {
|
|
2744
2743
|
let e = {};
|
|
2745
2744
|
for (let t in n) {
|
|
2746
2745
|
let r = n[t].spec.toDOM;
|
|
@@ -2751,10 +2750,10 @@ function Pr(n) {
|
|
|
2751
2750
|
function Cn(n) {
|
|
2752
2751
|
return n.document || window.document;
|
|
2753
2752
|
}
|
|
2754
|
-
const
|
|
2753
|
+
const Lr = /* @__PURE__ */ new WeakMap();
|
|
2755
2754
|
function cl(n) {
|
|
2756
|
-
let e =
|
|
2757
|
-
return e === void 0 &&
|
|
2755
|
+
let e = Lr.get(n);
|
|
2756
|
+
return e === void 0 && Lr.set(n, e = fl(n)), e;
|
|
2758
2757
|
}
|
|
2759
2758
|
function fl(n) {
|
|
2760
2759
|
let e = null;
|
|
@@ -2816,14 +2815,14 @@ const us = 65535, ps = Math.pow(2, 16);
|
|
|
2816
2815
|
function hl(n, e) {
|
|
2817
2816
|
return n + e * ps;
|
|
2818
2817
|
}
|
|
2819
|
-
function
|
|
2818
|
+
function Hr(n) {
|
|
2820
2819
|
return n & us;
|
|
2821
2820
|
}
|
|
2822
2821
|
function dl(n) {
|
|
2823
2822
|
return (n - (n & us)) / ps;
|
|
2824
2823
|
}
|
|
2825
2824
|
const ms = 1, gs = 2, Kt = 4, ys = 8;
|
|
2826
|
-
class
|
|
2825
|
+
class qn {
|
|
2827
2826
|
/**
|
|
2828
2827
|
@internal
|
|
2829
2828
|
*/
|
|
@@ -2859,21 +2858,21 @@ class Jn {
|
|
|
2859
2858
|
return (this.delInfo & Kt) > 0;
|
|
2860
2859
|
}
|
|
2861
2860
|
}
|
|
2862
|
-
class
|
|
2861
|
+
class G {
|
|
2863
2862
|
/**
|
|
2864
2863
|
Create a position map. The modifications to the document are
|
|
2865
2864
|
represented as an array of numbers, in which each group of three
|
|
2866
2865
|
represents a modified chunk as `[start, oldSize, newSize]`.
|
|
2867
2866
|
*/
|
|
2868
2867
|
constructor(e, t = !1) {
|
|
2869
|
-
if (this.ranges = e, this.inverted = t, !e.length &&
|
|
2870
|
-
return
|
|
2868
|
+
if (this.ranges = e, this.inverted = t, !e.length && G.empty)
|
|
2869
|
+
return G.empty;
|
|
2871
2870
|
}
|
|
2872
2871
|
/**
|
|
2873
2872
|
@internal
|
|
2874
2873
|
*/
|
|
2875
2874
|
recover(e) {
|
|
2876
|
-
let t = 0, r =
|
|
2875
|
+
let t = 0, r = Hr(e);
|
|
2877
2876
|
if (!this.inverted)
|
|
2878
2877
|
for (let i = 0; i < r; i++)
|
|
2879
2878
|
t += this.ranges[i * 3 + 2] - this.ranges[i * 3 + 1];
|
|
@@ -2900,17 +2899,17 @@ class _ {
|
|
|
2900
2899
|
if (r)
|
|
2901
2900
|
return u;
|
|
2902
2901
|
let p = e == (t < 0 ? a : h) ? null : hl(l / 3, e - a), m = e == a ? gs : e == h ? ms : Kt;
|
|
2903
|
-
return (t < 0 ? e != a : e != h) && (m |= ys), new
|
|
2902
|
+
return (t < 0 ? e != a : e != h) && (m |= ys), new qn(u, m, p);
|
|
2904
2903
|
}
|
|
2905
2904
|
i += f - c;
|
|
2906
2905
|
}
|
|
2907
|
-
return r ? e + i : new
|
|
2906
|
+
return r ? e + i : new qn(e + i, 0, null);
|
|
2908
2907
|
}
|
|
2909
2908
|
/**
|
|
2910
2909
|
@internal
|
|
2911
2910
|
*/
|
|
2912
2911
|
touches(e, t) {
|
|
2913
|
-
let r = 0, i =
|
|
2912
|
+
let r = 0, i = Hr(t), s = this.inverted ? 2 : 1, o = this.inverted ? 1 : 2;
|
|
2914
2913
|
for (let l = 0; l < this.ranges.length; l += 3) {
|
|
2915
2914
|
let a = this.ranges[l] - (this.inverted ? r : 0);
|
|
2916
2915
|
if (a > e)
|
|
@@ -2938,7 +2937,7 @@ class _ {
|
|
|
2938
2937
|
map positions in the post-step document to the pre-step document.
|
|
2939
2938
|
*/
|
|
2940
2939
|
invert() {
|
|
2941
|
-
return new
|
|
2940
|
+
return new G(this.ranges, !this.inverted);
|
|
2942
2941
|
}
|
|
2943
2942
|
/**
|
|
2944
2943
|
@internal
|
|
@@ -2952,10 +2951,10 @@ class _ {
|
|
|
2952
2951
|
sub-document to a larger document, or vice-versa.
|
|
2953
2952
|
*/
|
|
2954
2953
|
static offset(e) {
|
|
2955
|
-
return e == 0 ?
|
|
2954
|
+
return e == 0 ? G.empty : new G(e < 0 ? [0, -e, 0] : [0, 0, e]);
|
|
2956
2955
|
}
|
|
2957
2956
|
}
|
|
2958
|
-
|
|
2957
|
+
G.empty = new G([]);
|
|
2959
2958
|
class nt {
|
|
2960
2959
|
/**
|
|
2961
2960
|
Create a new mapping with the given position maps.
|
|
@@ -3060,18 +3059,18 @@ class nt {
|
|
|
3060
3059
|
}
|
|
3061
3060
|
i |= l.delInfo, e = l.pos;
|
|
3062
3061
|
}
|
|
3063
|
-
return r ? e : new
|
|
3062
|
+
return r ? e : new qn(e, i, null);
|
|
3064
3063
|
}
|
|
3065
3064
|
}
|
|
3066
3065
|
const wn = /* @__PURE__ */ Object.create(null);
|
|
3067
|
-
class
|
|
3066
|
+
class W {
|
|
3068
3067
|
/**
|
|
3069
3068
|
Get the step map that represents the changes made by this step,
|
|
3070
3069
|
and which can be used to transform between positions in the old
|
|
3071
3070
|
and the new document.
|
|
3072
3071
|
*/
|
|
3073
3072
|
getMap() {
|
|
3074
|
-
return
|
|
3073
|
+
return G.empty;
|
|
3075
3074
|
}
|
|
3076
3075
|
/**
|
|
3077
3076
|
Try to merge this step with another one, to be applied directly
|
|
@@ -3139,15 +3138,15 @@ class E {
|
|
|
3139
3138
|
}
|
|
3140
3139
|
}
|
|
3141
3140
|
}
|
|
3142
|
-
function
|
|
3141
|
+
function fr(n, e, t) {
|
|
3143
3142
|
let r = [];
|
|
3144
3143
|
for (let i = 0; i < n.childCount; i++) {
|
|
3145
3144
|
let s = n.child(i);
|
|
3146
|
-
s.content.size && (s = s.copy(
|
|
3145
|
+
s.content.size && (s = s.copy(fr(s.content, e, s))), s.isInline && (s = e(s, t, i)), r.push(s);
|
|
3147
3146
|
}
|
|
3148
3147
|
return y.fromArray(r);
|
|
3149
3148
|
}
|
|
3150
|
-
class Te extends
|
|
3149
|
+
class Te extends W {
|
|
3151
3150
|
/**
|
|
3152
3151
|
Create a mark step.
|
|
3153
3152
|
*/
|
|
@@ -3155,7 +3154,7 @@ class Te extends $ {
|
|
|
3155
3154
|
super(), this.from = e, this.to = t, this.mark = r;
|
|
3156
3155
|
}
|
|
3157
3156
|
apply(e) {
|
|
3158
|
-
let t = e.slice(this.from, this.to), r = e.resolve(this.from), i = r.node(r.sharedDepth(this.to)), s = new
|
|
3157
|
+
let t = e.slice(this.from, this.to), r = e.resolve(this.from), i = r.node(r.sharedDepth(this.to)), s = new x(fr(t.content, (o, l) => !o.isAtom || !l.type.allowsMarkType(this.mark.type) ? o : o.mark(this.mark.addToSet(o.marks)), i), t.openStart, t.openEnd);
|
|
3159
3158
|
return E.fromReplace(e, this.from, this.to, s);
|
|
3160
3159
|
}
|
|
3161
3160
|
invert() {
|
|
@@ -3185,8 +3184,8 @@ class Te extends $ {
|
|
|
3185
3184
|
return new Te(t.from, t.to, e.markFromJSON(t.mark));
|
|
3186
3185
|
}
|
|
3187
3186
|
}
|
|
3188
|
-
|
|
3189
|
-
class oe extends
|
|
3187
|
+
W.jsonID("addMark", Te);
|
|
3188
|
+
class oe extends W {
|
|
3190
3189
|
/**
|
|
3191
3190
|
Create a mark-removing step.
|
|
3192
3191
|
*/
|
|
@@ -3194,7 +3193,7 @@ class oe extends $ {
|
|
|
3194
3193
|
super(), this.from = e, this.to = t, this.mark = r;
|
|
3195
3194
|
}
|
|
3196
3195
|
apply(e) {
|
|
3197
|
-
let t = e.slice(this.from, this.to), r = new
|
|
3196
|
+
let t = e.slice(this.from, this.to), r = new x(fr(t.content, (i) => i.mark(this.mark.removeFromSet(i.marks)), e), t.openStart, t.openEnd);
|
|
3198
3197
|
return E.fromReplace(e, this.from, this.to, r);
|
|
3199
3198
|
}
|
|
3200
3199
|
invert() {
|
|
@@ -3224,8 +3223,8 @@ class oe extends $ {
|
|
|
3224
3223
|
return new oe(t.from, t.to, e.markFromJSON(t.mark));
|
|
3225
3224
|
}
|
|
3226
3225
|
}
|
|
3227
|
-
|
|
3228
|
-
class Ae extends
|
|
3226
|
+
W.jsonID("removeMark", oe);
|
|
3227
|
+
class Ae extends W {
|
|
3229
3228
|
/**
|
|
3230
3229
|
Create a node mark step.
|
|
3231
3230
|
*/
|
|
@@ -3237,7 +3236,7 @@ class Ae extends $ {
|
|
|
3237
3236
|
if (!t)
|
|
3238
3237
|
return E.fail("No node at mark step's position");
|
|
3239
3238
|
let r = t.type.create(t.attrs, null, this.mark.addToSet(t.marks));
|
|
3240
|
-
return E.fromReplace(e, this.pos, this.pos + 1, new
|
|
3239
|
+
return E.fromReplace(e, this.pos, this.pos + 1, new x(y.from(r), 0, t.isLeaf ? 0 : 1));
|
|
3241
3240
|
}
|
|
3242
3241
|
invert(e) {
|
|
3243
3242
|
let t = e.nodeAt(this.pos);
|
|
@@ -3268,8 +3267,8 @@ class Ae extends $ {
|
|
|
3268
3267
|
return new Ae(t.pos, e.markFromJSON(t.mark));
|
|
3269
3268
|
}
|
|
3270
3269
|
}
|
|
3271
|
-
|
|
3272
|
-
class lt extends
|
|
3270
|
+
W.jsonID("addNodeMark", Ae);
|
|
3271
|
+
class lt extends W {
|
|
3273
3272
|
/**
|
|
3274
3273
|
Create a mark-removing step.
|
|
3275
3274
|
*/
|
|
@@ -3281,7 +3280,7 @@ class lt extends $ {
|
|
|
3281
3280
|
if (!t)
|
|
3282
3281
|
return E.fail("No node at mark step's position");
|
|
3283
3282
|
let r = t.type.create(t.attrs, null, this.mark.removeFromSet(t.marks));
|
|
3284
|
-
return E.fromReplace(e, this.pos, this.pos + 1, new
|
|
3283
|
+
return E.fromReplace(e, this.pos, this.pos + 1, new x(y.from(r), 0, t.isLeaf ? 0 : 1));
|
|
3285
3284
|
}
|
|
3286
3285
|
invert(e) {
|
|
3287
3286
|
let t = e.nodeAt(this.pos);
|
|
@@ -3303,8 +3302,8 @@ class lt extends $ {
|
|
|
3303
3302
|
return new lt(t.pos, e.markFromJSON(t.mark));
|
|
3304
3303
|
}
|
|
3305
3304
|
}
|
|
3306
|
-
|
|
3307
|
-
class
|
|
3305
|
+
W.jsonID("removeNodeMark", lt);
|
|
3306
|
+
class H extends W {
|
|
3308
3307
|
/**
|
|
3309
3308
|
The given `slice` should fit the 'gap' between `from` and
|
|
3310
3309
|
`to`—the depths must line up, and the surrounding nodes must be
|
|
@@ -3318,27 +3317,27 @@ class L extends $ {
|
|
|
3318
3317
|
super(), this.from = e, this.to = t, this.slice = r, this.structure = i;
|
|
3319
3318
|
}
|
|
3320
3319
|
apply(e) {
|
|
3321
|
-
return this.structure &&
|
|
3320
|
+
return this.structure && Kn(e, this.from, this.to) ? E.fail("Structure replace would overwrite content") : E.fromReplace(e, this.from, this.to, this.slice);
|
|
3322
3321
|
}
|
|
3323
3322
|
getMap() {
|
|
3324
|
-
return new
|
|
3323
|
+
return new G([this.from, this.to - this.from, this.slice.size]);
|
|
3325
3324
|
}
|
|
3326
3325
|
invert(e) {
|
|
3327
|
-
return new
|
|
3326
|
+
return new H(this.from, this.from + this.slice.size, e.slice(this.from, this.to));
|
|
3328
3327
|
}
|
|
3329
3328
|
map(e) {
|
|
3330
3329
|
let t = e.mapResult(this.from, 1), r = e.mapResult(this.to, -1);
|
|
3331
|
-
return t.deletedAcross && r.deletedAcross ? null : new
|
|
3330
|
+
return t.deletedAcross && r.deletedAcross ? null : new H(t.pos, Math.max(t.pos, r.pos), this.slice);
|
|
3332
3331
|
}
|
|
3333
3332
|
merge(e) {
|
|
3334
|
-
if (!(e instanceof
|
|
3333
|
+
if (!(e instanceof H) || e.structure || this.structure)
|
|
3335
3334
|
return null;
|
|
3336
3335
|
if (this.from + this.slice.size == e.from && !this.slice.openEnd && !e.slice.openStart) {
|
|
3337
|
-
let t = this.slice.size + e.slice.size == 0 ?
|
|
3338
|
-
return new
|
|
3336
|
+
let t = this.slice.size + e.slice.size == 0 ? x.empty : new x(this.slice.content.append(e.slice.content), this.slice.openStart, e.slice.openEnd);
|
|
3337
|
+
return new H(this.from, this.to + (e.to - e.from), t, this.structure);
|
|
3339
3338
|
} else if (e.to == this.from && !this.slice.openStart && !e.slice.openEnd) {
|
|
3340
|
-
let t = this.slice.size + e.slice.size == 0 ?
|
|
3341
|
-
return new
|
|
3339
|
+
let t = this.slice.size + e.slice.size == 0 ? x.empty : new x(e.slice.content.append(this.slice.content), e.slice.openStart, this.slice.openEnd);
|
|
3340
|
+
return new H(e.from, this.to, t, this.structure);
|
|
3342
3341
|
} else
|
|
3343
3342
|
return null;
|
|
3344
3343
|
}
|
|
@@ -3352,11 +3351,11 @@ class L extends $ {
|
|
|
3352
3351
|
static fromJSON(e, t) {
|
|
3353
3352
|
if (typeof t.from != "number" || typeof t.to != "number")
|
|
3354
3353
|
throw new RangeError("Invalid input for ReplaceStep.fromJSON");
|
|
3355
|
-
return new
|
|
3354
|
+
return new H(t.from, t.to, x.fromJSON(e, t.slice), !!t.structure);
|
|
3356
3355
|
}
|
|
3357
3356
|
}
|
|
3358
|
-
|
|
3359
|
-
class
|
|
3357
|
+
W.jsonID("replace", H);
|
|
3358
|
+
class F extends W {
|
|
3360
3359
|
/**
|
|
3361
3360
|
Create a replace-around step with the given range and gap.
|
|
3362
3361
|
`insert` should be the point in the slice into which the content
|
|
@@ -3367,7 +3366,7 @@ class P extends $ {
|
|
|
3367
3366
|
super(), this.from = e, this.to = t, this.gapFrom = r, this.gapTo = i, this.slice = s, this.insert = o, this.structure = l;
|
|
3368
3367
|
}
|
|
3369
3368
|
apply(e) {
|
|
3370
|
-
if (this.structure && (
|
|
3369
|
+
if (this.structure && (Kn(e, this.from, this.gapFrom) || Kn(e, this.gapTo, this.to)))
|
|
3371
3370
|
return E.fail("Structure gap-replace would overwrite content");
|
|
3372
3371
|
let t = e.slice(this.gapFrom, this.gapTo);
|
|
3373
3372
|
if (t.openStart || t.openEnd)
|
|
@@ -3376,7 +3375,7 @@ class P extends $ {
|
|
|
3376
3375
|
return r ? E.fromReplace(e, this.from, this.to, r) : E.fail("Content does not fit in gap");
|
|
3377
3376
|
}
|
|
3378
3377
|
getMap() {
|
|
3379
|
-
return new
|
|
3378
|
+
return new G([
|
|
3380
3379
|
this.from,
|
|
3381
3380
|
this.gapFrom - this.from,
|
|
3382
3381
|
this.insert,
|
|
@@ -3387,11 +3386,11 @@ class P extends $ {
|
|
|
3387
3386
|
}
|
|
3388
3387
|
invert(e) {
|
|
3389
3388
|
let t = this.gapTo - this.gapFrom;
|
|
3390
|
-
return new
|
|
3389
|
+
return new F(this.from, this.from + this.slice.size + t, this.from + this.insert, this.from + this.insert + t, e.slice(this.from, this.to).removeBetween(this.gapFrom - this.from, this.gapTo - this.from), this.gapFrom - this.from, this.structure);
|
|
3391
3390
|
}
|
|
3392
3391
|
map(e) {
|
|
3393
3392
|
let t = e.mapResult(this.from, 1), r = e.mapResult(this.to, -1), i = this.from == this.gapFrom ? t.pos : e.map(this.gapFrom, -1), s = this.to == this.gapTo ? r.pos : e.map(this.gapTo, 1);
|
|
3394
|
-
return t.deletedAcross && r.deletedAcross || i < t.pos || s > r.pos ? null : new
|
|
3393
|
+
return t.deletedAcross && r.deletedAcross || i < t.pos || s > r.pos ? null : new F(t.pos, r.pos, i, s, this.slice, this.insert, this.structure);
|
|
3395
3394
|
}
|
|
3396
3395
|
toJSON() {
|
|
3397
3396
|
let e = {
|
|
@@ -3410,11 +3409,11 @@ class P extends $ {
|
|
|
3410
3409
|
static fromJSON(e, t) {
|
|
3411
3410
|
if (typeof t.from != "number" || typeof t.to != "number" || typeof t.gapFrom != "number" || typeof t.gapTo != "number" || typeof t.insert != "number")
|
|
3412
3411
|
throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");
|
|
3413
|
-
return new
|
|
3412
|
+
return new F(t.from, t.to, t.gapFrom, t.gapTo, x.fromJSON(e, t.slice), t.insert, !!t.structure);
|
|
3414
3413
|
}
|
|
3415
3414
|
}
|
|
3416
|
-
|
|
3417
|
-
function
|
|
3415
|
+
W.jsonID("replaceAround", F);
|
|
3416
|
+
function Kn(n, e, t) {
|
|
3418
3417
|
let r = n.resolve(e), i = t - e, s = r.depth;
|
|
3419
3418
|
for (; i > 0 && s > 0 && r.indexAfter(s) == r.node(s).childCount; )
|
|
3420
3419
|
s--, i--;
|
|
@@ -3467,12 +3466,12 @@ function pl(n, e, t, r) {
|
|
|
3467
3466
|
}
|
|
3468
3467
|
}), i.forEach((o) => n.step(new oe(o.from, o.to, o.style)));
|
|
3469
3468
|
}
|
|
3470
|
-
function
|
|
3469
|
+
function hr(n, e, t, r = t.contentMatch, i = !0) {
|
|
3471
3470
|
let s = n.doc.nodeAt(e), o = [], l = e + 1;
|
|
3472
3471
|
for (let a = 0; a < s.childCount; a++) {
|
|
3473
3472
|
let c = s.child(a), f = l + c.nodeSize, h = r.matchType(c.type);
|
|
3474
3473
|
if (!h)
|
|
3475
|
-
o.push(new
|
|
3474
|
+
o.push(new H(l, f, x.empty));
|
|
3476
3475
|
else {
|
|
3477
3476
|
r = h;
|
|
3478
3477
|
for (let d = 0; d < c.marks.length; d++)
|
|
@@ -3480,14 +3479,14 @@ function fr(n, e, t, r = t.contentMatch, i = !0) {
|
|
|
3480
3479
|
if (i && c.isText && t.whitespace != "pre") {
|
|
3481
3480
|
let d, u = /\r?\n|\r/g, p;
|
|
3482
3481
|
for (; d = u.exec(c.text); )
|
|
3483
|
-
p || (p = new
|
|
3482
|
+
p || (p = new x(y.from(t.schema.text(" ", t.allowedMarks(c.marks))), 0, 0)), o.push(new H(l + d.index, l + d.index + d[0].length, p));
|
|
3484
3483
|
}
|
|
3485
3484
|
}
|
|
3486
3485
|
l = f;
|
|
3487
3486
|
}
|
|
3488
3487
|
if (!r.validEnd) {
|
|
3489
3488
|
let a = r.fillBefore(y.empty, !0);
|
|
3490
|
-
n.replace(l, l, new
|
|
3489
|
+
n.replace(l, l, new x(a, 0, 0));
|
|
3491
3490
|
}
|
|
3492
3491
|
for (let a = o.length - 1; a >= 0; a--)
|
|
3493
3492
|
n.step(o[a]);
|
|
@@ -3513,13 +3512,13 @@ function gl(n, e, t) {
|
|
|
3513
3512
|
let d = y.empty, u = 0;
|
|
3514
3513
|
for (let p = s, m = !1; p > t; p--)
|
|
3515
3514
|
m || i.after(p + 1) < i.end(p) ? (m = !0, d = y.from(i.node(p).copy(d)), u++) : c++;
|
|
3516
|
-
n.step(new
|
|
3515
|
+
n.step(new F(a, c, o, l, new x(f.append(d), h, u), f.size - h, !0));
|
|
3517
3516
|
}
|
|
3518
3517
|
function bs(n, e, t = null, r = n) {
|
|
3519
3518
|
let i = yl(n, e), s = i && bl(r, e);
|
|
3520
|
-
return s ? i.map(
|
|
3519
|
+
return s ? i.map($r).concat({ type: e, attrs: t }).concat(s.map($r)) : null;
|
|
3521
3520
|
}
|
|
3522
|
-
function
|
|
3521
|
+
function $r(n) {
|
|
3523
3522
|
return { type: n, attrs: null };
|
|
3524
3523
|
}
|
|
3525
3524
|
function yl(n, e) {
|
|
@@ -3538,7 +3537,7 @@ function bl(n, e) {
|
|
|
3538
3537
|
a = a.matchType(t.child(c).type);
|
|
3539
3538
|
return !a || !a.validEnd ? null : o;
|
|
3540
3539
|
}
|
|
3541
|
-
function
|
|
3540
|
+
function xl(n, e, t) {
|
|
3542
3541
|
let r = y.empty;
|
|
3543
3542
|
for (let o = t.length - 1; o >= 0; o--) {
|
|
3544
3543
|
if (r.size) {
|
|
@@ -3549,9 +3548,9 @@ function kl(n, e, t) {
|
|
|
3549
3548
|
r = y.from(t[o].type.create(t[o].attrs, r));
|
|
3550
3549
|
}
|
|
3551
3550
|
let i = e.start, s = e.end;
|
|
3552
|
-
n.step(new
|
|
3551
|
+
n.step(new F(i, s, i, s, new x(r, 0, 0), t.length, !0));
|
|
3553
3552
|
}
|
|
3554
|
-
function
|
|
3553
|
+
function kl(n, e, t, r, i) {
|
|
3555
3554
|
if (!r.isTextblock)
|
|
3556
3555
|
throw new RangeError("Type given to setBlockType should be a textblock");
|
|
3557
3556
|
let s = n.steps.length;
|
|
@@ -3563,13 +3562,13 @@ function xl(n, e, t, r, i) {
|
|
|
3563
3562
|
let u = r.whitespace == "pre", p = !!r.contentMatch.matchType(r.schema.linebreakReplacement);
|
|
3564
3563
|
u && !p ? c = !1 : !u && p && (c = !0);
|
|
3565
3564
|
}
|
|
3566
|
-
c === !1 &&
|
|
3565
|
+
c === !1 && ks(n, o, l, s), hr(n, n.mapping.slice(s).map(l, 1), r, void 0, c === null);
|
|
3567
3566
|
let f = n.mapping.slice(s), h = f.map(l, 1), d = f.map(l + o.nodeSize, 1);
|
|
3568
|
-
return n.step(new
|
|
3567
|
+
return n.step(new F(h, d, h + 1, d - 1, new x(y.from(r.create(a, null, o.marks)), 0, 0), 1, !0)), c === !0 && xs(n, o, l, s), !1;
|
|
3569
3568
|
}
|
|
3570
3569
|
});
|
|
3571
3570
|
}
|
|
3572
|
-
function
|
|
3571
|
+
function xs(n, e, t, r) {
|
|
3573
3572
|
e.forEach((i, s) => {
|
|
3574
3573
|
if (i.isText) {
|
|
3575
3574
|
let o, l = /\r?\n|\r/g;
|
|
@@ -3580,7 +3579,7 @@ function ks(n, e, t, r) {
|
|
|
3580
3579
|
}
|
|
3581
3580
|
});
|
|
3582
3581
|
}
|
|
3583
|
-
function
|
|
3582
|
+
function ks(n, e, t, r) {
|
|
3584
3583
|
e.forEach((i, s) => {
|
|
3585
3584
|
if (i.type == i.type.schema.linebreakReplacement) {
|
|
3586
3585
|
let o = n.mapping.slice(r).map(t + 1 + s);
|
|
@@ -3603,7 +3602,7 @@ function Cl(n, e, t, r, i) {
|
|
|
3603
3602
|
return n.replaceWith(e, e + s.nodeSize, o);
|
|
3604
3603
|
if (!t.validContent(s.content))
|
|
3605
3604
|
throw new RangeError("Invalid content for node type " + t.name);
|
|
3606
|
-
n.step(new
|
|
3605
|
+
n.step(new F(e, e + s.nodeSize, e + 1, e + s.nodeSize - 1, new x(y.from(o), 0, 0), 1, !0));
|
|
3607
3606
|
}
|
|
3608
3607
|
function rt(n, e, t = 1, r) {
|
|
3609
3608
|
let i = n.resolve(e), s = i.depth - t, o = r && r[r.length - 1] || i.parent;
|
|
@@ -3629,7 +3628,7 @@ function wl(n, e, t = 1, r) {
|
|
|
3629
3628
|
let f = r && r[c];
|
|
3630
3629
|
o = y.from(f ? f.type.create(f.attrs, o) : i.node(l).copy(o));
|
|
3631
3630
|
}
|
|
3632
|
-
n.step(new
|
|
3631
|
+
n.step(new H(e, e, new x(s.append(o), t, t), !0));
|
|
3633
3632
|
}
|
|
3634
3633
|
function pn(n, e) {
|
|
3635
3634
|
let t = n.resolve(e), r = t.index();
|
|
@@ -3657,13 +3656,13 @@ function Nl(n, e, t) {
|
|
|
3657
3656
|
let l = n.steps.length;
|
|
3658
3657
|
if (r === !1) {
|
|
3659
3658
|
let f = n.doc.resolve(e + t);
|
|
3660
|
-
|
|
3659
|
+
ks(n, f.node(), f.before(), l);
|
|
3661
3660
|
}
|
|
3662
|
-
o.inlineContent &&
|
|
3661
|
+
o.inlineContent && hr(n, e + t - 1, o, s.node().contentMatchAt(s.index()), r == null);
|
|
3663
3662
|
let a = n.mapping.slice(l), c = a.map(e - t);
|
|
3664
|
-
if (n.step(new
|
|
3663
|
+
if (n.step(new H(c, a.map(e + t, -1), x.empty, !0)), r === !0) {
|
|
3665
3664
|
let f = n.doc.resolve(c);
|
|
3666
|
-
|
|
3665
|
+
xs(n, f.node(), f.before(), n.steps.length);
|
|
3667
3666
|
}
|
|
3668
3667
|
return n;
|
|
3669
3668
|
}
|
|
@@ -3710,11 +3709,11 @@ function Al(n, e, t) {
|
|
|
3710
3709
|
}
|
|
3711
3710
|
return null;
|
|
3712
3711
|
}
|
|
3713
|
-
function
|
|
3712
|
+
function dr(n, e, t = e, r = x.empty) {
|
|
3714
3713
|
if (e == t && !r.size)
|
|
3715
3714
|
return null;
|
|
3716
3715
|
let i = n.resolve(e), s = n.resolve(t);
|
|
3717
|
-
return Ss(i, s, r) ? new
|
|
3716
|
+
return Ss(i, s, r) ? new H(e, t, r) : new Dl(i, s, r).fit();
|
|
3718
3717
|
}
|
|
3719
3718
|
function Ss(n, e, t) {
|
|
3720
3719
|
return !t.openStart && !t.openEnd && n.start() == e.start() && n.parent.canReplace(n.index(), e.index(), t.content);
|
|
@@ -3746,8 +3745,8 @@ class Dl {
|
|
|
3746
3745
|
let s = this.placed, o = r.depth, l = i.depth;
|
|
3747
3746
|
for (; o && l && s.childCount == 1; )
|
|
3748
3747
|
s = s.firstChild.content, o--, l--;
|
|
3749
|
-
let a = new
|
|
3750
|
-
return e > -1 ? new
|
|
3748
|
+
let a = new x(s, o, l);
|
|
3749
|
+
return e > -1 ? new F(r.pos, e, this.$to.pos, this.$to.end(), a, t) : a.size || r.pos != this.$to.pos ? new H(r.pos, i.pos, a) : null;
|
|
3751
3750
|
}
|
|
3752
3751
|
// Find a position on the start spine of `this.unplaced` that has
|
|
3753
3752
|
// content that can be moved somewhere on the frontier. Returns two
|
|
@@ -3780,15 +3779,15 @@ class Dl {
|
|
|
3780
3779
|
}
|
|
3781
3780
|
openMore() {
|
|
3782
3781
|
let { content: e, openStart: t, openEnd: r } = this.unplaced, i = Mn(e, t);
|
|
3783
|
-
return !i.childCount || i.firstChild.isLeaf ? !1 : (this.unplaced = new
|
|
3782
|
+
return !i.childCount || i.firstChild.isLeaf ? !1 : (this.unplaced = new x(e, t + 1, Math.max(r, i.size + t >= e.size - r ? t + 1 : 0)), !0);
|
|
3784
3783
|
}
|
|
3785
3784
|
dropNode() {
|
|
3786
3785
|
let { content: e, openStart: t, openEnd: r } = this.unplaced, i = Mn(e, t);
|
|
3787
3786
|
if (i.childCount <= 1 && t > 0) {
|
|
3788
3787
|
let s = e.size - t <= t + i.size;
|
|
3789
|
-
this.unplaced = new
|
|
3788
|
+
this.unplaced = new x(gt(e, t - 1, 1), t - 1, s ? t - 1 : r);
|
|
3790
3789
|
} else
|
|
3791
|
-
this.unplaced = new
|
|
3790
|
+
this.unplaced = new x(gt(e, t, 1), t, r);
|
|
3792
3791
|
}
|
|
3793
3792
|
// Move content from the unplaced slice at `sliceDepth` to the
|
|
3794
3793
|
// frontier node at `frontierDepth`. Close that frontier node when
|
|
@@ -3818,7 +3817,7 @@ class Dl {
|
|
|
3818
3817
|
let b = g.lastChild;
|
|
3819
3818
|
this.frontier.push({ type: b.type, match: b.contentMatchAt(b.childCount) }), g = b.content;
|
|
3820
3819
|
}
|
|
3821
|
-
this.unplaced = p ? e == 0 ?
|
|
3820
|
+
this.unplaced = p ? e == 0 ? x.empty : new x(gt(o.content, e - 1, 1), e - 1, u < 0 ? o.openEnd : e - 1) : new x(gt(o.content, e, c), o.openStart, o.openEnd);
|
|
3822
3821
|
}
|
|
3823
3822
|
mustMoveInline() {
|
|
3824
3823
|
if (!this.$to.parent.isTextblock)
|
|
@@ -3904,7 +3903,7 @@ function Il(n, e, t, r) {
|
|
|
3904
3903
|
return n.deleteRange(e, t);
|
|
3905
3904
|
let i = n.doc.resolve(e), s = n.doc.resolve(t);
|
|
3906
3905
|
if (Ss(i, s, r))
|
|
3907
|
-
return n.step(new
|
|
3906
|
+
return n.step(new H(e, t, r));
|
|
3908
3907
|
let o = Ms(i, n.doc.resolve(t));
|
|
3909
3908
|
o[o.length - 1] == 0 && o.pop();
|
|
3910
3909
|
let l = -(i.depth + 1);
|
|
@@ -3935,9 +3934,9 @@ function Il(n, e, t, r) {
|
|
|
3935
3934
|
for (let m = 0; m < o.length; m++) {
|
|
3936
3935
|
let g = o[(m + a) % o.length], b = !0;
|
|
3937
3936
|
g < 0 && (b = !1, g = -g);
|
|
3938
|
-
let w = i.node(g - 1),
|
|
3939
|
-
if (w.canReplaceWith(
|
|
3940
|
-
return n.replace(i.before(g), b ? s.after(g) : t, new
|
|
3937
|
+
let w = i.node(g - 1), O = i.index(g - 1);
|
|
3938
|
+
if (w.canReplaceWith(O, O, p.type, p.marks))
|
|
3939
|
+
return n.replace(i.before(g), b ? s.after(g) : t, new x(ws(r.content, 0, r.openStart, u), u, r.openEnd));
|
|
3941
3940
|
}
|
|
3942
3941
|
}
|
|
3943
3942
|
let h = n.steps.length;
|
|
@@ -3962,7 +3961,7 @@ function vl(n, e, t, r) {
|
|
|
3962
3961
|
let i = Tl(n.doc, e, r.type);
|
|
3963
3962
|
i != null && (e = t = i);
|
|
3964
3963
|
}
|
|
3965
|
-
n.replaceRange(e, t, new
|
|
3964
|
+
n.replaceRange(e, t, new x(y.from(r), 0, 0));
|
|
3966
3965
|
}
|
|
3967
3966
|
function zl(n, e, t) {
|
|
3968
3967
|
let r = n.doc.resolve(e), i = n.doc.resolve(t), s = Ms(r, i);
|
|
@@ -3988,7 +3987,7 @@ function Ms(n, e) {
|
|
|
3988
3987
|
}
|
|
3989
3988
|
return t;
|
|
3990
3989
|
}
|
|
3991
|
-
class it extends
|
|
3990
|
+
class it extends W {
|
|
3992
3991
|
/**
|
|
3993
3992
|
Construct an attribute step.
|
|
3994
3993
|
*/
|
|
@@ -4004,10 +4003,10 @@ class it extends $ {
|
|
|
4004
4003
|
r[s] = t.attrs[s];
|
|
4005
4004
|
r[this.attr] = this.value;
|
|
4006
4005
|
let i = t.type.create(r, null, t.marks);
|
|
4007
|
-
return E.fromReplace(e, this.pos, this.pos + 1, new
|
|
4006
|
+
return E.fromReplace(e, this.pos, this.pos + 1, new x(y.from(i), 0, t.isLeaf ? 0 : 1));
|
|
4008
4007
|
}
|
|
4009
4008
|
getMap() {
|
|
4010
|
-
return
|
|
4009
|
+
return G.empty;
|
|
4011
4010
|
}
|
|
4012
4011
|
invert(e) {
|
|
4013
4012
|
return new it(this.pos, this.attr, e.nodeAt(this.pos).attrs[this.attr]);
|
|
@@ -4025,8 +4024,8 @@ class it extends $ {
|
|
|
4025
4024
|
return new it(t.pos, t.attr, t.value);
|
|
4026
4025
|
}
|
|
4027
4026
|
}
|
|
4028
|
-
|
|
4029
|
-
class Ot extends
|
|
4027
|
+
W.jsonID("attr", it);
|
|
4028
|
+
class Ot extends W {
|
|
4030
4029
|
/**
|
|
4031
4030
|
Construct an attribute step.
|
|
4032
4031
|
*/
|
|
@@ -4042,7 +4041,7 @@ class Ot extends $ {
|
|
|
4042
4041
|
return E.ok(r);
|
|
4043
4042
|
}
|
|
4044
4043
|
getMap() {
|
|
4045
|
-
return
|
|
4044
|
+
return G.empty;
|
|
4046
4045
|
}
|
|
4047
4046
|
invert(e) {
|
|
4048
4047
|
return new Ot(this.attr, e.attrs[this.attr]);
|
|
@@ -4059,7 +4058,7 @@ class Ot extends $ {
|
|
|
4059
4058
|
return new Ot(t.attr, t.value);
|
|
4060
4059
|
}
|
|
4061
4060
|
}
|
|
4062
|
-
|
|
4061
|
+
W.jsonID("docAttr", Ot);
|
|
4063
4062
|
let at = class extends Error {
|
|
4064
4063
|
};
|
|
4065
4064
|
at = function n(e) {
|
|
@@ -4117,8 +4116,8 @@ class Os {
|
|
|
4117
4116
|
Replace the part of the document between `from` and `to` with the
|
|
4118
4117
|
given `slice`.
|
|
4119
4118
|
*/
|
|
4120
|
-
replace(e, t = e, r =
|
|
4121
|
-
let i =
|
|
4119
|
+
replace(e, t = e, r = x.empty) {
|
|
4120
|
+
let i = dr(this.doc, e, t, r);
|
|
4122
4121
|
return i && this.step(i), this;
|
|
4123
4122
|
}
|
|
4124
4123
|
/**
|
|
@@ -4126,13 +4125,13 @@ class Os {
|
|
|
4126
4125
|
fragment, node, or array of nodes.
|
|
4127
4126
|
*/
|
|
4128
4127
|
replaceWith(e, t, r) {
|
|
4129
|
-
return this.replace(e, t, new
|
|
4128
|
+
return this.replace(e, t, new x(y.from(r), 0, 0));
|
|
4130
4129
|
}
|
|
4131
4130
|
/**
|
|
4132
4131
|
Delete the content between the given positions.
|
|
4133
4132
|
*/
|
|
4134
4133
|
delete(e, t) {
|
|
4135
|
-
return this.replace(e, t,
|
|
4134
|
+
return this.replace(e, t, x.empty);
|
|
4136
4135
|
}
|
|
4137
4136
|
/**
|
|
4138
4137
|
Insert the given content at the given position.
|
|
@@ -4204,14 +4203,14 @@ class Os {
|
|
|
4204
4203
|
probably be computed with [`findWrapping`](https://prosemirror.net/docs/ref/#transform.findWrapping).
|
|
4205
4204
|
*/
|
|
4206
4205
|
wrap(e, t) {
|
|
4207
|
-
return
|
|
4206
|
+
return xl(this, e, t), this;
|
|
4208
4207
|
}
|
|
4209
4208
|
/**
|
|
4210
4209
|
Set the type of all textblocks (partly) between `from` and `to` to
|
|
4211
4210
|
the given node type with the given attributes.
|
|
4212
4211
|
*/
|
|
4213
4212
|
setBlockType(e, t = e, r, i = null) {
|
|
4214
|
-
return
|
|
4213
|
+
return kl(this, e, t, r, i), this;
|
|
4215
4214
|
}
|
|
4216
4215
|
/**
|
|
4217
4216
|
Change the type, attributes, and/or marks of the node at `pos`.
|
|
@@ -4245,7 +4244,7 @@ class Os {
|
|
|
4245
4244
|
position `pos`.
|
|
4246
4245
|
*/
|
|
4247
4246
|
removeNodeMark(e, t) {
|
|
4248
|
-
if (!(t instanceof
|
|
4247
|
+
if (!(t instanceof N)) {
|
|
4249
4248
|
let r = this.doc.nodeAt(e);
|
|
4250
4249
|
if (!r)
|
|
4251
4250
|
throw new RangeError("No node at position " + e);
|
|
@@ -4286,7 +4285,7 @@ class Os {
|
|
|
4286
4285
|
third argument.
|
|
4287
4286
|
*/
|
|
4288
4287
|
clearIncompatible(e, t, r) {
|
|
4289
|
-
return
|
|
4288
|
+
return hr(this, e, t, r), this;
|
|
4290
4289
|
}
|
|
4291
4290
|
}
|
|
4292
4291
|
const Nn = /* @__PURE__ */ Object.create(null);
|
|
@@ -4355,14 +4354,14 @@ class S {
|
|
|
4355
4354
|
Replace the selection with a slice or, if no slice is given,
|
|
4356
4355
|
delete the selection. Will append to the given transaction.
|
|
4357
4356
|
*/
|
|
4358
|
-
replace(e, t =
|
|
4357
|
+
replace(e, t = x.empty) {
|
|
4359
4358
|
let r = t.content.lastChild, i = null;
|
|
4360
4359
|
for (let l = 0; l < t.openEnd; l++)
|
|
4361
4360
|
i = r, r = r.lastChild;
|
|
4362
4361
|
let s = e.steps.length, o = this.ranges;
|
|
4363
4362
|
for (let l = 0; l < o.length; l++) {
|
|
4364
4363
|
let { $from: a, $to: c } = o[l], f = e.mapping.slice(s);
|
|
4365
|
-
e.replaceRange(f.map(a.pos), f.map(c.pos), l ?
|
|
4364
|
+
e.replaceRange(f.map(a.pos), f.map(c.pos), l ? x.empty : t), l == 0 && qr(e, s, (r ? r.isInline : i && i.isTextblock) ? -1 : 1);
|
|
4366
4365
|
}
|
|
4367
4366
|
}
|
|
4368
4367
|
/**
|
|
@@ -4373,7 +4372,7 @@ class S {
|
|
|
4373
4372
|
let r = e.steps.length, i = this.ranges;
|
|
4374
4373
|
for (let s = 0; s < i.length; s++) {
|
|
4375
4374
|
let { $from: o, $to: l } = i[s], a = e.mapping.slice(r), c = a.map(o.pos), f = a.map(l.pos);
|
|
4376
|
-
s ? e.deleteRange(c, f) : (e.replaceRangeWith(c, f, t),
|
|
4375
|
+
s ? e.deleteRange(c, f) : (e.replaceRangeWith(c, f, t), qr(e, r, t.isInline ? -1 : 1));
|
|
4377
4376
|
}
|
|
4378
4377
|
}
|
|
4379
4378
|
/**
|
|
@@ -4463,16 +4462,16 @@ class Ns {
|
|
|
4463
4462
|
this.$from = e, this.$to = t;
|
|
4464
4463
|
}
|
|
4465
4464
|
}
|
|
4466
|
-
let
|
|
4467
|
-
function
|
|
4468
|
-
|
|
4465
|
+
let Wr = !1;
|
|
4466
|
+
function Jr(n) {
|
|
4467
|
+
!Wr && !n.parent.inlineContent && (Wr = !0, console.warn("TextSelection endpoint not pointing into a node with inline content (" + n.parent.type.name + ")"));
|
|
4469
4468
|
}
|
|
4470
4469
|
class C extends S {
|
|
4471
4470
|
/**
|
|
4472
4471
|
Construct a text selection between the given points.
|
|
4473
4472
|
*/
|
|
4474
4473
|
constructor(e, t = e) {
|
|
4475
|
-
|
|
4474
|
+
Jr(e), Jr(t), super(e, t);
|
|
4476
4475
|
}
|
|
4477
4476
|
/**
|
|
4478
4477
|
Returns a resolved position if this is a cursor selection (an
|
|
@@ -4488,8 +4487,8 @@ class C extends S {
|
|
|
4488
4487
|
let i = e.resolve(t.map(this.anchor));
|
|
4489
4488
|
return new C(i.parent.inlineContent ? i : r, r);
|
|
4490
4489
|
}
|
|
4491
|
-
replace(e, t =
|
|
4492
|
-
if (super.replace(e, t), t ==
|
|
4490
|
+
replace(e, t = x.empty) {
|
|
4491
|
+
if (super.replace(e, t), t == x.empty) {
|
|
4493
4492
|
let r = this.$from.marksAcross(this.$to);
|
|
4494
4493
|
r && e.ensureMarks(r);
|
|
4495
4494
|
}
|
|
@@ -4550,7 +4549,7 @@ class mn {
|
|
|
4550
4549
|
return C.between(e.resolve(this.anchor), e.resolve(this.head));
|
|
4551
4550
|
}
|
|
4552
4551
|
}
|
|
4553
|
-
class
|
|
4552
|
+
class k extends S {
|
|
4554
4553
|
/**
|
|
4555
4554
|
Create a node selection. Does not verify the validity of its
|
|
4556
4555
|
argument.
|
|
@@ -4561,19 +4560,19 @@ class x extends S {
|
|
|
4561
4560
|
}
|
|
4562
4561
|
map(e, t) {
|
|
4563
4562
|
let { deleted: r, pos: i } = t.mapResult(this.anchor), s = e.resolve(i);
|
|
4564
|
-
return r ? S.near(s) : new
|
|
4563
|
+
return r ? S.near(s) : new k(s);
|
|
4565
4564
|
}
|
|
4566
4565
|
content() {
|
|
4567
|
-
return new
|
|
4566
|
+
return new x(y.from(this.node), 0, 0);
|
|
4568
4567
|
}
|
|
4569
4568
|
eq(e) {
|
|
4570
|
-
return e instanceof
|
|
4569
|
+
return e instanceof k && e.anchor == this.anchor;
|
|
4571
4570
|
}
|
|
4572
4571
|
toJSON() {
|
|
4573
4572
|
return { type: "node", anchor: this.anchor };
|
|
4574
4573
|
}
|
|
4575
4574
|
getBookmark() {
|
|
4576
|
-
return new
|
|
4575
|
+
return new ur(this.anchor);
|
|
4577
4576
|
}
|
|
4578
4577
|
/**
|
|
4579
4578
|
@internal
|
|
@@ -4581,13 +4580,13 @@ class x extends S {
|
|
|
4581
4580
|
static fromJSON(e, t) {
|
|
4582
4581
|
if (typeof t.anchor != "number")
|
|
4583
4582
|
throw new RangeError("Invalid input for NodeSelection.fromJSON");
|
|
4584
|
-
return new
|
|
4583
|
+
return new k(e.resolve(t.anchor));
|
|
4585
4584
|
}
|
|
4586
4585
|
/**
|
|
4587
4586
|
Create a node selection from non-resolved positions.
|
|
4588
4587
|
*/
|
|
4589
4588
|
static create(e, t) {
|
|
4590
|
-
return new
|
|
4589
|
+
return new k(e.resolve(t));
|
|
4591
4590
|
}
|
|
4592
4591
|
/**
|
|
4593
4592
|
Determines whether the given node may be selected as a node
|
|
@@ -4597,19 +4596,19 @@ class x extends S {
|
|
|
4597
4596
|
return !e.isText && e.type.spec.selectable !== !1;
|
|
4598
4597
|
}
|
|
4599
4598
|
}
|
|
4600
|
-
|
|
4601
|
-
S.jsonID("node",
|
|
4602
|
-
class
|
|
4599
|
+
k.prototype.visible = !1;
|
|
4600
|
+
S.jsonID("node", k);
|
|
4601
|
+
class ur {
|
|
4603
4602
|
constructor(e) {
|
|
4604
4603
|
this.anchor = e;
|
|
4605
4604
|
}
|
|
4606
4605
|
map(e) {
|
|
4607
4606
|
let { deleted: t, pos: r } = e.mapResult(this.anchor);
|
|
4608
|
-
return t ? new mn(r, r) : new
|
|
4607
|
+
return t ? new mn(r, r) : new ur(r);
|
|
4609
4608
|
}
|
|
4610
4609
|
resolve(e) {
|
|
4611
4610
|
let t = e.resolve(this.anchor), r = t.nodeAfter;
|
|
4612
|
-
return r &&
|
|
4611
|
+
return r && k.isSelectable(r) ? new k(t) : S.near(t);
|
|
4613
4612
|
}
|
|
4614
4613
|
}
|
|
4615
4614
|
class X extends S {
|
|
@@ -4619,8 +4618,8 @@ class X extends S {
|
|
|
4619
4618
|
constructor(e) {
|
|
4620
4619
|
super(e.resolve(0), e.resolve(e.content.size));
|
|
4621
4620
|
}
|
|
4622
|
-
replace(e, t =
|
|
4623
|
-
if (t ==
|
|
4621
|
+
replace(e, t = x.empty) {
|
|
4622
|
+
if (t == x.empty) {
|
|
4624
4623
|
e.delete(0, e.doc.content.size);
|
|
4625
4624
|
let r = S.atStart(e.doc);
|
|
4626
4625
|
r.eq(e.selection) || e.setSelection(r);
|
|
@@ -4661,8 +4660,8 @@ function Qe(n, e, t, r, i, s = !1) {
|
|
|
4661
4660
|
for (let o = r - (i > 0 ? 0 : 1); i > 0 ? o < e.childCount : o >= 0; o += i) {
|
|
4662
4661
|
let l = e.child(o);
|
|
4663
4662
|
if (l.isAtom) {
|
|
4664
|
-
if (!s &&
|
|
4665
|
-
return
|
|
4663
|
+
if (!s && k.isSelectable(l))
|
|
4664
|
+
return k.create(n, t - (i < 0 ? l.nodeSize : 0));
|
|
4666
4665
|
} else {
|
|
4667
4666
|
let a = Qe(n, l, t + i, i < 0 ? l.childCount : 0, i, s);
|
|
4668
4667
|
if (a)
|
|
@@ -4672,19 +4671,19 @@ function Qe(n, e, t, r, i, s = !1) {
|
|
|
4672
4671
|
}
|
|
4673
4672
|
return null;
|
|
4674
4673
|
}
|
|
4675
|
-
function
|
|
4674
|
+
function qr(n, e, t) {
|
|
4676
4675
|
let r = n.steps.length - 1;
|
|
4677
4676
|
if (r < e)
|
|
4678
4677
|
return;
|
|
4679
4678
|
let i = n.steps[r];
|
|
4680
|
-
if (!(i instanceof
|
|
4679
|
+
if (!(i instanceof H || i instanceof F))
|
|
4681
4680
|
return;
|
|
4682
4681
|
let s = n.mapping.maps[r], o;
|
|
4683
4682
|
s.forEach((l, a, c, f) => {
|
|
4684
4683
|
o == null && (o = f);
|
|
4685
4684
|
}), n.setSelection(S.near(n.doc.resolve(o), t));
|
|
4686
4685
|
}
|
|
4687
|
-
const
|
|
4686
|
+
const Kr = 1, Ht = 2, jr = 4;
|
|
4688
4687
|
class Vl extends Os {
|
|
4689
4688
|
/**
|
|
4690
4689
|
@internal
|
|
@@ -4708,13 +4707,13 @@ class Vl extends Os {
|
|
|
4708
4707
|
setSelection(e) {
|
|
4709
4708
|
if (e.$from.doc != this.doc)
|
|
4710
4709
|
throw new RangeError("Selection passed to setSelection must point at the current document");
|
|
4711
|
-
return this.curSelection = e, this.curSelectionFor = this.steps.length, this.updated = (this.updated |
|
|
4710
|
+
return this.curSelection = e, this.curSelectionFor = this.steps.length, this.updated = (this.updated | Kr) & ~Ht, this.storedMarks = null, this;
|
|
4712
4711
|
}
|
|
4713
4712
|
/**
|
|
4714
4713
|
Whether the selection was explicitly updated by this transaction.
|
|
4715
4714
|
*/
|
|
4716
4715
|
get selectionSet() {
|
|
4717
|
-
return (this.updated &
|
|
4716
|
+
return (this.updated & Kr) > 0;
|
|
4718
4717
|
}
|
|
4719
4718
|
/**
|
|
4720
4719
|
Set the current stored marks.
|
|
@@ -4728,7 +4727,7 @@ class Vl extends Os {
|
|
|
4728
4727
|
this is already the case.
|
|
4729
4728
|
*/
|
|
4730
4729
|
ensureMarks(e) {
|
|
4731
|
-
return
|
|
4730
|
+
return N.sameSet(this.storedMarks || this.selection.$from.marks(), e) || this.setStoredMarks(e), this;
|
|
4732
4731
|
}
|
|
4733
4732
|
/**
|
|
4734
4733
|
Add a mark to the set of stored marks.
|
|
@@ -4773,7 +4772,7 @@ class Vl extends Os {
|
|
|
4773
4772
|
*/
|
|
4774
4773
|
replaceSelectionWith(e, t = !0) {
|
|
4775
4774
|
let r = this.selection;
|
|
4776
|
-
return t && (e = e.mark(this.storedMarks || (r.empty ? r.$from.marks() : r.$from.marksAcross(r.$to) ||
|
|
4775
|
+
return t && (e = e.mark(this.storedMarks || (r.empty ? r.$from.marks() : r.$from.marksAcross(r.$to) || N.none))), r.replaceWith(this, e), this;
|
|
4777
4776
|
}
|
|
4778
4777
|
/**
|
|
4779
4778
|
Delete the selection.
|
|
@@ -4827,21 +4826,21 @@ class Vl extends Os {
|
|
|
4827
4826
|
when updated to the state produced by this transaction.
|
|
4828
4827
|
*/
|
|
4829
4828
|
scrollIntoView() {
|
|
4830
|
-
return this.updated |=
|
|
4829
|
+
return this.updated |= jr, this;
|
|
4831
4830
|
}
|
|
4832
4831
|
/**
|
|
4833
4832
|
True when this transaction has had `scrollIntoView` called on it.
|
|
4834
4833
|
*/
|
|
4835
4834
|
get scrolledIntoView() {
|
|
4836
|
-
return (this.updated &
|
|
4835
|
+
return (this.updated & jr) > 0;
|
|
4837
4836
|
}
|
|
4838
4837
|
}
|
|
4839
|
-
function
|
|
4838
|
+
function Ur(n, e) {
|
|
4840
4839
|
return !e || !n ? n : n.bind(e);
|
|
4841
4840
|
}
|
|
4842
4841
|
class bt {
|
|
4843
4842
|
constructor(e, t, r) {
|
|
4844
|
-
this.name = e, this.init =
|
|
4843
|
+
this.name = e, this.init = Ur(t.init, r), this.apply = Ur(t.apply, r);
|
|
4845
4844
|
}
|
|
4846
4845
|
}
|
|
4847
4846
|
const Pl = [
|
|
@@ -5115,13 +5114,13 @@ const Ll = (n, e, t) => {
|
|
|
5115
5114
|
let s = i.nodeBefore;
|
|
5116
5115
|
if (Vs(n, i, e, -1))
|
|
5117
5116
|
return !0;
|
|
5118
|
-
if (r.parent.content.size == 0 && (ct(s, "end") ||
|
|
5117
|
+
if (r.parent.content.size == 0 && (ct(s, "end") || k.isSelectable(s)))
|
|
5119
5118
|
for (let o = r.depth; ; o--) {
|
|
5120
|
-
let l =
|
|
5119
|
+
let l = dr(n.doc, r.before(o), r.after(o), x.empty);
|
|
5121
5120
|
if (l && l.slice.size < l.to - l.from) {
|
|
5122
5121
|
if (e) {
|
|
5123
5122
|
let a = n.tr.step(l);
|
|
5124
|
-
a.setSelection(ct(s, "end") ? S.findFrom(a.doc.resolve(a.mapping.map(i.pos, -1)), -1) :
|
|
5123
|
+
a.setSelection(ct(s, "end") ? S.findFrom(a.doc.resolve(a.mapping.map(i.pos, -1)), -1) : k.create(a.doc, i.pos - s.nodeSize)), e(a.scrollIntoView());
|
|
5125
5124
|
}
|
|
5126
5125
|
return !0;
|
|
5127
5126
|
}
|
|
@@ -5149,7 +5148,7 @@ const Hl = (n, e, t) => {
|
|
|
5149
5148
|
s = Es(r);
|
|
5150
5149
|
}
|
|
5151
5150
|
let o = s && s.nodeBefore;
|
|
5152
|
-
return !o || !
|
|
5151
|
+
return !o || !k.isSelectable(o) ? !1 : (e && e(n.tr.setSelection(k.create(n.doc, s.pos - o.nodeSize)).scrollIntoView()), !0);
|
|
5153
5152
|
};
|
|
5154
5153
|
function Es(n) {
|
|
5155
5154
|
if (!n.parent.type.spec.isolating)
|
|
@@ -5175,12 +5174,12 @@ const Wl = (n, e, t) => {
|
|
|
5175
5174
|
let s = i.nodeAfter;
|
|
5176
5175
|
if (Vs(n, i, e, 1))
|
|
5177
5176
|
return !0;
|
|
5178
|
-
if (r.parent.content.size == 0 && (ct(s, "start") ||
|
|
5179
|
-
let o =
|
|
5177
|
+
if (r.parent.content.size == 0 && (ct(s, "start") || k.isSelectable(s))) {
|
|
5178
|
+
let o = dr(n.doc, r.before(), r.after(), x.empty);
|
|
5180
5179
|
if (o && o.slice.size < o.to - o.from) {
|
|
5181
5180
|
if (e) {
|
|
5182
5181
|
let l = n.tr.step(o);
|
|
5183
|
-
l.setSelection(ct(s, "start") ? S.findFrom(l.doc.resolve(l.mapping.map(i.pos)), 1) :
|
|
5182
|
+
l.setSelection(ct(s, "start") ? S.findFrom(l.doc.resolve(l.mapping.map(i.pos)), 1) : k.create(l.doc, l.mapping.map(i.pos))), e(l.scrollIntoView());
|
|
5184
5183
|
}
|
|
5185
5184
|
return !0;
|
|
5186
5185
|
}
|
|
@@ -5196,7 +5195,7 @@ const Wl = (n, e, t) => {
|
|
|
5196
5195
|
s = Rs(r);
|
|
5197
5196
|
}
|
|
5198
5197
|
let o = s && s.nodeAfter;
|
|
5199
|
-
return !o || !
|
|
5198
|
+
return !o || !k.isSelectable(o) ? !1 : (e && e(n.tr.setSelection(k.create(n.doc, s.pos)).scrollIntoView()), !0);
|
|
5200
5199
|
};
|
|
5201
5200
|
function Rs(n) {
|
|
5202
5201
|
if (!n.parent.type.spec.isolating)
|
|
@@ -5214,7 +5213,7 @@ const ql = (n, e) => {
|
|
|
5214
5213
|
return !t.parent.type.spec.code || !t.sameParent(r) ? !1 : (e && e(n.tr.insertText(`
|
|
5215
5214
|
`).scrollIntoView()), !0);
|
|
5216
5215
|
};
|
|
5217
|
-
function
|
|
5216
|
+
function pr(n) {
|
|
5218
5217
|
for (let e = 0; e < n.edgeCount; e++) {
|
|
5219
5218
|
let { type: t } = n.edge(e);
|
|
5220
5219
|
if (t.isTextblock && !t.hasRequiredAttrs())
|
|
@@ -5226,7 +5225,7 @@ const Is = (n, e) => {
|
|
|
5226
5225
|
let { $head: t, $anchor: r } = n.selection;
|
|
5227
5226
|
if (!t.parent.type.spec.code || !t.sameParent(r))
|
|
5228
5227
|
return !1;
|
|
5229
|
-
let i = t.node(-1), s = t.indexAfter(-1), o =
|
|
5228
|
+
let i = t.node(-1), s = t.indexAfter(-1), o = pr(i.contentMatchAt(s));
|
|
5230
5229
|
if (!o || !i.canReplaceWith(s, s, o))
|
|
5231
5230
|
return !1;
|
|
5232
5231
|
if (e) {
|
|
@@ -5238,7 +5237,7 @@ const Is = (n, e) => {
|
|
|
5238
5237
|
let t = n.selection, { $from: r, $to: i } = t;
|
|
5239
5238
|
if (t instanceof X || r.parent.inlineContent || i.parent.inlineContent)
|
|
5240
5239
|
return !1;
|
|
5241
|
-
let s =
|
|
5240
|
+
let s = pr(i.parent.contentMatchAt(i.indexAfter()));
|
|
5242
5241
|
if (!s || !s.isTextblock)
|
|
5243
5242
|
return !1;
|
|
5244
5243
|
if (e) {
|
|
@@ -5261,14 +5260,14 @@ const Is = (n, e) => {
|
|
|
5261
5260
|
function zs(n) {
|
|
5262
5261
|
return (e, t) => {
|
|
5263
5262
|
let { $from: r, $to: i } = e.selection;
|
|
5264
|
-
if (e.selection instanceof
|
|
5263
|
+
if (e.selection instanceof k && e.selection.node.isBlock)
|
|
5265
5264
|
return !r.parentOffset || !rt(e.doc, r.pos) ? !1 : (t && t(e.tr.split(r.pos).scrollIntoView()), !0);
|
|
5266
5265
|
if (!r.depth)
|
|
5267
5266
|
return !1;
|
|
5268
5267
|
let s = [], o, l, a = !1, c = !1;
|
|
5269
5268
|
for (let u = r.depth; ; u--)
|
|
5270
5269
|
if (r.node(u).isBlock) {
|
|
5271
|
-
a = r.end(u) == r.pos + (r.depth - u), c = r.start(u) == r.pos - (r.depth - u), l =
|
|
5270
|
+
a = r.end(u) == r.pos + (r.depth - u), c = r.start(u) == r.pos - (r.depth - u), l = pr(r.node(u - 1).contentMatchAt(r.indexAfter(u - 1)));
|
|
5272
5271
|
let m = n && n(i.parent, a, r);
|
|
5273
5272
|
s.unshift(m || (a && l ? { type: l } : null)), o = u;
|
|
5274
5273
|
break;
|
|
@@ -5303,7 +5302,7 @@ function Vs(n, e, t, r) {
|
|
|
5303
5302
|
for (let b = o.length - 1; b >= 0; b--)
|
|
5304
5303
|
p = y.from(o[b].create(null, p));
|
|
5305
5304
|
p = y.from(i.copy(p));
|
|
5306
|
-
let m = n.tr.step(new
|
|
5305
|
+
let m = n.tr.step(new F(e.pos - 1, u, e.pos, u, new x(p, 1, 0), o.length, !0)), g = m.doc.resolve(u + 2 * o.length);
|
|
5307
5306
|
g.nodeAfter && g.nodeAfter.type == i.type && pn(m.doc, g.pos) && m.join(g.pos), t(m.scrollIntoView());
|
|
5308
5307
|
}
|
|
5309
5308
|
return !0;
|
|
@@ -5321,9 +5320,9 @@ function Vs(n, e, t, r) {
|
|
|
5321
5320
|
if (u.canReplace(u.childCount, u.childCount, m.content)) {
|
|
5322
5321
|
if (t) {
|
|
5323
5322
|
let b = y.empty;
|
|
5324
|
-
for (let
|
|
5325
|
-
b = y.from(p[
|
|
5326
|
-
let w = n.tr.step(new
|
|
5323
|
+
for (let O = p.length - 1; O >= 0; O--)
|
|
5324
|
+
b = y.from(p[O].copy(b));
|
|
5325
|
+
let w = n.tr.step(new F(e.pos - p.length, e.pos + s.nodeSize, e.pos + g, e.pos + s.nodeSize - g, new x(b, p.length, 0), 0, !0));
|
|
5327
5326
|
t(w.scrollIntoView());
|
|
5328
5327
|
}
|
|
5329
5328
|
return !0;
|
|
@@ -5342,7 +5341,7 @@ function Ps(n) {
|
|
|
5342
5341
|
return i.node(s).isTextblock ? (t && t(e.tr.setSelection(C.create(e.doc, n < 0 ? i.start(s) : i.end(s)))), !0) : !1;
|
|
5343
5342
|
};
|
|
5344
5343
|
}
|
|
5345
|
-
const
|
|
5344
|
+
const Gl = Ps(-1), _l = Ps(1);
|
|
5346
5345
|
function Xl(n, e = null) {
|
|
5347
5346
|
return function(t, r) {
|
|
5348
5347
|
let i = !1;
|
|
@@ -5402,8 +5401,8 @@ function Ve(n, e = null, t) {
|
|
|
5402
5401
|
if (!c)
|
|
5403
5402
|
f.removeMark(d.pos, u.pos, n);
|
|
5404
5403
|
else {
|
|
5405
|
-
let p = d.pos, m = u.pos, g = d.nodeAfter, b = u.nodeBefore, w = g && g.isText ? /^\s*/.exec(g.text)[0].length : 0,
|
|
5406
|
-
p + w < m && (p += w, m -=
|
|
5404
|
+
let p = d.pos, m = u.pos, g = d.nodeAfter, b = u.nodeBefore, w = g && g.isText ? /^\s*/.exec(g.text)[0].length : 0, O = b && b.isText ? /\s*$/.exec(b.text)[0].length : 0;
|
|
5405
|
+
p + w < m && (p += w, m -= O), f.addMark(p, m, n.create(e));
|
|
5407
5406
|
}
|
|
5408
5407
|
}
|
|
5409
5408
|
s(f.scrollIntoView());
|
|
@@ -5419,15 +5418,15 @@ function Nt(...n) {
|
|
|
5419
5418
|
return !1;
|
|
5420
5419
|
};
|
|
5421
5420
|
}
|
|
5422
|
-
let Dn = Nt(Ds, Ll, Hl),
|
|
5421
|
+
let Dn = Nt(Ds, Ll, Hl), Gr = Nt(Ds, Wl, Jl);
|
|
5423
5422
|
const ge = {
|
|
5424
5423
|
Enter: Nt(ql, Kl, vs, jl),
|
|
5425
5424
|
"Mod-Enter": Is,
|
|
5426
5425
|
Backspace: Dn,
|
|
5427
5426
|
"Mod-Backspace": Dn,
|
|
5428
5427
|
"Shift-Backspace": Dn,
|
|
5429
|
-
Delete:
|
|
5430
|
-
"Mod-Delete":
|
|
5428
|
+
Delete: Gr,
|
|
5429
|
+
"Mod-Delete": Gr,
|
|
5431
5430
|
"Mod-a": Bs
|
|
5432
5431
|
}, Fs = {
|
|
5433
5432
|
"Ctrl-h": ge.Backspace,
|
|
@@ -5436,42 +5435,42 @@ const ge = {
|
|
|
5436
5435
|
"Ctrl-Alt-Backspace": ge["Mod-Delete"],
|
|
5437
5436
|
"Alt-Delete": ge["Mod-Delete"],
|
|
5438
5437
|
"Alt-d": ge["Mod-Delete"],
|
|
5439
|
-
"Ctrl-a":
|
|
5440
|
-
"Ctrl-e":
|
|
5438
|
+
"Ctrl-a": Gl,
|
|
5439
|
+
"Ctrl-e": _l
|
|
5441
5440
|
};
|
|
5442
5441
|
for (let n in ge)
|
|
5443
5442
|
Fs[n] = ge[n];
|
|
5444
5443
|
const Zl = typeof navigator < "u" ? /Mac|iP(hone|[oa]d)/.test(navigator.platform) : typeof os < "u" && os.platform ? os.platform() == "darwin" : !1, Ql = Zl ? Fs : ge;
|
|
5445
|
-
var nn = 200,
|
|
5444
|
+
var nn = 200, v = function() {
|
|
5446
5445
|
};
|
|
5447
|
-
|
|
5448
|
-
return e.length ? (e =
|
|
5446
|
+
v.prototype.append = function(e) {
|
|
5447
|
+
return e.length ? (e = v.from(e), !this.length && e || e.length < nn && this.leafAppend(e) || this.length < nn && e.leafPrepend(this) || this.appendInner(e)) : this;
|
|
5449
5448
|
};
|
|
5450
|
-
|
|
5451
|
-
return e.length ?
|
|
5449
|
+
v.prototype.prepend = function(e) {
|
|
5450
|
+
return e.length ? v.from(e).append(this) : this;
|
|
5452
5451
|
};
|
|
5453
|
-
|
|
5452
|
+
v.prototype.appendInner = function(e) {
|
|
5454
5453
|
return new ea(this, e);
|
|
5455
5454
|
};
|
|
5456
|
-
|
|
5457
|
-
return e === void 0 && (e = 0), t === void 0 && (t = this.length), e >= t ?
|
|
5455
|
+
v.prototype.slice = function(e, t) {
|
|
5456
|
+
return e === void 0 && (e = 0), t === void 0 && (t = this.length), e >= t ? v.empty : this.sliceInner(Math.max(0, e), Math.min(this.length, t));
|
|
5458
5457
|
};
|
|
5459
|
-
|
|
5458
|
+
v.prototype.get = function(e) {
|
|
5460
5459
|
if (!(e < 0 || e >= this.length))
|
|
5461
5460
|
return this.getInner(e);
|
|
5462
5461
|
};
|
|
5463
|
-
|
|
5462
|
+
v.prototype.forEach = function(e, t, r) {
|
|
5464
5463
|
t === void 0 && (t = 0), r === void 0 && (r = this.length), t <= r ? this.forEachInner(e, t, r, 0) : this.forEachInvertedInner(e, t, r, 0);
|
|
5465
5464
|
};
|
|
5466
|
-
|
|
5465
|
+
v.prototype.map = function(e, t, r) {
|
|
5467
5466
|
t === void 0 && (t = 0), r === void 0 && (r = this.length);
|
|
5468
5467
|
var i = [];
|
|
5469
5468
|
return this.forEach(function(s, o) {
|
|
5470
5469
|
return i.push(e(s, o));
|
|
5471
5470
|
}, t, r), i;
|
|
5472
5471
|
};
|
|
5473
|
-
|
|
5474
|
-
return e instanceof
|
|
5472
|
+
v.from = function(e) {
|
|
5473
|
+
return e instanceof v ? e : e && e.length ? new Ls(e) : v.empty;
|
|
5475
5474
|
};
|
|
5476
5475
|
var Ls = /* @__PURE__ */ function(n) {
|
|
5477
5476
|
function e(r) {
|
|
@@ -5504,8 +5503,8 @@ var Ls = /* @__PURE__ */ function(n) {
|
|
|
5504
5503
|
}, t.depth.get = function() {
|
|
5505
5504
|
return 0;
|
|
5506
5505
|
}, Object.defineProperties(e.prototype, t), e;
|
|
5507
|
-
}(
|
|
5508
|
-
|
|
5506
|
+
}(v);
|
|
5507
|
+
v.empty = new Ls([]);
|
|
5509
5508
|
var ea = /* @__PURE__ */ function(n) {
|
|
5510
5509
|
function e(t, r) {
|
|
5511
5510
|
n.call(this), this.left = t, this.right = r, this.length = t.length + r.length, this.depth = Math.max(t.depth, r.depth) + 1;
|
|
@@ -5538,7 +5537,7 @@ var ea = /* @__PURE__ */ function(n) {
|
|
|
5538
5537
|
}, e.prototype.appendInner = function(r) {
|
|
5539
5538
|
return this.left.depth >= Math.max(this.right.depth, r.depth) + 1 ? new e(this.left, new e(this.right, r)) : new e(this, r);
|
|
5540
5539
|
}, e;
|
|
5541
|
-
}(
|
|
5540
|
+
}(v);
|
|
5542
5541
|
const ta = 500;
|
|
5543
5542
|
class re {
|
|
5544
5543
|
constructor(e, t) {
|
|
@@ -5649,10 +5648,10 @@ class re {
|
|
|
5649
5648
|
(d = i.length && i[u].merge(h)) ? i[u] = d : i.push(h);
|
|
5650
5649
|
}
|
|
5651
5650
|
} else o.map && r--;
|
|
5652
|
-
}, this.items.length, 0), new re(
|
|
5651
|
+
}, this.items.length, 0), new re(v.from(i.reverse()), s);
|
|
5653
5652
|
}
|
|
5654
5653
|
}
|
|
5655
|
-
re.empty = new re(
|
|
5654
|
+
re.empty = new re(v.empty, 0);
|
|
5656
5655
|
function na(n, e) {
|
|
5657
5656
|
let t;
|
|
5658
5657
|
return n.forEach((r, i) => {
|
|
@@ -5727,11 +5726,11 @@ function oa(n, e, t) {
|
|
|
5727
5726
|
let o = s.selection.resolve(s.transform.doc), l = (t ? n.done : n.undone).addTransform(s.transform, e.selection.getBookmark(), i, r), a = new Ce(t ? l : s.remaining, t ? s.remaining : l, null, 0, -1);
|
|
5728
5727
|
return s.transform.setSelection(o).setMeta(qe, { redo: t, historyState: a });
|
|
5729
5728
|
}
|
|
5730
|
-
let Rn = !1,
|
|
5729
|
+
let Rn = !1, Xr = null;
|
|
5731
5730
|
function jt(n) {
|
|
5732
5731
|
let e = n.plugins;
|
|
5733
|
-
if (
|
|
5734
|
-
Rn = !1,
|
|
5732
|
+
if (Xr != e) {
|
|
5733
|
+
Rn = !1, Xr = e;
|
|
5735
5734
|
for (let t = 0; t < e.length; t++)
|
|
5736
5735
|
if (e[t].spec.historyPreserveItems) {
|
|
5737
5736
|
Rn = !0;
|
|
@@ -5759,7 +5758,7 @@ function aa(n = {}) {
|
|
|
5759
5758
|
props: {
|
|
5760
5759
|
handleDOMEvents: {
|
|
5761
5760
|
beforeinput(e, t) {
|
|
5762
|
-
let r = t.inputType, i = r == "historyUndo" ? $s : r == "historyRedo" ?
|
|
5761
|
+
let r = t.inputType, i = r == "historyUndo" ? $s : r == "historyRedo" ? jn : null;
|
|
5763
5762
|
return i ? (t.preventDefault(), i(e.state, e.dispatch)) : !1;
|
|
5764
5763
|
}
|
|
5765
5764
|
}
|
|
@@ -5778,7 +5777,7 @@ function Hs(n, e) {
|
|
|
5778
5777
|
return !0;
|
|
5779
5778
|
};
|
|
5780
5779
|
}
|
|
5781
|
-
const $s = Hs(!1, !0),
|
|
5780
|
+
const $s = Hs(!1, !0), jn = Hs(!0, !0);
|
|
5782
5781
|
var ve = {
|
|
5783
5782
|
8: "Backspace",
|
|
5784
5783
|
9: "Tab",
|
|
@@ -5858,10 +5857,10 @@ var ve = {
|
|
|
5858
5857
|
221: "}",
|
|
5859
5858
|
222: '"'
|
|
5860
5859
|
}, ca = typeof navigator < "u" && /Mac/.test(navigator.platform), fa = typeof navigator < "u" && /MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);
|
|
5861
|
-
for (var
|
|
5862
|
-
for (var
|
|
5863
|
-
for (var
|
|
5864
|
-
ve[
|
|
5860
|
+
for (var V = 0; V < 10; V++) ve[48 + V] = ve[96 + V] = String(V);
|
|
5861
|
+
for (var V = 1; V <= 24; V++) ve[V + 111] = "F" + V;
|
|
5862
|
+
for (var V = 65; V <= 90; V++)
|
|
5863
|
+
ve[V] = String.fromCharCode(V + 32), rn[V] = String.fromCharCode(V);
|
|
5865
5864
|
for (var In in ve) rn.hasOwnProperty(In) || (rn[In] = ve[In]);
|
|
5866
5865
|
function ha(n) {
|
|
5867
5866
|
var e = ca && n.metaKey && n.shiftKey && !n.ctrlKey && !n.altKey || fa && n.shiftKey && n.key && n.key.length == 1 || n.key == "Unidentified", t = !e && n.key || (n.shiftKey ? rn : ve)[n.keyCode] || n.key || "Unidentified";
|
|
@@ -5922,7 +5921,7 @@ function Ws(n) {
|
|
|
5922
5921
|
return !1;
|
|
5923
5922
|
};
|
|
5924
5923
|
}
|
|
5925
|
-
function
|
|
5924
|
+
function Yr(n, e = null) {
|
|
5926
5925
|
return function(t, r) {
|
|
5927
5926
|
let { $from: i, $to: s } = t.selection, o = i.blockRange(s), l = !1, a = o;
|
|
5928
5927
|
if (!o)
|
|
@@ -5941,7 +5940,7 @@ function ma(n, e, t, r, i) {
|
|
|
5941
5940
|
let s = y.empty;
|
|
5942
5941
|
for (let f = t.length - 1; f >= 0; f--)
|
|
5943
5942
|
s = y.from(t[f].type.create(t[f].attrs, s));
|
|
5944
|
-
n.step(new
|
|
5943
|
+
n.step(new F(e.start - (r ? 2 : 0), e.end, e.start, e.end, new x(s, 0, 0), t.length, !0));
|
|
5945
5944
|
let o = 0;
|
|
5946
5945
|
for (let f = 0; f < t.length; f++)
|
|
5947
5946
|
t[f].type == i && (o = f + 1);
|
|
@@ -5967,7 +5966,7 @@ function ga(n, e) {
|
|
|
5967
5966
|
h = y.from(i.node(b).copy(h));
|
|
5968
5967
|
let u = i.indexAfter(-1) < i.node(-2).childCount ? 1 : i.indexAfter(-2) < i.node(-3).childCount ? 2 : 3;
|
|
5969
5968
|
h = h.append(y.from(n.createAndFill()));
|
|
5970
|
-
let p = i.before(i.depth - (d - 1)), m = t.tr.replace(p, i.after(-u), new
|
|
5969
|
+
let p = i.before(i.depth - (d - 1)), m = t.tr.replace(p, i.after(-u), new x(h, 4 - d, 0)), g = -1;
|
|
5971
5970
|
m.doc.nodesBetween(p, m.doc.content.size, (b, w) => {
|
|
5972
5971
|
if (g > -1)
|
|
5973
5972
|
return !1;
|
|
@@ -5980,7 +5979,7 @@ function ga(n, e) {
|
|
|
5980
5979
|
return rt(c.doc, i.pos, 2, f) ? (r && r(c.split(i.pos, 2, f).scrollIntoView()), !0) : !1;
|
|
5981
5980
|
};
|
|
5982
5981
|
}
|
|
5983
|
-
function
|
|
5982
|
+
function Un(n) {
|
|
5984
5983
|
return function(e, t) {
|
|
5985
5984
|
let { $from: r, $to: i } = e.selection, s = r.blockRange(i, (o) => o.childCount > 0 && o.firstChild.type == n);
|
|
5986
5985
|
return s ? t ? r.node(s.depth - 1).type == n ? ya(e, t, n, s) : ba(e, t, s) : !0 : !1;
|
|
@@ -5988,7 +5987,7 @@ function jn(n) {
|
|
|
5988
5987
|
}
|
|
5989
5988
|
function ya(n, e, t, r) {
|
|
5990
5989
|
let i = n.tr, s = r.end, o = r.$to.end(r.depth);
|
|
5991
|
-
s < o && (i.step(new
|
|
5990
|
+
s < o && (i.step(new F(s - 1, o, s, o, new x(y.from(t.create(null, r.parent.copy())), 1, 0), 1, !0)), r = new Zt(i.doc.resolve(r.$from.pos), i.doc.resolve(o), r.depth));
|
|
5992
5991
|
const l = un(r);
|
|
5993
5992
|
if (l == null)
|
|
5994
5993
|
return !1;
|
|
@@ -6007,9 +6006,9 @@ function ba(n, e, t) {
|
|
|
6007
6006
|
if (!c.canReplace(f + (l ? 0 : 1), f + 1, o.content.append(a ? y.empty : y.from(i))))
|
|
6008
6007
|
return !1;
|
|
6009
6008
|
let h = s.pos, d = h + o.nodeSize;
|
|
6010
|
-
return r.step(new
|
|
6009
|
+
return r.step(new F(h - (l ? 1 : 0), d + (a ? 1 : 0), h + 1, d - 1, new x((l ? y.empty : y.from(i.copy(y.empty))).append(a ? y.empty : y.from(i.copy(y.empty))), l ? 0 : 1, a ? 0 : 1), l ? 0 : 1)), e(r.scrollIntoView()), !0;
|
|
6011
6010
|
}
|
|
6012
|
-
function
|
|
6011
|
+
function xa(n) {
|
|
6013
6012
|
return function(e, t) {
|
|
6014
6013
|
let { $from: r, $to: i } = e.selection, s = r.blockRange(i, (c) => c.childCount > 0 && c.firstChild.type == n);
|
|
6015
6014
|
if (!s)
|
|
@@ -6021,13 +6020,13 @@ function ka(n) {
|
|
|
6021
6020
|
if (a.type != n)
|
|
6022
6021
|
return !1;
|
|
6023
6022
|
if (t) {
|
|
6024
|
-
let c = a.lastChild && a.lastChild.type == l.type, f = y.from(c ? n.create() : null), h = new
|
|
6025
|
-
t(e.tr.step(new
|
|
6023
|
+
let c = a.lastChild && a.lastChild.type == l.type, f = y.from(c ? n.create() : null), h = new x(y.from(n.create(null, y.from(l.type.create(null, f)))), c ? 3 : 1, 0), d = s.start, u = s.end;
|
|
6024
|
+
t(e.tr.step(new F(d - (c ? 3 : 1), u, d, u, h, 1, !0)).scrollIntoView());
|
|
6026
6025
|
}
|
|
6027
6026
|
return !0;
|
|
6028
6027
|
};
|
|
6029
6028
|
}
|
|
6030
|
-
const
|
|
6029
|
+
const P = function(n) {
|
|
6031
6030
|
for (var e = 0; ; e++)
|
|
6032
6031
|
if (n = n.previousSibling, !n)
|
|
6033
6032
|
return e;
|
|
@@ -6035,16 +6034,16 @@ const V = function(n) {
|
|
|
6035
6034
|
let e = n.assignedSlot || n.parentNode;
|
|
6036
6035
|
return e && e.nodeType == 11 ? e.host : e;
|
|
6037
6036
|
};
|
|
6038
|
-
let
|
|
6037
|
+
let Gn = null;
|
|
6039
6038
|
const me = function(n, e, t) {
|
|
6040
|
-
let r =
|
|
6039
|
+
let r = Gn || (Gn = document.createRange());
|
|
6041
6040
|
return r.setEnd(n, t ?? n.nodeValue.length), r.setStart(n, e || 0), r;
|
|
6042
|
-
},
|
|
6043
|
-
|
|
6044
|
-
},
|
|
6045
|
-
return t && (
|
|
6041
|
+
}, ka = function() {
|
|
6042
|
+
Gn = null;
|
|
6043
|
+
}, Ge = function(n, e, t, r) {
|
|
6044
|
+
return t && (Zr(n, e, t, r, -1) || Zr(n, e, t, r, 1));
|
|
6046
6045
|
}, Sa = /^(img|br|input|textarea|hr)$/i;
|
|
6047
|
-
function
|
|
6046
|
+
function Zr(n, e, t, r, i) {
|
|
6048
6047
|
for (; ; ) {
|
|
6049
6048
|
if (n == t && e == r)
|
|
6050
6049
|
return !0;
|
|
@@ -6052,7 +6051,7 @@ function Yr(n, e, t, r, i) {
|
|
|
6052
6051
|
let s = n.parentNode;
|
|
6053
6052
|
if (!s || s.nodeType != 1 || vt(n) || Sa.test(n.nodeName) || n.contentEditable == "false")
|
|
6054
6053
|
return !1;
|
|
6055
|
-
e =
|
|
6054
|
+
e = P(n) + (i < 0 ? 0 : 1), n = s;
|
|
6056
6055
|
} else if (n.nodeType == 1) {
|
|
6057
6056
|
if (n = n.childNodes[e + (i < 0 ? -1 : 0)], n.contentEditable == "false")
|
|
6058
6057
|
return !1;
|
|
@@ -6073,7 +6072,7 @@ function Ca(n, e) {
|
|
|
6073
6072
|
return null;
|
|
6074
6073
|
n = n.childNodes[e - 1], e = Q(n);
|
|
6075
6074
|
} else if (n.parentNode && !vt(n))
|
|
6076
|
-
e =
|
|
6075
|
+
e = P(n), n = n.parentNode;
|
|
6077
6076
|
else
|
|
6078
6077
|
return null;
|
|
6079
6078
|
}
|
|
@@ -6087,7 +6086,7 @@ function wa(n, e) {
|
|
|
6087
6086
|
return null;
|
|
6088
6087
|
n = n.childNodes[e], e = 0;
|
|
6089
6088
|
} else if (n.parentNode && !vt(n))
|
|
6090
|
-
e =
|
|
6089
|
+
e = P(n) + 1, n = n.parentNode;
|
|
6091
6090
|
else
|
|
6092
6091
|
return null;
|
|
6093
6092
|
}
|
|
@@ -6096,7 +6095,7 @@ function Ma(n, e, t) {
|
|
|
6096
6095
|
for (let r = e == 0, i = e == Q(n); r || i; ) {
|
|
6097
6096
|
if (n == t)
|
|
6098
6097
|
return !0;
|
|
6099
|
-
let s =
|
|
6098
|
+
let s = P(n);
|
|
6100
6099
|
if (n = n.parentNode, !n)
|
|
6101
6100
|
return !1;
|
|
6102
6101
|
r = r && s == 0, i = i && s == Q(n);
|
|
@@ -6109,7 +6108,7 @@ function vt(n) {
|
|
|
6109
6108
|
return e && e.node && e.node.isBlock && (e.dom == n || e.contentDOM == n);
|
|
6110
6109
|
}
|
|
6111
6110
|
const gn = function(n) {
|
|
6112
|
-
return n.focusNode &&
|
|
6111
|
+
return n.focusNode && Ge(n.focusNode, n.focusOffset, n.anchorNode, n.anchorOffset);
|
|
6113
6112
|
};
|
|
6114
6113
|
function Pe(n, e) {
|
|
6115
6114
|
let t = document.createEvent("Event");
|
|
@@ -6135,9 +6134,9 @@ function Na(n, e, t) {
|
|
|
6135
6134
|
return { node: r.startContainer, offset: Math.min(Q(r.startContainer), r.startOffset) };
|
|
6136
6135
|
}
|
|
6137
6136
|
}
|
|
6138
|
-
const le = typeof navigator < "u" ? navigator : null,
|
|
6137
|
+
const le = typeof navigator < "u" ? navigator : null, Qr = typeof document < "u" ? document : null, ze = le && le.userAgent || "", _n = /Edge\/(\d+)/.exec(ze), Js = /MSIE \d/.exec(ze), Xn = /Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(ze), U = !!(Js || Xn || _n), Ee = Js ? document.documentMode : Xn ? +Xn[1] : _n ? +_n[1] : 0, ie = !U && /gecko\/(\d+)/i.test(ze);
|
|
6139
6138
|
ie && +(/Firefox\/(\d+)/.exec(ze) || [0, 0])[1];
|
|
6140
|
-
const
|
|
6139
|
+
const Yn = !U && /Chrome\/(\d+)/.exec(ze), $ = !!Yn, qs = Yn ? +Yn[1] : 0, J = !U && !!le && /Apple Computer/.test(le.vendor), ft = J && (/Mobile\/\w+/.test(ze) || !!le && le.maxTouchPoints > 2), Z = ft || (le ? /Mac/.test(le.platform) : !1), Ta = le ? /Win/.test(le.platform) : !1, ne = /Android \d/.test(ze), zt = !!Qr && "webkitFontSmoothing" in Qr.documentElement.style, Aa = zt ? +(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent) || [0, 0])[1] : 0;
|
|
6141
6140
|
function Da(n) {
|
|
6142
6141
|
let e = n.defaultView && n.defaultView.visualViewport;
|
|
6143
6142
|
return e ? {
|
|
@@ -6164,7 +6163,7 @@ function Ea(n) {
|
|
|
6164
6163
|
bottom: e.top + n.clientHeight * r
|
|
6165
6164
|
};
|
|
6166
6165
|
}
|
|
6167
|
-
function
|
|
6166
|
+
function ei(n, e, t) {
|
|
6168
6167
|
let r = n.someProp("scrollThreshold") || 0, i = n.someProp("scrollMargin") || 5, s = n.dom.ownerDocument;
|
|
6169
6168
|
for (let o = t || n.dom; o; o = Tt(o)) {
|
|
6170
6169
|
if (o.nodeType != 1)
|
|
@@ -6259,12 +6258,12 @@ function za(n, e) {
|
|
|
6259
6258
|
for (let i = 0; i < t; i++) {
|
|
6260
6259
|
r.setEnd(n, i + 1), r.setStart(n, i);
|
|
6261
6260
|
let s = Se(r, 1);
|
|
6262
|
-
if (s.top != s.bottom &&
|
|
6261
|
+
if (s.top != s.bottom && mr(e, s))
|
|
6263
6262
|
return { node: n, offset: i + (e.left >= (s.left + s.right) / 2 ? 1 : 0) };
|
|
6264
6263
|
}
|
|
6265
6264
|
return { node: n, offset: 0 };
|
|
6266
6265
|
}
|
|
6267
|
-
function
|
|
6266
|
+
function mr(n, e) {
|
|
6268
6267
|
return n.left >= e.left - 1 && n.left <= e.right + 1 && n.top >= e.top - 1 && n.top <= e.bottom + 1;
|
|
6269
6268
|
}
|
|
6270
6269
|
function Ba(n, e) {
|
|
@@ -6294,7 +6293,7 @@ function Pa(n, e, t, r) {
|
|
|
6294
6293
|
}
|
|
6295
6294
|
return i > -1 ? i : n.docView.posFromDOM(e, t, -1);
|
|
6296
6295
|
}
|
|
6297
|
-
function
|
|
6296
|
+
function Gs(n, e, t) {
|
|
6298
6297
|
let r = n.childNodes.length;
|
|
6299
6298
|
if (r && t.top < t.bottom)
|
|
6300
6299
|
for (let i = Math.max(0, Math.min(r - 1, Math.floor(r * (e.top - t.top) / (t.bottom - t.top)) - 2)), s = i; ; ) {
|
|
@@ -6303,8 +6302,8 @@ function _s(n, e, t) {
|
|
|
6303
6302
|
let l = o.getClientRects();
|
|
6304
6303
|
for (let a = 0; a < l.length; a++) {
|
|
6305
6304
|
let c = l[a];
|
|
6306
|
-
if (
|
|
6307
|
-
return
|
|
6305
|
+
if (mr(e, c))
|
|
6306
|
+
return Gs(o, e, c);
|
|
6308
6307
|
}
|
|
6309
6308
|
}
|
|
6310
6309
|
if ((s = (s + 1) % r) == i)
|
|
@@ -6318,7 +6317,7 @@ function Fa(n, e) {
|
|
|
6318
6317
|
let o = (n.root.elementFromPoint ? n.root : t).elementFromPoint(e.left, e.top), l;
|
|
6319
6318
|
if (!o || !n.dom.contains(o.nodeType != 1 ? o.parentNode : o)) {
|
|
6320
6319
|
let c = n.dom.getBoundingClientRect();
|
|
6321
|
-
if (!
|
|
6320
|
+
if (!mr(e, c) || (o = Gs(n.dom, e, c), !o))
|
|
6322
6321
|
return null;
|
|
6323
6322
|
}
|
|
6324
6323
|
if (J)
|
|
@@ -6336,20 +6335,20 @@ function Fa(n, e) {
|
|
|
6336
6335
|
let a = n.docView.nearestDesc(o, !0);
|
|
6337
6336
|
return { pos: l, inside: a ? a.posAtStart - a.border : -1 };
|
|
6338
6337
|
}
|
|
6339
|
-
function
|
|
6338
|
+
function ti(n) {
|
|
6340
6339
|
return n.top < n.bottom || n.left < n.right;
|
|
6341
6340
|
}
|
|
6342
6341
|
function Se(n, e) {
|
|
6343
6342
|
let t = n.getClientRects();
|
|
6344
6343
|
if (t.length) {
|
|
6345
6344
|
let r = t[e < 0 ? 0 : t.length - 1];
|
|
6346
|
-
if (
|
|
6345
|
+
if (ti(r))
|
|
6347
6346
|
return r;
|
|
6348
6347
|
}
|
|
6349
|
-
return Array.prototype.find.call(t,
|
|
6348
|
+
return Array.prototype.find.call(t, ti) || n.getBoundingClientRect();
|
|
6350
6349
|
}
|
|
6351
6350
|
const La = /[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;
|
|
6352
|
-
function
|
|
6351
|
+
function _s(n, e, t) {
|
|
6353
6352
|
let { node: r, offset: i, atom: s } = n.docView.domFromPos(e, t < 0 ? -1 : 1), o = zt || ie;
|
|
6354
6353
|
if (r.nodeType == 3)
|
|
6355
6354
|
if (o && (La.test(r.nodeValue) || (t < 0 ? !i : i == r.nodeValue.length))) {
|
|
@@ -6430,7 +6429,7 @@ function Ha(n, e, t) {
|
|
|
6430
6429
|
}
|
|
6431
6430
|
s = l.dom.parentNode;
|
|
6432
6431
|
}
|
|
6433
|
-
let o =
|
|
6432
|
+
let o = _s(n, i.pos, 1);
|
|
6434
6433
|
for (let l = s.firstChild; l; l = l.nextSibling) {
|
|
6435
6434
|
let a;
|
|
6436
6435
|
if (l.nodeType == 1)
|
|
@@ -6465,11 +6464,11 @@ function Wa(n, e, t) {
|
|
|
6465
6464
|
return d != null && (l.caretBidiLevel = d), g;
|
|
6466
6465
|
}) : r.pos == r.start() || r.pos == r.end();
|
|
6467
6466
|
}
|
|
6468
|
-
let
|
|
6467
|
+
let ni = null, ri = null, ii = !1;
|
|
6469
6468
|
function Ja(n, e, t) {
|
|
6470
|
-
return
|
|
6469
|
+
return ni == e && ri == t ? ii : (ni = e, ri = t, ii = t == "up" || t == "down" ? Ha(n, e, t) : Wa(n, e, t));
|
|
6471
6470
|
}
|
|
6472
|
-
const ee = 0,
|
|
6471
|
+
const ee = 0, si = 1, Fe = 2, ae = 3;
|
|
6473
6472
|
class Bt {
|
|
6474
6473
|
constructor(e, t, r, i) {
|
|
6475
6474
|
this.parent = e, this.children = t, this.dom = r, this.contentDOM = i, this.dirty = ee, r.pmViewDesc = this;
|
|
@@ -6565,7 +6564,7 @@ class Bt {
|
|
|
6565
6564
|
}
|
|
6566
6565
|
let i;
|
|
6567
6566
|
if (e == this.dom && this.contentDOM)
|
|
6568
|
-
i = t >
|
|
6567
|
+
i = t > P(this.contentDOM);
|
|
6569
6568
|
else if (this.contentDOM && this.contentDOM != this.dom && this.dom.contains(this.contentDOM))
|
|
6570
6569
|
i = e.compareDocumentPosition(this.contentDOM) & 2;
|
|
6571
6570
|
else if (this.dom.firstChild) {
|
|
@@ -6649,12 +6648,12 @@ class Bt {
|
|
|
6649
6648
|
let s, o = !0;
|
|
6650
6649
|
for (; s = r ? this.children[r - 1] : null, !(!s || s.dom.parentNode == this.contentDOM); r--, o = !1)
|
|
6651
6650
|
;
|
|
6652
|
-
return s && t && o && !s.border && !s.domAtom ? s.domFromPos(s.size, t) : { node: this.contentDOM, offset: s ?
|
|
6651
|
+
return s && t && o && !s.border && !s.domAtom ? s.domFromPos(s.size, t) : { node: this.contentDOM, offset: s ? P(s.dom) + 1 : 0 };
|
|
6653
6652
|
} else {
|
|
6654
6653
|
let s, o = !0;
|
|
6655
6654
|
for (; s = r < this.children.length ? this.children[r] : null, !(!s || s.dom.parentNode == this.contentDOM); r++, o = !1)
|
|
6656
6655
|
;
|
|
6657
|
-
return s && o && !s.border && !s.domAtom ? s.domFromPos(0, t) : { node: this.contentDOM, offset: s ?
|
|
6656
|
+
return s && o && !s.border && !s.domAtom ? s.domFromPos(0, t) : { node: this.contentDOM, offset: s ? P(s.dom) : this.contentDOM.childNodes.length };
|
|
6658
6657
|
}
|
|
6659
6658
|
}
|
|
6660
6659
|
// Used to find a DOM range in a single parent for a given changed
|
|
@@ -6673,7 +6672,7 @@ class Bt {
|
|
|
6673
6672
|
for (let h = l; h > 0; h--) {
|
|
6674
6673
|
let d = this.children[h - 1];
|
|
6675
6674
|
if (d.size && d.dom.parentNode == this.contentDOM && !d.emptyChildAt(1)) {
|
|
6676
|
-
i =
|
|
6675
|
+
i = P(d.dom) + 1;
|
|
6677
6676
|
break;
|
|
6678
6677
|
}
|
|
6679
6678
|
e -= d.size;
|
|
@@ -6685,7 +6684,7 @@ class Bt {
|
|
|
6685
6684
|
for (let f = l + 1; f < this.children.length; f++) {
|
|
6686
6685
|
let h = this.children[f];
|
|
6687
6686
|
if (h.size && h.dom.parentNode == this.contentDOM && !h.emptyChildAt(-1)) {
|
|
6688
|
-
s =
|
|
6687
|
+
s = P(h.dom);
|
|
6689
6688
|
break;
|
|
6690
6689
|
}
|
|
6691
6690
|
t += h.size;
|
|
@@ -6730,7 +6729,7 @@ class Bt {
|
|
|
6730
6729
|
`), h && p == u.nodeValue.length)
|
|
6731
6730
|
for (let m = u, g; m; m = m.parentNode) {
|
|
6732
6731
|
if (g = m.nextSibling) {
|
|
6733
|
-
g.nodeName == "BR" && (l = a = { node: g.parentNode, offset:
|
|
6732
|
+
g.nodeName == "BR" && (l = a = { node: g.parentNode, offset: P(g) + 1 });
|
|
6734
6733
|
break;
|
|
6735
6734
|
}
|
|
6736
6735
|
let b = m.pmViewDesc;
|
|
@@ -6746,7 +6745,7 @@ class Bt {
|
|
|
6746
6745
|
let u = f.focusNode.childNodes[f.focusOffset];
|
|
6747
6746
|
u && u.contentEditable == "false" && (i = !0);
|
|
6748
6747
|
}
|
|
6749
|
-
if (!(i || h && J) &&
|
|
6748
|
+
if (!(i || h && J) && Ge(l.node, l.offset, f.anchorNode, f.anchorOffset) && Ge(a.node, a.offset, f.focusNode, f.focusOffset))
|
|
6750
6749
|
return;
|
|
6751
6750
|
let d = !1;
|
|
6752
6751
|
if ((c.extend || e == t) && !h) {
|
|
@@ -6779,7 +6778,7 @@ class Bt {
|
|
|
6779
6778
|
if (r == o ? e <= o && t >= r : e < o && t > r) {
|
|
6780
6779
|
let l = r + s.border, a = o - s.border;
|
|
6781
6780
|
if (e >= l && t <= a) {
|
|
6782
|
-
this.dirty = e == r || t == o ? Fe :
|
|
6781
|
+
this.dirty = e == r || t == o ? Fe : si, e == l && t == a && (s.contentLost || s.dom.parentNode != this.contentDOM) ? s.dirty = ae : s.markDirty(e - l, t - l);
|
|
6783
6782
|
return;
|
|
6784
6783
|
} else
|
|
6785
6784
|
s.dirty = s.dom == s.contentDOM && s.dom.parentNode == this.contentDOM && !s.children.length ? Fe : ae;
|
|
@@ -6791,7 +6790,7 @@ class Bt {
|
|
|
6791
6790
|
markParentsDirty() {
|
|
6792
6791
|
let e = 1;
|
|
6793
6792
|
for (let t = this.parent; t; t = t.parent, e++) {
|
|
6794
|
-
let r = e == 1 ? Fe :
|
|
6793
|
+
let r = e == 1 ? Fe : si;
|
|
6795
6794
|
t.dirty < r && (t.dirty = r);
|
|
6796
6795
|
}
|
|
6797
6796
|
}
|
|
@@ -6862,13 +6861,13 @@ class qa extends Bt {
|
|
|
6862
6861
|
return e.type === "characterData" && e.target.nodeValue == e.oldValue;
|
|
6863
6862
|
}
|
|
6864
6863
|
}
|
|
6865
|
-
class
|
|
6864
|
+
class _e extends Bt {
|
|
6866
6865
|
constructor(e, t, r, i, s) {
|
|
6867
6866
|
super(e, [], r, i), this.mark = t, this.spec = s;
|
|
6868
6867
|
}
|
|
6869
6868
|
static create(e, t, r, i) {
|
|
6870
6869
|
let s = i.nodeViews[t.type.name], o = s && s(t, i, r);
|
|
6871
|
-
return (!o || !o.dom) && (o = Xe.renderSpec(document, t.type.spec.toDOM(t, r), null, t.attrs)), new
|
|
6870
|
+
return (!o || !o.dom) && (o = Xe.renderSpec(document, t.type.spec.toDOM(t, r), null, t.attrs)), new _e(e, t, o.dom, o.contentDOM || o.dom, o);
|
|
6872
6871
|
}
|
|
6873
6872
|
parseRule() {
|
|
6874
6873
|
return this.dirty & ae || this.mark.type.spec.reparseInView ? null : { mark: this.mark.type.name, attrs: this.mark.attrs, contentElement: this.contentDOM };
|
|
@@ -6885,8 +6884,8 @@ class Ge extends Bt {
|
|
|
6885
6884
|
}
|
|
6886
6885
|
}
|
|
6887
6886
|
slice(e, t, r) {
|
|
6888
|
-
let i =
|
|
6889
|
-
t < o && (s =
|
|
6887
|
+
let i = _e.create(this.parent, this.mark, !0, r), s = this.children, o = this.size;
|
|
6888
|
+
t < o && (s = Qn(s, t, o, r)), e > 0 && (s = Qn(s, 0, e, r));
|
|
6890
6889
|
for (let l = 0; l < s.length; l++)
|
|
6891
6890
|
s[l].parent = i;
|
|
6892
6891
|
return i.children = s, i;
|
|
@@ -6964,7 +6963,7 @@ class Re extends Bt {
|
|
|
6964
6963
|
updateChildren(e, t) {
|
|
6965
6964
|
let r = this.node.inlineContent, i = t, s = e.composing ? this.localCompositionInfo(e, t) : null, o = s && s.pos > -1 ? s : null, l = s && s.pos < 0, a = new Ua(this, o && o.node, e);
|
|
6966
6965
|
Xa(this.node, this.innerDeco, (c, f, h) => {
|
|
6967
|
-
c.spec.marks ? a.syncToMarks(c.spec.marks, r, e) : c.type.side >= 0 && !h && a.syncToMarks(f == this.node.childCount ?
|
|
6966
|
+
c.spec.marks ? a.syncToMarks(c.spec.marks, r, e) : c.type.side >= 0 && !h && a.syncToMarks(f == this.node.childCount ? N.none : this.node.child(f).marks, r, e), a.placeWidget(c, e, i);
|
|
6968
6967
|
}, (c, f, h, d) => {
|
|
6969
6968
|
a.syncToMarks(c.marks, r, e);
|
|
6970
6969
|
let u;
|
|
@@ -6996,7 +6995,7 @@ class Re extends Bt {
|
|
|
6996
6995
|
s.pmViewDesc && (s.pmViewDesc = void 0);
|
|
6997
6996
|
}
|
|
6998
6997
|
let o = new qa(this, s, t, i);
|
|
6999
|
-
e.input.compositionNodes.push(o), this.children =
|
|
6998
|
+
e.input.compositionNodes.push(o), this.children = Qn(this.children, r, r + i.length, e, o);
|
|
7000
6999
|
}
|
|
7001
7000
|
// If this desc must be updated to match the given node decoration,
|
|
7002
7001
|
// do so and return true.
|
|
@@ -7010,7 +7009,7 @@ class Re extends Bt {
|
|
|
7010
7009
|
if (sn(e, this.outerDeco))
|
|
7011
7010
|
return;
|
|
7012
7011
|
let t = this.nodeDOM.nodeType != 1, r = this.dom;
|
|
7013
|
-
this.dom = eo(this.dom, this.nodeDOM,
|
|
7012
|
+
this.dom = eo(this.dom, this.nodeDOM, Zn(this.outerDeco, this.node, t), Zn(e, this.node, t)), this.dom != r && (r.pmViewDesc = void 0, this.dom.pmViewDesc = this), this.outerDeco = e;
|
|
7014
7013
|
}
|
|
7015
7014
|
// Mark this node as being the selected node.
|
|
7016
7015
|
selectNode() {
|
|
@@ -7024,7 +7023,7 @@ class Re extends Bt {
|
|
|
7024
7023
|
return this.node.isAtom;
|
|
7025
7024
|
}
|
|
7026
7025
|
}
|
|
7027
|
-
function
|
|
7026
|
+
function oi(n, e, t, r, i) {
|
|
7028
7027
|
to(r, e, n);
|
|
7029
7028
|
let s = new Re(void 0, n, e, t, r, r, r, i, 0);
|
|
7030
7029
|
return s.contentDOM && s.updateChildren(i, 0), s;
|
|
@@ -7126,17 +7125,17 @@ function Qs(n, e, t) {
|
|
|
7126
7125
|
let o = e[s], l = o.dom;
|
|
7127
7126
|
if (l.parentNode == n) {
|
|
7128
7127
|
for (; l != r; )
|
|
7129
|
-
r =
|
|
7128
|
+
r = li(r), i = !0;
|
|
7130
7129
|
r = r.nextSibling;
|
|
7131
7130
|
} else
|
|
7132
7131
|
i = !0, n.insertBefore(l, r);
|
|
7133
|
-
if (o instanceof
|
|
7132
|
+
if (o instanceof _e) {
|
|
7134
7133
|
let a = r ? r.previousSibling : n.lastChild;
|
|
7135
7134
|
Qs(o.contentDOM, o.children, t), r = a ? a.nextSibling : n.firstChild;
|
|
7136
7135
|
}
|
|
7137
7136
|
}
|
|
7138
7137
|
for (; r; )
|
|
7139
|
-
r =
|
|
7138
|
+
r = li(r), i = !0;
|
|
7140
7139
|
i && t.trackWrites == n && (t.trackWrites = null);
|
|
7141
7140
|
}
|
|
7142
7141
|
const St = function(n) {
|
|
@@ -7144,7 +7143,7 @@ const St = function(n) {
|
|
|
7144
7143
|
};
|
|
7145
7144
|
St.prototype = /* @__PURE__ */ Object.create(null);
|
|
7146
7145
|
const Le = [new St()];
|
|
7147
|
-
function
|
|
7146
|
+
function Zn(n, e, t) {
|
|
7148
7147
|
if (n.length == 0)
|
|
7149
7148
|
return Le;
|
|
7150
7149
|
let r = t ? Le[0] : new St(), i = [r];
|
|
@@ -7197,7 +7196,7 @@ function ja(n, e, t) {
|
|
|
7197
7196
|
}
|
|
7198
7197
|
}
|
|
7199
7198
|
function to(n, e, t) {
|
|
7200
|
-
return eo(n, n, Le,
|
|
7199
|
+
return eo(n, n, Le, Zn(e, t, n.nodeType != 1));
|
|
7201
7200
|
}
|
|
7202
7201
|
function sn(n, e) {
|
|
7203
7202
|
if (n.length != e.length)
|
|
@@ -7207,13 +7206,13 @@ function sn(n, e) {
|
|
|
7207
7206
|
return !1;
|
|
7208
7207
|
return !0;
|
|
7209
7208
|
}
|
|
7210
|
-
function
|
|
7209
|
+
function li(n) {
|
|
7211
7210
|
let e = n.nextSibling;
|
|
7212
7211
|
return n.parentNode.removeChild(n), e;
|
|
7213
7212
|
}
|
|
7214
7213
|
class Ua {
|
|
7215
7214
|
constructor(e, t, r) {
|
|
7216
|
-
this.lock = t, this.view = r, this.index = 0, this.stack = [], this.changed = !1, this.top = e, this.preMatch =
|
|
7215
|
+
this.lock = t, this.view = r, this.index = 0, this.stack = [], this.changed = !1, this.top = e, this.preMatch = Ga(e.node.content, e);
|
|
7217
7216
|
}
|
|
7218
7217
|
// Destroy and remove the children between the given indices in
|
|
7219
7218
|
// `this.top`.
|
|
@@ -7249,7 +7248,7 @@ class Ua {
|
|
|
7249
7248
|
if (l > -1)
|
|
7250
7249
|
l > this.index && (this.changed = !0, this.destroyBetween(this.index, l)), this.top = this.top.children[this.index];
|
|
7251
7250
|
else {
|
|
7252
|
-
let a =
|
|
7251
|
+
let a = _e.create(this.top, e[s], t, r);
|
|
7253
7252
|
this.top.children.splice(this.index, 0, a), this.top = a, this.changed = !0;
|
|
7254
7253
|
}
|
|
7255
7254
|
this.index = 0, s++;
|
|
@@ -7342,10 +7341,10 @@ class Ua {
|
|
|
7342
7341
|
// contentEditable.
|
|
7343
7342
|
addTextblockHacks() {
|
|
7344
7343
|
let e = this.top.children[this.index - 1], t = this.top;
|
|
7345
|
-
for (; e instanceof
|
|
7344
|
+
for (; e instanceof _e; )
|
|
7346
7345
|
t = e, e = t.children[t.children.length - 1];
|
|
7347
7346
|
(!e || // Empty textblock
|
|
7348
|
-
!(e instanceof yn) || /\n$/.test(e.node.text) || this.view.requiresGeckoHackNode && /\s$/.test(e.node.text)) && ((J ||
|
|
7347
|
+
!(e instanceof yn) || /\n$/.test(e.node.text) || this.view.requiresGeckoHackNode && /\s$/.test(e.node.text)) && ((J || $) && e && e.dom.contentEditable == "false" && this.addHackNode("IMG", t), this.addHackNode("BR", this.top));
|
|
7349
7348
|
}
|
|
7350
7349
|
addHackNode(e, t) {
|
|
7351
7350
|
if (t == this.top && this.index < t.children.length && t.children[this.index].matchesHack(e))
|
|
@@ -7361,14 +7360,14 @@ class Ua {
|
|
|
7361
7360
|
return this.lock && (e == this.lock || e.nodeType == 1 && e.contains(this.lock.parentNode));
|
|
7362
7361
|
}
|
|
7363
7362
|
}
|
|
7364
|
-
function
|
|
7363
|
+
function Ga(n, e) {
|
|
7365
7364
|
let t = e, r = t.children.length, i = n.childCount, s = /* @__PURE__ */ new Map(), o = [];
|
|
7366
7365
|
e: for (; i > 0; ) {
|
|
7367
7366
|
let l;
|
|
7368
7367
|
for (; ; )
|
|
7369
7368
|
if (r) {
|
|
7370
7369
|
let c = t.children[r - 1];
|
|
7371
|
-
if (c instanceof
|
|
7370
|
+
if (c instanceof _e)
|
|
7372
7371
|
t = c, r = c.children.length;
|
|
7373
7372
|
else {
|
|
7374
7373
|
l = c, r--;
|
|
@@ -7388,7 +7387,7 @@ function _a(n, e) {
|
|
|
7388
7387
|
}
|
|
7389
7388
|
return { index: i, matched: s, matches: o.reverse() };
|
|
7390
7389
|
}
|
|
7391
|
-
function
|
|
7390
|
+
function _a(n, e) {
|
|
7392
7391
|
return n.type.side - e.type.side;
|
|
7393
7392
|
}
|
|
7394
7393
|
function Xa(n, e, t, r) {
|
|
@@ -7409,7 +7408,7 @@ function Xa(n, e, t, r) {
|
|
|
7409
7408
|
}
|
|
7410
7409
|
if (f)
|
|
7411
7410
|
if (h) {
|
|
7412
|
-
h.sort(
|
|
7411
|
+
h.sort(_a);
|
|
7413
7412
|
for (let g = 0; g < h.length; g++)
|
|
7414
7413
|
t(h[g], c, !!a);
|
|
7415
7414
|
} else
|
|
@@ -7469,7 +7468,7 @@ function Za(n, e, t, r) {
|
|
|
7469
7468
|
}
|
|
7470
7469
|
return -1;
|
|
7471
7470
|
}
|
|
7472
|
-
function
|
|
7471
|
+
function Qn(n, e, t, r, i) {
|
|
7473
7472
|
let s = [];
|
|
7474
7473
|
for (let o = 0, l = 0; o < n.length; o++) {
|
|
7475
7474
|
let a = n[o], c = l, f = l += a.size;
|
|
@@ -7477,7 +7476,7 @@ function Zn(n, e, t, r, i) {
|
|
|
7477
7476
|
}
|
|
7478
7477
|
return s;
|
|
7479
7478
|
}
|
|
7480
|
-
function
|
|
7479
|
+
function gr(n, e = null) {
|
|
7481
7480
|
let t = n.domSelectionRange(), r = n.state.doc;
|
|
7482
7481
|
if (!t.focusNode)
|
|
7483
7482
|
return null;
|
|
@@ -7489,9 +7488,9 @@ function mr(n, e = null) {
|
|
|
7489
7488
|
for (a = o; i && !i.node; )
|
|
7490
7489
|
i = i.parent;
|
|
7491
7490
|
let h = i.node;
|
|
7492
|
-
if (i && h.isAtom &&
|
|
7491
|
+
if (i && h.isAtom && k.isSelectable(h) && i.parent && !(h.isInline && Ma(t.focusNode, t.focusOffset, i.dom))) {
|
|
7493
7492
|
let d = i.posBefore;
|
|
7494
|
-
c = new
|
|
7493
|
+
c = new k(o == d ? l : r.resolve(d));
|
|
7495
7494
|
}
|
|
7496
7495
|
} else {
|
|
7497
7496
|
if (t instanceof n.dom.ownerDocument.defaultView.Selection && t.rangeCount > 1) {
|
|
@@ -7511,7 +7510,7 @@ function mr(n, e = null) {
|
|
|
7511
7510
|
let f = r.resolve(a);
|
|
7512
7511
|
if (!c) {
|
|
7513
7512
|
let h = e == "pointer" || n.state.selection.head < l.pos && !s ? 1 : -1;
|
|
7514
|
-
c =
|
|
7513
|
+
c = yr(n, f, l, h);
|
|
7515
7514
|
}
|
|
7516
7515
|
return c;
|
|
7517
7516
|
}
|
|
@@ -7521,9 +7520,9 @@ function no(n) {
|
|
|
7521
7520
|
function ye(n, e = !1) {
|
|
7522
7521
|
let t = n.state.selection;
|
|
7523
7522
|
if (ro(n, t), !!no(n)) {
|
|
7524
|
-
if (!e && n.input.mouseDown && n.input.mouseDown.allowDefault &&
|
|
7523
|
+
if (!e && n.input.mouseDown && n.input.mouseDown.allowDefault && $) {
|
|
7525
7524
|
let r = n.domSelectionRange(), i = n.domObserver.currentSelection;
|
|
7526
|
-
if (r.anchorNode && i.anchorNode &&
|
|
7525
|
+
if (r.anchorNode && i.anchorNode && Ge(r.anchorNode, r.anchorOffset, i.anchorNode, i.anchorOffset)) {
|
|
7527
7526
|
n.input.mouseDown.delayedSelectionSync = !0, n.domObserver.setCurSelection();
|
|
7528
7527
|
return;
|
|
7529
7528
|
}
|
|
@@ -7532,13 +7531,13 @@ function ye(n, e = !1) {
|
|
|
7532
7531
|
ec(n);
|
|
7533
7532
|
else {
|
|
7534
7533
|
let { anchor: r, head: i } = t, s, o;
|
|
7535
|
-
|
|
7534
|
+
ai && !(t instanceof C) && (t.$from.parent.inlineContent || (s = ci(n, t.from)), !t.empty && !t.$from.parent.inlineContent && (o = ci(n, t.to))), n.docView.setSelection(r, i, n, e), ai && (s && fi(s), o && fi(o)), t.visible ? n.dom.classList.remove("ProseMirror-hideselection") : (n.dom.classList.add("ProseMirror-hideselection"), "onselectionchange" in document && Qa(n));
|
|
7536
7535
|
}
|
|
7537
7536
|
n.domObserver.setCurSelection(), n.domObserver.connectSelection();
|
|
7538
7537
|
}
|
|
7539
7538
|
}
|
|
7540
|
-
const
|
|
7541
|
-
function
|
|
7539
|
+
const ai = J || $ && qs < 63;
|
|
7540
|
+
function ci(n, e) {
|
|
7542
7541
|
let { node: t, offset: r } = n.docView.domFromPos(e, 0), i = r < t.childNodes.length ? t.childNodes[r] : null, s = r ? t.childNodes[r - 1] : null;
|
|
7543
7542
|
if (J && i && i.contentEditable == "false")
|
|
7544
7543
|
return Vn(i);
|
|
@@ -7552,7 +7551,7 @@ function ai(n, e) {
|
|
|
7552
7551
|
function Vn(n) {
|
|
7553
7552
|
return n.contentEditable = "true", J && n.draggable && (n.draggable = !1, n.wasDraggable = !0), n;
|
|
7554
7553
|
}
|
|
7555
|
-
function
|
|
7554
|
+
function fi(n) {
|
|
7556
7555
|
n.contentEditable = "false", n.wasDraggable && (n.draggable = !0, n.wasDraggable = null);
|
|
7557
7556
|
}
|
|
7558
7557
|
function Qa(n) {
|
|
@@ -7570,22 +7569,22 @@ function ec(n) {
|
|
|
7570
7569
|
if (!e)
|
|
7571
7570
|
return;
|
|
7572
7571
|
let r = n.cursorWrapper.dom, i = r.nodeName == "IMG";
|
|
7573
|
-
i ? t.setStart(r.parentNode,
|
|
7572
|
+
i ? t.setStart(r.parentNode, P(r) + 1) : t.setStart(r, 0), t.collapse(!0), e.removeAllRanges(), e.addRange(t), !i && !n.state.selection.visible && U && Ee <= 11 && (r.disabled = !0, r.disabled = !1);
|
|
7574
7573
|
}
|
|
7575
7574
|
function ro(n, e) {
|
|
7576
|
-
if (e instanceof
|
|
7575
|
+
if (e instanceof k) {
|
|
7577
7576
|
let t = n.docView.descAt(e.from);
|
|
7578
|
-
t != n.lastSelectedViewDesc && (
|
|
7577
|
+
t != n.lastSelectedViewDesc && (hi(n), t && t.selectNode(), n.lastSelectedViewDesc = t);
|
|
7579
7578
|
} else
|
|
7580
|
-
|
|
7579
|
+
hi(n);
|
|
7581
7580
|
}
|
|
7582
|
-
function
|
|
7581
|
+
function hi(n) {
|
|
7583
7582
|
n.lastSelectedViewDesc && (n.lastSelectedViewDesc.parent && n.lastSelectedViewDesc.deselectNode(), n.lastSelectedViewDesc = void 0);
|
|
7584
7583
|
}
|
|
7585
|
-
function
|
|
7584
|
+
function yr(n, e, t, r) {
|
|
7586
7585
|
return n.someProp("createSelectionBetween", (i) => i(n, e, t)) || C.between(e, t, r);
|
|
7587
7586
|
}
|
|
7588
|
-
function
|
|
7587
|
+
function di(n) {
|
|
7589
7588
|
return n.editable && !n.hasFocus() ? !1 : io(n);
|
|
7590
7589
|
}
|
|
7591
7590
|
function io(n) {
|
|
@@ -7600,16 +7599,16 @@ function io(n) {
|
|
|
7600
7599
|
}
|
|
7601
7600
|
function tc(n) {
|
|
7602
7601
|
let e = n.docView.domFromPos(n.state.selection.anchor, 0), t = n.domSelectionRange();
|
|
7603
|
-
return
|
|
7602
|
+
return Ge(e.node, e.offset, t.anchorNode, t.anchorOffset);
|
|
7604
7603
|
}
|
|
7605
|
-
function
|
|
7604
|
+
function er(n, e) {
|
|
7606
7605
|
let { $anchor: t, $head: r } = n.selection, i = e > 0 ? t.max(r) : t.min(r), s = i.parent.inlineContent ? i.depth ? n.doc.resolve(e > 0 ? i.after() : i.before()) : null : i;
|
|
7607
7606
|
return s && S.findFrom(s, e);
|
|
7608
7607
|
}
|
|
7609
7608
|
function we(n, e) {
|
|
7610
7609
|
return n.dispatch(n.state.tr.setSelection(e).scrollIntoView()), !0;
|
|
7611
7610
|
}
|
|
7612
|
-
function
|
|
7611
|
+
function ui(n, e, t) {
|
|
7613
7612
|
let r = n.state.selection;
|
|
7614
7613
|
if (r instanceof C)
|
|
7615
7614
|
if (t.indexOf("s") > -1) {
|
|
@@ -7620,21 +7619,21 @@ function di(n, e, t) {
|
|
|
7620
7619
|
return we(n, new C(r.$anchor, o));
|
|
7621
7620
|
} else if (r.empty) {
|
|
7622
7621
|
if (n.endOfTextblock(e > 0 ? "forward" : "backward")) {
|
|
7623
|
-
let i =
|
|
7624
|
-
return i && i instanceof
|
|
7622
|
+
let i = er(n.state, e);
|
|
7623
|
+
return i && i instanceof k ? we(n, i) : !1;
|
|
7625
7624
|
} else if (!(Z && t.indexOf("m") > -1)) {
|
|
7626
7625
|
let i = r.$head, s = i.textOffset ? null : e < 0 ? i.nodeBefore : i.nodeAfter, o;
|
|
7627
7626
|
if (!s || s.isText)
|
|
7628
7627
|
return !1;
|
|
7629
7628
|
let l = e < 0 ? i.pos - s.nodeSize : i.pos;
|
|
7630
|
-
return s.isAtom || (o = n.docView.descAt(l)) && !o.contentDOM ?
|
|
7629
|
+
return s.isAtom || (o = n.docView.descAt(l)) && !o.contentDOM ? k.isSelectable(s) ? we(n, new k(e < 0 ? n.state.doc.resolve(i.pos - s.nodeSize) : i)) : zt ? we(n, new C(n.state.doc.resolve(e < 0 ? l : l + s.nodeSize))) : !1 : !1;
|
|
7631
7630
|
}
|
|
7632
7631
|
} else return !1;
|
|
7633
7632
|
else {
|
|
7634
|
-
if (r instanceof
|
|
7633
|
+
if (r instanceof k && r.node.isInline)
|
|
7635
7634
|
return we(n, new C(e > 0 ? r.$to : r.$from));
|
|
7636
7635
|
{
|
|
7637
|
-
let i =
|
|
7636
|
+
let i = er(n.state, e);
|
|
7638
7637
|
return i ? we(n, i) : !1;
|
|
7639
7638
|
}
|
|
7640
7639
|
}
|
|
@@ -7673,7 +7672,7 @@ function nc(n) {
|
|
|
7673
7672
|
{
|
|
7674
7673
|
let l = t.previousSibling;
|
|
7675
7674
|
for (; l && Ct(l, -1); )
|
|
7676
|
-
i = t.parentNode, s =
|
|
7675
|
+
i = t.parentNode, s = P(l), l = l.previousSibling;
|
|
7677
7676
|
if (l)
|
|
7678
7677
|
t = l, r = on(t);
|
|
7679
7678
|
else {
|
|
@@ -7683,7 +7682,7 @@ function nc(n) {
|
|
|
7683
7682
|
}
|
|
7684
7683
|
}
|
|
7685
7684
|
}
|
|
7686
|
-
o ?
|
|
7685
|
+
o ? tr(n, t, r) : i && tr(n, i, s);
|
|
7687
7686
|
}
|
|
7688
7687
|
function rc(n) {
|
|
7689
7688
|
let e = n.domSelectionRange(), t = e.focusNode, r = e.focusOffset;
|
|
@@ -7705,7 +7704,7 @@ function rc(n) {
|
|
|
7705
7704
|
{
|
|
7706
7705
|
let l = t.nextSibling;
|
|
7707
7706
|
for (; l && Ct(l, 1); )
|
|
7708
|
-
s = l.parentNode, o =
|
|
7707
|
+
s = l.parentNode, o = P(l) + 1, l = l.nextSibling;
|
|
7709
7708
|
if (l)
|
|
7710
7709
|
t = l, r = 0, i = on(t);
|
|
7711
7710
|
else {
|
|
@@ -7715,7 +7714,7 @@ function rc(n) {
|
|
|
7715
7714
|
}
|
|
7716
7715
|
}
|
|
7717
7716
|
}
|
|
7718
|
-
s &&
|
|
7717
|
+
s && tr(n, s, o);
|
|
7719
7718
|
}
|
|
7720
7719
|
function so(n) {
|
|
7721
7720
|
let e = n.pmViewDesc;
|
|
@@ -7723,7 +7722,7 @@ function so(n) {
|
|
|
7723
7722
|
}
|
|
7724
7723
|
function ic(n, e) {
|
|
7725
7724
|
for (; n && e == n.childNodes.length && !vt(n); )
|
|
7726
|
-
e =
|
|
7725
|
+
e = P(n) + 1, n = n.parentNode;
|
|
7727
7726
|
for (; n && e < n.childNodes.length; ) {
|
|
7728
7727
|
let t = n.childNodes[e];
|
|
7729
7728
|
if (t.nodeType == 3)
|
|
@@ -7735,7 +7734,7 @@ function ic(n, e) {
|
|
|
7735
7734
|
}
|
|
7736
7735
|
function sc(n, e) {
|
|
7737
7736
|
for (; n && !e && !vt(n); )
|
|
7738
|
-
e =
|
|
7737
|
+
e = P(n), n = n.parentNode;
|
|
7739
7738
|
for (; n && e; ) {
|
|
7740
7739
|
let t = n.childNodes[e - 1];
|
|
7741
7740
|
if (t.nodeType == 3)
|
|
@@ -7745,7 +7744,7 @@ function sc(n, e) {
|
|
|
7745
7744
|
n = t, e = n.childNodes.length;
|
|
7746
7745
|
}
|
|
7747
7746
|
}
|
|
7748
|
-
function
|
|
7747
|
+
function tr(n, e, t) {
|
|
7749
7748
|
if (e.nodeType != 3) {
|
|
7750
7749
|
let s, o;
|
|
7751
7750
|
(o = ic(e, t)) ? (e = o, t = 0) : (s = sc(e, t)) && (e = s, t = s.nodeValue.length);
|
|
@@ -7763,9 +7762,9 @@ function er(n, e, t) {
|
|
|
7763
7762
|
n.state == i && ye(n);
|
|
7764
7763
|
}, 50);
|
|
7765
7764
|
}
|
|
7766
|
-
function
|
|
7765
|
+
function pi(n, e) {
|
|
7767
7766
|
let t = n.state.doc.resolve(e);
|
|
7768
|
-
if (!(
|
|
7767
|
+
if (!($ || Ta) && t.parent.inlineContent) {
|
|
7769
7768
|
let i = n.coordsAtPos(e);
|
|
7770
7769
|
if (e > t.start()) {
|
|
7771
7770
|
let s = n.coordsAtPos(e - 1), o = (s.top + s.bottom) / 2;
|
|
@@ -7780,14 +7779,14 @@ function ui(n, e) {
|
|
|
7780
7779
|
}
|
|
7781
7780
|
return getComputedStyle(n.dom).direction == "rtl" ? "rtl" : "ltr";
|
|
7782
7781
|
}
|
|
7783
|
-
function
|
|
7782
|
+
function mi(n, e, t) {
|
|
7784
7783
|
let r = n.state.selection;
|
|
7785
7784
|
if (r instanceof C && !r.empty || t.indexOf("s") > -1 || Z && t.indexOf("m") > -1)
|
|
7786
7785
|
return !1;
|
|
7787
7786
|
let { $from: i, $to: s } = r;
|
|
7788
7787
|
if (!i.parent.inlineContent || n.endOfTextblock(e < 0 ? "up" : "down")) {
|
|
7789
|
-
let o =
|
|
7790
|
-
if (o && o instanceof
|
|
7788
|
+
let o = er(n.state, e);
|
|
7789
|
+
if (o && o instanceof k)
|
|
7791
7790
|
return we(n, o);
|
|
7792
7791
|
}
|
|
7793
7792
|
if (!i.parent.inlineContent) {
|
|
@@ -7796,7 +7795,7 @@ function pi(n, e, t) {
|
|
|
7796
7795
|
}
|
|
7797
7796
|
return !1;
|
|
7798
7797
|
}
|
|
7799
|
-
function
|
|
7798
|
+
function gi(n, e) {
|
|
7800
7799
|
if (!(n.state.selection instanceof C))
|
|
7801
7800
|
return !0;
|
|
7802
7801
|
let { $head: t, $anchor: r, empty: i } = n.state.selection;
|
|
@@ -7813,7 +7812,7 @@ function mi(n, e) {
|
|
|
7813
7812
|
}
|
|
7814
7813
|
return !1;
|
|
7815
7814
|
}
|
|
7816
|
-
function
|
|
7815
|
+
function yi(n, e, t) {
|
|
7817
7816
|
n.domObserver.stop(), e.contentEditable = t, n.domObserver.start();
|
|
7818
7817
|
}
|
|
7819
7818
|
function oc(n) {
|
|
@@ -7822,7 +7821,7 @@ function oc(n) {
|
|
|
7822
7821
|
let { focusNode: e, focusOffset: t } = n.domSelectionRange();
|
|
7823
7822
|
if (e && e.nodeType == 1 && t == 0 && e.firstChild && e.firstChild.contentEditable == "false") {
|
|
7824
7823
|
let r = e.firstChild;
|
|
7825
|
-
|
|
7824
|
+
yi(n, r, "true"), setTimeout(() => yi(n, r, "false"), 20);
|
|
7826
7825
|
}
|
|
7827
7826
|
return !1;
|
|
7828
7827
|
}
|
|
@@ -7833,22 +7832,22 @@ function lc(n) {
|
|
|
7833
7832
|
function ac(n, e) {
|
|
7834
7833
|
let t = e.keyCode, r = lc(e);
|
|
7835
7834
|
if (t == 8 || Z && t == 72 && r == "c")
|
|
7836
|
-
return
|
|
7835
|
+
return gi(n, -1) || Ze(n, -1);
|
|
7837
7836
|
if (t == 46 && !e.shiftKey || Z && t == 68 && r == "c")
|
|
7838
|
-
return
|
|
7837
|
+
return gi(n, 1) || Ze(n, 1);
|
|
7839
7838
|
if (t == 13 || t == 27)
|
|
7840
7839
|
return !0;
|
|
7841
7840
|
if (t == 37 || Z && t == 66 && r == "c") {
|
|
7842
|
-
let i = t == 37 ?
|
|
7843
|
-
return
|
|
7841
|
+
let i = t == 37 ? pi(n, n.state.selection.from) == "ltr" ? -1 : 1 : -1;
|
|
7842
|
+
return ui(n, i, r) || Ze(n, i);
|
|
7844
7843
|
} else if (t == 39 || Z && t == 70 && r == "c") {
|
|
7845
|
-
let i = t == 39 ?
|
|
7846
|
-
return
|
|
7844
|
+
let i = t == 39 ? pi(n, n.state.selection.from) == "ltr" ? 1 : -1 : 1;
|
|
7845
|
+
return ui(n, i, r) || Ze(n, i);
|
|
7847
7846
|
} else {
|
|
7848
7847
|
if (t == 38 || Z && t == 80 && r == "c")
|
|
7849
|
-
return
|
|
7848
|
+
return mi(n, -1, r) || Ze(n, -1);
|
|
7850
7849
|
if (t == 40 || Z && t == 78 && r == "c")
|
|
7851
|
-
return oc(n) ||
|
|
7850
|
+
return oc(n) || mi(n, 1, r) || Ze(n, 1);
|
|
7852
7851
|
if (r == (Z ? "m" : "c") && (t == 66 || t == 73 || t == 89 || t == 90))
|
|
7853
7852
|
return !0;
|
|
7854
7853
|
}
|
|
@@ -7891,8 +7890,8 @@ function lo(n, e, t, r, i) {
|
|
|
7891
7890
|
if (n.someProp("transformPastedText", (d) => {
|
|
7892
7891
|
e = d(e, s || r, n);
|
|
7893
7892
|
}), s)
|
|
7894
|
-
return e ? new
|
|
7895
|
-
`))), 0, 0) :
|
|
7893
|
+
return e ? new x(y.from(n.state.schema.text(e.replace(/\r\n?/g, `
|
|
7894
|
+
`))), 0, 0) : x.empty;
|
|
7896
7895
|
let h = n.someProp("clipboardTextParser", (d) => d(e, i, r, n));
|
|
7897
7896
|
if (h)
|
|
7898
7897
|
l = h;
|
|
@@ -7924,14 +7923,14 @@ function lo(n, e, t, r, i) {
|
|
|
7924
7923
|
return d.nodeName == "BR" && !d.nextSibling && d.parentNode && !cc.test(d.parentNode.nodeName) ? { ignore: !0 } : null;
|
|
7925
7924
|
}
|
|
7926
7925
|
})), f)
|
|
7927
|
-
l = pc(
|
|
7928
|
-
else if (l =
|
|
7926
|
+
l = pc(bi(l, +f[1], +f[2]), f[4]);
|
|
7927
|
+
else if (l = x.maxOpen(fc(l.content, i), !0), l.openStart || l.openEnd) {
|
|
7929
7928
|
let h = 0, d = 0;
|
|
7930
7929
|
for (let u = l.content.firstChild; h < l.openStart && !u.type.spec.isolating; h++, u = u.firstChild)
|
|
7931
7930
|
;
|
|
7932
7931
|
for (let u = l.content.lastChild; d < l.openEnd && !u.type.spec.isolating; d++, u = u.lastChild)
|
|
7933
7932
|
;
|
|
7934
|
-
l =
|
|
7933
|
+
l = bi(l, h, d);
|
|
7935
7934
|
}
|
|
7936
7935
|
return n.someProp("transformPasted", (h) => {
|
|
7937
7936
|
l = h(l, n);
|
|
@@ -7981,12 +7980,12 @@ function fo(n, e) {
|
|
|
7981
7980
|
let t = n.content.replaceChild(n.childCount - 1, fo(n.lastChild, e - 1)), r = n.contentMatchAt(n.childCount).fillBefore(y.empty, !0);
|
|
7982
7981
|
return n.copy(t.append(r));
|
|
7983
7982
|
}
|
|
7984
|
-
function
|
|
7983
|
+
function nr(n, e, t, r, i, s) {
|
|
7985
7984
|
let o = e < 0 ? n.firstChild : n.lastChild, l = o.content;
|
|
7986
|
-
return n.childCount > 1 && (s = 0), i < r - 1 && (l =
|
|
7985
|
+
return n.childCount > 1 && (s = 0), i < r - 1 && (l = nr(l, e, t, r, i + 1, s)), i >= t && (l = e < 0 ? o.contentMatchAt(0).fillBefore(l, s <= i).append(l) : l.append(o.contentMatchAt(o.childCount).fillBefore(y.empty, !0))), n.replaceChild(e < 0 ? 0 : n.childCount - 1, o.copy(l));
|
|
7987
7986
|
}
|
|
7988
|
-
function
|
|
7989
|
-
return e < n.openStart && (n = new
|
|
7987
|
+
function bi(n, e, t) {
|
|
7988
|
+
return e < n.openStart && (n = new x(nr(n.content, -1, e, n.openStart, 0, n.openEnd), e, n.openEnd)), t < n.openEnd && (n = new x(nr(n.content, 1, t, n.openEnd, 0, 0), n.openStart, t)), n;
|
|
7990
7989
|
}
|
|
7991
7990
|
const ho = {
|
|
7992
7991
|
thead: ["table"],
|
|
@@ -7999,9 +7998,9 @@ const ho = {
|
|
|
7999
7998
|
td: ["table", "tbody", "tr"],
|
|
8000
7999
|
th: ["table", "tbody", "tr"]
|
|
8001
8000
|
};
|
|
8002
|
-
let
|
|
8001
|
+
let xi = null;
|
|
8003
8002
|
function uo() {
|
|
8004
|
-
return
|
|
8003
|
+
return xi || (xi = document.implementation.createHTMLDocument("title"));
|
|
8005
8004
|
}
|
|
8006
8005
|
let Pn = null;
|
|
8007
8006
|
function hc(n) {
|
|
@@ -8018,7 +8017,7 @@ function dc(n) {
|
|
|
8018
8017
|
return t;
|
|
8019
8018
|
}
|
|
8020
8019
|
function uc(n) {
|
|
8021
|
-
let e = n.querySelectorAll(
|
|
8020
|
+
let e = n.querySelectorAll($ ? "span:not([class]):not([style])" : "span.Apple-converted-space");
|
|
8022
8021
|
for (let t = 0; t < e.length; t++) {
|
|
8023
8022
|
let r = e[t];
|
|
8024
8023
|
r.childNodes.length == 1 && r.textContent == " " && r.parentNode && r.parentNode.replaceChild(n.ownerDocument.createTextNode(" "), r);
|
|
@@ -8040,7 +8039,7 @@ function pc(n, e) {
|
|
|
8040
8039
|
break;
|
|
8041
8040
|
i = y.from(a.create(r[l + 1], i)), s++, o++;
|
|
8042
8041
|
}
|
|
8043
|
-
return new
|
|
8042
|
+
return new x(i, s, o);
|
|
8044
8043
|
}
|
|
8045
8044
|
const q = {}, K = {}, mc = { touchstart: !0, touchmove: !0 };
|
|
8046
8045
|
class gc {
|
|
@@ -8052,10 +8051,10 @@ function yc(n) {
|
|
|
8052
8051
|
for (let e in q) {
|
|
8053
8052
|
let t = q[e];
|
|
8054
8053
|
n.dom.addEventListener(e, n.input.eventHandlers[e] = (r) => {
|
|
8055
|
-
|
|
8054
|
+
xc(n, r) && !br(n, r) && (n.editable || !(r.type in K)) && t(n, r);
|
|
8056
8055
|
}, mc[e] ? { passive: !0 } : void 0);
|
|
8057
8056
|
}
|
|
8058
|
-
J && n.dom.addEventListener("input", () => null),
|
|
8057
|
+
J && n.dom.addEventListener("input", () => null), rr(n);
|
|
8059
8058
|
}
|
|
8060
8059
|
function De(n, e) {
|
|
8061
8060
|
n.input.lastSelectionOrigin = e, n.input.lastSelectionTime = Date.now();
|
|
@@ -8066,19 +8065,19 @@ function bc(n) {
|
|
|
8066
8065
|
n.dom.removeEventListener(e, n.input.eventHandlers[e]);
|
|
8067
8066
|
clearTimeout(n.input.composingTimeout), clearTimeout(n.input.lastIOSEnterFallbackTimeout);
|
|
8068
8067
|
}
|
|
8069
|
-
function
|
|
8068
|
+
function rr(n) {
|
|
8070
8069
|
n.someProp("handleDOMEvents", (e) => {
|
|
8071
8070
|
for (let t in e)
|
|
8072
|
-
n.input.eventHandlers[t] || n.dom.addEventListener(t, n.input.eventHandlers[t] = (r) =>
|
|
8071
|
+
n.input.eventHandlers[t] || n.dom.addEventListener(t, n.input.eventHandlers[t] = (r) => br(n, r));
|
|
8073
8072
|
});
|
|
8074
8073
|
}
|
|
8075
|
-
function
|
|
8074
|
+
function br(n, e) {
|
|
8076
8075
|
return n.someProp("handleDOMEvents", (t) => {
|
|
8077
8076
|
let r = t[e.type];
|
|
8078
8077
|
return r ? r(n, e) || e.defaultPrevented : !1;
|
|
8079
8078
|
});
|
|
8080
8079
|
}
|
|
8081
|
-
function
|
|
8080
|
+
function xc(n, e) {
|
|
8082
8081
|
if (!e.bubbles)
|
|
8083
8082
|
return !0;
|
|
8084
8083
|
if (e.defaultPrevented)
|
|
@@ -8088,12 +8087,12 @@ function kc(n, e) {
|
|
|
8088
8087
|
return !1;
|
|
8089
8088
|
return !0;
|
|
8090
8089
|
}
|
|
8091
|
-
function
|
|
8092
|
-
!
|
|
8090
|
+
function kc(n, e) {
|
|
8091
|
+
!br(n, e) && q[e.type] && (n.editable || !(e.type in K)) && q[e.type](n, e);
|
|
8093
8092
|
}
|
|
8094
8093
|
K.keydown = (n, e) => {
|
|
8095
8094
|
let t = e;
|
|
8096
|
-
if (n.input.shiftKey = t.keyCode == 16 || t.shiftKey, !mo(n, t) && (n.input.lastKeyCode = t.keyCode, n.input.lastKeyCodeTime = Date.now(), !(ne &&
|
|
8095
|
+
if (n.input.shiftKey = t.keyCode == 16 || t.shiftKey, !mo(n, t) && (n.input.lastKeyCode = t.keyCode, n.input.lastKeyCodeTime = Date.now(), !(ne && $ && t.keyCode == 13)))
|
|
8097
8096
|
if (t.keyCode != 229 && n.domObserver.forceFlush(), ft && t.keyCode == 13 && !t.ctrlKey && !t.altKey && !t.metaKey) {
|
|
8098
8097
|
let r = Date.now();
|
|
8099
8098
|
n.input.lastIOSEnter = r, n.input.lastIOSEnterFallbackTimeout = setTimeout(() => {
|
|
@@ -8125,7 +8124,7 @@ function Sc(n, e) {
|
|
|
8125
8124
|
let t = e.x - n.clientX, r = e.y - n.clientY;
|
|
8126
8125
|
return t * t + r * r < 100;
|
|
8127
8126
|
}
|
|
8128
|
-
function
|
|
8127
|
+
function xr(n, e, t, r, i) {
|
|
8129
8128
|
if (r == -1)
|
|
8130
8129
|
return !1;
|
|
8131
8130
|
let s = n.state.doc.resolve(r);
|
|
@@ -8144,31 +8143,31 @@ function Cc(n, e) {
|
|
|
8144
8143
|
if (e == -1)
|
|
8145
8144
|
return !1;
|
|
8146
8145
|
let t = n.state.doc.resolve(e), r = t.nodeAfter;
|
|
8147
|
-
return r && r.isAtom &&
|
|
8146
|
+
return r && r.isAtom && k.isSelectable(r) ? (st(n, new k(t)), !0) : !1;
|
|
8148
8147
|
}
|
|
8149
8148
|
function wc(n, e) {
|
|
8150
8149
|
if (e == -1)
|
|
8151
8150
|
return !1;
|
|
8152
8151
|
let t = n.state.selection, r, i;
|
|
8153
|
-
t instanceof
|
|
8152
|
+
t instanceof k && (r = t.node);
|
|
8154
8153
|
let s = n.state.doc.resolve(e);
|
|
8155
8154
|
for (let o = s.depth + 1; o > 0; o--) {
|
|
8156
8155
|
let l = o > s.depth ? s.nodeAfter : s.node(o);
|
|
8157
|
-
if (
|
|
8156
|
+
if (k.isSelectable(l)) {
|
|
8158
8157
|
r && t.$from.depth > 0 && o >= t.$from.depth && s.before(t.$from.depth + 1) == t.$from.pos ? i = s.before(t.$from.depth) : i = s.before(o);
|
|
8159
8158
|
break;
|
|
8160
8159
|
}
|
|
8161
8160
|
}
|
|
8162
|
-
return i != null ? (st(n,
|
|
8161
|
+
return i != null ? (st(n, k.create(n.state.doc, i)), !0) : !1;
|
|
8163
8162
|
}
|
|
8164
8163
|
function Mc(n, e, t, r, i) {
|
|
8165
|
-
return
|
|
8164
|
+
return xr(n, "handleClickOn", e, t, r) || n.someProp("handleClick", (s) => s(n, e, r)) || (i ? wc(n, t) : Cc(n, t));
|
|
8166
8165
|
}
|
|
8167
8166
|
function Oc(n, e, t, r) {
|
|
8168
|
-
return
|
|
8167
|
+
return xr(n, "handleDoubleClickOn", e, t, r) || n.someProp("handleDoubleClick", (i) => i(n, e, r));
|
|
8169
8168
|
}
|
|
8170
8169
|
function Nc(n, e, t, r) {
|
|
8171
|
-
return
|
|
8170
|
+
return xr(n, "handleTripleClickOn", e, t, r) || n.someProp("handleTripleClick", (i) => i(n, e, r)) || Tc(n, t, r);
|
|
8172
8171
|
}
|
|
8173
8172
|
function Tc(n, e, t) {
|
|
8174
8173
|
if (t.button != 0)
|
|
@@ -8181,8 +8180,8 @@ function Tc(n, e, t) {
|
|
|
8181
8180
|
let o = s > i.depth ? i.nodeAfter : i.node(s), l = i.before(s);
|
|
8182
8181
|
if (o.inlineContent)
|
|
8183
8182
|
st(n, C.create(r, l + 1, l + 1 + o.content.size));
|
|
8184
|
-
else if (
|
|
8185
|
-
st(n,
|
|
8183
|
+
else if (k.isSelectable(o))
|
|
8184
|
+
st(n, k.create(r, l));
|
|
8186
8185
|
else
|
|
8187
8186
|
continue;
|
|
8188
8187
|
return !0;
|
|
@@ -8213,7 +8212,7 @@ class Ac {
|
|
|
8213
8212
|
const l = i ? null : r.target, a = l ? e.docView.nearestDesc(l, !0) : null;
|
|
8214
8213
|
this.target = a && a.dom.nodeType == 1 ? a.dom : null;
|
|
8215
8214
|
let { selection: c } = e.state;
|
|
8216
|
-
(r.button == 0 && s.type.spec.draggable && s.type.spec.selectable !== !1 || c instanceof
|
|
8215
|
+
(r.button == 0 && s.type.spec.draggable && s.type.spec.selectable !== !1 || c instanceof k && c.from <= o && c.to > o) && (this.mightDrag = {
|
|
8217
8216
|
node: s,
|
|
8218
8217
|
pos: o,
|
|
8219
8218
|
addAttr: !!(this.target && !this.target.draggable),
|
|
@@ -8237,7 +8236,7 @@ class Ac {
|
|
|
8237
8236
|
// (hidden) cursor is doesn't change the selection, and
|
|
8238
8237
|
// thus doesn't get a reaction from ProseMirror. This
|
|
8239
8238
|
// works around that.
|
|
8240
|
-
|
|
8239
|
+
$ && !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) ? (st(this.view, S.near(this.view.state.doc.resolve(t.pos))), e.preventDefault()) : De(this.view, "pointer");
|
|
8241
8240
|
}
|
|
8242
8241
|
move(e) {
|
|
8243
8242
|
this.updateAllowDefault(e), De(this.view, "pointer"), e.buttons == 0 && this.done();
|
|
@@ -8317,7 +8316,7 @@ function Rc() {
|
|
|
8317
8316
|
function ln(n, e = !1) {
|
|
8318
8317
|
if (!(ne && n.domObserver.flushingSoon >= 0)) {
|
|
8319
8318
|
if (n.domObserver.forceFlush(), yo(n), e || n.docView && n.docView.dirty) {
|
|
8320
|
-
let t =
|
|
8319
|
+
let t = gr(n);
|
|
8321
8320
|
return t && !t.eq(n.state.selection) ? n.dispatch(n.state.tr.setSelection(t)) : (n.markCursor || e) && !n.state.selection.empty ? n.dispatch(n.state.tr.deleteSelection()) : n.updateState(n.state), !0;
|
|
8322
8321
|
}
|
|
8323
8322
|
return !1;
|
|
@@ -8356,7 +8355,7 @@ function zc(n, e) {
|
|
|
8356
8355
|
}
|
|
8357
8356
|
function Dt(n, e, t, r, i) {
|
|
8358
8357
|
let s = lo(n, e, t, r, n.state.selection.$from);
|
|
8359
|
-
if (n.someProp("handlePaste", (a) => a(n, i, s ||
|
|
8358
|
+
if (n.someProp("handlePaste", (a) => a(n, i, s || x.empty)))
|
|
8360
8359
|
return !0;
|
|
8361
8360
|
if (!s)
|
|
8362
8361
|
return !1;
|
|
@@ -8377,27 +8376,27 @@ K.paste = (n, e) => {
|
|
|
8377
8376
|
let r = At ? null : t.clipboardData, i = n.input.shiftKey && n.input.lastKeyCode != 45;
|
|
8378
8377
|
r && Dt(n, bo(r), r.getData("text/html"), i, t) ? t.preventDefault() : zc(n, t);
|
|
8379
8378
|
};
|
|
8380
|
-
class
|
|
8379
|
+
class xo {
|
|
8381
8380
|
constructor(e, t, r) {
|
|
8382
8381
|
this.slice = e, this.move = t, this.node = r;
|
|
8383
8382
|
}
|
|
8384
8383
|
}
|
|
8385
|
-
const
|
|
8384
|
+
const ko = Z ? "altKey" : "ctrlKey";
|
|
8386
8385
|
q.dragstart = (n, e) => {
|
|
8387
8386
|
let t = e, r = n.input.mouseDown;
|
|
8388
8387
|
if (r && r.done(), !t.dataTransfer)
|
|
8389
8388
|
return;
|
|
8390
8389
|
let i = n.state.selection, s = i.empty ? null : n.posAtCoords(bn(t)), o;
|
|
8391
|
-
if (!(s && s.pos >= i.from && s.pos <= (i instanceof
|
|
8390
|
+
if (!(s && s.pos >= i.from && s.pos <= (i instanceof k ? i.to - 1 : i.to))) {
|
|
8392
8391
|
if (r && r.mightDrag)
|
|
8393
|
-
o =
|
|
8392
|
+
o = k.create(n.state.doc, r.mightDrag.pos);
|
|
8394
8393
|
else if (t.target && t.target.nodeType == 1) {
|
|
8395
8394
|
let h = n.docView.nearestDesc(t.target, !0);
|
|
8396
|
-
h && h.node.type.spec.draggable && h != n.docView && (o =
|
|
8395
|
+
h && h.node.type.spec.draggable && h != n.docView && (o = k.create(n.state.doc, h.posBefore));
|
|
8397
8396
|
}
|
|
8398
8397
|
}
|
|
8399
8398
|
let l = (o || n.state.selection).content(), { dom: a, text: c, slice: f } = oo(n, l);
|
|
8400
|
-
(!t.dataTransfer.files.length ||
|
|
8399
|
+
(!t.dataTransfer.files.length || !$ || qs > 120) && t.dataTransfer.clearData(), t.dataTransfer.setData(At ? "Text" : "text/html", a.innerHTML), t.dataTransfer.effectAllowed = "copyMove", At || t.dataTransfer.setData("text/plain", c), n.dragging = new xo(f, !t[ko], o);
|
|
8401
8400
|
};
|
|
8402
8401
|
q.dragend = (n) => {
|
|
8403
8402
|
let e = n.dragging;
|
|
@@ -8417,8 +8416,8 @@ K.drop = (n, e) => {
|
|
|
8417
8416
|
o ? n.someProp("transformPasted", (p) => {
|
|
8418
8417
|
o = p(o, n);
|
|
8419
8418
|
}) : o = lo(n, bo(t.dataTransfer), At ? null : t.dataTransfer.getData("text/html"), !1, s);
|
|
8420
|
-
let l = !!(r && !t[
|
|
8421
|
-
if (n.someProp("handleDrop", (p) => p(n, t, o ||
|
|
8419
|
+
let l = !!(r && !t[ko]);
|
|
8420
|
+
if (n.someProp("handleDrop", (p) => p(n, t, o || x.empty, l))) {
|
|
8422
8421
|
t.preventDefault();
|
|
8423
8422
|
return;
|
|
8424
8423
|
}
|
|
@@ -8436,11 +8435,11 @@ K.drop = (n, e) => {
|
|
|
8436
8435
|
if (h ? c.replaceRangeWith(f, f, o.content.firstChild) : c.replaceRange(f, f, o), c.doc.eq(d))
|
|
8437
8436
|
return;
|
|
8438
8437
|
let u = c.doc.resolve(f);
|
|
8439
|
-
if (h &&
|
|
8440
|
-
c.setSelection(new
|
|
8438
|
+
if (h && k.isSelectable(o.content.firstChild) && u.nodeAfter && u.nodeAfter.sameMarkup(o.content.firstChild))
|
|
8439
|
+
c.setSelection(new k(u));
|
|
8441
8440
|
else {
|
|
8442
8441
|
let p = c.mapping.map(a);
|
|
8443
|
-
c.mapping.maps[c.mapping.maps.length - 1].forEach((m, g, b, w) => p = w), c.setSelection(
|
|
8442
|
+
c.mapping.maps[c.mapping.maps.length - 1].forEach((m, g, b, w) => p = w), c.setSelection(yr(n, u, c.doc.resolve(p)));
|
|
8444
8443
|
}
|
|
8445
8444
|
n.focus(), n.dispatch(c.setMeta("uiEvent", "drop"));
|
|
8446
8445
|
};
|
|
@@ -8454,7 +8453,7 @@ q.blur = (n, e) => {
|
|
|
8454
8453
|
n.focused && (n.domObserver.stop(), n.dom.classList.remove("ProseMirror-focused"), n.domObserver.start(), t.relatedTarget && n.dom.contains(t.relatedTarget) && n.domObserver.currentSelection.clear(), n.focused = !1);
|
|
8455
8454
|
};
|
|
8456
8455
|
q.beforeinput = (n, e) => {
|
|
8457
|
-
if (
|
|
8456
|
+
if ($ && ne && e.inputType == "deleteContentBackward") {
|
|
8458
8457
|
n.domObserver.flushSoon();
|
|
8459
8458
|
let { domChangeCount: r } = n.input;
|
|
8460
8459
|
setTimeout(() => {
|
|
@@ -8516,7 +8515,7 @@ class Ie {
|
|
|
8516
8515
|
destroy() {
|
|
8517
8516
|
}
|
|
8518
8517
|
}
|
|
8519
|
-
class
|
|
8518
|
+
class Sr {
|
|
8520
8519
|
constructor(e, t) {
|
|
8521
8520
|
this.attrs = e, this.spec = t || Ke;
|
|
8522
8521
|
}
|
|
@@ -8532,7 +8531,7 @@ class xr {
|
|
|
8532
8531
|
return i == t.from && !(s = e.child(r)).isText && i + s.nodeSize == t.to;
|
|
8533
8532
|
}
|
|
8534
8533
|
eq(e) {
|
|
8535
|
-
return this == e || e instanceof
|
|
8534
|
+
return this == e || e instanceof Sr && Et(this.attrs, e.attrs) && Et(this.spec, e.spec);
|
|
8536
8535
|
}
|
|
8537
8536
|
destroy() {
|
|
8538
8537
|
}
|
|
@@ -8586,7 +8585,7 @@ class j {
|
|
|
8586
8585
|
node, will receive the given attributes.
|
|
8587
8586
|
*/
|
|
8588
8587
|
static node(e, t, r, i) {
|
|
8589
|
-
return new j(e, t, new
|
|
8588
|
+
return new j(e, t, new Sr(r, i));
|
|
8590
8589
|
}
|
|
8591
8590
|
/**
|
|
8592
8591
|
The spec provided when creating this decoration. Can be useful
|
|
@@ -8622,7 +8621,7 @@ class A {
|
|
|
8622
8621
|
you must make a copy if you want need to preserve that.
|
|
8623
8622
|
*/
|
|
8624
8623
|
static create(e, t) {
|
|
8625
|
-
return t.length ? cn(t, e, 0, Ke) :
|
|
8624
|
+
return t.length ? cn(t, e, 0, Ke) : L;
|
|
8626
8625
|
}
|
|
8627
8626
|
/**
|
|
8628
8627
|
Find all decorations in this set which touch the given range
|
|
@@ -8652,7 +8651,7 @@ class A {
|
|
|
8652
8651
|
document.
|
|
8653
8652
|
*/
|
|
8654
8653
|
map(e, t, r) {
|
|
8655
|
-
return this ==
|
|
8654
|
+
return this == L || e.maps.length == 0 ? this : this.mapInner(e, t, 0, 0, r || Ke);
|
|
8656
8655
|
}
|
|
8657
8656
|
/**
|
|
8658
8657
|
@internal
|
|
@@ -8663,7 +8662,7 @@ class A {
|
|
|
8663
8662
|
let a = this.local[l].map(e, r, i);
|
|
8664
8663
|
a && a.type.valid(t, a) ? (o || (o = [])).push(a) : s.onRemove && s.onRemove(this.local[l].spec);
|
|
8665
8664
|
}
|
|
8666
|
-
return this.children.length ? Bc(this.children, o || [], e, t, r, i, s) : o ? new A(o.sort(je), et) :
|
|
8665
|
+
return this.children.length ? Bc(this.children, o || [], e, t, r, i, s) : o ? new A(o.sort(je), et) : L;
|
|
8667
8666
|
}
|
|
8668
8667
|
/**
|
|
8669
8668
|
Add the given array of decorations to the ones in the set,
|
|
@@ -8672,7 +8671,7 @@ class A {
|
|
|
8672
8671
|
structure.
|
|
8673
8672
|
*/
|
|
8674
8673
|
add(e, t) {
|
|
8675
|
-
return t.length ? this ==
|
|
8674
|
+
return t.length ? this == L ? A.create(e, t) : this.addInner(e, t, 0) : this;
|
|
8676
8675
|
}
|
|
8677
8676
|
addInner(e, t, r) {
|
|
8678
8677
|
let i, s = 0;
|
|
@@ -8694,7 +8693,7 @@ class A {
|
|
|
8694
8693
|
the ones in the given array.
|
|
8695
8694
|
*/
|
|
8696
8695
|
remove(e) {
|
|
8697
|
-
return e.length == 0 || this ==
|
|
8696
|
+
return e.length == 0 || this == L ? this : this.removeInner(e, 0);
|
|
8698
8697
|
}
|
|
8699
8698
|
removeInner(e, t) {
|
|
8700
8699
|
let r = this.children, i = this.local;
|
|
@@ -8706,7 +8705,7 @@ class A {
|
|
|
8706
8705
|
continue;
|
|
8707
8706
|
r == this.children && (r = this.children.slice());
|
|
8708
8707
|
let c = r[s + 2].removeInner(o, l + 1);
|
|
8709
|
-
c !=
|
|
8708
|
+
c != L ? r[s + 2] = c : (r.splice(s, 3), s -= 3);
|
|
8710
8709
|
}
|
|
8711
8710
|
if (i.length) {
|
|
8712
8711
|
for (let s = 0, o; s < e.length; s++)
|
|
@@ -8714,10 +8713,10 @@ class A {
|
|
|
8714
8713
|
for (let l = 0; l < i.length; l++)
|
|
8715
8714
|
i[l].eq(o, t) && (i == this.local && (i = this.local.slice()), i.splice(l--, 1));
|
|
8716
8715
|
}
|
|
8717
|
-
return r == this.children && i == this.local ? this : i.length || r.length ? new A(i, r) :
|
|
8716
|
+
return r == this.children && i == this.local ? this : i.length || r.length ? new A(i, r) : L;
|
|
8718
8717
|
}
|
|
8719
8718
|
forChild(e, t) {
|
|
8720
|
-
if (this ==
|
|
8719
|
+
if (this == L)
|
|
8721
8720
|
return this;
|
|
8722
8721
|
if (t.isLeaf)
|
|
8723
8722
|
return A.empty;
|
|
@@ -8739,7 +8738,7 @@ class A {
|
|
|
8739
8738
|
let l = new A(i.sort(je), et);
|
|
8740
8739
|
return r ? new Oe([l, r]) : l;
|
|
8741
8740
|
}
|
|
8742
|
-
return r ||
|
|
8741
|
+
return r || L;
|
|
8743
8742
|
}
|
|
8744
8743
|
/**
|
|
8745
8744
|
@internal
|
|
@@ -8761,13 +8760,13 @@ class A {
|
|
|
8761
8760
|
@internal
|
|
8762
8761
|
*/
|
|
8763
8762
|
locals(e) {
|
|
8764
|
-
return
|
|
8763
|
+
return Cr(this.localsInner(e));
|
|
8765
8764
|
}
|
|
8766
8765
|
/**
|
|
8767
8766
|
@internal
|
|
8768
8767
|
*/
|
|
8769
8768
|
localsInner(e) {
|
|
8770
|
-
if (this ==
|
|
8769
|
+
if (this == L)
|
|
8771
8770
|
return et;
|
|
8772
8771
|
if (e.inlineContent || !this.local.some(Ie.is))
|
|
8773
8772
|
return this.local;
|
|
@@ -8781,8 +8780,8 @@ class A {
|
|
|
8781
8780
|
}
|
|
8782
8781
|
}
|
|
8783
8782
|
A.empty = new A([], []);
|
|
8784
|
-
A.removeOverlap =
|
|
8785
|
-
const
|
|
8783
|
+
A.removeOverlap = Cr;
|
|
8784
|
+
const L = A.empty;
|
|
8786
8785
|
class Oe {
|
|
8787
8786
|
constructor(e) {
|
|
8788
8787
|
this.members = e;
|
|
@@ -8797,7 +8796,7 @@ class Oe {
|
|
|
8797
8796
|
let r = [];
|
|
8798
8797
|
for (let i = 0; i < this.members.length; i++) {
|
|
8799
8798
|
let s = this.members[i].forChild(e, t);
|
|
8800
|
-
s !=
|
|
8799
|
+
s != L && (s instanceof Oe ? r = r.concat(s.members) : r.push(s));
|
|
8801
8800
|
}
|
|
8802
8801
|
return Oe.from(r);
|
|
8803
8802
|
}
|
|
@@ -8822,14 +8821,14 @@ class Oe {
|
|
|
8822
8821
|
t.push(s[o]);
|
|
8823
8822
|
}
|
|
8824
8823
|
}
|
|
8825
|
-
return t ?
|
|
8824
|
+
return t ? Cr(r ? t : t.sort(je)) : et;
|
|
8826
8825
|
}
|
|
8827
8826
|
// Create a group for the given array of decoration sets, or return
|
|
8828
8827
|
// a single set when possible.
|
|
8829
8828
|
static from(e) {
|
|
8830
8829
|
switch (e.length) {
|
|
8831
8830
|
case 0:
|
|
8832
|
-
return
|
|
8831
|
+
return L;
|
|
8833
8832
|
case 1:
|
|
8834
8833
|
return e[0];
|
|
8835
8834
|
default:
|
|
@@ -8851,8 +8850,8 @@ function Bc(n, e, t, r, i, s, o) {
|
|
|
8851
8850
|
let w = l[b + 1];
|
|
8852
8851
|
if (w < 0 || d > w + f - h)
|
|
8853
8852
|
continue;
|
|
8854
|
-
let
|
|
8855
|
-
u >=
|
|
8853
|
+
let O = l[b] + f - h;
|
|
8854
|
+
u >= O ? l[b + 1] = d <= O ? -2 : -1 : d >= f && g && (l[b] += g, l[b + 1] += g);
|
|
8856
8855
|
}
|
|
8857
8856
|
h += g;
|
|
8858
8857
|
}), f = t.maps[c].map(f, -1);
|
|
@@ -8872,7 +8871,7 @@ function Bc(n, e, t, r, i, s, o) {
|
|
|
8872
8871
|
let d = t.map(n[c + 1] + s, -1), u = d - i, { index: p, offset: m } = r.content.findIndex(h), g = r.maybeChild(p);
|
|
8873
8872
|
if (g && m == h && m + g.nodeSize == u) {
|
|
8874
8873
|
let b = l[c + 2].mapInner(t, g, f + 1, n[c] + s + 1, o);
|
|
8875
|
-
b !=
|
|
8874
|
+
b != L ? (l[c] = h, l[c + 1] = u, l[c + 2] = b) : (l[c + 1] = -2, a = !0);
|
|
8876
8875
|
} else
|
|
8877
8876
|
a = !0;
|
|
8878
8877
|
}
|
|
@@ -8934,18 +8933,18 @@ function cn(n, e, t, r) {
|
|
|
8934
8933
|
if (c) {
|
|
8935
8934
|
s = !0;
|
|
8936
8935
|
let f = cn(c, l, t + a + 1, r);
|
|
8937
|
-
f !=
|
|
8936
|
+
f != L && i.push(a, a + l.nodeSize, f);
|
|
8938
8937
|
}
|
|
8939
8938
|
});
|
|
8940
8939
|
let o = So(s ? wo(n) : n, -t).sort(je);
|
|
8941
8940
|
for (let l = 0; l < o.length; l++)
|
|
8942
8941
|
o[l].type.valid(e, o[l]) || (r.onRemove && r.onRemove(o[l].spec), o.splice(l--, 1));
|
|
8943
|
-
return o.length || i.length ? new A(o, i) :
|
|
8942
|
+
return o.length || i.length ? new A(o, i) : L;
|
|
8944
8943
|
}
|
|
8945
8944
|
function je(n, e) {
|
|
8946
8945
|
return n.from - e.from || n.to - e.to;
|
|
8947
8946
|
}
|
|
8948
|
-
function
|
|
8947
|
+
function Cr(n) {
|
|
8949
8948
|
let e = n;
|
|
8950
8949
|
for (let t = 0; t < e.length - 1; t++) {
|
|
8951
8950
|
let r = e[t];
|
|
@@ -8972,7 +8971,7 @@ function Fn(n) {
|
|
|
8972
8971
|
let e = [];
|
|
8973
8972
|
return n.someProp("decorations", (t) => {
|
|
8974
8973
|
let r = t(n.state);
|
|
8975
|
-
r && r !=
|
|
8974
|
+
r && r != L && e.push(r);
|
|
8976
8975
|
}), n.cursorWrapper && e.push(A.create(n.state.doc, [n.cursorWrapper.deco])), Oe.from(e);
|
|
8977
8976
|
}
|
|
8978
8977
|
const Pc = {
|
|
@@ -9040,12 +9039,12 @@ class Hc {
|
|
|
9040
9039
|
this.suppressingSelectionUpdates = !0, setTimeout(() => this.suppressingSelectionUpdates = !1, 50);
|
|
9041
9040
|
}
|
|
9042
9041
|
onSelectionChange() {
|
|
9043
|
-
if (
|
|
9042
|
+
if (di(this.view)) {
|
|
9044
9043
|
if (this.suppressingSelectionUpdates)
|
|
9045
9044
|
return ye(this.view);
|
|
9046
9045
|
if (U && Ee <= 11 && !this.view.state.selection.empty) {
|
|
9047
9046
|
let e = this.view.domSelectionRange();
|
|
9048
|
-
if (e.focusNode &&
|
|
9047
|
+
if (e.focusNode && Ge(e.focusNode, e.focusOffset, e.anchorNode, e.anchorOffset))
|
|
9049
9048
|
return this.flushSoon();
|
|
9050
9049
|
}
|
|
9051
9050
|
this.flush();
|
|
@@ -9084,7 +9083,7 @@ class Hc {
|
|
|
9084
9083
|
return;
|
|
9085
9084
|
let t = this.pendingRecords();
|
|
9086
9085
|
t.length && (this.queue = []);
|
|
9087
|
-
let r = e.domSelectionRange(), i = !this.suppressingSelectionUpdates && !this.currentSelection.eq(r) &&
|
|
9086
|
+
let r = e.domSelectionRange(), i = !this.suppressingSelectionUpdates && !this.currentSelection.eq(r) && di(e) && !this.ignoreSelectionChange(r), s = -1, o = -1, l = !1, a = [];
|
|
9088
9087
|
if (e.editable)
|
|
9089
9088
|
for (let f = 0; f < t.length; f++) {
|
|
9090
9089
|
let h = this.registerMutation(t[f], a);
|
|
@@ -9104,7 +9103,7 @@ class Hc {
|
|
|
9104
9103
|
}
|
|
9105
9104
|
}
|
|
9106
9105
|
let c = null;
|
|
9107
|
-
s < 0 && i && e.input.lastFocus > Date.now() - 200 && Math.max(e.input.lastTouch, e.input.lastClick.time) < Date.now() - 300 && gn(r) && (c =
|
|
9106
|
+
s < 0 && i && e.input.lastFocus > Date.now() - 200 && Math.max(e.input.lastTouch, e.input.lastClick.time) < Date.now() - 300 && gn(r) && (c = gr(e)) && c.eq(S.near(e.state.doc.resolve(0), 1)) ? (e.input.lastFocus = 0, ye(e), this.currentSelection.set(r), e.scrollToSelection()) : (s > -1 || i) && (s > -1 && (e.docView.markDirty(s, o), $c(e)), this.handleDOMChange(s, o, l, a), e.docView && e.docView.dirty ? e.updateState(e.state) : this.currentSelection.eq(r) || ye(e), this.currentSelection.set(r));
|
|
9108
9107
|
}
|
|
9109
9108
|
registerMutation(e, t) {
|
|
9110
9109
|
if (t.indexOf(e.target) > -1)
|
|
@@ -9126,7 +9125,7 @@ class Hc {
|
|
|
9126
9125
|
let { previousSibling: h, nextSibling: d } = e.addedNodes[f];
|
|
9127
9126
|
(!h || Array.prototype.indexOf.call(e.addedNodes, h) < 0) && (i = h), (!d || Array.prototype.indexOf.call(e.addedNodes, d) < 0) && (s = d);
|
|
9128
9127
|
}
|
|
9129
|
-
let o = i && i.parentNode == e.target ?
|
|
9128
|
+
let o = i && i.parentNode == e.target ? P(i) + 1 : 0, l = r.localPosFromDOM(e.target, o, -1), a = s && s.parentNode == e.target ? P(s) : e.target.childNodes.length, c = r.localPosFromDOM(e.target, a, 1);
|
|
9130
9129
|
return { from: l, to: c };
|
|
9131
9130
|
} else return e.type == "attributes" ? { from: r.posAtStart - r.border, to: r.posAtEnd + r.border } : (this.lastChangedTextNode = e.target, {
|
|
9132
9131
|
from: r.posAtStart,
|
|
@@ -9139,29 +9138,29 @@ class Hc {
|
|
|
9139
9138
|
});
|
|
9140
9139
|
}
|
|
9141
9140
|
}
|
|
9142
|
-
let
|
|
9141
|
+
let Si = /* @__PURE__ */ new WeakMap(), Ci = !1;
|
|
9143
9142
|
function $c(n) {
|
|
9144
|
-
if (!
|
|
9145
|
-
if (n.requiresGeckoHackNode = ie,
|
|
9143
|
+
if (!Si.has(n) && (Si.set(n, null), ["normal", "nowrap", "pre-line"].indexOf(getComputedStyle(n.dom).whiteSpace) !== -1)) {
|
|
9144
|
+
if (n.requiresGeckoHackNode = ie, Ci)
|
|
9146
9145
|
return;
|
|
9147
|
-
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."),
|
|
9146
|
+
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."), Ci = !0;
|
|
9148
9147
|
}
|
|
9149
9148
|
}
|
|
9150
|
-
function
|
|
9149
|
+
function wi(n, e) {
|
|
9151
9150
|
let t = e.startContainer, r = e.startOffset, i = e.endContainer, s = e.endOffset, o = n.domAtPos(n.state.selection.anchor);
|
|
9152
|
-
return
|
|
9151
|
+
return Ge(o.node, o.offset, i, s) && ([t, r, i, s] = [i, s, t, r]), { anchorNode: t, anchorOffset: r, focusNode: i, focusOffset: s };
|
|
9153
9152
|
}
|
|
9154
9153
|
function Wc(n, e) {
|
|
9155
9154
|
if (e.getComposedRanges) {
|
|
9156
9155
|
let i = e.getComposedRanges(n.root)[0];
|
|
9157
9156
|
if (i)
|
|
9158
|
-
return
|
|
9157
|
+
return wi(n, i);
|
|
9159
9158
|
}
|
|
9160
9159
|
let t;
|
|
9161
9160
|
function r(i) {
|
|
9162
9161
|
i.preventDefault(), i.stopImmediatePropagation(), t = i.getTargetRanges()[0];
|
|
9163
9162
|
}
|
|
9164
|
-
return n.dom.addEventListener("beforeinput", r, !0), document.execCommand("indent"), n.dom.removeEventListener("beforeinput", r, !0), t ?
|
|
9163
|
+
return n.dom.addEventListener("beforeinput", r, !0), document.execCommand("indent"), n.dom.removeEventListener("beforeinput", r, !0), t ? wi(n, t) : null;
|
|
9165
9164
|
}
|
|
9166
9165
|
function Jc(n, e) {
|
|
9167
9166
|
for (let t = e.parentNode; t && t != n.dom; t = t.parentNode) {
|
|
@@ -9173,7 +9172,7 @@ function Jc(n, e) {
|
|
|
9173
9172
|
}
|
|
9174
9173
|
function qc(n, e, t) {
|
|
9175
9174
|
let { node: r, fromOffset: i, toOffset: s, from: o, to: l } = n.docView.parseRange(e, t), a = n.domSelectionRange(), c, f = a.anchorNode;
|
|
9176
|
-
if (f && n.dom.contains(f.nodeType == 1 ? f : f.parentNode) && (c = [{ node: f, offset: a.anchorOffset }], gn(a) || c.push({ node: a.focusNode, offset: a.focusOffset })),
|
|
9175
|
+
if (f && n.dom.contains(f.nodeType == 1 ? f : f.parentNode) && (c = [{ node: f, offset: a.anchorOffset }], gn(a) || c.push({ node: a.focusNode, offset: a.focusOffset })), $ && n.input.lastKeyCode === 8)
|
|
9177
9176
|
for (let g = s; g > i; g--) {
|
|
9178
9177
|
let b = r.childNodes[g - 1], w = b.pmViewDesc;
|
|
9179
9178
|
if (b.nodeName == "BR" && !w) {
|
|
@@ -9218,11 +9217,11 @@ const jc = /^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|df
|
|
|
9218
9217
|
function Uc(n, e, t, r, i) {
|
|
9219
9218
|
let s = n.input.compositionPendingChanges || (n.composing ? n.input.compositionID : 0);
|
|
9220
9219
|
if (n.input.compositionPendingChanges = 0, e < 0) {
|
|
9221
|
-
let M = n.input.lastSelectionTime > Date.now() - 50 ? n.input.lastSelectionOrigin : null,
|
|
9222
|
-
if (
|
|
9223
|
-
if (
|
|
9220
|
+
let M = n.input.lastSelectionTime > Date.now() - 50 ? n.input.lastSelectionOrigin : null, ke = gr(n, M);
|
|
9221
|
+
if (ke && !n.state.selection.eq(ke)) {
|
|
9222
|
+
if ($ && ne && n.input.lastKeyCode === 13 && Date.now() - 100 < n.input.lastKeyCodeTime && n.someProp("handleKeyDown", (Ho) => Ho(n, Pe(13, "Enter"))))
|
|
9224
9223
|
return;
|
|
9225
|
-
let Pt = n.state.tr.setSelection(
|
|
9224
|
+
let Pt = n.state.tr.setSelection(ke);
|
|
9226
9225
|
M == "pointer" ? Pt.setMeta("pointer", !0) : M == "key" && Pt.scrollIntoView(), s && Pt.setMeta("composition", s), n.dispatch(Pt);
|
|
9227
9226
|
}
|
|
9228
9227
|
return;
|
|
@@ -9241,55 +9240,55 @@ function Uc(n, e, t, r, i) {
|
|
|
9241
9240
|
p = { start: a.from, endA: a.to, endB: a.to };
|
|
9242
9241
|
else {
|
|
9243
9242
|
if (c.sel) {
|
|
9244
|
-
let M =
|
|
9243
|
+
let M = Mi(n, n.state.doc, c.sel);
|
|
9245
9244
|
if (M && !M.eq(n.state.selection)) {
|
|
9246
|
-
let
|
|
9247
|
-
s &&
|
|
9245
|
+
let ke = n.state.tr.setSelection(M);
|
|
9246
|
+
s && ke.setMeta("composition", s), n.dispatch(ke);
|
|
9248
9247
|
}
|
|
9249
9248
|
}
|
|
9250
9249
|
return;
|
|
9251
9250
|
}
|
|
9252
9251
|
n.state.selection.from < n.state.selection.to && p.start == p.endB && n.state.selection instanceof C && (p.start > n.state.selection.from && p.start <= n.state.selection.from + 2 && n.state.selection.from >= c.from ? p.start = n.state.selection.from : p.endA < n.state.selection.to && p.endA >= n.state.selection.to - 2 && n.state.selection.to <= c.to && (p.endB += n.state.selection.to - p.endA, p.endA = n.state.selection.to)), U && Ee <= 11 && p.endB == p.start + 1 && p.endA == p.start && p.start > c.from && c.doc.textBetween(p.start - c.from - 1, p.start - c.from + 1) == " " && (p.start--, p.endA--, p.endB--);
|
|
9253
|
-
let m = c.doc.resolveNoCache(p.start - c.from), g = c.doc.resolveNoCache(p.endB - c.from), b = f.resolve(p.start), w = m.sameParent(g) && m.parent.inlineContent && b.end() >= p.endA,
|
|
9254
|
-
if ((ft && n.input.lastIOSEnter > Date.now() - 225 && (!w || i.some((M) => M.nodeName == "DIV" || M.nodeName == "P")) || !w && m.pos < c.doc.content.size && !m.sameParent(g) && (
|
|
9252
|
+
let m = c.doc.resolveNoCache(p.start - c.from), g = c.doc.resolveNoCache(p.endB - c.from), b = f.resolve(p.start), w = m.sameParent(g) && m.parent.inlineContent && b.end() >= p.endA, O;
|
|
9253
|
+
if ((ft && n.input.lastIOSEnter > Date.now() - 225 && (!w || i.some((M) => M.nodeName == "DIV" || M.nodeName == "P")) || !w && m.pos < c.doc.content.size && !m.sameParent(g) && (O = S.findFrom(c.doc.resolve(m.pos + 1), 1, !0)) && O.head == g.pos) && n.someProp("handleKeyDown", (M) => M(n, Pe(13, "Enter")))) {
|
|
9255
9254
|
n.input.lastIOSEnter = 0;
|
|
9256
9255
|
return;
|
|
9257
9256
|
}
|
|
9258
|
-
if (n.state.selection.anchor > p.start &&
|
|
9259
|
-
ne &&
|
|
9257
|
+
if (n.state.selection.anchor > p.start && _c(f, p.start, p.endA, m, g) && n.someProp("handleKeyDown", (M) => M(n, Pe(8, "Backspace")))) {
|
|
9258
|
+
ne && $ && n.domObserver.suppressSelectionUpdates();
|
|
9260
9259
|
return;
|
|
9261
9260
|
}
|
|
9262
|
-
|
|
9261
|
+
$ && ne && p.endB == p.start && (n.input.lastAndroidDelete = Date.now()), ne && !w && m.start() != g.start() && g.parentOffset == 0 && m.depth == g.depth && c.sel && c.sel.anchor == c.sel.head && c.sel.head == p.endA && (p.endB -= 2, g = c.doc.resolveNoCache(p.endB - c.from), setTimeout(() => {
|
|
9263
9262
|
n.someProp("handleKeyDown", function(M) {
|
|
9264
9263
|
return M(n, Pe(13, "Enter"));
|
|
9265
9264
|
});
|
|
9266
9265
|
}, 20));
|
|
9267
|
-
let T = p.start,
|
|
9266
|
+
let T = p.start, R = p.endA, I, fe, xe;
|
|
9268
9267
|
if (w) {
|
|
9269
9268
|
if (m.pos == g.pos)
|
|
9270
|
-
U && Ee <= 11 && m.parentOffset == 0 && (n.domObserver.suppressSelectionUpdates(), setTimeout(() => ye(n), 20)),
|
|
9269
|
+
U && Ee <= 11 && m.parentOffset == 0 && (n.domObserver.suppressSelectionUpdates(), setTimeout(() => ye(n), 20)), I = n.state.tr.delete(T, R), fe = f.resolve(p.start).marksAcross(f.resolve(p.endA));
|
|
9271
9270
|
else if (
|
|
9272
9271
|
// Adding or removing a mark
|
|
9273
|
-
p.endA == p.endB && (
|
|
9272
|
+
p.endA == p.endB && (xe = Gc(m.parent.content.cut(m.parentOffset, g.parentOffset), b.parent.content.cut(b.parentOffset, p.endA - b.start())))
|
|
9274
9273
|
)
|
|
9275
|
-
|
|
9274
|
+
I = n.state.tr, xe.type == "add" ? I.addMark(T, R, xe.mark) : I.removeMark(T, R, xe.mark);
|
|
9276
9275
|
else if (m.parent.child(m.index()).isText && m.index() == g.index() - (g.textOffset ? 0 : 1)) {
|
|
9277
9276
|
let M = m.parent.textBetween(m.parentOffset, g.parentOffset);
|
|
9278
|
-
if (n.someProp("handleTextInput", (
|
|
9277
|
+
if (n.someProp("handleTextInput", (ke) => ke(n, T, R, M)))
|
|
9279
9278
|
return;
|
|
9280
|
-
|
|
9279
|
+
I = n.state.tr.insertText(M, T, R);
|
|
9281
9280
|
}
|
|
9282
9281
|
}
|
|
9283
|
-
if (
|
|
9284
|
-
let M =
|
|
9285
|
-
M && !(
|
|
9282
|
+
if (I || (I = n.state.tr.replace(T, R, c.doc.slice(p.start - c.from, p.endB - c.from))), c.sel) {
|
|
9283
|
+
let M = Mi(n, I.doc, c.sel);
|
|
9284
|
+
M && !($ && ne && n.composing && M.empty && (p.start != p.endB || n.input.lastAndroidDelete < Date.now() - 100) && (M.head == T || M.head == I.mapping.map(R) - 1) || U && M.empty && M.head == T) && I.setSelection(M);
|
|
9286
9285
|
}
|
|
9287
|
-
fe &&
|
|
9286
|
+
fe && I.ensureMarks(fe), s && I.setMeta("composition", s), n.dispatch(I.scrollIntoView());
|
|
9288
9287
|
}
|
|
9289
|
-
function
|
|
9290
|
-
return Math.max(t.anchor, t.head) > e.content.size ? null :
|
|
9288
|
+
function Mi(n, e, t) {
|
|
9289
|
+
return Math.max(t.anchor, t.head) > e.content.size ? null : yr(n, e.resolve(t.anchor), e.resolve(t.head));
|
|
9291
9290
|
}
|
|
9292
|
-
function
|
|
9291
|
+
function Gc(n, e) {
|
|
9293
9292
|
let t = n.firstChild.marks, r = e.firstChild.marks, i = t, s = r, o, l, a;
|
|
9294
9293
|
for (let f = 0; f < r.length; f++)
|
|
9295
9294
|
i = r[f].removeFromSet(i);
|
|
@@ -9307,7 +9306,7 @@ function _c(n, e) {
|
|
|
9307
9306
|
if (y.from(c).eq(n))
|
|
9308
9307
|
return { mark: l, type: o };
|
|
9309
9308
|
}
|
|
9310
|
-
function
|
|
9309
|
+
function _c(n, e, t, r, i) {
|
|
9311
9310
|
if (
|
|
9312
9311
|
// The content must have shrunk
|
|
9313
9312
|
t - e <= i.pos - r.pos || // newEnd must point directly at or after the end of the block that newStart points into
|
|
@@ -9346,14 +9345,14 @@ function Xc(n, e, t, r, i) {
|
|
|
9346
9345
|
}
|
|
9347
9346
|
if (o < s && n.size < e.size) {
|
|
9348
9347
|
let a = r <= s && r >= o ? s - r : 0;
|
|
9349
|
-
s -= a, s && s < e.size &&
|
|
9348
|
+
s -= a, s && s < e.size && Oi(e.textBetween(s - 1, s + 1)) && (s += a ? 1 : -1), l = s + (l - o), o = s;
|
|
9350
9349
|
} else if (l < s) {
|
|
9351
9350
|
let a = r <= s && r >= l ? s - r : 0;
|
|
9352
|
-
s -= a, s && s < n.size &&
|
|
9351
|
+
s -= a, s && s < n.size && Oi(n.textBetween(s - 1, s + 1)) && (s += a ? 1 : -1), o = s + (o - l), l = s;
|
|
9353
9352
|
}
|
|
9354
9353
|
return { start: s, endA: o, endB: l };
|
|
9355
9354
|
}
|
|
9356
|
-
function
|
|
9355
|
+
function Oi(n) {
|
|
9357
9356
|
if (n.length != 2)
|
|
9358
9357
|
return !1;
|
|
9359
9358
|
let e = n.charCodeAt(0), t = n.charCodeAt(1);
|
|
@@ -9368,7 +9367,7 @@ class Yc {
|
|
|
9368
9367
|
added to the document.
|
|
9369
9368
|
*/
|
|
9370
9369
|
constructor(e, t) {
|
|
9371
|
-
this._root = null, this.focused = !1, this.trackWrites = null, this.mounted = !1, this.markCursor = null, this.cursorWrapper = null, this.lastSelectedViewDesc = void 0, this.input = new gc(), this.prevDirectPlugins = [], this.pluginViews = [], this.requiresGeckoHackNode = !1, this.dragging = null, this._props = t, this.state = t.state, this.directPlugins = t.plugins || [], this.directPlugins.forEach(
|
|
9370
|
+
this._root = null, this.focused = !1, this.trackWrites = null, this.mounted = !1, this.markCursor = null, this.cursorWrapper = null, this.lastSelectedViewDesc = void 0, this.input = new gc(), this.prevDirectPlugins = [], this.pluginViews = [], this.requiresGeckoHackNode = !1, this.dragging = null, this._props = t, this.state = t.state, this.directPlugins = t.plugins || [], this.directPlugins.forEach(Ei), this.dispatch = this.dispatch.bind(this), this.dom = e && e.mount || document.createElement("div"), e && (e.appendChild ? e.appendChild(this.dom) : typeof e == "function" ? e(this.dom) : e.mount && (this.mounted = !0)), this.editable = Ai(this), Ti(this), this.nodeViews = Di(this), this.docView = oi(this.state.doc, Ni(this), Fn(this), this.dom, this), this.domObserver = new Hc(this, (r, i, s, o) => Uc(this, r, i, s, o)), this.domObserver.start(), yc(this), this.updatePluginViews();
|
|
9372
9371
|
}
|
|
9373
9372
|
/**
|
|
9374
9373
|
Holds `true` when a
|
|
@@ -9396,9 +9395,9 @@ class Yc {
|
|
|
9396
9395
|
the DOM.
|
|
9397
9396
|
*/
|
|
9398
9397
|
update(e) {
|
|
9399
|
-
e.handleDOMEvents != this._props.handleDOMEvents &&
|
|
9398
|
+
e.handleDOMEvents != this._props.handleDOMEvents && rr(this);
|
|
9400
9399
|
let t = this._props;
|
|
9401
|
-
this._props = e, e.plugins && (e.plugins.forEach(
|
|
9400
|
+
this._props = e, e.plugins && (e.plugins.forEach(Ei), this.directPlugins = e.plugins), this.updateStateInner(e.state, t);
|
|
9402
9401
|
}
|
|
9403
9402
|
/**
|
|
9404
9403
|
Update the view by updating existing props object with the object
|
|
@@ -9427,19 +9426,19 @@ class Yc {
|
|
|
9427
9426
|
e.storedMarks && this.composing && (yo(this), o = !0), this.state = e;
|
|
9428
9427
|
let l = i.plugins != e.plugins || this._props.plugins != t.plugins;
|
|
9429
9428
|
if (l || this._props.plugins != t.plugins || this._props.nodeViews != t.nodeViews) {
|
|
9430
|
-
let u =
|
|
9429
|
+
let u = Di(this);
|
|
9431
9430
|
Qc(u, this.nodeViews) && (this.nodeViews = u, s = !0);
|
|
9432
9431
|
}
|
|
9433
|
-
(l || t.handleDOMEvents != this._props.handleDOMEvents) &&
|
|
9434
|
-
let a = Fn(this), c =
|
|
9432
|
+
(l || t.handleDOMEvents != this._props.handleDOMEvents) && rr(this), this.editable = Ai(this), Ti(this);
|
|
9433
|
+
let a = Fn(this), c = Ni(this), f = i.plugins != e.plugins && !i.doc.eq(e.doc) ? "reset" : e.scrollToSelection > i.scrollToSelection ? "to selection" : "preserve", h = s || !this.docView.matchesNode(e.doc, c, a);
|
|
9435
9434
|
(h || !e.selection.eq(i.selection)) && (o = !0);
|
|
9436
9435
|
let d = f == "preserve" && o && this.dom.style.overflowAnchor == null && Ra(this);
|
|
9437
9436
|
if (o) {
|
|
9438
9437
|
this.domObserver.stop();
|
|
9439
|
-
let u = h && (U ||
|
|
9438
|
+
let u = h && (U || $) && !this.composing && !i.selection.empty && !e.selection.empty && Zc(i.selection, e.selection);
|
|
9440
9439
|
if (h) {
|
|
9441
|
-
let p =
|
|
9442
|
-
this.composing && (this.input.compositionNode = Ec(this)), (s || !this.docView.update(e.doc, c, a, this)) && (this.docView.updateOuterDeco(c), this.docView.destroy(), this.docView =
|
|
9440
|
+
let p = $ ? this.trackWrites = this.domSelectionRange().focusNode : null;
|
|
9441
|
+
this.composing && (this.input.compositionNode = Ec(this)), (s || !this.docView.update(e.doc, c, a, this)) && (this.docView.updateOuterDeco(c), this.docView.destroy(), this.docView = oi(e.doc, c, a, this.dom, this)), p && !this.trackWrites && (u = !0);
|
|
9443
9442
|
}
|
|
9444
9443
|
u || !(this.input.mouseDown && this.domObserver.currentSelection.eq(this.domSelectionRange()) && tc(this)) ? ye(this, u) : (ro(this, e.selection), this.domObserver.setCurSelection()), this.domObserver.start();
|
|
9445
9444
|
}
|
|
@@ -9450,11 +9449,11 @@ class Yc {
|
|
|
9450
9449
|
*/
|
|
9451
9450
|
scrollToSelection() {
|
|
9452
9451
|
let e = this.domSelectionRange().focusNode;
|
|
9453
|
-
if (!this.someProp("handleScrollToSelection", (t) => t(this))) if (this.state.selection instanceof
|
|
9452
|
+
if (!this.someProp("handleScrollToSelection", (t) => t(this))) if (this.state.selection instanceof k) {
|
|
9454
9453
|
let t = this.docView.domAfterPos(this.state.selection.from);
|
|
9455
|
-
t.nodeType == 1 &&
|
|
9454
|
+
t.nodeType == 1 && ei(this, t.getBoundingClientRect(), e);
|
|
9456
9455
|
} else
|
|
9457
|
-
|
|
9456
|
+
ei(this, this.coordsAtPos(this.state.selection.head, 1), e);
|
|
9458
9457
|
}
|
|
9459
9458
|
destroyPluginViews() {
|
|
9460
9459
|
let e;
|
|
@@ -9486,7 +9485,7 @@ class Yc {
|
|
|
9486
9485
|
let s = r.from + (this.state.doc.content.size - t.doc.content.size);
|
|
9487
9486
|
(s > 0 && this.state.doc.nodeAt(s)) == r.node && (i = s);
|
|
9488
9487
|
}
|
|
9489
|
-
this.dragging = new
|
|
9488
|
+
this.dragging = new xo(e.slice, e.move, i < 0 ? void 0 : k.create(this.state.doc, i));
|
|
9490
9489
|
}
|
|
9491
9490
|
someProp(e, t) {
|
|
9492
9491
|
let r = this._props && this._props[e], i;
|
|
@@ -9573,7 +9572,7 @@ class Yc {
|
|
|
9573
9572
|
otherwise the element after.
|
|
9574
9573
|
*/
|
|
9575
9574
|
coordsAtPos(e, t = 1) {
|
|
9576
|
-
return
|
|
9575
|
+
return _s(this, e, t);
|
|
9577
9576
|
}
|
|
9578
9577
|
/**
|
|
9579
9578
|
Find the DOM position that corresponds to the given document
|
|
@@ -9648,7 +9647,7 @@ class Yc {
|
|
|
9648
9647
|
views](https://prosemirror.net/docs/ref/#view.NodeView).
|
|
9649
9648
|
*/
|
|
9650
9649
|
destroy() {
|
|
9651
|
-
this.docView && (bc(this), this.destroyPluginViews(), this.mounted ? (this.docView.update(this.state.doc, [], Fn(this), this), this.dom.textContent = "") : this.dom.parentNode && this.dom.parentNode.removeChild(this.dom), this.docView.destroy(), this.docView = null,
|
|
9650
|
+
this.docView && (bc(this), this.destroyPluginViews(), this.mounted ? (this.docView.update(this.state.doc, [], Fn(this), this), this.dom.textContent = "") : this.dom.parentNode && this.dom.parentNode.removeChild(this.dom), this.docView.destroy(), this.docView = null, ka());
|
|
9652
9651
|
}
|
|
9653
9652
|
/**
|
|
9654
9653
|
This is true when the view has been
|
|
@@ -9662,7 +9661,7 @@ class Yc {
|
|
|
9662
9661
|
Used for testing.
|
|
9663
9662
|
*/
|
|
9664
9663
|
dispatchEvent(e) {
|
|
9665
|
-
return
|
|
9664
|
+
return kc(this, e);
|
|
9666
9665
|
}
|
|
9667
9666
|
/**
|
|
9668
9667
|
Dispatch a transaction. Will call
|
|
@@ -9691,7 +9690,7 @@ class Yc {
|
|
|
9691
9690
|
return this.root.getSelection();
|
|
9692
9691
|
}
|
|
9693
9692
|
}
|
|
9694
|
-
function
|
|
9693
|
+
function Ni(n) {
|
|
9695
9694
|
let e = /* @__PURE__ */ Object.create(null);
|
|
9696
9695
|
return e.class = "ProseMirror", e.contenteditable = String(n.editable), n.someProp("attributes", (t) => {
|
|
9697
9696
|
if (typeof t == "function" && (t = t(n.state)), t)
|
|
@@ -9699,21 +9698,21 @@ function Oi(n) {
|
|
|
9699
9698
|
r == "class" ? e.class += " " + t[r] : r == "style" ? e.style = (e.style ? e.style + ";" : "") + t[r] : !e[r] && r != "contenteditable" && r != "nodeName" && (e[r] = String(t[r]));
|
|
9700
9699
|
}), e.translate || (e.translate = "no"), [j.node(0, n.state.doc.content.size, e)];
|
|
9701
9700
|
}
|
|
9702
|
-
function
|
|
9701
|
+
function Ti(n) {
|
|
9703
9702
|
if (n.markCursor) {
|
|
9704
9703
|
let e = document.createElement("img");
|
|
9705
9704
|
e.className = "ProseMirror-separator", e.setAttribute("mark-placeholder", "true"), e.setAttribute("alt", ""), n.cursorWrapper = { dom: e, deco: j.widget(n.state.selection.from, e, { raw: !0, marks: n.markCursor }) };
|
|
9706
9705
|
} else
|
|
9707
9706
|
n.cursorWrapper = null;
|
|
9708
9707
|
}
|
|
9709
|
-
function
|
|
9708
|
+
function Ai(n) {
|
|
9710
9709
|
return !n.someProp("editable", (e) => e(n.state) === !1);
|
|
9711
9710
|
}
|
|
9712
9711
|
function Zc(n, e) {
|
|
9713
9712
|
let t = Math.min(n.$anchor.sharedDepth(n.head), e.$anchor.sharedDepth(e.head));
|
|
9714
9713
|
return n.$anchor.start(t) != e.$anchor.start(t);
|
|
9715
9714
|
}
|
|
9716
|
-
function
|
|
9715
|
+
function Di(n) {
|
|
9717
9716
|
let e = /* @__PURE__ */ Object.create(null);
|
|
9718
9717
|
function t(r) {
|
|
9719
9718
|
for (let i in r)
|
|
@@ -9732,12 +9731,12 @@ function Qc(n, e) {
|
|
|
9732
9731
|
r++;
|
|
9733
9732
|
return t != r;
|
|
9734
9733
|
}
|
|
9735
|
-
function
|
|
9734
|
+
function Ei(n) {
|
|
9736
9735
|
if (n.spec.state || n.spec.filterTransaction || n.spec.appendTransaction)
|
|
9737
9736
|
throw new RangeError("Plugins passed directly to the view must not have a state component");
|
|
9738
9737
|
}
|
|
9739
|
-
const
|
|
9740
|
-
|
|
9738
|
+
const wr = "app.grapesjs.com", Mo = "app-stage.grapesjs.com", Ri = [
|
|
9739
|
+
wr,
|
|
9741
9740
|
Mo,
|
|
9742
9741
|
"localhost",
|
|
9743
9742
|
"127.0.0.1",
|
|
@@ -9747,11 +9746,11 @@ const Cr = "app.grapesjs.com", Mo = "app-stage.grapesjs.com", Ei = [
|
|
|
9747
9746
|
// For stackblitz.com demos
|
|
9748
9747
|
"-sandpack.codesandbox.io"
|
|
9749
9748
|
// For Sandpack demos
|
|
9750
|
-
], ef = "license:check:start", tf = "license:check:end", Oo = () => typeof window < "u", nf = ({ isDev: n, isStage: e }) => `${n ? "" : `https://${e ? Mo :
|
|
9749
|
+
], ef = "license:check:start", tf = "license:check:end", Oo = () => typeof window < "u", nf = ({ isDev: n, isStage: e }) => `${n ? "" : `https://${e ? Mo : wr}`}/api`, rf = () => {
|
|
9751
9750
|
const n = Oo() && window.location.hostname;
|
|
9752
|
-
return !!n && (
|
|
9753
|
-
}, sf = () => (Oo() && window.location.hostname) ===
|
|
9754
|
-
var of = {
|
|
9751
|
+
return !!n && (Ri.includes(n) || Ri.some((e) => n.endsWith(e)));
|
|
9752
|
+
}, sf = () => (Oo() && window.location.hostname) === wr;
|
|
9753
|
+
var of = {};
|
|
9755
9754
|
const lf = of.NODE_ENV !== "production";
|
|
9756
9755
|
async function af({
|
|
9757
9756
|
path: n,
|
|
@@ -9811,18 +9810,18 @@ async function df({ licenseKey: n, pluginName: e }) {
|
|
|
9811
9810
|
return console.error("Error during SDK license check:", t), !1;
|
|
9812
9811
|
}
|
|
9813
9812
|
}
|
|
9814
|
-
var
|
|
9813
|
+
var ir, sr;
|
|
9815
9814
|
if (typeof WeakMap < "u") {
|
|
9816
9815
|
let n = /* @__PURE__ */ new WeakMap();
|
|
9817
|
-
|
|
9816
|
+
ir = (e) => n.get(e), sr = (e, t) => (n.set(e, t), t);
|
|
9818
9817
|
} else {
|
|
9819
9818
|
const n = [];
|
|
9820
9819
|
let t = 0;
|
|
9821
|
-
|
|
9820
|
+
ir = (r) => {
|
|
9822
9821
|
for (let i = 0; i < n.length; i += 2)
|
|
9823
9822
|
if (n[i] == r)
|
|
9824
9823
|
return n[i + 1];
|
|
9825
|
-
},
|
|
9824
|
+
}, sr = (r, i) => (t == 10 && (t = 0), n[t++] = r, n[t++] = i);
|
|
9826
9825
|
}
|
|
9827
9826
|
var D = class {
|
|
9828
9827
|
constructor(n, e, t, r) {
|
|
@@ -9905,7 +9904,7 @@ var D = class {
|
|
|
9905
9904
|
}
|
|
9906
9905
|
// Find the table map for the given table node.
|
|
9907
9906
|
static get(n) {
|
|
9908
|
-
return
|
|
9907
|
+
return ir(n) || sr(n, uf(n));
|
|
9909
9908
|
}
|
|
9910
9909
|
};
|
|
9911
9910
|
function uf(n) {
|
|
@@ -9925,27 +9924,27 @@ function uf(n) {
|
|
|
9925
9924
|
if (p == h.childCount)
|
|
9926
9925
|
break;
|
|
9927
9926
|
const m = h.child(p), { colspan: g, rowspan: b, colwidth: w } = m.attrs;
|
|
9928
|
-
for (let
|
|
9929
|
-
if (
|
|
9927
|
+
for (let O = 0; O < b; O++) {
|
|
9928
|
+
if (O + c >= t) {
|
|
9930
9929
|
(s || (s = [])).push({
|
|
9931
9930
|
type: "overlong_rowspan",
|
|
9932
9931
|
pos: f,
|
|
9933
|
-
n: b -
|
|
9932
|
+
n: b - O
|
|
9934
9933
|
});
|
|
9935
9934
|
break;
|
|
9936
9935
|
}
|
|
9937
|
-
const T = i +
|
|
9938
|
-
for (let
|
|
9939
|
-
r[T +
|
|
9936
|
+
const T = i + O * e;
|
|
9937
|
+
for (let R = 0; R < g; R++) {
|
|
9938
|
+
r[T + R] == 0 ? r[T + R] = f : (s || (s = [])).push({
|
|
9940
9939
|
type: "collision",
|
|
9941
9940
|
row: c,
|
|
9942
9941
|
pos: f,
|
|
9943
|
-
n: g -
|
|
9942
|
+
n: g - R
|
|
9944
9943
|
});
|
|
9945
|
-
const
|
|
9946
|
-
if (
|
|
9947
|
-
const fe = (T +
|
|
9948
|
-
|
|
9944
|
+
const I = w && w[R];
|
|
9945
|
+
if (I) {
|
|
9946
|
+
const fe = (T + R) % e * 2, xe = o[fe];
|
|
9947
|
+
xe == null || xe != I && o[fe + 1] == 1 ? (o[fe] = I, o[fe + 1] = 1) : xe == I && o[fe + 1]++;
|
|
9949
9948
|
}
|
|
9950
9949
|
}
|
|
9951
9950
|
}
|
|
@@ -10016,7 +10015,7 @@ function gf(n) {
|
|
|
10016
10015
|
e.push(0);
|
|
10017
10016
|
return e;
|
|
10018
10017
|
}
|
|
10019
|
-
function
|
|
10018
|
+
function Ii(n, e) {
|
|
10020
10019
|
if (typeof n == "string")
|
|
10021
10020
|
return {};
|
|
10022
10021
|
const t = n.getAttribute("data-colwidth"), r = t && /^\d+(,\d+)*$/.test(t) ? t.split(",").map((o) => Number(o)) : null, i = Number(n.getAttribute("colspan") || 1), s = {
|
|
@@ -10030,7 +10029,7 @@ function Ri(n, e) {
|
|
|
10030
10029
|
}
|
|
10031
10030
|
return s;
|
|
10032
10031
|
}
|
|
10033
|
-
function
|
|
10032
|
+
function vi(n, e) {
|
|
10034
10033
|
const t = {};
|
|
10035
10034
|
n.attrs.colspan != 1 && (t.colspan = n.attrs.colspan), n.attrs.rowspan != 1 && (t.rowspan = n.attrs.rowspan), n.attrs.colwidth && (t["data-colwidth"] = n.attrs.colwidth.join(","));
|
|
10036
10035
|
for (const r in e) {
|
|
@@ -10072,10 +10071,10 @@ function yf(n) {
|
|
|
10072
10071
|
tableRole: "cell",
|
|
10073
10072
|
isolating: !0,
|
|
10074
10073
|
parseDOM: [
|
|
10075
|
-
{ tag: "td", getAttrs: (r) =>
|
|
10074
|
+
{ tag: "td", getAttrs: (r) => Ii(r, e) }
|
|
10076
10075
|
],
|
|
10077
10076
|
toDOM(r) {
|
|
10078
|
-
return ["td",
|
|
10077
|
+
return ["td", vi(r, e), 0];
|
|
10079
10078
|
}
|
|
10080
10079
|
},
|
|
10081
10080
|
table_header: {
|
|
@@ -10084,10 +10083,10 @@ function yf(n) {
|
|
|
10084
10083
|
tableRole: "header_cell",
|
|
10085
10084
|
isolating: !0,
|
|
10086
10085
|
parseDOM: [
|
|
10087
|
-
{ tag: "th", getAttrs: (r) =>
|
|
10086
|
+
{ tag: "th", getAttrs: (r) => Ii(r, e) }
|
|
10088
10087
|
],
|
|
10089
10088
|
toDOM(r) {
|
|
10090
|
-
return ["th",
|
|
10089
|
+
return ["th", vi(r, e), 0];
|
|
10091
10090
|
}
|
|
10092
10091
|
}
|
|
10093
10092
|
};
|
|
@@ -10110,14 +10109,14 @@ function Vt(n) {
|
|
|
10110
10109
|
return n.node(0).resolve(n.before(e + 1));
|
|
10111
10110
|
return null;
|
|
10112
10111
|
}
|
|
10113
|
-
function
|
|
10112
|
+
function xn(n) {
|
|
10114
10113
|
const e = n.selection.$head;
|
|
10115
10114
|
for (let t = e.depth; t > 0; t--)
|
|
10116
10115
|
if (e.node(t).type.spec.tableRole == "row")
|
|
10117
10116
|
return !0;
|
|
10118
10117
|
return !1;
|
|
10119
10118
|
}
|
|
10120
|
-
function
|
|
10119
|
+
function Mr(n) {
|
|
10121
10120
|
const e = n.selection;
|
|
10122
10121
|
if ("$anchorCell" in e && e.$anchorCell)
|
|
10123
10122
|
return e.$anchorCell.pos > e.$headCell.pos ? e.$anchorCell : e.$headCell;
|
|
@@ -10140,13 +10139,13 @@ function bf(n) {
|
|
|
10140
10139
|
return n.doc.resolve(t - e.nodeSize);
|
|
10141
10140
|
}
|
|
10142
10141
|
}
|
|
10143
|
-
function
|
|
10142
|
+
function or(n) {
|
|
10144
10143
|
return n.parent.type.spec.tableRole == "row" && !!n.nodeAfter;
|
|
10145
10144
|
}
|
|
10146
|
-
function
|
|
10145
|
+
function xf(n) {
|
|
10147
10146
|
return n.node(0).resolve(n.pos + n.nodeAfter.nodeSize);
|
|
10148
10147
|
}
|
|
10149
|
-
function
|
|
10148
|
+
function Or(n, e) {
|
|
10150
10149
|
return n.depth == e.depth && n.pos >= e.start(-1) && n.pos <= e.end(-1);
|
|
10151
10150
|
}
|
|
10152
10151
|
function No(n, e, t) {
|
|
@@ -10157,7 +10156,7 @@ function ht(n, e, t = 1) {
|
|
|
10157
10156
|
const r = { ...n, colspan: n.colspan - t };
|
|
10158
10157
|
return r.colwidth && (r.colwidth = r.colwidth.slice(), r.colwidth.splice(e, t), r.colwidth.some((i) => i > 0) || (r.colwidth = null)), r;
|
|
10159
10158
|
}
|
|
10160
|
-
var
|
|
10159
|
+
var z = class pe extends S {
|
|
10161
10160
|
// A table selection is identified by its anchor and head cells. The
|
|
10162
10161
|
// positions given to this constructor should point _before_ two
|
|
10163
10162
|
// cells in the same table. They may be the same, to select a single
|
|
@@ -10182,7 +10181,7 @@ var v = class pe extends S {
|
|
|
10182
10181
|
}
|
|
10183
10182
|
map(e, t) {
|
|
10184
10183
|
const r = e.resolve(t.map(this.$anchorCell.pos)), i = e.resolve(t.map(this.$headCell.pos));
|
|
10185
|
-
if (
|
|
10184
|
+
if (or(r) && or(i) && Or(r, i)) {
|
|
10186
10185
|
const s = this.$anchorCell.node(-1) != r.node(-1);
|
|
10187
10186
|
return s && this.isRowSelection() ? pe.rowSelection(r, i) : s && this.isColSelection() ? pe.colSelection(r, i) : new pe(r, i);
|
|
10188
10187
|
}
|
|
@@ -10233,16 +10232,16 @@ var v = class pe extends S {
|
|
|
10233
10232
|
o.push(e.child(a).copy(y.from(c)));
|
|
10234
10233
|
}
|
|
10235
10234
|
const l = this.isColSelection() && this.isRowSelection() ? e : o;
|
|
10236
|
-
return new
|
|
10235
|
+
return new x(y.from(l), 1, 1);
|
|
10237
10236
|
}
|
|
10238
|
-
replace(e, t =
|
|
10237
|
+
replace(e, t = x.empty) {
|
|
10239
10238
|
const r = e.steps.length, i = this.ranges;
|
|
10240
10239
|
for (let o = 0; o < i.length; o++) {
|
|
10241
10240
|
const { $from: l, $to: a } = i[o], c = e.mapping.slice(r);
|
|
10242
10241
|
e.replace(
|
|
10243
10242
|
c.map(l.pos),
|
|
10244
10243
|
c.map(a.pos),
|
|
10245
|
-
o ?
|
|
10244
|
+
o ? x.empty : t
|
|
10246
10245
|
);
|
|
10247
10246
|
}
|
|
10248
10247
|
const s = S.findFrom(
|
|
@@ -10252,7 +10251,7 @@ var v = class pe extends S {
|
|
|
10252
10251
|
s && e.setSelection(s);
|
|
10253
10252
|
}
|
|
10254
10253
|
replaceWith(e, t) {
|
|
10255
|
-
this.replace(e, new
|
|
10254
|
+
this.replace(e, new x(y.from(t), 0, 0));
|
|
10256
10255
|
}
|
|
10257
10256
|
forEachCell(e) {
|
|
10258
10257
|
const t = this.$anchorCell.node(-1), r = D.get(t), i = this.$anchorCell.start(-1), s = r.cellsInRect(
|
|
@@ -10321,12 +10320,12 @@ var v = class pe extends S {
|
|
|
10321
10320
|
return new pe(e.resolve(t), e.resolve(r));
|
|
10322
10321
|
}
|
|
10323
10322
|
getBookmark() {
|
|
10324
|
-
return new
|
|
10323
|
+
return new kf(this.$anchorCell.pos, this.$headCell.pos);
|
|
10325
10324
|
}
|
|
10326
10325
|
};
|
|
10327
|
-
|
|
10328
|
-
S.jsonID("cell",
|
|
10329
|
-
var
|
|
10326
|
+
z.prototype.visible = !1;
|
|
10327
|
+
S.jsonID("cell", z);
|
|
10328
|
+
var kf = class To {
|
|
10330
10329
|
constructor(e, t) {
|
|
10331
10330
|
this.anchor = e, this.head = t;
|
|
10332
10331
|
}
|
|
@@ -10335,11 +10334,11 @@ var xf = class To {
|
|
|
10335
10334
|
}
|
|
10336
10335
|
resolve(e) {
|
|
10337
10336
|
const t = e.resolve(this.anchor), r = e.resolve(this.head);
|
|
10338
|
-
return t.parent.type.spec.tableRole == "row" && r.parent.type.spec.tableRole == "row" && t.index() < t.parent.childCount && r.index() < r.parent.childCount &&
|
|
10337
|
+
return t.parent.type.spec.tableRole == "row" && r.parent.type.spec.tableRole == "row" && t.index() < t.parent.childCount && r.index() < r.parent.childCount && Or(t, r) ? new z(t, r) : S.near(r, 1);
|
|
10339
10338
|
}
|
|
10340
10339
|
};
|
|
10341
10340
|
function Sf(n) {
|
|
10342
|
-
if (!(n.selection instanceof
|
|
10341
|
+
if (!(n.selection instanceof z))
|
|
10343
10342
|
return null;
|
|
10344
10343
|
const e = [];
|
|
10345
10344
|
return n.selection.forEachCell((t, r) => {
|
|
@@ -10379,15 +10378,15 @@ function wf({ $from: n, $to: e }) {
|
|
|
10379
10378
|
function Mf(n, e, t) {
|
|
10380
10379
|
const r = (e || n).selection, i = (e || n).doc;
|
|
10381
10380
|
let s, o;
|
|
10382
|
-
if (r instanceof
|
|
10381
|
+
if (r instanceof k && (o = r.node.type.spec.tableRole)) {
|
|
10383
10382
|
if (o == "cell" || o == "header_cell")
|
|
10384
|
-
s =
|
|
10383
|
+
s = z.create(i, r.from);
|
|
10385
10384
|
else if (o == "row") {
|
|
10386
10385
|
const l = i.resolve(r.from + 1);
|
|
10387
|
-
s =
|
|
10386
|
+
s = z.rowSelection(l, l);
|
|
10388
10387
|
} else if (!t) {
|
|
10389
10388
|
const l = D.get(r.node), a = r.from + 1, c = a + l.map[l.width * l.height - 1];
|
|
10390
|
-
s =
|
|
10389
|
+
s = z.create(i, a + 1, c);
|
|
10391
10390
|
}
|
|
10392
10391
|
} else r instanceof C && Cf(r) ? s = C.create(i, r.from) : r instanceof C && wf(r) && (s = C.create(i, r.$from.start(), r.$from.end()));
|
|
10393
10392
|
return s && (e || (e = n.tr)).setSelection(s), e;
|
|
@@ -10476,15 +10475,15 @@ function Tf(n, e, t, r) {
|
|
|
10476
10475
|
return r.setMeta(Of, { fixTables: !0 });
|
|
10477
10476
|
}
|
|
10478
10477
|
function Do(n) {
|
|
10479
|
-
const e = n.selection, t =
|
|
10480
|
-
return { ...e instanceof
|
|
10478
|
+
const e = n.selection, t = Mr(n), r = t.node(-1), i = t.start(-1), s = D.get(r);
|
|
10479
|
+
return { ...e instanceof z ? s.rectBetween(
|
|
10481
10480
|
e.$anchorCell.pos - i,
|
|
10482
10481
|
e.$headCell.pos - i
|
|
10483
10482
|
) : s.findCell(t.pos - i), tableStart: i, map: s, table: r };
|
|
10484
10483
|
}
|
|
10485
10484
|
function Af(n) {
|
|
10486
10485
|
return function(e, t) {
|
|
10487
|
-
if (!
|
|
10486
|
+
if (!xn(e))
|
|
10488
10487
|
return !1;
|
|
10489
10488
|
if (t) {
|
|
10490
10489
|
const r = ce(e.schema), i = Do(e), s = e.tr, o = i.map.cellsInRect(
|
|
@@ -10518,7 +10517,7 @@ function Af(n) {
|
|
|
10518
10517
|
return !0;
|
|
10519
10518
|
};
|
|
10520
10519
|
}
|
|
10521
|
-
function
|
|
10520
|
+
function zi(n, e, t) {
|
|
10522
10521
|
const r = e.map.cellsInRect({
|
|
10523
10522
|
left: 0,
|
|
10524
10523
|
top: 0,
|
|
@@ -10532,12 +10531,12 @@ function vi(n, e, t) {
|
|
|
10532
10531
|
}
|
|
10533
10532
|
return !0;
|
|
10534
10533
|
}
|
|
10535
|
-
function
|
|
10534
|
+
function Nr(n, e) {
|
|
10536
10535
|
return e = e || { useDeprecatedLogic: !1 }, e.useDeprecatedLogic ? Af(n) : function(t, r) {
|
|
10537
|
-
if (!
|
|
10536
|
+
if (!xn(t))
|
|
10538
10537
|
return !1;
|
|
10539
10538
|
if (r) {
|
|
10540
|
-
const i = ce(t.schema), s = Do(t), o = t.tr, l =
|
|
10539
|
+
const i = ce(t.schema), s = Do(t), o = t.tr, l = zi("row", s, i), a = zi(
|
|
10541
10540
|
"column",
|
|
10542
10541
|
s,
|
|
10543
10542
|
i
|
|
@@ -10560,13 +10559,13 @@ function Or(n, e) {
|
|
|
10560
10559
|
return !0;
|
|
10561
10560
|
};
|
|
10562
10561
|
}
|
|
10563
|
-
|
|
10562
|
+
Nr("row", {
|
|
10564
10563
|
useDeprecatedLogic: !0
|
|
10565
10564
|
});
|
|
10566
|
-
|
|
10565
|
+
Nr("column", {
|
|
10567
10566
|
useDeprecatedLogic: !0
|
|
10568
10567
|
});
|
|
10569
|
-
|
|
10568
|
+
Nr("cell", {
|
|
10570
10569
|
useDeprecatedLogic: !0
|
|
10571
10570
|
});
|
|
10572
10571
|
function Df(n, e) {
|
|
@@ -10593,17 +10592,17 @@ function Df(n, e) {
|
|
|
10593
10592
|
}
|
|
10594
10593
|
return null;
|
|
10595
10594
|
}
|
|
10596
|
-
function
|
|
10595
|
+
function Bi(n) {
|
|
10597
10596
|
return function(e, t) {
|
|
10598
|
-
if (!
|
|
10597
|
+
if (!xn(e))
|
|
10599
10598
|
return !1;
|
|
10600
|
-
const r = Df(
|
|
10599
|
+
const r = Df(Mr(e), n);
|
|
10601
10600
|
if (r == null)
|
|
10602
10601
|
return !1;
|
|
10603
10602
|
if (t) {
|
|
10604
10603
|
const i = e.doc.resolve(r);
|
|
10605
10604
|
t(
|
|
10606
|
-
e.tr.setSelection(C.between(i,
|
|
10605
|
+
e.tr.setSelection(C.between(i, xf(i))).scrollIntoView()
|
|
10607
10606
|
);
|
|
10608
10607
|
}
|
|
10609
10608
|
return !0;
|
|
@@ -10611,7 +10610,7 @@ function zi(n) {
|
|
|
10611
10610
|
}
|
|
10612
10611
|
function $t(n, e) {
|
|
10613
10612
|
const t = n.selection;
|
|
10614
|
-
if (!(t instanceof
|
|
10613
|
+
if (!(t instanceof z))
|
|
10615
10614
|
return !1;
|
|
10616
10615
|
if (e) {
|
|
10617
10616
|
const r = n.tr, i = ce(n.schema).cell.createAndFill().content;
|
|
@@ -10619,7 +10618,7 @@ function $t(n, e) {
|
|
|
10619
10618
|
s.content.eq(i) || r.replace(
|
|
10620
10619
|
r.mapping.map(o + 1),
|
|
10621
10620
|
r.mapping.map(o + s.nodeSize - 1),
|
|
10622
|
-
new
|
|
10621
|
+
new x(i, 0, 0)
|
|
10623
10622
|
);
|
|
10624
10623
|
}), r.docChanged && e(r);
|
|
10625
10624
|
}
|
|
@@ -10636,16 +10635,16 @@ function Ef(n) {
|
|
|
10636
10635
|
for (let a = 0; a < e.childCount; a++) {
|
|
10637
10636
|
let c = e.child(a).content;
|
|
10638
10637
|
const f = a ? 0 : Math.max(0, t - 1), h = a < e.childCount - 1 ? 0 : Math.max(0, r - 1);
|
|
10639
|
-
(f || h) && (c =
|
|
10638
|
+
(f || h) && (c = lr(
|
|
10640
10639
|
ce(o).row,
|
|
10641
|
-
new
|
|
10640
|
+
new x(c, f, h)
|
|
10642
10641
|
).content), l.push(c);
|
|
10643
10642
|
}
|
|
10644
10643
|
else if (s == "cell" || s == "header_cell")
|
|
10645
10644
|
l.push(
|
|
10646
|
-
t || r ?
|
|
10645
|
+
t || r ? lr(
|
|
10647
10646
|
ce(o).row,
|
|
10648
|
-
new
|
|
10647
|
+
new x(e, t, r)
|
|
10649
10648
|
).content : e
|
|
10650
10649
|
);
|
|
10651
10650
|
else
|
|
@@ -10674,7 +10673,7 @@ function Rf(n, e) {
|
|
|
10674
10673
|
}
|
|
10675
10674
|
return { height: e.length, width: r, rows: e };
|
|
10676
10675
|
}
|
|
10677
|
-
function
|
|
10676
|
+
function lr(n, e) {
|
|
10678
10677
|
const t = n.createAndFill();
|
|
10679
10678
|
return new Os(t).replace(0, t.content.size, e).doc;
|
|
10680
10679
|
}
|
|
@@ -10749,7 +10748,7 @@ function vf(n, e, t, r, i, s, o) {
|
|
|
10749
10748
|
}
|
|
10750
10749
|
return !!(c || f);
|
|
10751
10750
|
}
|
|
10752
|
-
function
|
|
10751
|
+
function Vi(n, e, t, r, i, s, o, l) {
|
|
10753
10752
|
if (o == 0 || o == e.height)
|
|
10754
10753
|
return !1;
|
|
10755
10754
|
let a = !1;
|
|
@@ -10772,7 +10771,7 @@ function Bi(n, e, t, r, i, s, o, l) {
|
|
|
10772
10771
|
}
|
|
10773
10772
|
return a;
|
|
10774
10773
|
}
|
|
10775
|
-
function
|
|
10774
|
+
function Pi(n, e, t, r, i, s, o, l) {
|
|
10776
10775
|
if (o == 0 || o == e.width)
|
|
10777
10776
|
return !1;
|
|
10778
10777
|
let a = !1;
|
|
@@ -10799,7 +10798,7 @@ function Vi(n, e, t, r, i, s, o, l) {
|
|
|
10799
10798
|
}
|
|
10800
10799
|
return a;
|
|
10801
10800
|
}
|
|
10802
|
-
function
|
|
10801
|
+
function Fi(n, e, t, r, i) {
|
|
10803
10802
|
let s = t ? n.doc.nodeAt(t - 1) : n.doc;
|
|
10804
10803
|
if (!s)
|
|
10805
10804
|
throw new Error("No table found");
|
|
@@ -10811,17 +10810,17 @@ function Pi(n, e, t, r, i) {
|
|
|
10811
10810
|
throw new Error("No table found");
|
|
10812
10811
|
o = D.get(s), d = h.mapping.maps.length;
|
|
10813
10812
|
}
|
|
10814
|
-
vf(h, o, s, t, c, f, d) && u(),
|
|
10813
|
+
vf(h, o, s, t, c, f, d) && u(), Vi(h, o, s, t, a, c, l, d) && u(), Vi(h, o, s, t, a, c, f, d) && u(), Pi(h, o, s, t, l, f, a, d) && u(), Pi(h, o, s, t, l, f, c, d) && u();
|
|
10815
10814
|
for (let p = l; p < f; p++) {
|
|
10816
10815
|
const m = o.positionAt(p, a, s), g = o.positionAt(p, c, s);
|
|
10817
10816
|
h.replace(
|
|
10818
10817
|
h.mapping.slice(d).map(m + t),
|
|
10819
10818
|
h.mapping.slice(d).map(g + t),
|
|
10820
|
-
new
|
|
10819
|
+
new x(i.rows[p - l], 0, 0)
|
|
10821
10820
|
);
|
|
10822
10821
|
}
|
|
10823
10822
|
u(), h.setSelection(
|
|
10824
|
-
new
|
|
10823
|
+
new z(
|
|
10825
10824
|
h.doc.resolve(t + o.positionAt(l, a, s)),
|
|
10826
10825
|
h.doc.resolve(t + o.positionAt(f - 1, c - 1, s))
|
|
10827
10826
|
)
|
|
@@ -10849,7 +10848,7 @@ function Wt(n, e) {
|
|
|
10849
10848
|
if (!i)
|
|
10850
10849
|
return !1;
|
|
10851
10850
|
const s = t.selection;
|
|
10852
|
-
if (s instanceof
|
|
10851
|
+
if (s instanceof z)
|
|
10853
10852
|
return Ut(
|
|
10854
10853
|
t,
|
|
10855
10854
|
r,
|
|
@@ -10879,38 +10878,38 @@ function Jt(n, e) {
|
|
|
10879
10878
|
return !1;
|
|
10880
10879
|
const s = t.selection;
|
|
10881
10880
|
let o;
|
|
10882
|
-
if (s instanceof
|
|
10881
|
+
if (s instanceof z)
|
|
10883
10882
|
o = s;
|
|
10884
10883
|
else {
|
|
10885
10884
|
const a = Eo(i, n, e);
|
|
10886
10885
|
if (a == null)
|
|
10887
10886
|
return !1;
|
|
10888
|
-
o = new
|
|
10887
|
+
o = new z(t.doc.resolve(a));
|
|
10889
10888
|
}
|
|
10890
10889
|
const l = No(o.$headCell, n, e);
|
|
10891
10890
|
return l ? Ut(
|
|
10892
10891
|
t,
|
|
10893
10892
|
r,
|
|
10894
|
-
new
|
|
10893
|
+
new z(o.$anchorCell, l)
|
|
10895
10894
|
) : !1;
|
|
10896
10895
|
};
|
|
10897
10896
|
}
|
|
10898
10897
|
function Bf(n, e) {
|
|
10899
10898
|
const t = n.state.doc, r = Vt(t.resolve(e));
|
|
10900
|
-
return r ? (n.dispatch(n.state.tr.setSelection(new
|
|
10899
|
+
return r ? (n.dispatch(n.state.tr.setSelection(new z(r))), !0) : !1;
|
|
10901
10900
|
}
|
|
10902
10901
|
function Vf(n, e, t) {
|
|
10903
|
-
if (!
|
|
10902
|
+
if (!xn(n.state))
|
|
10904
10903
|
return !1;
|
|
10905
10904
|
let r = Ef(t);
|
|
10906
10905
|
const i = n.state.selection;
|
|
10907
|
-
if (i instanceof
|
|
10906
|
+
if (i instanceof z) {
|
|
10908
10907
|
r || (r = {
|
|
10909
10908
|
width: 1,
|
|
10910
10909
|
height: 1,
|
|
10911
10910
|
rows: [
|
|
10912
10911
|
y.from(
|
|
10913
|
-
|
|
10912
|
+
lr(ce(n.state.schema).cell, t)
|
|
10914
10913
|
)
|
|
10915
10914
|
]
|
|
10916
10915
|
});
|
|
@@ -10918,10 +10917,10 @@ function Vf(n, e, t) {
|
|
|
10918
10917
|
i.$anchorCell.pos - o,
|
|
10919
10918
|
i.$headCell.pos - o
|
|
10920
10919
|
);
|
|
10921
|
-
return r = If(r, l.right - l.left, l.bottom - l.top),
|
|
10920
|
+
return r = If(r, l.right - l.left, l.bottom - l.top), Fi(n.state, n.dispatch, o, l, r), !0;
|
|
10922
10921
|
} else if (r) {
|
|
10923
|
-
const s =
|
|
10924
|
-
return
|
|
10922
|
+
const s = Mr(n.state), o = s.start(-1);
|
|
10923
|
+
return Fi(
|
|
10925
10924
|
n.state,
|
|
10926
10925
|
n.dispatch,
|
|
10927
10926
|
o,
|
|
@@ -10935,9 +10934,9 @@ function Pf(n, e) {
|
|
|
10935
10934
|
var t;
|
|
10936
10935
|
if (e.ctrlKey || e.metaKey)
|
|
10937
10936
|
return;
|
|
10938
|
-
const r =
|
|
10937
|
+
const r = Li(n, e.target);
|
|
10939
10938
|
let i;
|
|
10940
|
-
if (e.shiftKey && n.state.selection instanceof
|
|
10939
|
+
if (e.shiftKey && n.state.selection instanceof z)
|
|
10941
10940
|
s(n.state.selection.$anchorCell, e), e.preventDefault();
|
|
10942
10941
|
else if (e.shiftKey && r && (i = Vt(n.state.selection.$anchor)) != null && ((t = Hn(n, e)) == null ? void 0 : t.pos) != i.pos)
|
|
10943
10942
|
s(i, e), e.preventDefault();
|
|
@@ -10946,12 +10945,12 @@ function Pf(n, e) {
|
|
|
10946
10945
|
function s(a, c) {
|
|
10947
10946
|
let f = Hn(n, c);
|
|
10948
10947
|
const h = Ne.getState(n.state) == null;
|
|
10949
|
-
if (!f || !
|
|
10948
|
+
if (!f || !Or(a, f))
|
|
10950
10949
|
if (h)
|
|
10951
10950
|
f = a;
|
|
10952
10951
|
else
|
|
10953
10952
|
return;
|
|
10954
|
-
const d = new
|
|
10953
|
+
const d = new z(a, f);
|
|
10955
10954
|
if (h || !n.state.selection.eq(d)) {
|
|
10956
10955
|
const u = n.state.tr.setSelection(d);
|
|
10957
10956
|
h && u.setMeta(Ne, a.pos), n.dispatch(u);
|
|
@@ -10965,7 +10964,7 @@ function Pf(n, e) {
|
|
|
10965
10964
|
let h;
|
|
10966
10965
|
if (f != null)
|
|
10967
10966
|
h = n.state.doc.resolve(f);
|
|
10968
|
-
else if (
|
|
10967
|
+
else if (Li(n, c.target) != r && (h = Hn(n, e), !h))
|
|
10969
10968
|
return o();
|
|
10970
10969
|
h && s(h, c);
|
|
10971
10970
|
}
|
|
@@ -10986,7 +10985,7 @@ function Eo(n, e, t) {
|
|
|
10986
10985
|
}
|
|
10987
10986
|
return null;
|
|
10988
10987
|
}
|
|
10989
|
-
function
|
|
10988
|
+
function Li(n, e) {
|
|
10990
10989
|
for (; e && e != n.dom; e = e.parentNode)
|
|
10991
10990
|
if (e.nodeName == "TD" || e.nodeName == "TH")
|
|
10992
10991
|
return e;
|
|
@@ -11004,10 +11003,10 @@ var Ff = class {
|
|
|
11004
11003
|
this.node = n, this.defaultCellMinWidth = e, this.dom = document.createElement("div"), this.dom.className = "tableWrapper", this.table = this.dom.appendChild(document.createElement("table")), this.table.style.setProperty(
|
|
11005
11004
|
"--default-cell-min-width",
|
|
11006
11005
|
`${e}px`
|
|
11007
|
-
), this.colgroup = this.table.appendChild(document.createElement("colgroup")),
|
|
11006
|
+
), this.colgroup = this.table.appendChild(document.createElement("colgroup")), ar(n, this.colgroup, this.table, e), this.contentDOM = this.table.appendChild(document.createElement("tbody"));
|
|
11008
11007
|
}
|
|
11009
11008
|
update(n) {
|
|
11010
|
-
return n.type != this.node.type ? !1 : (this.node = n,
|
|
11009
|
+
return n.type != this.node.type ? !1 : (this.node = n, ar(
|
|
11011
11010
|
n,
|
|
11012
11011
|
this.colgroup,
|
|
11013
11012
|
this.table,
|
|
@@ -11018,7 +11017,7 @@ var Ff = class {
|
|
|
11018
11017
|
return n.type == "attributes" && (n.target == this.table || this.colgroup.contains(n.target));
|
|
11019
11018
|
}
|
|
11020
11019
|
};
|
|
11021
|
-
function
|
|
11020
|
+
function ar(n, e, t, r, i, s) {
|
|
11022
11021
|
var o;
|
|
11023
11022
|
let l = 0, a = !0, c = e.firstChild;
|
|
11024
11023
|
const f = n.firstChild;
|
|
@@ -11042,7 +11041,7 @@ function lr(n, e, t, r, i, s) {
|
|
|
11042
11041
|
a ? (t.style.width = l + "px", t.style.minWidth = "") : (t.style.width = "", t.style.minWidth = l + "px");
|
|
11043
11042
|
}
|
|
11044
11043
|
}
|
|
11045
|
-
var
|
|
11044
|
+
var _ = new It(
|
|
11046
11045
|
"tableColumnResizing"
|
|
11047
11046
|
);
|
|
11048
11047
|
function Lf({
|
|
@@ -11053,7 +11052,7 @@ function Lf({
|
|
|
11053
11052
|
lastColumnResizable: i = !0
|
|
11054
11053
|
} = {}) {
|
|
11055
11054
|
const s = new Rt({
|
|
11056
|
-
key:
|
|
11055
|
+
key: _,
|
|
11057
11056
|
state: {
|
|
11058
11057
|
init(o, l) {
|
|
11059
11058
|
var a, c;
|
|
@@ -11066,7 +11065,7 @@ function Lf({
|
|
|
11066
11065
|
},
|
|
11067
11066
|
props: {
|
|
11068
11067
|
attributes: (o) => {
|
|
11069
|
-
const l =
|
|
11068
|
+
const l = _.getState(o);
|
|
11070
11069
|
return l && l.activeHandle > -1 ? { class: "resize-cursor" } : {};
|
|
11071
11070
|
},
|
|
11072
11071
|
handleDOMEvents: {
|
|
@@ -11081,40 +11080,40 @@ function Lf({
|
|
|
11081
11080
|
}
|
|
11082
11081
|
},
|
|
11083
11082
|
decorations: (o) => {
|
|
11084
|
-
const l =
|
|
11083
|
+
const l = _.getState(o);
|
|
11085
11084
|
if (l && l.activeHandle > -1)
|
|
11086
|
-
return
|
|
11085
|
+
return Gf(o, l.activeHandle);
|
|
11087
11086
|
},
|
|
11088
11087
|
nodeViews: {}
|
|
11089
11088
|
}
|
|
11090
11089
|
});
|
|
11091
11090
|
return s;
|
|
11092
11091
|
}
|
|
11093
|
-
var Hf = class
|
|
11092
|
+
var Hf = class Gt {
|
|
11094
11093
|
constructor(e, t) {
|
|
11095
11094
|
this.activeHandle = e, this.dragging = t;
|
|
11096
11095
|
}
|
|
11097
11096
|
apply(e) {
|
|
11098
|
-
const t = this, r = e.getMeta(
|
|
11097
|
+
const t = this, r = e.getMeta(_);
|
|
11099
11098
|
if (r && r.setHandle != null)
|
|
11100
|
-
return new
|
|
11099
|
+
return new Gt(r.setHandle, !1);
|
|
11101
11100
|
if (r && r.setDragging !== void 0)
|
|
11102
|
-
return new
|
|
11101
|
+
return new Gt(t.activeHandle, r.setDragging);
|
|
11103
11102
|
if (t.activeHandle > -1 && e.docChanged) {
|
|
11104
11103
|
let i = e.mapping.map(t.activeHandle, -1);
|
|
11105
|
-
return
|
|
11104
|
+
return or(e.doc.resolve(i)) || (i = -1), new Gt(i, t.dragging);
|
|
11106
11105
|
}
|
|
11107
11106
|
return t;
|
|
11108
11107
|
}
|
|
11109
11108
|
};
|
|
11110
11109
|
function $f(n, e, t, r) {
|
|
11111
|
-
const i =
|
|
11110
|
+
const i = _.getState(n.state);
|
|
11112
11111
|
if (i && !i.dragging) {
|
|
11113
11112
|
const s = Kf(e.target);
|
|
11114
11113
|
let o = -1;
|
|
11115
11114
|
if (s) {
|
|
11116
11115
|
const { left: l, right: a } = s.getBoundingClientRect();
|
|
11117
|
-
e.clientX - l <= t ? o =
|
|
11116
|
+
e.clientX - l <= t ? o = Hi(n, e, "left", t) : a - e.clientX <= t && (o = Hi(n, e, "right", t));
|
|
11118
11117
|
}
|
|
11119
11118
|
if (o != i.activeHandle) {
|
|
11120
11119
|
if (!r && o !== -1) {
|
|
@@ -11127,38 +11126,38 @@ function $f(n, e, t, r) {
|
|
|
11127
11126
|
}
|
|
11128
11127
|
}
|
|
11129
11128
|
function Wf(n) {
|
|
11130
|
-
const e =
|
|
11129
|
+
const e = _.getState(n.state);
|
|
11131
11130
|
e && e.activeHandle > -1 && !e.dragging && Ro(n, -1);
|
|
11132
11131
|
}
|
|
11133
11132
|
function Jf(n, e, t, r) {
|
|
11134
11133
|
var i;
|
|
11135
|
-
const s = (i = n.dom.ownerDocument.defaultView) != null ? i : window, o =
|
|
11134
|
+
const s = (i = n.dom.ownerDocument.defaultView) != null ? i : window, o = _.getState(n.state);
|
|
11136
11135
|
if (!o || o.activeHandle == -1 || o.dragging)
|
|
11137
11136
|
return !1;
|
|
11138
11137
|
const l = n.state.doc.nodeAt(o.activeHandle), a = qf(n, o.activeHandle, l.attrs);
|
|
11139
11138
|
n.dispatch(
|
|
11140
|
-
n.state.tr.setMeta(
|
|
11139
|
+
n.state.tr.setMeta(_, {
|
|
11141
11140
|
setDragging: { startX: e.clientX, startWidth: a }
|
|
11142
11141
|
})
|
|
11143
11142
|
);
|
|
11144
11143
|
function c(h) {
|
|
11145
11144
|
s.removeEventListener("mouseup", c), s.removeEventListener("mousemove", f);
|
|
11146
|
-
const d =
|
|
11145
|
+
const d = _.getState(n.state);
|
|
11147
11146
|
d != null && d.dragging && (jf(
|
|
11148
11147
|
n,
|
|
11149
11148
|
d.activeHandle,
|
|
11150
|
-
|
|
11149
|
+
$i(d.dragging, h, t)
|
|
11151
11150
|
), n.dispatch(
|
|
11152
|
-
n.state.tr.setMeta(
|
|
11151
|
+
n.state.tr.setMeta(_, { setDragging: null })
|
|
11153
11152
|
));
|
|
11154
11153
|
}
|
|
11155
11154
|
function f(h) {
|
|
11156
11155
|
if (!h.which)
|
|
11157
11156
|
return c(h);
|
|
11158
|
-
const d =
|
|
11157
|
+
const d = _.getState(n.state);
|
|
11159
11158
|
if (d && d.dragging) {
|
|
11160
|
-
const u =
|
|
11161
|
-
|
|
11159
|
+
const u = $i(d.dragging, h, t);
|
|
11160
|
+
Wi(
|
|
11162
11161
|
n,
|
|
11163
11162
|
d.activeHandle,
|
|
11164
11163
|
u,
|
|
@@ -11166,7 +11165,7 @@ function Jf(n, e, t, r) {
|
|
|
11166
11165
|
);
|
|
11167
11166
|
}
|
|
11168
11167
|
}
|
|
11169
|
-
return
|
|
11168
|
+
return Wi(
|
|
11170
11169
|
n,
|
|
11171
11170
|
o.activeHandle,
|
|
11172
11171
|
a,
|
|
@@ -11189,7 +11188,7 @@ function Kf(n) {
|
|
|
11189
11188
|
n = n.classList && n.classList.contains("ProseMirror") ? null : n.parentNode;
|
|
11190
11189
|
return n;
|
|
11191
11190
|
}
|
|
11192
|
-
function
|
|
11191
|
+
function Hi(n, e, t, r) {
|
|
11193
11192
|
const i = t == "right" ? -r : r, s = n.posAtCoords({
|
|
11194
11193
|
left: e.clientX + i,
|
|
11195
11194
|
top: e.clientY
|
|
@@ -11204,13 +11203,13 @@ function Li(n, e, t, r) {
|
|
|
11204
11203
|
const a = D.get(l.node(-1)), c = l.start(-1), f = a.map.indexOf(l.pos - c);
|
|
11205
11204
|
return f % a.width == 0 ? -1 : c + a.map[f - 1];
|
|
11206
11205
|
}
|
|
11207
|
-
function
|
|
11206
|
+
function $i(n, e, t) {
|
|
11208
11207
|
const r = e.clientX - n.startX;
|
|
11209
11208
|
return Math.max(t, n.startWidth + r);
|
|
11210
11209
|
}
|
|
11211
11210
|
function Ro(n, e) {
|
|
11212
11211
|
n.dispatch(
|
|
11213
|
-
n.state.tr.setMeta(
|
|
11212
|
+
n.state.tr.setMeta(_, { setHandle: e })
|
|
11214
11213
|
);
|
|
11215
11214
|
}
|
|
11216
11215
|
function jf(n, e, t) {
|
|
@@ -11227,12 +11226,12 @@ function jf(n, e, t) {
|
|
|
11227
11226
|
}
|
|
11228
11227
|
a.docChanged && n.dispatch(a);
|
|
11229
11228
|
}
|
|
11230
|
-
function
|
|
11229
|
+
function Wi(n, e, t, r) {
|
|
11231
11230
|
const i = n.state.doc.resolve(e), s = i.node(-1), o = i.start(-1), l = D.get(s).colCount(i.pos - o) + i.nodeAfter.attrs.colspan - 1;
|
|
11232
11231
|
let a = n.domAtPos(i.start(-1)).node;
|
|
11233
11232
|
for (; a && a.nodeName != "TABLE"; )
|
|
11234
11233
|
a = a.parentNode;
|
|
11235
|
-
a &&
|
|
11234
|
+
a && ar(
|
|
11236
11235
|
s,
|
|
11237
11236
|
a.firstChild,
|
|
11238
11237
|
a,
|
|
@@ -11244,7 +11243,7 @@ function $i(n, e, t, r) {
|
|
|
11244
11243
|
function Uf(n) {
|
|
11245
11244
|
return Array(n).fill(0);
|
|
11246
11245
|
}
|
|
11247
|
-
function
|
|
11246
|
+
function Gf(n, e) {
|
|
11248
11247
|
var t;
|
|
11249
11248
|
const r = [], i = n.doc.resolve(e), s = i.node(-1);
|
|
11250
11249
|
if (!s)
|
|
@@ -11254,7 +11253,7 @@ function _f(n, e) {
|
|
|
11254
11253
|
const f = a + c * o.width;
|
|
11255
11254
|
if ((a == o.width - 1 || o.map[f] != o.map[f + 1]) && (c == 0 || o.map[f] != o.map[f - o.width])) {
|
|
11256
11255
|
const h = o.map[f], d = l + h + s.nodeAt(h).nodeSize - 1, u = document.createElement("div");
|
|
11257
|
-
u.className = "column-resize-handle", (t =
|
|
11256
|
+
u.className = "column-resize-handle", (t = _.getState(n)) != null && t.dragging && r.push(
|
|
11258
11257
|
j.node(
|
|
11259
11258
|
l + h,
|
|
11260
11259
|
l + h + s.nodeAt(h).nodeSize,
|
|
@@ -11267,7 +11266,7 @@ function _f(n, e) {
|
|
|
11267
11266
|
}
|
|
11268
11267
|
return A.create(n.doc, r);
|
|
11269
11268
|
}
|
|
11270
|
-
function
|
|
11269
|
+
function _f({
|
|
11271
11270
|
allowTableNodeSelection: n = !1
|
|
11272
11271
|
} = {}) {
|
|
11273
11272
|
return new Rt({
|
|
@@ -11313,7 +11312,7 @@ function Gf({
|
|
|
11313
11312
|
const wt = (n) => {
|
|
11314
11313
|
const e = Object.fromEntries(Array.from(n.attributes).map((t) => [t.name, t.value]));
|
|
11315
11314
|
return delete e.draggable, e;
|
|
11316
|
-
},
|
|
11315
|
+
}, Ji = "data-gs-mrk-fs", qi = "data-gs-ib", fn = "data-gs-ifrg", be = "attrs", Io = {
|
|
11317
11316
|
[be]: { default: "{}" }
|
|
11318
11317
|
}, de = {
|
|
11319
11318
|
[be]: { default: {} }
|
|
@@ -11390,9 +11389,9 @@ const wt = (n) => {
|
|
|
11390
11389
|
inline: !0,
|
|
11391
11390
|
group: "inline",
|
|
11392
11391
|
selectable: !1,
|
|
11393
|
-
parseDOM: [{ tag: `br[${
|
|
11392
|
+
parseDOM: [{ tag: `br[${qi}]` }],
|
|
11394
11393
|
toDOM() {
|
|
11395
|
-
return ["br", { [
|
|
11394
|
+
return ["br", { [qi]: "" }];
|
|
11396
11395
|
}
|
|
11397
11396
|
},
|
|
11398
11397
|
hardBreak: {
|
|
@@ -11488,7 +11487,7 @@ const wt = (n) => {
|
|
|
11488
11487
|
},
|
|
11489
11488
|
parseDOM: [
|
|
11490
11489
|
{
|
|
11491
|
-
tag: `span[${
|
|
11490
|
+
tag: `span[${Ji}]`,
|
|
11492
11491
|
getAttrs: (n) => ({
|
|
11493
11492
|
...vo(n),
|
|
11494
11493
|
size: n.style.fontSize
|
|
@@ -11498,21 +11497,21 @@ const wt = (n) => {
|
|
|
11498
11497
|
toDOM(n) {
|
|
11499
11498
|
const { size: e } = n.attrs, t = {
|
|
11500
11499
|
...Me(n),
|
|
11501
|
-
[
|
|
11500
|
+
[Ji]: !0
|
|
11502
11501
|
};
|
|
11503
11502
|
return e && (t.style = `font-size: ${e}`), ["span", t, 0];
|
|
11504
11503
|
}
|
|
11505
11504
|
}
|
|
11506
|
-
},
|
|
11505
|
+
}, Ki = new rl({
|
|
11507
11506
|
nodes: Xf,
|
|
11508
11507
|
marks: Yf
|
|
11509
11508
|
});
|
|
11510
11509
|
var hn = /* @__PURE__ */ ((n) => (n.toastAdd = "studio:toastAdd", n.dialogOpen = "studio:dialogOpen", n.dialogClose = "studio:dialogClose", n.sidebarLeftSet = "studio:sidebarLeft:set", n.sidebarLeftGet = "studio:sidebarLeft:get", n.sidebarLeftToggle = "studio:sidebarLeft:toggle", n.sidebarRightSet = "studio:sidebarRight:set", n.sidebarRightGet = "studio:sidebarRight:get", n.sidebarRightToggle = "studio:sidebarRight:toggle", n.sidebarTopSet = "studio:sidebarTop:set", n.sidebarTopGet = "studio:sidebarTop:get", n.sidebarTopToggle = "studio:sidebarTop:toggle", n.sidebarBottomSet = "studio:sidebarBottom:set", n.sidebarBottomGet = "studio:sidebarBottom:get", n.sidebarBottomToggle = "studio:sidebarBottom:toggle", n.symbolAdd = "studio:symbolAdd", n.symbolDetach = "studio:symbolDetach", n.symbolOverride = "studio:symbolOverride", n.symbolPropagateStyles = "studio:propagateStyles", n.getPagesConfig = "studio:getPagesConfig", n.setPagesConfig = "studio:setPagesConfig", n.getPageSettings = "studio:getPageSettings", n.setPageSettings = "studio:setPageSettings", n.projectFiles = "studio:projectFiles", n.canvasReload = "studio:canvasReload", n.getBlocksPanel = "studio:getBlocksPanel", n.setBlocksPanel = "studio:setBlocksPanel", n.contextMenuComponent = "studio:contextMenuComponent", n.layoutAdd = "studio:layoutAdd", n.layoutRemove = "studio:layoutRemove", n.layoutToggle = "studio:layoutToggle", n))(hn || {});
|
|
11511
|
-
const
|
|
11512
|
-
|
|
11510
|
+
const kn = /* @__PURE__ */ new WeakMap(), Tr = /* @__PURE__ */ new WeakMap(), Zf = (n, e) => {
|
|
11511
|
+
kn.set(n, e), Tr.set(e, n);
|
|
11513
11512
|
}, Qf = (n, e) => {
|
|
11514
|
-
|
|
11515
|
-
},
|
|
11513
|
+
kn.delete(n), Tr.delete(e);
|
|
11514
|
+
}, $n = (n) => kn.get(n), eh = (n) => Tr.get(n), ji = (n) => {
|
|
11516
11515
|
var t;
|
|
11517
11516
|
const e = eh(n);
|
|
11518
11517
|
return (t = e == null ? void 0 : e.__gjsv) == null ? void 0 : t.model;
|
|
@@ -11535,11 +11534,28 @@ function nh(n) {
|
|
|
11535
11534
|
};
|
|
11536
11535
|
e(n);
|
|
11537
11536
|
}
|
|
11538
|
-
|
|
11539
|
-
|
|
11540
|
-
|
|
11537
|
+
function rh(n, e = {}) {
|
|
11538
|
+
if (!e.enableOnClick) return () => {
|
|
11539
|
+
};
|
|
11540
|
+
const t = n.Components.events, r = (f) => n.getSelectedAll().includes(f), i = (f) => f.isInstanceOf("text") && !f.isChildOf("text"), s = (f) => f.isChildOf("text"), o = (f) => n.getEditing() === f, l = (f, h = {}) => {
|
|
11541
|
+
f.trigger("focus", h.event);
|
|
11542
|
+
}, a = (f, h) => {
|
|
11543
|
+
r(f) && i(f) && !o(f) && l(f, h);
|
|
11544
|
+
}, c = (f, h) => {
|
|
11545
|
+
if (r(f) && !i(f) && s(f)) {
|
|
11546
|
+
const d = f.parents().find((u) => u.isInstanceOf("text"));
|
|
11547
|
+
d && (l(d, h), setTimeout(() => n.select(d), 0));
|
|
11548
|
+
}
|
|
11549
|
+
};
|
|
11550
|
+
return n.on(t.select, a), n.on(t.selectBefore, c), () => {
|
|
11551
|
+
n.off(t.select, a), n.off(t.selectBefore, c);
|
|
11552
|
+
};
|
|
11553
|
+
}
|
|
11554
|
+
const ih = (n, e) => {
|
|
11555
|
+
const t = sh(n);
|
|
11556
|
+
return t && ph(t) ? oh(n, e) : t ? zs(() => ({ type: n.schema.nodes.div }))(n, e) : !1;
|
|
11541
11557
|
};
|
|
11542
|
-
function
|
|
11558
|
+
function sh(n) {
|
|
11543
11559
|
const e = n.selection.$from;
|
|
11544
11560
|
if (e.node(e.depth).type === n.schema.nodes.inlineFragment) {
|
|
11545
11561
|
const t = e.depth - 1;
|
|
@@ -11547,13 +11563,13 @@ function ih(n) {
|
|
|
11547
11563
|
}
|
|
11548
11564
|
return e.node(e.depth);
|
|
11549
11565
|
}
|
|
11550
|
-
function
|
|
11566
|
+
function oh(n, e) {
|
|
11551
11567
|
const { selection: t, schema: r, tr: i } = n;
|
|
11552
11568
|
i.split(t.from, 1);
|
|
11553
11569
|
const s = t.from + 1, o = i.doc.nodeAt(s), l = { ...o.attrs.attrs, id: void 0 }, a = o.textContent.length > 0, c = o.textContent.length || 0, f = o.textContent || " ", h = r.text(f), d = r.nodes.div.create(l, a ? h : [], []);
|
|
11554
11570
|
return i.replaceRangeWith(s, s + c + 2, d), i.setSelection(C.create(i.doc, s + 1)), e == null || e(i.scrollIntoView()), !0;
|
|
11555
11571
|
}
|
|
11556
|
-
function
|
|
11572
|
+
function lh(n, e, t) {
|
|
11557
11573
|
const { state: r, dispatch: i } = n, { selection: s, tr: o } = r, l = (a, c, f) => {
|
|
11558
11574
|
const h = {};
|
|
11559
11575
|
return a.split(";").forEach((d) => {
|
|
@@ -11606,7 +11622,7 @@ const mt = (n, e) => {
|
|
|
11606
11622
|
s.marks.some((o) => o.type === e) && (i = !0);
|
|
11607
11623
|
}), i;
|
|
11608
11624
|
};
|
|
11609
|
-
function
|
|
11625
|
+
function ah(n, e, t = "_blank") {
|
|
11610
11626
|
const { state: r, dispatch: i } = n, { schema: s, selection: o, tr: l } = r, a = s.marks.link;
|
|
11611
11627
|
try {
|
|
11612
11628
|
const c = a.create({ [be]: JSON.stringify({ href: e, target: t }) });
|
|
@@ -11615,7 +11631,7 @@ function lh(n, e, t = "_blank") {
|
|
|
11615
11631
|
console.error("Error applying link mark:", c);
|
|
11616
11632
|
}
|
|
11617
11633
|
}
|
|
11618
|
-
function
|
|
11634
|
+
function ch(n, e) {
|
|
11619
11635
|
const { state: t, dispatch: r } = n, { selection: i, tr: s } = t;
|
|
11620
11636
|
if (i.empty) return;
|
|
11621
11637
|
const o = t.schema.marks.font_size;
|
|
@@ -11637,11 +11653,11 @@ const He = (n, e) => {
|
|
|
11637
11653
|
node: o
|
|
11638
11654
|
};
|
|
11639
11655
|
}
|
|
11640
|
-
},
|
|
11656
|
+
}, fh = (n) => (n || "").split(";").map((e) => e.split(":")).reduce(
|
|
11641
11657
|
(e, [t, r]) => (t = t.replace(/-./g, (i) => i.toUpperCase()[1]).trim(), e[t] = `${r}`.trim(), e),
|
|
11642
11658
|
{}
|
|
11643
11659
|
);
|
|
11644
|
-
function
|
|
11660
|
+
function hh(...n) {
|
|
11645
11661
|
return (e, t) => {
|
|
11646
11662
|
const r = (o) => {
|
|
11647
11663
|
e = e.apply(o), t == null || t(o);
|
|
@@ -11649,7 +11665,7 @@ function fh(...n) {
|
|
|
11649
11665
|
return n.reduce((o, l) => o || l(e, r), !1) && i !== void 0 && i(e, t);
|
|
11650
11666
|
};
|
|
11651
11667
|
}
|
|
11652
|
-
const
|
|
11668
|
+
const dh = (n, e) => {
|
|
11653
11669
|
const { state: t, dispatch: r } = n;
|
|
11654
11670
|
if (e != null && e.event) {
|
|
11655
11671
|
const { event: i } = e, s = n.posAtCoords({ left: i.clientX, top: i.clientY });
|
|
@@ -11657,19 +11673,19 @@ const hh = (n, e) => {
|
|
|
11657
11673
|
} else
|
|
11658
11674
|
Bs(t, r);
|
|
11659
11675
|
setTimeout(() => setTimeout(() => n.focus()));
|
|
11660
|
-
},
|
|
11676
|
+
}, cr = (n) => n.isBlock, zo = (n) => n.type.name === "inlineFragment", uh = (n) => cr(n) && !zo(n), Bo = (n) => n.type.name === "bulletList", Vo = (n) => n.type.name === "orderedList", ph = (n) => n.type.name === "heading", mh = (n) => Bo(n) || Vo(n), Ui = (n, e) => {
|
|
11661
11677
|
var s, o;
|
|
11662
11678
|
const t = (s = He(n, (l) => l.type === e)) == null ? void 0 : s.node, r = n.state.schema.nodes.listItem;
|
|
11663
11679
|
let i;
|
|
11664
|
-
return t ? i =
|
|
11680
|
+
return t ? i = Un(r) : (o = He(n, mh)) != null && o.node ? i = hh(Un(r), Yr(e)) : i = Yr(e), i(n.state, n.dispatch);
|
|
11665
11681
|
}, Po = (n, e) => {
|
|
11666
11682
|
const { selection: t } = n.state;
|
|
11667
11683
|
return [...t.$from.marks(), ...t.$to.marks()].find((r) => r.type.name === e);
|
|
11668
|
-
},
|
|
11684
|
+
}, gh = (n) => {
|
|
11669
11685
|
var o;
|
|
11670
|
-
const { view: e, prop: t, editor: r, propCSS: i } = n, s = (o = He(e,
|
|
11686
|
+
const { view: e, prop: t, editor: r, propCSS: i } = n, s = (o = He(e, uh)) == null ? void 0 : o.node;
|
|
11671
11687
|
if (s) {
|
|
11672
|
-
const l = s.attrs.attrs || {}, a =
|
|
11688
|
+
const l = s.attrs.attrs || {}, a = fh(l.style);
|
|
11673
11689
|
if (t in a)
|
|
11674
11690
|
return a[t] || "";
|
|
11675
11691
|
if (l.id) {
|
|
@@ -11678,7 +11694,7 @@ const hh = (n, e) => {
|
|
|
11678
11694
|
}
|
|
11679
11695
|
}
|
|
11680
11696
|
return "";
|
|
11681
|
-
},
|
|
11697
|
+
}, yh = (n) => {
|
|
11682
11698
|
const { view: e, prop: t, markName: r, editor: i, propCSS: s } = n, o = Po(e, r);
|
|
11683
11699
|
if (o) {
|
|
11684
11700
|
const l = o.attrs;
|
|
@@ -11737,16 +11753,16 @@ const hh = (n, e) => {
|
|
|
11737
11753
|
isActive: () => mt(n.state, i.link),
|
|
11738
11754
|
create: (s) => {
|
|
11739
11755
|
const o = ji(n);
|
|
11740
|
-
o != null && o.is("link") ? (o.addAttributes({ href: s.url, target: s.target }), n.focus()) :
|
|
11756
|
+
o != null && o.is("link") ? (o.addAttributes({ href: s.url, target: s.target }), n.focus()) : ah(n, s.url, s.target);
|
|
11741
11757
|
}
|
|
11742
11758
|
},
|
|
11743
11759
|
alignText: {
|
|
11744
|
-
get: () =>
|
|
11745
|
-
set: (s) =>
|
|
11760
|
+
get: () => gh({ view: n, editor: e, prop: "textAlign", propCSS: "text-align" }),
|
|
11761
|
+
set: (s) => lh(n, s.value, !0)
|
|
11746
11762
|
},
|
|
11747
11763
|
fontSize: {
|
|
11748
|
-
get: () =>
|
|
11749
|
-
set: (s) =>
|
|
11764
|
+
get: () => yh({ view: n, editor: e, markName: "font_size", prop: "size", propCSS: "font-size" }),
|
|
11765
|
+
set: (s) => ch(n, s.value)
|
|
11750
11766
|
},
|
|
11751
11767
|
image: {
|
|
11752
11768
|
open() {
|
|
@@ -11769,12 +11785,12 @@ const hh = (n, e) => {
|
|
|
11769
11785
|
heading: {
|
|
11770
11786
|
get: () => {
|
|
11771
11787
|
var o;
|
|
11772
|
-
const s = (o = He(n,
|
|
11788
|
+
const s = (o = He(n, cr)) == null ? void 0 : o.node;
|
|
11773
11789
|
return `${(s == null ? void 0 : s.attrs.level) || ""}`;
|
|
11774
11790
|
},
|
|
11775
11791
|
set: ({ value: s }) => {
|
|
11776
11792
|
var a;
|
|
11777
|
-
const { state: o } = n, l = (a = He(n,
|
|
11793
|
+
const { state: o } = n, l = (a = He(n, cr)) == null ? void 0 : a.node;
|
|
11778
11794
|
Xl(o.schema.nodes.heading, {
|
|
11779
11795
|
attrs: l == null ? void 0 : l.attrs.attrs,
|
|
11780
11796
|
level: s ? parseInt(s, 10) : 0
|
|
@@ -11809,9 +11825,9 @@ const hh = (n, e) => {
|
|
|
11809
11825
|
alignTextCenter: '<svg viewBox="0 0 24 24"><path d="M3,3H21V5H3V3M7,7H17V9H7V7M3,11H21V13H3V11M7,15H17V17H7V15M3,19H21V21H3V19Z" /></svg>',
|
|
11810
11826
|
alignTextRight: '<svg viewBox="0 0 24 24"><path d="M3,3H21V5H3V3M9,7H21V9H9V7M3,11H21V13H3V11M9,15H21V17H9V15M3,19H21V21H3V19Z" /></svg>',
|
|
11811
11827
|
alignTextJustify: '<svg viewBox="0 0 24 24"><path d="M3,3H21V5H3V3M3,7H21V9H3V7M3,11H21V13H3V11M3,15H21V17H3V15M3,19H21V21H3V19Z" /></svg>'
|
|
11812
|
-
},
|
|
11828
|
+
}, bh = (n, e) => {
|
|
11813
11829
|
var a;
|
|
11814
|
-
const { editor: t, el: r } = n, i =
|
|
11830
|
+
const { editor: t, el: r } = n, i = kn.get(r), s = Fo(i, t), o = {
|
|
11815
11831
|
separator: {
|
|
11816
11832
|
type: "column",
|
|
11817
11833
|
style: { borderRightWidth: "1px", borderRightStyle: "solid", alignSelf: "stretch", margin: 3 }
|
|
@@ -11903,9 +11919,9 @@ const hh = (n, e) => {
|
|
|
11903
11919
|
type: "column",
|
|
11904
11920
|
as: "form",
|
|
11905
11921
|
style: { padding: "0 10px 15px", gap: 10 },
|
|
11906
|
-
onSubmit: (
|
|
11907
|
-
|
|
11908
|
-
const T = new FormData(
|
|
11922
|
+
onSubmit: (O) => {
|
|
11923
|
+
O.preventDefault();
|
|
11924
|
+
const T = new FormData(O.currentTarget);
|
|
11909
11925
|
s.link.create({ url: T.get("url"), target: T.get("target") }), g();
|
|
11910
11926
|
},
|
|
11911
11927
|
children: [
|
|
@@ -11916,7 +11932,7 @@ const hh = (n, e) => {
|
|
|
11916
11932
|
placeholder: "eg. https://google.com",
|
|
11917
11933
|
required: !0,
|
|
11918
11934
|
value: (b == null ? void 0 : b.href) || "",
|
|
11919
|
-
onChange: ({ value:
|
|
11935
|
+
onChange: ({ value: O, setState: T }) => T({ value: O })
|
|
11920
11936
|
},
|
|
11921
11937
|
{
|
|
11922
11938
|
type: "selectField",
|
|
@@ -11928,7 +11944,7 @@ const hh = (n, e) => {
|
|
|
11928
11944
|
{ id: "", label: "Current window" },
|
|
11929
11945
|
{ id: "_blank", label: "New window" }
|
|
11930
11946
|
],
|
|
11931
|
-
onChange: ({ value:
|
|
11947
|
+
onChange: ({ value: O, setState: T }) => T({ value: O })
|
|
11932
11948
|
},
|
|
11933
11949
|
{
|
|
11934
11950
|
type: "row",
|
|
@@ -12073,7 +12089,7 @@ const hh = (n, e) => {
|
|
|
12073
12089
|
items: l
|
|
12074
12090
|
})) || l;
|
|
12075
12091
|
};
|
|
12076
|
-
class
|
|
12092
|
+
class xh {
|
|
12077
12093
|
constructor(e, t, r) {
|
|
12078
12094
|
this.editor = r, this.node = e, this.dom = document.createElement("img"), this.view = t, Object.keys(e.attrs.attrs).forEach((i) => {
|
|
12079
12095
|
this.dom.setAttribute(i, e.attrs.attrs[i]);
|
|
@@ -12129,8 +12145,8 @@ function kh(n) {
|
|
|
12129
12145
|
return e.tr.insertText(s, r, i);
|
|
12130
12146
|
};
|
|
12131
12147
|
}
|
|
12132
|
-
const
|
|
12133
|
-
function
|
|
12148
|
+
const Sh = 500;
|
|
12149
|
+
function Ch({ rules: n }) {
|
|
12134
12150
|
let e = new Rt({
|
|
12135
12151
|
state: {
|
|
12136
12152
|
init() {
|
|
@@ -12143,13 +12159,13 @@ function Sh({ rules: n }) {
|
|
|
12143
12159
|
},
|
|
12144
12160
|
props: {
|
|
12145
12161
|
handleTextInput(t, r, i, s) {
|
|
12146
|
-
return
|
|
12162
|
+
return Gi(t, r, i, s, n, e);
|
|
12147
12163
|
},
|
|
12148
12164
|
handleDOMEvents: {
|
|
12149
12165
|
compositionend: (t) => {
|
|
12150
12166
|
setTimeout(() => {
|
|
12151
12167
|
let { $cursor: r } = t.state.selection;
|
|
12152
|
-
r &&
|
|
12168
|
+
r && Gi(t, r.pos, r.pos, "", n, e);
|
|
12153
12169
|
});
|
|
12154
12170
|
}
|
|
12155
12171
|
}
|
|
@@ -12158,10 +12174,10 @@ function Sh({ rules: n }) {
|
|
|
12158
12174
|
});
|
|
12159
12175
|
return e;
|
|
12160
12176
|
}
|
|
12161
|
-
function
|
|
12177
|
+
function Gi(n, e, t, r, i, s) {
|
|
12162
12178
|
if (n.composing)
|
|
12163
12179
|
return !1;
|
|
12164
|
-
let o = n.state, l = o.doc.resolve(e), a = l.parent.textBetween(Math.max(0, l.parentOffset -
|
|
12180
|
+
let o = n.state, l = o.doc.resolve(e), a = l.parent.textBetween(Math.max(0, l.parentOffset - Sh), l.parentOffset, null, "") + r;
|
|
12165
12181
|
for (let c = 0; c < i.length; c++) {
|
|
12166
12182
|
let f = i[c];
|
|
12167
12183
|
if (l.parent.type.spec.code) {
|
|
@@ -12175,8 +12191,8 @@ function _i(n, e, t, r, i, s) {
|
|
|
12175
12191
|
}
|
|
12176
12192
|
return !1;
|
|
12177
12193
|
}
|
|
12178
|
-
const
|
|
12179
|
-
function
|
|
12194
|
+
const wh = new Be(/--$/, "—"), Mh = new Be(/\.\.\.$/, "…"), Oh = new Be(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(")$/, "“"), Nh = new Be(/"$/, "”"), Th = new Be(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(')$/, "‘"), Ah = new Be(/'$/, "’"), Dh = [Oh, Nh, Th, Ah];
|
|
12195
|
+
function Ar(n, e, t = null, r) {
|
|
12180
12196
|
return new Be(n, (i, s, o, l) => {
|
|
12181
12197
|
let a = t instanceof Function ? t(s) : t, c = i.tr.delete(o, l), f = c.doc.resolve(o), h = f.blockRange(), d = h && bs(h, e, a);
|
|
12182
12198
|
if (!d)
|
|
@@ -12192,123 +12208,127 @@ function Lo(n, e, t = null) {
|
|
|
12192
12208
|
return l.node(-1).canReplaceWith(l.index(-1), l.indexAfter(-1), e) ? r.tr.delete(s, o).setBlockType(s, s, e, a) : null;
|
|
12193
12209
|
});
|
|
12194
12210
|
}
|
|
12195
|
-
function Dh(n) {
|
|
12196
|
-
return Tr(/^\s*>\s$/, n);
|
|
12197
|
-
}
|
|
12198
12211
|
function Eh(n) {
|
|
12199
|
-
return
|
|
12212
|
+
return Ar(/^\s*>\s$/, n);
|
|
12213
|
+
}
|
|
12214
|
+
function Rh(n) {
|
|
12215
|
+
return Ar(
|
|
12200
12216
|
/^(\d+)\.\s$/,
|
|
12201
12217
|
n,
|
|
12202
12218
|
(e) => ({ order: +e[1] }),
|
|
12203
12219
|
(e, t) => t.childCount + t.attrs.order == +e[1]
|
|
12204
12220
|
);
|
|
12205
12221
|
}
|
|
12206
|
-
function Rh(n) {
|
|
12207
|
-
return Tr(/^\s*([-+*])\s$/, n);
|
|
12208
|
-
}
|
|
12209
12222
|
function Ih(n) {
|
|
12223
|
+
return Ar(/^\s*([-+*])\s$/, n);
|
|
12224
|
+
}
|
|
12225
|
+
function vh(n) {
|
|
12210
12226
|
return Lo(/^```$/, n);
|
|
12211
12227
|
}
|
|
12212
|
-
function
|
|
12228
|
+
function zh(n, e) {
|
|
12213
12229
|
return Lo(new RegExp("^(#{1," + e + "})\\s$"), n, (t) => ({
|
|
12214
12230
|
level: t[1].length
|
|
12215
12231
|
}));
|
|
12216
12232
|
}
|
|
12217
|
-
function
|
|
12218
|
-
const e =
|
|
12233
|
+
function Bh(n) {
|
|
12234
|
+
const e = Dh.concat(Mh, wh);
|
|
12219
12235
|
let t;
|
|
12220
|
-
return (t = n.nodes.blockquote) && e.push(
|
|
12236
|
+
return (t = n.nodes.blockquote) && e.push(Eh(t)), (t = n.nodes.orderedList) && e.push(Rh(t)), (t = n.nodes.bulletList) && e.push(Ih(t)), (t = n.nodes.codeBlock) && e.push(vh(t)), (t = n.nodes.heading) && e.push(zh(t, 6)), Ch({ rules: e });
|
|
12221
12237
|
}
|
|
12222
|
-
const
|
|
12238
|
+
const Vh = "rteProseMirror", Ph = function(n, e = {}) {
|
|
12223
12239
|
const t = {
|
|
12224
|
-
plugins: (
|
|
12240
|
+
plugins: (o) => o.plugins,
|
|
12225
12241
|
...e
|
|
12226
|
-
}, r = (
|
|
12227
|
-
var
|
|
12228
|
-
const
|
|
12229
|
-
doc:
|
|
12230
|
-
schema:
|
|
12231
|
-
plugins: (
|
|
12242
|
+
}, r = (o, l) => {
|
|
12243
|
+
var p, m;
|
|
12244
|
+
const a = ((p = t.schema) == null ? void 0 : p.call(t, { editor: n, schema: Ki })) || Ki, { nodes: c, marks: f } = a, h = ot.fromSchema(a).parse(o), d = tt.create({
|
|
12245
|
+
doc: h,
|
|
12246
|
+
schema: a,
|
|
12247
|
+
plugins: (m = t.plugins) == null ? void 0 : m.call(t, {
|
|
12232
12248
|
editor: n,
|
|
12233
12249
|
plugins: [
|
|
12234
12250
|
Lf(),
|
|
12235
|
-
|
|
12236
|
-
|
|
12251
|
+
_f(),
|
|
12252
|
+
Bh(a),
|
|
12237
12253
|
aa(),
|
|
12238
12254
|
zn({
|
|
12239
|
-
Tab:
|
|
12240
|
-
"Shift-Tab":
|
|
12255
|
+
Tab: Bi(1),
|
|
12256
|
+
"Shift-Tab": Bi(-1)
|
|
12241
12257
|
}),
|
|
12242
12258
|
zn({
|
|
12243
|
-
Enter: Nt(vs, ga(
|
|
12244
|
-
"Shift-Enter": Nt(Is, (
|
|
12259
|
+
Enter: Nt(vs, ga(c.listItem), ih),
|
|
12260
|
+
"Shift-Enter": Nt(Is, (g, b) => (b && b(g.tr.replaceSelectionWith(c.inlineBreak.create()).scrollIntoView()), !0)),
|
|
12245
12261
|
"Mod-z": $s,
|
|
12246
|
-
"Mod-y":
|
|
12262
|
+
"Mod-y": jn,
|
|
12247
12263
|
// On Windows
|
|
12248
|
-
"Mod-Shift-z":
|
|
12264
|
+
"Mod-Shift-z": jn,
|
|
12249
12265
|
// On Mac
|
|
12250
|
-
"Mod-b": Ve(
|
|
12251
|
-
"Mod-i": Ve(
|
|
12252
|
-
"Shift-Tab":
|
|
12253
|
-
Tab:
|
|
12266
|
+
"Mod-b": Ve(f.strong),
|
|
12267
|
+
"Mod-i": Ve(f.em),
|
|
12268
|
+
"Shift-Tab": Un(c.listItem),
|
|
12269
|
+
Tab: xa(c.listItem)
|
|
12254
12270
|
}),
|
|
12255
12271
|
zn(Ql)
|
|
12256
12272
|
]
|
|
12257
12273
|
})
|
|
12258
|
-
}),
|
|
12274
|
+
}), u = new Yc(
|
|
12259
12275
|
// this mounts the editor on the element instead of creating its own container
|
|
12260
|
-
{ mount:
|
|
12276
|
+
{ mount: o },
|
|
12261
12277
|
{
|
|
12262
|
-
state:
|
|
12263
|
-
dispatchTransaction(
|
|
12264
|
-
var
|
|
12265
|
-
const { state:
|
|
12266
|
-
|
|
12267
|
-
const
|
|
12268
|
-
|
|
12278
|
+
state: d,
|
|
12279
|
+
dispatchTransaction(g) {
|
|
12280
|
+
var R;
|
|
12281
|
+
const { state: b } = u, w = b.apply(g), O = !b.doc.eq(w.doc);
|
|
12282
|
+
u.updateState(w);
|
|
12283
|
+
const T = !b.selection.eq(w.selection);
|
|
12284
|
+
O && (th(((R = l == null ? void 0 : l.view) == null ? void 0 : R.el) || o), u.focus()), (T || O) && n.trigger(te);
|
|
12269
12285
|
}
|
|
12270
12286
|
}
|
|
12271
12287
|
);
|
|
12272
|
-
return
|
|
12288
|
+
return o.__rteView = u, u.setProps({
|
|
12273
12289
|
nodeViews: {
|
|
12274
|
-
image(
|
|
12275
|
-
return new
|
|
12290
|
+
image(g) {
|
|
12291
|
+
return new xh(g, u, n);
|
|
12276
12292
|
}
|
|
12277
12293
|
}
|
|
12278
|
-
}),
|
|
12279
|
-
}, i = (
|
|
12294
|
+
}), u;
|
|
12295
|
+
}, i = (o) => bh(o, t);
|
|
12280
12296
|
n.setCustomRte({
|
|
12281
12297
|
// Use Studio SDK toolbar
|
|
12282
12298
|
toolbar: i,
|
|
12283
12299
|
parseContent: !0,
|
|
12284
|
-
async enable(
|
|
12285
|
-
const
|
|
12286
|
-
|
|
12300
|
+
async enable(o, l, a) {
|
|
12301
|
+
const c = $n(o);
|
|
12302
|
+
if (c) return c;
|
|
12303
|
+
const f = r(o, a);
|
|
12304
|
+
return Zf(o, f), dh(f, a), f;
|
|
12287
12305
|
},
|
|
12288
|
-
disable(
|
|
12289
|
-
const
|
|
12290
|
-
if (
|
|
12291
|
-
return Qf(
|
|
12306
|
+
disable(o) {
|
|
12307
|
+
const l = $n(o);
|
|
12308
|
+
if (l)
|
|
12309
|
+
return Qf(o, l), l.destroy(), { forceSync: !0 };
|
|
12292
12310
|
},
|
|
12293
|
-
getContent(
|
|
12294
|
-
const
|
|
12295
|
-
if (
|
|
12296
|
-
const { schema:
|
|
12297
|
-
return
|
|
12298
|
-
|
|
12299
|
-
}),
|
|
12311
|
+
getContent(o) {
|
|
12312
|
+
const l = $n(o);
|
|
12313
|
+
if (l) {
|
|
12314
|
+
const { schema: a, doc: c } = l.state, f = document.createElement("div"), h = Xe.fromSchema(a).serializeFragment(c.content);
|
|
12315
|
+
return h.childNodes.forEach((d) => {
|
|
12316
|
+
d.nodeType === Node.ELEMENT_NODE && d.innerHTML === "" && (d.innerHTML = "<br/>");
|
|
12317
|
+
}), f.appendChild(h), nh(f), o.classList.remove("ProseMirror-focused"), f.innerHTML;
|
|
12300
12318
|
}
|
|
12301
|
-
return
|
|
12319
|
+
return o.innerHTML;
|
|
12302
12320
|
}
|
|
12303
|
-
})
|
|
12321
|
+
});
|
|
12322
|
+
const s = rh(n, t);
|
|
12323
|
+
hf({
|
|
12304
12324
|
editor: n,
|
|
12305
12325
|
licenseKey: t.licenseKey,
|
|
12306
|
-
pluginName:
|
|
12326
|
+
pluginName: Vh,
|
|
12307
12327
|
cleanup: () => {
|
|
12308
|
-
n.RichTextEditor.customRte = void 0;
|
|
12328
|
+
n.RichTextEditor.customRte = void 0, s();
|
|
12309
12329
|
}
|
|
12310
12330
|
});
|
|
12311
|
-
}, Fh = ff(
|
|
12331
|
+
}, Fh = ff(Ph);
|
|
12312
12332
|
export {
|
|
12313
12333
|
Fh as default
|
|
12314
12334
|
};
|