@jinntec/jinntap 1.1.2 → 1.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/jinn-tap.es.js +819 -818
- package/dist/jinn-tap.umd.js +12 -12
- package/package.json +1 -1
package/dist/jinn-tap.es.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
function
|
|
1
|
+
function $(r) {
|
|
2
2
|
this.content = r;
|
|
3
3
|
}
|
|
4
|
-
|
|
5
|
-
constructor:
|
|
4
|
+
$.prototype = {
|
|
5
|
+
constructor: $,
|
|
6
6
|
find: function(r) {
|
|
7
7
|
for (var e = 0; e < this.content.length; e += 2)
|
|
8
8
|
if (this.content[e] === r) return e;
|
|
@@ -21,7 +21,7 @@ V.prototype = {
|
|
|
21
21
|
// given, the key of the binding will be replaced with that key.
|
|
22
22
|
update: function(r, e, t) {
|
|
23
23
|
var n = t && t != r ? this.remove(t) : this, i = n.find(r), s = n.content.slice();
|
|
24
|
-
return i == -1 ? s.push(t || r, e) : (s[i + 1] = e, t && (s[i] = t)), new
|
|
24
|
+
return i == -1 ? s.push(t || r, e) : (s[i + 1] = e, t && (s[i] = t)), new $(s);
|
|
25
25
|
},
|
|
26
26
|
// :: (string) → OrderedMap
|
|
27
27
|
// Return a map with the given key removed, if it existed.
|
|
@@ -29,25 +29,25 @@ V.prototype = {
|
|
|
29
29
|
var e = this.find(r);
|
|
30
30
|
if (e == -1) return this;
|
|
31
31
|
var t = this.content.slice();
|
|
32
|
-
return t.splice(e, 2), new
|
|
32
|
+
return t.splice(e, 2), new $(t);
|
|
33
33
|
},
|
|
34
34
|
// :: (string, any) → OrderedMap
|
|
35
35
|
// Add a new key to the start of the map.
|
|
36
36
|
addToStart: function(r, e) {
|
|
37
|
-
return new
|
|
37
|
+
return new $([r, e].concat(this.remove(r).content));
|
|
38
38
|
},
|
|
39
39
|
// :: (string, any) → OrderedMap
|
|
40
40
|
// Add a new key to the end of the map.
|
|
41
41
|
addToEnd: function(r, e) {
|
|
42
42
|
var t = this.remove(r).content.slice();
|
|
43
|
-
return t.push(r, e), new
|
|
43
|
+
return t.push(r, e), new $(t);
|
|
44
44
|
},
|
|
45
45
|
// :: (string, string, any) → OrderedMap
|
|
46
46
|
// Add a key after the given key. If `place` is not found, the new
|
|
47
47
|
// key is added to the end.
|
|
48
48
|
addBefore: function(r, e, t) {
|
|
49
49
|
var n = this.remove(e), i = n.content.slice(), s = n.find(r);
|
|
50
|
-
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 $(i);
|
|
51
51
|
},
|
|
52
52
|
// :: ((key: string, value: any))
|
|
53
53
|
// Call the given function for each key/value pair in the map, in
|
|
@@ -60,20 +60,20 @@ V.prototype = {
|
|
|
60
60
|
// Create a new map by prepending the keys in this map that don't
|
|
61
61
|
// appear in `map` before the keys in `map`.
|
|
62
62
|
prepend: function(r) {
|
|
63
|
-
return r =
|
|
63
|
+
return r = $.from(r), r.size ? new $(r.content.concat(this.subtract(r).content)) : this;
|
|
64
64
|
},
|
|
65
65
|
// :: (union<Object, OrderedMap>) → OrderedMap
|
|
66
66
|
// Create a new map by appending the keys in this map that don't
|
|
67
67
|
// appear in `map` after the keys in `map`.
|
|
68
68
|
append: function(r) {
|
|
69
|
-
return r =
|
|
69
|
+
return r = $.from(r), r.size ? new $(this.subtract(r).content.concat(r.content)) : this;
|
|
70
70
|
},
|
|
71
71
|
// :: (union<Object, OrderedMap>) → OrderedMap
|
|
72
72
|
// Create a map containing all the keys in this map that don't
|
|
73
73
|
// appear in `map`.
|
|
74
74
|
subtract: function(r) {
|
|
75
75
|
var e = this;
|
|
76
|
-
r =
|
|
76
|
+
r = $.from(r);
|
|
77
77
|
for (var t = 0; t < r.content.length; t += 2)
|
|
78
78
|
e = e.remove(r.content[t]);
|
|
79
79
|
return e;
|
|
@@ -92,11 +92,11 @@ V.prototype = {
|
|
|
92
92
|
return this.content.length >> 1;
|
|
93
93
|
}
|
|
94
94
|
};
|
|
95
|
-
|
|
96
|
-
if (r instanceof
|
|
95
|
+
$.from = function(r) {
|
|
96
|
+
if (r instanceof $) return r;
|
|
97
97
|
var e = [];
|
|
98
98
|
if (r) for (var t in r) e.push(t, r[t]);
|
|
99
|
-
return new
|
|
99
|
+
return new $(e);
|
|
100
100
|
};
|
|
101
101
|
function Vi(r, e, t) {
|
|
102
102
|
for (let n = 0; ; n++) {
|
|
@@ -1492,9 +1492,9 @@ class je {
|
|
|
1492
1492
|
let { type: u, next: d } = o.next[c];
|
|
1493
1493
|
if (!(u.isText || u.hasRequiredAttrs()) && i.indexOf(d) == -1) {
|
|
1494
1494
|
i.push(d);
|
|
1495
|
-
let
|
|
1496
|
-
if (
|
|
1497
|
-
return
|
|
1495
|
+
let h = s(d, l.concat(u));
|
|
1496
|
+
if (h)
|
|
1497
|
+
return h;
|
|
1498
1498
|
}
|
|
1499
1499
|
}
|
|
1500
1500
|
return null;
|
|
@@ -2050,7 +2050,7 @@ class ts {
|
|
|
2050
2050
|
let t = this.spec = {};
|
|
2051
2051
|
for (let i in e)
|
|
2052
2052
|
t[i] = e[i];
|
|
2053
|
-
t.nodes =
|
|
2053
|
+
t.nodes = $.from(e.nodes), t.marks = $.from(e.marks || {}), this.nodes = vr.compile(this.spec.nodes, this), this.marks = en.compile(this.spec.marks, this);
|
|
2054
2054
|
let n = /* @__PURE__ */ Object.create(null);
|
|
2055
2055
|
for (let i in this.nodes) {
|
|
2056
2056
|
if (i in this.marks)
|
|
@@ -2795,19 +2795,19 @@ function Bt(r, e, t, n) {
|
|
|
2795
2795
|
u = 2;
|
|
2796
2796
|
for (let d in c)
|
|
2797
2797
|
if (c[d] != null) {
|
|
2798
|
-
let
|
|
2799
|
-
|
|
2798
|
+
let h = d.indexOf(" ");
|
|
2799
|
+
h > 0 ? a.setAttributeNS(d.slice(0, h), d.slice(h + 1), c[d]) : a.setAttribute(d, c[d]);
|
|
2800
2800
|
}
|
|
2801
2801
|
}
|
|
2802
2802
|
for (let d = u; d < e.length; d++) {
|
|
2803
|
-
let
|
|
2804
|
-
if (
|
|
2803
|
+
let h = e[d];
|
|
2804
|
+
if (h === 0) {
|
|
2805
2805
|
if (d < e.length - 1 || d > u)
|
|
2806
2806
|
throw new RangeError("Content hole must be the only child of its parent node");
|
|
2807
2807
|
return { dom: a, contentDOM: a };
|
|
2808
2808
|
} else {
|
|
2809
|
-
let { dom:
|
|
2810
|
-
if (a.appendChild(
|
|
2809
|
+
let { dom: f, contentDOM: p } = Bt(r, h, t, n);
|
|
2810
|
+
if (a.appendChild(f), p) {
|
|
2811
2811
|
if (l)
|
|
2812
2812
|
throw new RangeError("Multiple content holes");
|
|
2813
2813
|
l = p;
|
|
@@ -2900,11 +2900,11 @@ class X {
|
|
|
2900
2900
|
break;
|
|
2901
2901
|
let c = this.ranges[l + s], u = this.ranges[l + o], d = a + c;
|
|
2902
2902
|
if (e <= d) {
|
|
2903
|
-
let
|
|
2903
|
+
let h = c ? e == a ? -1 : e == d ? 1 : t : t, f = a + i + (h < 0 ? 0 : u);
|
|
2904
2904
|
if (n)
|
|
2905
|
-
return
|
|
2905
|
+
return f;
|
|
2906
2906
|
let p = e == (t < 0 ? a : d) ? null : Qo(l / 3, e - a), m = e == a ? as : e == d ? ls : zt;
|
|
2907
|
-
return (t < 0 ? e != a : e != d) && (m |= cs), new Vn(
|
|
2907
|
+
return (t < 0 ? e != a : e != d) && (m |= cs), new Vn(f, m, p);
|
|
2908
2908
|
}
|
|
2909
2909
|
i += u - c;
|
|
2910
2910
|
}
|
|
@@ -3109,7 +3109,7 @@ class q {
|
|
|
3109
3109
|
return yn[e] = t, t.prototype.jsonID = e, t;
|
|
3110
3110
|
}
|
|
3111
3111
|
}
|
|
3112
|
-
class
|
|
3112
|
+
class R {
|
|
3113
3113
|
/**
|
|
3114
3114
|
@internal
|
|
3115
3115
|
*/
|
|
@@ -3120,13 +3120,13 @@ class B {
|
|
|
3120
3120
|
Create a successful step result.
|
|
3121
3121
|
*/
|
|
3122
3122
|
static ok(e) {
|
|
3123
|
-
return new
|
|
3123
|
+
return new R(e, null);
|
|
3124
3124
|
}
|
|
3125
3125
|
/**
|
|
3126
3126
|
Create a failed step result.
|
|
3127
3127
|
*/
|
|
3128
3128
|
static fail(e) {
|
|
3129
|
-
return new
|
|
3129
|
+
return new R(null, e);
|
|
3130
3130
|
}
|
|
3131
3131
|
/**
|
|
3132
3132
|
Call [`Node.replace`](https://prosemirror.net/docs/ref/#model.Node.replace) with the given
|
|
@@ -3135,10 +3135,10 @@ class B {
|
|
|
3135
3135
|
*/
|
|
3136
3136
|
static fromReplace(e, t, n, i) {
|
|
3137
3137
|
try {
|
|
3138
|
-
return
|
|
3138
|
+
return R.ok(e.replace(t, n, i));
|
|
3139
3139
|
} catch (s) {
|
|
3140
3140
|
if (s instanceof jt)
|
|
3141
|
-
return
|
|
3141
|
+
return R.fail(s.message);
|
|
3142
3142
|
throw s;
|
|
3143
3143
|
}
|
|
3144
3144
|
}
|
|
@@ -3160,10 +3160,10 @@ class Se extends q {
|
|
|
3160
3160
|
}
|
|
3161
3161
|
apply(e) {
|
|
3162
3162
|
let t = e.slice(this.from, this.to), n = e.resolve(this.from), i = n.node(n.sharedDepth(this.to)), s = new k(ir(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);
|
|
3163
|
-
return
|
|
3163
|
+
return R.fromReplace(e, this.from, this.to, s);
|
|
3164
3164
|
}
|
|
3165
3165
|
invert() {
|
|
3166
|
-
return new
|
|
3166
|
+
return new ce(this.from, this.to, this.mark);
|
|
3167
3167
|
}
|
|
3168
3168
|
map(e) {
|
|
3169
3169
|
let t = e.mapResult(this.from, 1), n = e.mapResult(this.to, -1);
|
|
@@ -3190,7 +3190,7 @@ class Se extends q {
|
|
|
3190
3190
|
}
|
|
3191
3191
|
}
|
|
3192
3192
|
q.jsonID("addMark", Se);
|
|
3193
|
-
class
|
|
3193
|
+
class ce extends q {
|
|
3194
3194
|
/**
|
|
3195
3195
|
Create a mark-removing step.
|
|
3196
3196
|
*/
|
|
@@ -3199,17 +3199,17 @@ class ae extends q {
|
|
|
3199
3199
|
}
|
|
3200
3200
|
apply(e) {
|
|
3201
3201
|
let t = e.slice(this.from, this.to), n = new k(ir(t.content, (i) => i.mark(this.mark.removeFromSet(i.marks)), e), t.openStart, t.openEnd);
|
|
3202
|
-
return
|
|
3202
|
+
return R.fromReplace(e, this.from, this.to, n);
|
|
3203
3203
|
}
|
|
3204
3204
|
invert() {
|
|
3205
3205
|
return new Se(this.from, this.to, this.mark);
|
|
3206
3206
|
}
|
|
3207
3207
|
map(e) {
|
|
3208
3208
|
let t = e.mapResult(this.from, 1), n = e.mapResult(this.to, -1);
|
|
3209
|
-
return t.deleted && n.deleted || t.pos >= n.pos ? null : new
|
|
3209
|
+
return t.deleted && n.deleted || t.pos >= n.pos ? null : new ce(t.pos, n.pos, this.mark);
|
|
3210
3210
|
}
|
|
3211
3211
|
merge(e) {
|
|
3212
|
-
return e instanceof
|
|
3212
|
+
return e instanceof ce && e.mark.eq(this.mark) && this.from <= e.to && this.to >= e.from ? new ce(Math.min(this.from, e.from), Math.max(this.to, e.to), this.mark) : null;
|
|
3213
3213
|
}
|
|
3214
3214
|
toJSON() {
|
|
3215
3215
|
return {
|
|
@@ -3225,10 +3225,10 @@ class ae extends q {
|
|
|
3225
3225
|
static fromJSON(e, t) {
|
|
3226
3226
|
if (typeof t.from != "number" || typeof t.to != "number")
|
|
3227
3227
|
throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");
|
|
3228
|
-
return new
|
|
3228
|
+
return new ce(t.from, t.to, e.markFromJSON(t.mark));
|
|
3229
3229
|
}
|
|
3230
3230
|
}
|
|
3231
|
-
q.jsonID("removeMark",
|
|
3231
|
+
q.jsonID("removeMark", ce);
|
|
3232
3232
|
class Ce extends q {
|
|
3233
3233
|
/**
|
|
3234
3234
|
Create a node mark step.
|
|
@@ -3239,9 +3239,9 @@ class Ce extends q {
|
|
|
3239
3239
|
apply(e) {
|
|
3240
3240
|
let t = e.nodeAt(this.pos);
|
|
3241
3241
|
if (!t)
|
|
3242
|
-
return
|
|
3242
|
+
return R.fail("No node at mark step's position");
|
|
3243
3243
|
let n = t.type.create(t.attrs, null, this.mark.addToSet(t.marks));
|
|
3244
|
-
return
|
|
3244
|
+
return R.fromReplace(e, this.pos, this.pos + 1, new k(b.from(n), 0, t.isLeaf ? 0 : 1));
|
|
3245
3245
|
}
|
|
3246
3246
|
invert(e) {
|
|
3247
3247
|
let t = e.nodeAt(this.pos);
|
|
@@ -3283,9 +3283,9 @@ class et extends q {
|
|
|
3283
3283
|
apply(e) {
|
|
3284
3284
|
let t = e.nodeAt(this.pos);
|
|
3285
3285
|
if (!t)
|
|
3286
|
-
return
|
|
3286
|
+
return R.fail("No node at mark step's position");
|
|
3287
3287
|
let n = t.type.create(t.attrs, null, this.mark.removeFromSet(t.marks));
|
|
3288
|
-
return
|
|
3288
|
+
return R.fromReplace(e, this.pos, this.pos + 1, new k(b.from(n), 0, t.isLeaf ? 0 : 1));
|
|
3289
3289
|
}
|
|
3290
3290
|
invert(e) {
|
|
3291
3291
|
let t = e.nodeAt(this.pos);
|
|
@@ -3308,7 +3308,7 @@ class et extends q {
|
|
|
3308
3308
|
}
|
|
3309
3309
|
}
|
|
3310
3310
|
q.jsonID("removeNodeMark", et);
|
|
3311
|
-
class
|
|
3311
|
+
class P extends q {
|
|
3312
3312
|
/**
|
|
3313
3313
|
The given `slice` should fit the 'gap' between `from` and
|
|
3314
3314
|
`to`—the depths must line up, and the surrounding nodes must be
|
|
@@ -3322,27 +3322,27 @@ class R extends q {
|
|
|
3322
3322
|
super(), this.from = e, this.to = t, this.slice = n, this.structure = i;
|
|
3323
3323
|
}
|
|
3324
3324
|
apply(e) {
|
|
3325
|
-
return this.structure && jn(e, this.from, this.to) ?
|
|
3325
|
+
return this.structure && jn(e, this.from, this.to) ? R.fail("Structure replace would overwrite content") : R.fromReplace(e, this.from, this.to, this.slice);
|
|
3326
3326
|
}
|
|
3327
3327
|
getMap() {
|
|
3328
3328
|
return new X([this.from, this.to - this.from, this.slice.size]);
|
|
3329
3329
|
}
|
|
3330
3330
|
invert(e) {
|
|
3331
|
-
return new
|
|
3331
|
+
return new P(this.from, this.from + this.slice.size, e.slice(this.from, this.to));
|
|
3332
3332
|
}
|
|
3333
3333
|
map(e) {
|
|
3334
3334
|
let t = e.mapResult(this.from, 1), n = e.mapResult(this.to, -1);
|
|
3335
|
-
return t.deletedAcross && n.deletedAcross ? null : new
|
|
3335
|
+
return t.deletedAcross && n.deletedAcross ? null : new P(t.pos, Math.max(t.pos, n.pos), this.slice);
|
|
3336
3336
|
}
|
|
3337
3337
|
merge(e) {
|
|
3338
|
-
if (!(e instanceof
|
|
3338
|
+
if (!(e instanceof P) || e.structure || this.structure)
|
|
3339
3339
|
return null;
|
|
3340
3340
|
if (this.from + this.slice.size == e.from && !this.slice.openEnd && !e.slice.openStart) {
|
|
3341
3341
|
let t = this.slice.size + e.slice.size == 0 ? k.empty : new k(this.slice.content.append(e.slice.content), this.slice.openStart, e.slice.openEnd);
|
|
3342
|
-
return new
|
|
3342
|
+
return new P(this.from, this.to + (e.to - e.from), t, this.structure);
|
|
3343
3343
|
} else if (e.to == this.from && !this.slice.openStart && !e.slice.openEnd) {
|
|
3344
3344
|
let t = this.slice.size + e.slice.size == 0 ? k.empty : new k(e.slice.content.append(this.slice.content), e.slice.openStart, this.slice.openEnd);
|
|
3345
|
-
return new
|
|
3345
|
+
return new P(e.from, this.to, t, this.structure);
|
|
3346
3346
|
} else
|
|
3347
3347
|
return null;
|
|
3348
3348
|
}
|
|
@@ -3356,11 +3356,11 @@ class R extends q {
|
|
|
3356
3356
|
static fromJSON(e, t) {
|
|
3357
3357
|
if (typeof t.from != "number" || typeof t.to != "number")
|
|
3358
3358
|
throw new RangeError("Invalid input for ReplaceStep.fromJSON");
|
|
3359
|
-
return new
|
|
3359
|
+
return new P(t.from, t.to, k.fromJSON(e, t.slice), !!t.structure);
|
|
3360
3360
|
}
|
|
3361
3361
|
}
|
|
3362
|
-
q.jsonID("replace",
|
|
3363
|
-
class
|
|
3362
|
+
q.jsonID("replace", P);
|
|
3363
|
+
class z extends q {
|
|
3364
3364
|
/**
|
|
3365
3365
|
Create a replace-around step with the given range and gap.
|
|
3366
3366
|
`insert` should be the point in the slice into which the content
|
|
@@ -3372,12 +3372,12 @@ class F extends q {
|
|
|
3372
3372
|
}
|
|
3373
3373
|
apply(e) {
|
|
3374
3374
|
if (this.structure && (jn(e, this.from, this.gapFrom) || jn(e, this.gapTo, this.to)))
|
|
3375
|
-
return
|
|
3375
|
+
return R.fail("Structure gap-replace would overwrite content");
|
|
3376
3376
|
let t = e.slice(this.gapFrom, this.gapTo);
|
|
3377
3377
|
if (t.openStart || t.openEnd)
|
|
3378
|
-
return
|
|
3378
|
+
return R.fail("Gap is not a flat range");
|
|
3379
3379
|
let n = this.slice.insertAt(this.insert, t.content);
|
|
3380
|
-
return n ?
|
|
3380
|
+
return n ? R.fromReplace(e, this.from, this.to, n) : R.fail("Content does not fit in gap");
|
|
3381
3381
|
}
|
|
3382
3382
|
getMap() {
|
|
3383
3383
|
return new X([
|
|
@@ -3391,11 +3391,11 @@ class F extends q {
|
|
|
3391
3391
|
}
|
|
3392
3392
|
invert(e) {
|
|
3393
3393
|
let t = this.gapTo - this.gapFrom;
|
|
3394
|
-
return new
|
|
3394
|
+
return new z(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);
|
|
3395
3395
|
}
|
|
3396
3396
|
map(e) {
|
|
3397
3397
|
let t = e.mapResult(this.from, 1), n = e.mapResult(this.to, -1), i = this.from == this.gapFrom ? t.pos : e.map(this.gapFrom, -1), s = this.to == this.gapTo ? n.pos : e.map(this.gapTo, 1);
|
|
3398
|
-
return t.deletedAcross && n.deletedAcross || i < t.pos || s > n.pos ? null : new
|
|
3398
|
+
return t.deletedAcross && n.deletedAcross || i < t.pos || s > n.pos ? null : new z(t.pos, n.pos, i, s, this.slice, this.insert, this.structure);
|
|
3399
3399
|
}
|
|
3400
3400
|
toJSON() {
|
|
3401
3401
|
let e = {
|
|
@@ -3414,10 +3414,10 @@ class F extends q {
|
|
|
3414
3414
|
static fromJSON(e, t) {
|
|
3415
3415
|
if (typeof t.from != "number" || typeof t.to != "number" || typeof t.gapFrom != "number" || typeof t.gapTo != "number" || typeof t.insert != "number")
|
|
3416
3416
|
throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");
|
|
3417
|
-
return new
|
|
3417
|
+
return new z(t.from, t.to, t.gapFrom, t.gapTo, k.fromJSON(e, t.slice), t.insert, !!t.structure);
|
|
3418
3418
|
}
|
|
3419
3419
|
}
|
|
3420
|
-
q.jsonID("replaceAround",
|
|
3420
|
+
q.jsonID("replaceAround", z);
|
|
3421
3421
|
function jn(r, e, t) {
|
|
3422
3422
|
let n = r.resolve(e), i = t - e, s = n.depth;
|
|
3423
3423
|
for (; i > 0 && s > 0 && n.indexAfter(s) == n.node(s).childCount; )
|
|
@@ -3439,10 +3439,10 @@ function tl(r, e, t, n) {
|
|
|
3439
3439
|
return;
|
|
3440
3440
|
let d = a.marks;
|
|
3441
3441
|
if (!n.isInSet(d) && u.type.allowsMarkType(n.type)) {
|
|
3442
|
-
let
|
|
3442
|
+
let h = Math.max(c, e), f = Math.min(c + a.nodeSize, t), p = n.addToSet(d);
|
|
3443
3443
|
for (let m = 0; m < d.length; m++)
|
|
3444
|
-
d[m].isInSet(p) || (o && o.to ==
|
|
3445
|
-
l && l.to ==
|
|
3444
|
+
d[m].isInSet(p) || (o && o.to == h && o.mark.eq(d[m]) ? o.to = f : i.push(o = new ce(h, f, d[m])));
|
|
3445
|
+
l && l.to == h ? l.to = f : s.push(l = new Se(h, f, n));
|
|
3446
3446
|
}
|
|
3447
3447
|
}), i.forEach((a) => r.step(a)), s.forEach((a) => r.step(a));
|
|
3448
3448
|
}
|
|
@@ -3461,30 +3461,30 @@ function nl(r, e, t, n) {
|
|
|
3461
3461
|
if (a && a.length) {
|
|
3462
3462
|
let c = Math.min(l + o.nodeSize, t);
|
|
3463
3463
|
for (let u = 0; u < a.length; u++) {
|
|
3464
|
-
let d = a[u],
|
|
3465
|
-
for (let
|
|
3466
|
-
let p = i[
|
|
3467
|
-
p.step == s - 1 && d.eq(i[
|
|
3464
|
+
let d = a[u], h;
|
|
3465
|
+
for (let f = 0; f < i.length; f++) {
|
|
3466
|
+
let p = i[f];
|
|
3467
|
+
p.step == s - 1 && d.eq(i[f].style) && (h = p);
|
|
3468
3468
|
}
|
|
3469
|
-
|
|
3469
|
+
h ? (h.to = c, h.step = s) : i.push({ style: d, from: Math.max(l, e), to: c, step: s });
|
|
3470
3470
|
}
|
|
3471
3471
|
}
|
|
3472
|
-
}), i.forEach((o) => r.step(new
|
|
3472
|
+
}), i.forEach((o) => r.step(new ce(o.from, o.to, o.style)));
|
|
3473
3473
|
}
|
|
3474
3474
|
function sr(r, e, t, n = t.contentMatch, i = !0) {
|
|
3475
3475
|
let s = r.doc.nodeAt(e), o = [], l = e + 1;
|
|
3476
3476
|
for (let a = 0; a < s.childCount; a++) {
|
|
3477
3477
|
let c = s.child(a), u = l + c.nodeSize, d = n.matchType(c.type);
|
|
3478
3478
|
if (!d)
|
|
3479
|
-
o.push(new
|
|
3479
|
+
o.push(new P(l, u, k.empty));
|
|
3480
3480
|
else {
|
|
3481
3481
|
n = d;
|
|
3482
|
-
for (let
|
|
3483
|
-
t.allowsMarkType(c.marks[
|
|
3482
|
+
for (let h = 0; h < c.marks.length; h++)
|
|
3483
|
+
t.allowsMarkType(c.marks[h].type) || r.step(new ce(l, u, c.marks[h]));
|
|
3484
3484
|
if (i && c.isText && t.whitespace != "pre") {
|
|
3485
|
-
let
|
|
3486
|
-
for (;
|
|
3487
|
-
p || (p = new k(b.from(t.schema.text(" ", t.allowedMarks(c.marks))), 0, 0)), o.push(new
|
|
3485
|
+
let h, f = /\r?\n|\r/g, p;
|
|
3486
|
+
for (; h = f.exec(c.text); )
|
|
3487
|
+
p || (p = new k(b.from(t.schema.text(" ", t.allowedMarks(c.marks))), 0, 0)), o.push(new P(l + h.index, l + h.index + h[0].length, p));
|
|
3488
3488
|
}
|
|
3489
3489
|
}
|
|
3490
3490
|
l = u;
|
|
@@ -3514,10 +3514,10 @@ function il(r, e, t) {
|
|
|
3514
3514
|
let { $from: n, $to: i, depth: s } = e, o = n.before(s + 1), l = i.after(s + 1), a = o, c = l, u = b.empty, d = 0;
|
|
3515
3515
|
for (let p = s, m = !1; p > t; p--)
|
|
3516
3516
|
m || n.index(p) > 0 ? (m = !0, u = b.from(n.node(p).copy(u)), d++) : a--;
|
|
3517
|
-
let
|
|
3517
|
+
let h = b.empty, f = 0;
|
|
3518
3518
|
for (let p = s, m = !1; p > t; p--)
|
|
3519
|
-
m || i.after(p + 1) < i.end(p) ? (m = !0,
|
|
3520
|
-
r.step(new
|
|
3519
|
+
m || i.after(p + 1) < i.end(p) ? (m = !0, h = b.from(i.node(p).copy(h)), f++) : c++;
|
|
3520
|
+
r.step(new z(a, c, o, l, new k(u.append(h), d, f), u.size - d, !0));
|
|
3521
3521
|
}
|
|
3522
3522
|
function us(r, e, t = null, n = r) {
|
|
3523
3523
|
let i = sl(r, e), s = i && ol(n, e);
|
|
@@ -3553,7 +3553,7 @@ function ll(r, e, t) {
|
|
|
3553
3553
|
n = b.from(t[o].type.create(t[o].attrs, n));
|
|
3554
3554
|
}
|
|
3555
3555
|
let i = e.start, s = e.end;
|
|
3556
|
-
r.step(new
|
|
3556
|
+
r.step(new z(i, s, i, s, new k(n, 0, 0), t.length, !0));
|
|
3557
3557
|
}
|
|
3558
3558
|
function al(r, e, t, n, i) {
|
|
3559
3559
|
if (!n.isTextblock)
|
|
@@ -3564,12 +3564,12 @@ function al(r, e, t, n, i) {
|
|
|
3564
3564
|
if (o.isTextblock && !o.hasMarkup(n, a) && cl(r.doc, r.mapping.slice(s).map(l), n)) {
|
|
3565
3565
|
let c = null;
|
|
3566
3566
|
if (n.schema.linebreakReplacement) {
|
|
3567
|
-
let
|
|
3568
|
-
|
|
3567
|
+
let f = n.whitespace == "pre", p = !!n.contentMatch.matchType(n.schema.linebreakReplacement);
|
|
3568
|
+
f && !p ? c = !1 : !f && p && (c = !0);
|
|
3569
3569
|
}
|
|
3570
|
-
c === !1 &&
|
|
3571
|
-
let u = r.mapping.slice(s), d = u.map(l, 1),
|
|
3572
|
-
return r.step(new
|
|
3570
|
+
c === !1 && hs(r, o, l, s), sr(r, r.mapping.slice(s).map(l, 1), n, void 0, c === null);
|
|
3571
|
+
let u = r.mapping.slice(s), d = u.map(l, 1), h = u.map(l + o.nodeSize, 1);
|
|
3572
|
+
return r.step(new z(d, h, d + 1, h - 1, new k(b.from(n.create(a, null, o.marks)), 0, 0), 1, !0)), c === !0 && ds(r, o, l, s), !1;
|
|
3573
3573
|
}
|
|
3574
3574
|
});
|
|
3575
3575
|
}
|
|
@@ -3584,7 +3584,7 @@ function ds(r, e, t, n) {
|
|
|
3584
3584
|
}
|
|
3585
3585
|
});
|
|
3586
3586
|
}
|
|
3587
|
-
function
|
|
3587
|
+
function hs(r, e, t, n) {
|
|
3588
3588
|
e.forEach((i, s) => {
|
|
3589
3589
|
if (i.type == i.type.schema.linebreakReplacement) {
|
|
3590
3590
|
let o = r.mapping.slice(n).map(t + 1 + s);
|
|
@@ -3607,20 +3607,20 @@ function ul(r, e, t, n, i) {
|
|
|
3607
3607
|
return r.replaceWith(e, e + s.nodeSize, o);
|
|
3608
3608
|
if (!t.validContent(s.content))
|
|
3609
3609
|
throw new RangeError("Invalid content for node type " + t.name);
|
|
3610
|
-
r.step(new
|
|
3610
|
+
r.step(new z(e, e + s.nodeSize, e + 1, e + s.nodeSize - 1, new k(b.from(o), 0, 0), 1, !0));
|
|
3611
3611
|
}
|
|
3612
|
-
function
|
|
3612
|
+
function me(r, e, t = 1, n) {
|
|
3613
3613
|
let i = r.resolve(e), s = i.depth - t, o = n && n[n.length - 1] || i.parent;
|
|
3614
3614
|
if (s < 0 || i.parent.type.spec.isolating || !i.parent.canReplace(i.index(), i.parent.childCount) || !o.type.validContent(i.parent.content.cutByIndex(i.index(), i.parent.childCount)))
|
|
3615
3615
|
return !1;
|
|
3616
3616
|
for (let c = i.depth - 1, u = t - 2; c > s; c--, u--) {
|
|
3617
|
-
let d = i.node(c),
|
|
3617
|
+
let d = i.node(c), h = i.index(c);
|
|
3618
3618
|
if (d.type.spec.isolating)
|
|
3619
3619
|
return !1;
|
|
3620
|
-
let
|
|
3621
|
-
p && (
|
|
3620
|
+
let f = d.content.cutByIndex(h, d.childCount), p = n && n[u + 1];
|
|
3621
|
+
p && (f = f.replaceChild(0, p.type.create(p.attrs)));
|
|
3622
3622
|
let m = n && n[u] || d;
|
|
3623
|
-
if (!d.canReplace(
|
|
3623
|
+
if (!d.canReplace(h + 1, d.childCount) || !m.type.validContent(f))
|
|
3624
3624
|
return !1;
|
|
3625
3625
|
}
|
|
3626
3626
|
let l = i.indexAfter(s), a = n && n[0];
|
|
@@ -3633,13 +3633,13 @@ function dl(r, e, t = 1, n) {
|
|
|
3633
3633
|
let u = n && n[c];
|
|
3634
3634
|
o = b.from(u ? u.type.create(u.attrs, o) : i.node(l).copy(o));
|
|
3635
3635
|
}
|
|
3636
|
-
r.step(new
|
|
3636
|
+
r.step(new P(e, e, new k(s.append(o), t, t), !0));
|
|
3637
3637
|
}
|
|
3638
3638
|
function qe(r, e) {
|
|
3639
3639
|
let t = r.resolve(e), n = t.index();
|
|
3640
|
-
return
|
|
3640
|
+
return fs(t.nodeBefore, t.nodeAfter) && t.parent.canReplace(n, n + 1);
|
|
3641
3641
|
}
|
|
3642
|
-
function
|
|
3642
|
+
function hl(r, e) {
|
|
3643
3643
|
e.content.size || r.type.compatibleContent(e.type);
|
|
3644
3644
|
let t = r.contentMatchAt(r.childCount), { linebreakReplacement: n } = r.type.schema;
|
|
3645
3645
|
for (let i = 0; i < e.childCount; i++) {
|
|
@@ -3649,21 +3649,21 @@ function fl(r, e) {
|
|
|
3649
3649
|
}
|
|
3650
3650
|
return t.validEnd;
|
|
3651
3651
|
}
|
|
3652
|
-
function
|
|
3653
|
-
return !!(r && e && !r.isLeaf &&
|
|
3652
|
+
function fs(r, e) {
|
|
3653
|
+
return !!(r && e && !r.isLeaf && hl(r, e));
|
|
3654
3654
|
}
|
|
3655
3655
|
function tn(r, e, t = -1) {
|
|
3656
3656
|
let n = r.resolve(e);
|
|
3657
3657
|
for (let i = n.depth; ; i--) {
|
|
3658
3658
|
let s, o, l = n.index(i);
|
|
3659
|
-
if (i == n.depth ? (s = n.nodeBefore, o = n.nodeAfter) : t > 0 ? (s = n.node(i + 1), l++, o = n.node(i).maybeChild(l)) : (s = n.node(i).maybeChild(l - 1), o = n.node(i + 1)), s && !s.isTextblock &&
|
|
3659
|
+
if (i == n.depth ? (s = n.nodeBefore, o = n.nodeAfter) : t > 0 ? (s = n.node(i + 1), l++, o = n.node(i).maybeChild(l)) : (s = n.node(i).maybeChild(l - 1), o = n.node(i + 1)), s && !s.isTextblock && fs(s, o) && n.node(i).canReplace(l, l + 1))
|
|
3660
3660
|
return e;
|
|
3661
3661
|
if (i == 0)
|
|
3662
3662
|
break;
|
|
3663
3663
|
e = t < 0 ? n.before(i) : n.after(i);
|
|
3664
3664
|
}
|
|
3665
3665
|
}
|
|
3666
|
-
function
|
|
3666
|
+
function fl(r, e, t) {
|
|
3667
3667
|
let n = null, { linebreakReplacement: i } = r.doc.type.schema, s = r.doc.resolve(e - t), o = s.node().type;
|
|
3668
3668
|
if (i && o.inlineContent) {
|
|
3669
3669
|
let u = o.whitespace == "pre", d = !!o.contentMatch.matchType(i);
|
|
@@ -3672,11 +3672,11 @@ function hl(r, e, t) {
|
|
|
3672
3672
|
let l = r.steps.length;
|
|
3673
3673
|
if (n === !1) {
|
|
3674
3674
|
let u = r.doc.resolve(e + t);
|
|
3675
|
-
|
|
3675
|
+
hs(r, u.node(), u.before(), l);
|
|
3676
3676
|
}
|
|
3677
3677
|
o.inlineContent && sr(r, e + t - 1, o, s.node().contentMatchAt(s.index()), n == null);
|
|
3678
3678
|
let a = r.mapping.slice(l), c = a.map(e - t);
|
|
3679
|
-
if (r.step(new
|
|
3679
|
+
if (r.step(new P(c, a.map(e + t, -1), k.empty, !0)), n === !0) {
|
|
3680
3680
|
let u = r.doc.resolve(c);
|
|
3681
3681
|
ds(r, u.node(), u.before(), r.steps.length);
|
|
3682
3682
|
}
|
|
@@ -3729,7 +3729,7 @@ function nn(r, e, t = e, n = k.empty) {
|
|
|
3729
3729
|
if (e == t && !n.size)
|
|
3730
3730
|
return null;
|
|
3731
3731
|
let i = r.resolve(e), s = r.resolve(t);
|
|
3732
|
-
return ps(i, s, n) ? new
|
|
3732
|
+
return ps(i, s, n) ? new P(e, t, n) : new gl(i, s, n).fit();
|
|
3733
3733
|
}
|
|
3734
3734
|
function ps(r, e, t) {
|
|
3735
3735
|
return !t.openStart && !t.openEnd && r.start() == e.start() && r.parent.canReplace(r.index(), e.index(), t.content);
|
|
@@ -3762,7 +3762,7 @@ class gl {
|
|
|
3762
3762
|
for (; o && l && s.childCount == 1; )
|
|
3763
3763
|
s = s.firstChild.content, o--, l--;
|
|
3764
3764
|
let a = new k(s, o, l);
|
|
3765
|
-
return e > -1 ? new
|
|
3765
|
+
return e > -1 ? new z(n.pos, e, this.$to.pos, this.$to.end(), a, t) : a.size || n.pos != this.$to.pos ? new P(n.pos, i.pos, a) : null;
|
|
3766
3766
|
}
|
|
3767
3767
|
// Find a position on the start spine of `this.unplaced` that has
|
|
3768
3768
|
// content that can be moved somewhere on the frontier. Returns two
|
|
@@ -3814,26 +3814,26 @@ class gl {
|
|
|
3814
3814
|
if (s)
|
|
3815
3815
|
for (let m = 0; m < s.length; m++)
|
|
3816
3816
|
this.openFrontierNode(s[m]);
|
|
3817
|
-
let o = this.unplaced, l = n ? n.content : o.content, a = o.openStart - e, c = 0, u = [], { match: d, type:
|
|
3817
|
+
let o = this.unplaced, l = n ? n.content : o.content, a = o.openStart - e, c = 0, u = [], { match: d, type: h } = this.frontier[t];
|
|
3818
3818
|
if (i) {
|
|
3819
3819
|
for (let m = 0; m < i.childCount; m++)
|
|
3820
3820
|
u.push(i.child(m));
|
|
3821
3821
|
d = d.matchFragment(i);
|
|
3822
3822
|
}
|
|
3823
|
-
let
|
|
3823
|
+
let f = l.size + e - (o.content.size - o.openEnd);
|
|
3824
3824
|
for (; c < l.childCount; ) {
|
|
3825
3825
|
let m = l.child(c), g = d.matchType(m.type);
|
|
3826
3826
|
if (!g)
|
|
3827
3827
|
break;
|
|
3828
|
-
c++, (c > 1 || a == 0 || m.content.size) && (d = g, u.push(ms(m.mark(
|
|
3828
|
+
c++, (c > 1 || a == 0 || m.content.size) && (d = g, u.push(ms(m.mark(h.allowedMarks(m.marks)), c == 1 ? a : 0, c == l.childCount ? f : -1)));
|
|
3829
3829
|
}
|
|
3830
3830
|
let p = c == l.childCount;
|
|
3831
|
-
p || (
|
|
3832
|
-
for (let m = 0, g = l; m <
|
|
3831
|
+
p || (f = -1), this.placed = at(this.placed, t, b.from(u)), this.frontier[t].match = d, p && f < 0 && n && n.type == this.frontier[this.depth].type && this.frontier.length > 1 && this.closeFrontierNode();
|
|
3832
|
+
for (let m = 0, g = l; m < f; m++) {
|
|
3833
3833
|
let y = g.lastChild;
|
|
3834
3834
|
this.frontier.push({ type: y.type, match: y.contentMatchAt(y.childCount) }), g = y.content;
|
|
3835
3835
|
}
|
|
3836
|
-
this.unplaced = p ? e == 0 ? k.empty : new k(lt(o.content, e - 1, 1), e - 1,
|
|
3836
|
+
this.unplaced = p ? e == 0 ? k.empty : new k(lt(o.content, e - 1, 1), e - 1, f < 0 ? o.openEnd : e - 1) : new k(lt(o.content, e, c), o.openStart, o.openEnd);
|
|
3837
3837
|
}
|
|
3838
3838
|
mustMoveInline() {
|
|
3839
3839
|
if (!this.$to.parent.isTextblock)
|
|
@@ -3919,46 +3919,46 @@ function kl(r, e, t, n) {
|
|
|
3919
3919
|
return r.deleteRange(e, t);
|
|
3920
3920
|
let i = r.doc.resolve(e), s = r.doc.resolve(t);
|
|
3921
3921
|
if (ps(i, s, n))
|
|
3922
|
-
return r.step(new
|
|
3922
|
+
return r.step(new P(e, t, n));
|
|
3923
3923
|
let o = ys(i, r.doc.resolve(t));
|
|
3924
3924
|
o[o.length - 1] == 0 && o.pop();
|
|
3925
3925
|
let l = -(i.depth + 1);
|
|
3926
3926
|
o.unshift(l);
|
|
3927
|
-
for (let
|
|
3928
|
-
let p = i.node(
|
|
3927
|
+
for (let h = i.depth, f = i.pos - 1; h > 0; h--, f--) {
|
|
3928
|
+
let p = i.node(h).type.spec;
|
|
3929
3929
|
if (p.defining || p.definingAsContext || p.isolating)
|
|
3930
3930
|
break;
|
|
3931
|
-
o.indexOf(
|
|
3931
|
+
o.indexOf(h) > -1 ? l = h : i.before(h) == f && o.splice(1, 0, -h);
|
|
3932
3932
|
}
|
|
3933
3933
|
let a = o.indexOf(l), c = [], u = n.openStart;
|
|
3934
|
-
for (let
|
|
3935
|
-
let p =
|
|
3936
|
-
if (c.push(p),
|
|
3934
|
+
for (let h = n.content, f = 0; ; f++) {
|
|
3935
|
+
let p = h.firstChild;
|
|
3936
|
+
if (c.push(p), f == n.openStart)
|
|
3937
3937
|
break;
|
|
3938
|
-
|
|
3938
|
+
h = p.content;
|
|
3939
3939
|
}
|
|
3940
|
-
for (let
|
|
3941
|
-
let
|
|
3942
|
-
if (p && !
|
|
3943
|
-
u =
|
|
3944
|
-
else if (p || !
|
|
3940
|
+
for (let h = u - 1; h >= 0; h--) {
|
|
3941
|
+
let f = c[h], p = bl(f.type);
|
|
3942
|
+
if (p && !f.sameMarkup(i.node(Math.abs(l) - 1)))
|
|
3943
|
+
u = h;
|
|
3944
|
+
else if (p || !f.type.isTextblock)
|
|
3945
3945
|
break;
|
|
3946
3946
|
}
|
|
3947
|
-
for (let
|
|
3948
|
-
let
|
|
3947
|
+
for (let h = n.openStart; h >= 0; h--) {
|
|
3948
|
+
let f = (h + u + 1) % (n.openStart + 1), p = c[f];
|
|
3949
3949
|
if (p)
|
|
3950
3950
|
for (let m = 0; m < o.length; m++) {
|
|
3951
3951
|
let g = o[(m + a) % o.length], y = !0;
|
|
3952
3952
|
g < 0 && (y = !1, g = -g);
|
|
3953
3953
|
let S = i.node(g - 1), w = i.index(g - 1);
|
|
3954
3954
|
if (S.canReplaceWith(w, w, p.type, p.marks))
|
|
3955
|
-
return r.replace(i.before(g), y ? s.after(g) : t, new k(gs(n.content, 0, n.openStart,
|
|
3955
|
+
return r.replace(i.before(g), y ? s.after(g) : t, new k(gs(n.content, 0, n.openStart, f), f, n.openEnd));
|
|
3956
3956
|
}
|
|
3957
3957
|
}
|
|
3958
3958
|
let d = r.steps.length;
|
|
3959
|
-
for (let
|
|
3960
|
-
let
|
|
3961
|
-
|
|
3959
|
+
for (let h = o.length - 1; h >= 0 && (r.replace(e, t, n), !(r.steps.length > d)); h--) {
|
|
3960
|
+
let f = o[h];
|
|
3961
|
+
f < 0 || (e = i.before(f), t = s.after(f));
|
|
3962
3962
|
}
|
|
3963
3963
|
}
|
|
3964
3964
|
function gs(r, e, t, n, i) {
|
|
@@ -4013,13 +4013,13 @@ class Ze extends q {
|
|
|
4013
4013
|
apply(e) {
|
|
4014
4014
|
let t = e.nodeAt(this.pos);
|
|
4015
4015
|
if (!t)
|
|
4016
|
-
return
|
|
4016
|
+
return R.fail("No node at attribute step's position");
|
|
4017
4017
|
let n = /* @__PURE__ */ Object.create(null);
|
|
4018
4018
|
for (let s in t.attrs)
|
|
4019
4019
|
n[s] = t.attrs[s];
|
|
4020
4020
|
n[this.attr] = this.value;
|
|
4021
4021
|
let i = t.type.create(n, null, t.marks);
|
|
4022
|
-
return
|
|
4022
|
+
return R.fromReplace(e, this.pos, this.pos + 1, new k(b.from(i), 0, t.isLeaf ? 0 : 1));
|
|
4023
4023
|
}
|
|
4024
4024
|
getMap() {
|
|
4025
4025
|
return X.empty;
|
|
@@ -4054,7 +4054,7 @@ class yt extends q {
|
|
|
4054
4054
|
t[i] = e.attrs[i];
|
|
4055
4055
|
t[this.attr] = this.value;
|
|
4056
4056
|
let n = e.type.create(t, e.content, e.marks);
|
|
4057
|
-
return
|
|
4057
|
+
return R.ok(n);
|
|
4058
4058
|
}
|
|
4059
4059
|
getMap() {
|
|
4060
4060
|
return X.empty;
|
|
@@ -4211,7 +4211,7 @@ class Cl {
|
|
|
4211
4211
|
last and first siblings are also joined, and so on.
|
|
4212
4212
|
*/
|
|
4213
4213
|
join(e, t = 1) {
|
|
4214
|
-
return
|
|
4214
|
+
return fl(this, e, t), this;
|
|
4215
4215
|
}
|
|
4216
4216
|
/**
|
|
4217
4217
|
Wrap the given [range](https://prosemirror.net/docs/ref/#model.NodeRange) in the given set of wrappers.
|
|
@@ -4399,7 +4399,7 @@ class O {
|
|
|
4399
4399
|
found.
|
|
4400
4400
|
*/
|
|
4401
4401
|
static findFrom(e, t, n = !1) {
|
|
4402
|
-
let i = e.parent.inlineContent ? new
|
|
4402
|
+
let i = e.parent.inlineContent ? new T(e) : _e(e.node(0), e.parent, e.pos, e.index(), t, n);
|
|
4403
4403
|
if (i)
|
|
4404
4404
|
return i;
|
|
4405
4405
|
for (let s = e.depth - 1; s >= 0; s--) {
|
|
@@ -4466,7 +4466,7 @@ class O {
|
|
|
4466
4466
|
returns the bookmark for that.
|
|
4467
4467
|
*/
|
|
4468
4468
|
getBookmark() {
|
|
4469
|
-
return
|
|
4469
|
+
return T.between(this.$anchor, this.$head).getBookmark();
|
|
4470
4470
|
}
|
|
4471
4471
|
}
|
|
4472
4472
|
O.prototype.visible = !0;
|
|
@@ -4482,7 +4482,7 @@ let Vr = !1;
|
|
|
4482
4482
|
function jr(r) {
|
|
4483
4483
|
!Vr && !r.parent.inlineContent && (Vr = !0, console.warn("TextSelection endpoint not pointing into a node with inline content (" + r.parent.type.name + ")"));
|
|
4484
4484
|
}
|
|
4485
|
-
class
|
|
4485
|
+
class T extends O {
|
|
4486
4486
|
/**
|
|
4487
4487
|
Construct a text selection between the given points.
|
|
4488
4488
|
*/
|
|
@@ -4501,7 +4501,7 @@ class E extends O {
|
|
|
4501
4501
|
if (!n.parent.inlineContent)
|
|
4502
4502
|
return O.near(n);
|
|
4503
4503
|
let i = e.resolve(t.map(this.anchor));
|
|
4504
|
-
return new
|
|
4504
|
+
return new T(i.parent.inlineContent ? i : n, n);
|
|
4505
4505
|
}
|
|
4506
4506
|
replace(e, t = k.empty) {
|
|
4507
4507
|
if (super.replace(e, t), t == k.empty) {
|
|
@@ -4510,7 +4510,7 @@ class E extends O {
|
|
|
4510
4510
|
}
|
|
4511
4511
|
}
|
|
4512
4512
|
eq(e) {
|
|
4513
|
-
return e instanceof
|
|
4513
|
+
return e instanceof T && e.anchor == this.anchor && e.head == this.head;
|
|
4514
4514
|
}
|
|
4515
4515
|
getBookmark() {
|
|
4516
4516
|
return new rn(this.anchor, this.head);
|
|
@@ -4524,7 +4524,7 @@ class E extends O {
|
|
|
4524
4524
|
static fromJSON(e, t) {
|
|
4525
4525
|
if (typeof t.anchor != "number" || typeof t.head != "number")
|
|
4526
4526
|
throw new RangeError("Invalid input for TextSelection.fromJSON");
|
|
4527
|
-
return new
|
|
4527
|
+
return new T(e.resolve(t.anchor), e.resolve(t.head));
|
|
4528
4528
|
}
|
|
4529
4529
|
/**
|
|
4530
4530
|
Create a text selection from non-resolved positions.
|
|
@@ -4550,10 +4550,10 @@ class E extends O {
|
|
|
4550
4550
|
else
|
|
4551
4551
|
return O.near(t, n);
|
|
4552
4552
|
}
|
|
4553
|
-
return e.parent.inlineContent || (i == 0 ? e = t : (e = (O.findFrom(e, -n, !0) || O.findFrom(e, n, !0)).$anchor, e.pos < t.pos != i < 0 && (e = t))), new
|
|
4553
|
+
return e.parent.inlineContent || (i == 0 ? e = t : (e = (O.findFrom(e, -n, !0) || O.findFrom(e, n, !0)).$anchor, e.pos < t.pos != i < 0 && (e = t))), new T(e, t);
|
|
4554
4554
|
}
|
|
4555
4555
|
}
|
|
4556
|
-
O.jsonID("text",
|
|
4556
|
+
O.jsonID("text", T);
|
|
4557
4557
|
class rn {
|
|
4558
4558
|
constructor(e, t) {
|
|
4559
4559
|
this.anchor = e, this.head = t;
|
|
@@ -4562,7 +4562,7 @@ class rn {
|
|
|
4562
4562
|
return new rn(e.map(this.anchor), e.map(this.head));
|
|
4563
4563
|
}
|
|
4564
4564
|
resolve(e) {
|
|
4565
|
-
return
|
|
4565
|
+
return T.between(e.resolve(this.anchor), e.resolve(this.head));
|
|
4566
4566
|
}
|
|
4567
4567
|
}
|
|
4568
4568
|
class C extends O {
|
|
@@ -4672,7 +4672,7 @@ const Ml = {
|
|
|
4672
4672
|
};
|
|
4673
4673
|
function _e(r, e, t, n, i, s = !1) {
|
|
4674
4674
|
if (e.inlineContent)
|
|
4675
|
-
return
|
|
4675
|
+
return T.create(r, t);
|
|
4676
4676
|
for (let o = n - (i > 0 ? 0 : 1); i > 0 ? o < e.childCount : o >= 0; o += i) {
|
|
4677
4677
|
let l = e.child(o);
|
|
4678
4678
|
if (l.isAtom) {
|
|
@@ -4692,7 +4692,7 @@ function Wr(r, e, t) {
|
|
|
4692
4692
|
if (n < e)
|
|
4693
4693
|
return;
|
|
4694
4694
|
let i = r.steps[n];
|
|
4695
|
-
if (!(i instanceof
|
|
4695
|
+
if (!(i instanceof P || i instanceof z))
|
|
4696
4696
|
return;
|
|
4697
4697
|
let s = r.mapping.maps[n], o;
|
|
4698
4698
|
s.forEach((l, a, c, u) => {
|
|
@@ -5092,7 +5092,7 @@ const Cn = /* @__PURE__ */ Object.create(null);
|
|
|
5092
5092
|
function ks(r) {
|
|
5093
5093
|
return r in Cn ? r + "$" + ++Cn[r] : (Cn[r] = 0, r + "$");
|
|
5094
5094
|
}
|
|
5095
|
-
class
|
|
5095
|
+
class le {
|
|
5096
5096
|
/**
|
|
5097
5097
|
Create a plugin key.
|
|
5098
5098
|
*/
|
|
@@ -5113,7 +5113,7 @@ class oe {
|
|
|
5113
5113
|
return e[this.key];
|
|
5114
5114
|
}
|
|
5115
5115
|
}
|
|
5116
|
-
const
|
|
5116
|
+
const V = function(r) {
|
|
5117
5117
|
for (var e = 0; ; e++)
|
|
5118
5118
|
if (r = r.previousSibling, !r)
|
|
5119
5119
|
return e;
|
|
@@ -5134,20 +5134,20 @@ function Ur(r, e, t, n, i) {
|
|
|
5134
5134
|
for (; ; ) {
|
|
5135
5135
|
if (r == t && e == n)
|
|
5136
5136
|
return !0;
|
|
5137
|
-
if (e == (i < 0 ? 0 :
|
|
5137
|
+
if (e == (i < 0 ? 0 : ne(r))) {
|
|
5138
5138
|
let s = r.parentNode;
|
|
5139
5139
|
if (!s || s.nodeType != 1 || Mt(r) || Nl.test(r.nodeName) || r.contentEditable == "false")
|
|
5140
5140
|
return !1;
|
|
5141
|
-
e =
|
|
5141
|
+
e = V(r) + (i < 0 ? 0 : 1), r = s;
|
|
5142
5142
|
} else if (r.nodeType == 1) {
|
|
5143
5143
|
if (r = r.childNodes[e + (i < 0 ? -1 : 0)], r.contentEditable == "false")
|
|
5144
5144
|
return !1;
|
|
5145
|
-
e = i < 0 ?
|
|
5145
|
+
e = i < 0 ? ne(r) : 0;
|
|
5146
5146
|
} else
|
|
5147
5147
|
return !1;
|
|
5148
5148
|
}
|
|
5149
5149
|
}
|
|
5150
|
-
function
|
|
5150
|
+
function ne(r) {
|
|
5151
5151
|
return r.nodeType == 3 ? r.nodeValue.length : r.childNodes.length;
|
|
5152
5152
|
}
|
|
5153
5153
|
function Al(r, e) {
|
|
@@ -5157,9 +5157,9 @@ function Al(r, e) {
|
|
|
5157
5157
|
if (r.nodeType == 1 && e > 0) {
|
|
5158
5158
|
if (r.contentEditable == "false")
|
|
5159
5159
|
return null;
|
|
5160
|
-
r = r.childNodes[e - 1], e =
|
|
5160
|
+
r = r.childNodes[e - 1], e = ne(r);
|
|
5161
5161
|
} else if (r.parentNode && !Mt(r))
|
|
5162
|
-
e =
|
|
5162
|
+
e = V(r), r = r.parentNode;
|
|
5163
5163
|
else
|
|
5164
5164
|
return null;
|
|
5165
5165
|
}
|
|
@@ -5173,19 +5173,19 @@ function vl(r, e) {
|
|
|
5173
5173
|
return null;
|
|
5174
5174
|
r = r.childNodes[e], e = 0;
|
|
5175
5175
|
} else if (r.parentNode && !Mt(r))
|
|
5176
|
-
e =
|
|
5176
|
+
e = V(r) + 1, r = r.parentNode;
|
|
5177
5177
|
else
|
|
5178
5178
|
return null;
|
|
5179
5179
|
}
|
|
5180
5180
|
}
|
|
5181
5181
|
function Dl(r, e, t) {
|
|
5182
|
-
for (let n = e == 0, i = e ==
|
|
5182
|
+
for (let n = e == 0, i = e == ne(r); n || i; ) {
|
|
5183
5183
|
if (r == t)
|
|
5184
5184
|
return !0;
|
|
5185
|
-
let s =
|
|
5185
|
+
let s = V(r);
|
|
5186
5186
|
if (r = r.parentNode, !r)
|
|
5187
5187
|
return !1;
|
|
5188
|
-
n = n && s == 0, i = i && s ==
|
|
5188
|
+
n = n && s == 0, i = i && s == ne(r);
|
|
5189
5189
|
}
|
|
5190
5190
|
}
|
|
5191
5191
|
function Mt(r) {
|
|
@@ -5212,18 +5212,18 @@ function Pl(r, e, t) {
|
|
|
5212
5212
|
try {
|
|
5213
5213
|
let n = r.caretPositionFromPoint(e, t);
|
|
5214
5214
|
if (n)
|
|
5215
|
-
return { node: n.offsetNode, offset: Math.min(
|
|
5215
|
+
return { node: n.offsetNode, offset: Math.min(ne(n.offsetNode), n.offset) };
|
|
5216
5216
|
} catch {
|
|
5217
5217
|
}
|
|
5218
5218
|
if (r.caretRangeFromPoint) {
|
|
5219
5219
|
let n = r.caretRangeFromPoint(e, t);
|
|
5220
5220
|
if (n)
|
|
5221
|
-
return { node: n.startContainer, offset: Math.min(
|
|
5221
|
+
return { node: n.startContainer, offset: Math.min(ne(n.startContainer), n.startOffset) };
|
|
5222
5222
|
}
|
|
5223
5223
|
}
|
|
5224
|
-
const
|
|
5225
|
-
|
|
5226
|
-
const qn = !G && /Chrome\/(\d+)/.exec(Ae), J = !!qn, Ss = qn ? +qn[1] : 0, K = !G && !!
|
|
5224
|
+
const ue = typeof navigator < "u" ? navigator : null, _r = typeof document < "u" ? document : null, Ae = ue && ue.userAgent || "", Hn = /Edge\/(\d+)/.exec(Ae), xs = /MSIE \d/.exec(Ae), Jn = /Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Ae), G = !!(xs || Jn || Hn), Ee = xs ? document.documentMode : Jn ? +Jn[1] : Hn ? +Hn[1] : 0, oe = !G && /gecko\/(\d+)/i.test(Ae);
|
|
5225
|
+
oe && +(/Firefox\/(\d+)/.exec(Ae) || [0, 0])[1];
|
|
5226
|
+
const qn = !G && /Chrome\/(\d+)/.exec(Ae), J = !!qn, Ss = qn ? +qn[1] : 0, K = !G && !!ue && /Apple Computer/.test(ue.vendor), rt = K && (/Mobile\/\w+/.test(Ae) || !!ue && ue.maxTouchPoints > 2), te = rt || (ue ? /Mac/.test(ue.platform) : !1), Rl = ue ? /Win/.test(ue.platform) : !1, pe = /Android \d/.test(Ae), Et = !!_r && "webkitFontSmoothing" in _r.documentElement.style, Bl = Et ? +(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent) || [0, 0])[1] : 0;
|
|
5227
5227
|
function zl(r) {
|
|
5228
5228
|
let e = r.defaultView && r.defaultView.visualViewport;
|
|
5229
5229
|
return e ? {
|
|
@@ -5238,7 +5238,7 @@ function zl(r) {
|
|
|
5238
5238
|
bottom: r.documentElement.clientHeight
|
|
5239
5239
|
};
|
|
5240
5240
|
}
|
|
5241
|
-
function
|
|
5241
|
+
function he(r, e) {
|
|
5242
5242
|
return typeof r == "number" ? r : r[e];
|
|
5243
5243
|
}
|
|
5244
5244
|
function Fl(r) {
|
|
@@ -5258,19 +5258,19 @@ function Gr(r, e, t) {
|
|
|
5258
5258
|
continue;
|
|
5259
5259
|
}
|
|
5260
5260
|
let l = o, a = l == s.body, c = a ? zl(s) : Fl(l), u = 0, d = 0;
|
|
5261
|
-
if (e.top < c.top +
|
|
5261
|
+
if (e.top < c.top + he(n, "top") ? d = -(c.top - e.top + he(i, "top")) : e.bottom > c.bottom - he(n, "bottom") && (d = e.bottom - e.top > c.bottom - c.top ? e.top + he(i, "top") - c.top : e.bottom - c.bottom + he(i, "bottom")), e.left < c.left + he(n, "left") ? u = -(c.left - e.left + he(i, "left")) : e.right > c.right - he(n, "right") && (u = e.right - c.right + he(i, "right")), u || d)
|
|
5262
5262
|
if (a)
|
|
5263
5263
|
s.defaultView.scrollBy(u, d);
|
|
5264
5264
|
else {
|
|
5265
|
-
let
|
|
5265
|
+
let f = l.scrollLeft, p = l.scrollTop;
|
|
5266
5266
|
d && (l.scrollTop += d), u && (l.scrollLeft += u);
|
|
5267
|
-
let m = l.scrollLeft -
|
|
5267
|
+
let m = l.scrollLeft - f, g = l.scrollTop - p;
|
|
5268
5268
|
e = { left: e.left - m, top: e.top - g, right: e.right - m, bottom: e.bottom - g };
|
|
5269
5269
|
}
|
|
5270
|
-
let
|
|
5271
|
-
if (/^(fixed|sticky)$/.test(
|
|
5270
|
+
let h = a ? "fixed" : getComputedStyle(o).position;
|
|
5271
|
+
if (/^(fixed|sticky)$/.test(h))
|
|
5272
5272
|
break;
|
|
5273
|
-
o =
|
|
5273
|
+
o = h == "absolute" ? o.offsetParent : nt(o);
|
|
5274
5274
|
}
|
|
5275
5275
|
}
|
|
5276
5276
|
function Ll(r) {
|
|
@@ -5319,15 +5319,15 @@ function Vl(r) {
|
|
|
5319
5319
|
function Ms(r, e) {
|
|
5320
5320
|
let t, n = 2e8, i, s = 0, o = e.top, l = e.top, a, c;
|
|
5321
5321
|
for (let u = r.firstChild, d = 0; u; u = u.nextSibling, d++) {
|
|
5322
|
-
let
|
|
5322
|
+
let h;
|
|
5323
5323
|
if (u.nodeType == 1)
|
|
5324
|
-
|
|
5324
|
+
h = u.getClientRects();
|
|
5325
5325
|
else if (u.nodeType == 3)
|
|
5326
|
-
|
|
5326
|
+
h = fe(u).getClientRects();
|
|
5327
5327
|
else
|
|
5328
5328
|
continue;
|
|
5329
|
-
for (let
|
|
5330
|
-
let p = f
|
|
5329
|
+
for (let f = 0; f < h.length; f++) {
|
|
5330
|
+
let p = h[f];
|
|
5331
5331
|
if (p.top <= o && p.bottom >= l) {
|
|
5332
5332
|
o = Math.max(p.bottom, o), l = Math.min(p.top, l);
|
|
5333
5333
|
let m = p.left > e.left ? p.left - e.left : p.right < e.left ? e.left - p.right : 0;
|
|
@@ -5413,7 +5413,7 @@ function ql(r, e) {
|
|
|
5413
5413
|
for (let c = o; n && c; c = nt(c))
|
|
5414
5414
|
c.draggable && (n = void 0);
|
|
5415
5415
|
if (o = Wl(o, e), n) {
|
|
5416
|
-
if (
|
|
5416
|
+
if (oe && n.nodeType == 1 && (i = Math.min(i, n.childNodes.length), i < n.childNodes.length)) {
|
|
5417
5417
|
let u = n.childNodes[i], d;
|
|
5418
5418
|
u.nodeName == "IMG" && (d = u.getBoundingClientRect()).right <= e.left && d.bottom > e.top && i++;
|
|
5419
5419
|
}
|
|
@@ -5438,11 +5438,11 @@ function ye(r, e) {
|
|
|
5438
5438
|
}
|
|
5439
5439
|
const Kl = /[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;
|
|
5440
5440
|
function Ts(r, e, t) {
|
|
5441
|
-
let { node: n, offset: i, atom: s } = r.docView.domFromPos(e, t < 0 ? -1 : 1), o = Et ||
|
|
5441
|
+
let { node: n, offset: i, atom: s } = r.docView.domFromPos(e, t < 0 ? -1 : 1), o = Et || oe;
|
|
5442
5442
|
if (n.nodeType == 3)
|
|
5443
5443
|
if (o && (Kl.test(n.nodeValue) || (t < 0 ? !i : i == n.nodeValue.length))) {
|
|
5444
5444
|
let a = ye(fe(n, i, i), t);
|
|
5445
|
-
if (
|
|
5445
|
+
if (oe && i && /\s/.test(n.nodeValue[i - 1]) && i < n.nodeValue.length) {
|
|
5446
5446
|
let c = ye(fe(n, i - 1, i - 1), -1);
|
|
5447
5447
|
if (c.top == a.top) {
|
|
5448
5448
|
let u = ye(fe(n, i, i + 1), -1);
|
|
@@ -5456,24 +5456,24 @@ function Ts(r, e, t) {
|
|
|
5456
5456
|
return t < 0 && !i ? (c++, u = -1) : t >= 0 && i == n.nodeValue.length ? (a--, u = 1) : t < 0 ? a-- : c++, ot(ye(fe(n, a, c), u), u < 0);
|
|
5457
5457
|
}
|
|
5458
5458
|
if (!r.state.doc.resolve(e - (s || 0)).parent.inlineContent) {
|
|
5459
|
-
if (s == null && i && (t < 0 || i ==
|
|
5459
|
+
if (s == null && i && (t < 0 || i == ne(n))) {
|
|
5460
5460
|
let a = n.childNodes[i - 1];
|
|
5461
5461
|
if (a.nodeType == 1)
|
|
5462
5462
|
return wn(a.getBoundingClientRect(), !1);
|
|
5463
5463
|
}
|
|
5464
|
-
if (s == null && i <
|
|
5464
|
+
if (s == null && i < ne(n)) {
|
|
5465
5465
|
let a = n.childNodes[i];
|
|
5466
5466
|
if (a.nodeType == 1)
|
|
5467
5467
|
return wn(a.getBoundingClientRect(), !0);
|
|
5468
5468
|
}
|
|
5469
5469
|
return wn(n.getBoundingClientRect(), t >= 0);
|
|
5470
5470
|
}
|
|
5471
|
-
if (s == null && i && (t < 0 || i ==
|
|
5472
|
-
let a = n.childNodes[i - 1], c = a.nodeType == 3 ? fe(a,
|
|
5471
|
+
if (s == null && i && (t < 0 || i == ne(n))) {
|
|
5472
|
+
let a = n.childNodes[i - 1], c = a.nodeType == 3 ? fe(a, ne(a) - (o ? 0 : 1)) : a.nodeType == 1 && (a.nodeName != "BR" || !a.nextSibling) ? a : null;
|
|
5473
5473
|
if (c)
|
|
5474
5474
|
return ot(ye(c, 1), !1);
|
|
5475
5475
|
}
|
|
5476
|
-
if (s == null && i <
|
|
5476
|
+
if (s == null && i < ne(n)) {
|
|
5477
5477
|
let a = n.childNodes[i];
|
|
5478
5478
|
for (; a.pmViewDesc && a.pmViewDesc.ignoreForCoords; )
|
|
5479
5479
|
a = a.nextSibling;
|
|
@@ -5543,24 +5543,24 @@ function Gl(r, e, t) {
|
|
|
5543
5543
|
return !1;
|
|
5544
5544
|
let i = n.parentOffset, s = !i, o = i == n.parent.content.size, l = r.domSelection();
|
|
5545
5545
|
return l ? !_l.test(n.parent.textContent) || !l.modify ? t == "left" || t == "backward" ? s : o : Os(r, e, () => {
|
|
5546
|
-
let { focusNode: a, focusOffset: c, anchorNode: u, anchorOffset: d } = r.domSelectionRange(),
|
|
5546
|
+
let { focusNode: a, focusOffset: c, anchorNode: u, anchorOffset: d } = r.domSelectionRange(), h = l.caretBidiLevel;
|
|
5547
5547
|
l.modify("move", t, "character");
|
|
5548
|
-
let
|
|
5548
|
+
let f = n.depth ? r.docView.domAfterPos(n.before()) : r.dom, { focusNode: p, focusOffset: m } = r.domSelectionRange(), g = p && !f.contains(p.nodeType == 1 ? p : p.parentNode) || a == p && c == m;
|
|
5549
5549
|
try {
|
|
5550
5550
|
l.collapse(u, d), a && (a != u || c != d) && l.extend && l.extend(a, c);
|
|
5551
5551
|
} catch {
|
|
5552
5552
|
}
|
|
5553
|
-
return
|
|
5553
|
+
return h != null && (l.caretBidiLevel = h), g;
|
|
5554
5554
|
}) : n.pos == n.start() || n.pos == n.end();
|
|
5555
5555
|
}
|
|
5556
5556
|
let Xr = null, Zr = null, Qr = !1;
|
|
5557
5557
|
function Yl(r, e, t) {
|
|
5558
5558
|
return Xr == e && Zr == t ? Qr : (Xr = e, Zr = t, Qr = t == "up" || t == "down" ? Ul(r, e, t) : Gl(r, e, t));
|
|
5559
5559
|
}
|
|
5560
|
-
const
|
|
5560
|
+
const ie = 0, ei = 1, Pe = 2, de = 3;
|
|
5561
5561
|
class Tt {
|
|
5562
5562
|
constructor(e, t, n, i) {
|
|
5563
|
-
this.parent = e, this.children = t, this.dom = n, this.contentDOM = i, this.dirty =
|
|
5563
|
+
this.parent = e, this.children = t, this.dom = n, this.contentDOM = i, this.dirty = ie, n.pmViewDesc = this;
|
|
5564
5564
|
}
|
|
5565
5565
|
// Used to check whether a given description corresponds to a
|
|
5566
5566
|
// widget/mark/node.
|
|
@@ -5653,7 +5653,7 @@ class Tt {
|
|
|
5653
5653
|
}
|
|
5654
5654
|
let i;
|
|
5655
5655
|
if (e == this.dom && this.contentDOM)
|
|
5656
|
-
i = t >
|
|
5656
|
+
i = t > V(this.contentDOM);
|
|
5657
5657
|
else if (this.contentDOM && this.contentDOM != this.dom && this.dom.contains(this.contentDOM))
|
|
5658
5658
|
i = e.compareDocumentPosition(this.contentDOM) & 2;
|
|
5659
5659
|
else if (this.dom.firstChild) {
|
|
@@ -5743,12 +5743,12 @@ class Tt {
|
|
|
5743
5743
|
let s, o = !0;
|
|
5744
5744
|
for (; s = n ? this.children[n - 1] : null, !(!s || s.dom.parentNode == this.contentDOM); n--, o = !1)
|
|
5745
5745
|
;
|
|
5746
|
-
return s && t && o && !s.border && !s.domAtom ? s.domFromPos(s.size, t) : { node: this.contentDOM, offset: s ?
|
|
5746
|
+
return s && t && o && !s.border && !s.domAtom ? s.domFromPos(s.size, t) : { node: this.contentDOM, offset: s ? V(s.dom) + 1 : 0 };
|
|
5747
5747
|
} else {
|
|
5748
5748
|
let s, o = !0;
|
|
5749
5749
|
for (; s = n < this.children.length ? this.children[n] : null, !(!s || s.dom.parentNode == this.contentDOM); n++, o = !1)
|
|
5750
5750
|
;
|
|
5751
|
-
return s && o && !s.border && !s.domAtom ? s.domFromPos(0, t) : { node: this.contentDOM, offset: s ?
|
|
5751
|
+
return s && o && !s.border && !s.domAtom ? s.domFromPos(0, t) : { node: this.contentDOM, offset: s ? V(s.dom) : this.contentDOM.childNodes.length };
|
|
5752
5752
|
}
|
|
5753
5753
|
}
|
|
5754
5754
|
// Used to find a DOM range in a single parent for a given changed
|
|
@@ -5765,12 +5765,12 @@ class Tt {
|
|
|
5765
5765
|
return a.parseRange(e, t, u);
|
|
5766
5766
|
e = o;
|
|
5767
5767
|
for (let d = l; d > 0; d--) {
|
|
5768
|
-
let
|
|
5769
|
-
if (
|
|
5770
|
-
i =
|
|
5768
|
+
let h = this.children[d - 1];
|
|
5769
|
+
if (h.size && h.dom.parentNode == this.contentDOM && !h.emptyChildAt(1)) {
|
|
5770
|
+
i = V(h.dom) + 1;
|
|
5771
5771
|
break;
|
|
5772
5772
|
}
|
|
5773
|
-
e -=
|
|
5773
|
+
e -= h.size;
|
|
5774
5774
|
}
|
|
5775
5775
|
i == -1 && (i = 0);
|
|
5776
5776
|
}
|
|
@@ -5779,7 +5779,7 @@ class Tt {
|
|
|
5779
5779
|
for (let u = l + 1; u < this.children.length; u++) {
|
|
5780
5780
|
let d = this.children[u];
|
|
5781
5781
|
if (d.size && d.dom.parentNode == this.contentDOM && !d.emptyChildAt(-1)) {
|
|
5782
|
-
s =
|
|
5782
|
+
s = V(d.dom);
|
|
5783
5783
|
break;
|
|
5784
5784
|
}
|
|
5785
5785
|
t += d.size;
|
|
@@ -5810,21 +5810,21 @@ class Tt {
|
|
|
5810
5810
|
// case we just use whatever domFromPos produces as a best effort.
|
|
5811
5811
|
setSelection(e, t, n, i = !1) {
|
|
5812
5812
|
let s = Math.min(e, t), o = Math.max(e, t);
|
|
5813
|
-
for (let
|
|
5814
|
-
let m = this.children[
|
|
5813
|
+
for (let f = 0, p = 0; f < this.children.length; f++) {
|
|
5814
|
+
let m = this.children[f], g = p + m.size;
|
|
5815
5815
|
if (s > p && o < g)
|
|
5816
5816
|
return m.setSelection(e - p - m.border, t - p - m.border, n, i);
|
|
5817
5817
|
p = g;
|
|
5818
5818
|
}
|
|
5819
5819
|
let l = this.domFromPos(e, e ? -1 : 1), a = t == e ? l : this.domFromPos(t, t ? -1 : 1), c = n.root.getSelection(), u = n.domSelectionRange(), d = !1;
|
|
5820
|
-
if ((
|
|
5821
|
-
let { node:
|
|
5822
|
-
if (
|
|
5823
|
-
if (d = !!(p &&
|
|
5824
|
-
`), d && p ==
|
|
5825
|
-
for (let m =
|
|
5820
|
+
if ((oe || K) && e == t) {
|
|
5821
|
+
let { node: f, offset: p } = l;
|
|
5822
|
+
if (f.nodeType == 3) {
|
|
5823
|
+
if (d = !!(p && f.nodeValue[p - 1] == `
|
|
5824
|
+
`), d && p == f.nodeValue.length)
|
|
5825
|
+
for (let m = f, g; m; m = m.parentNode) {
|
|
5826
5826
|
if (g = m.nextSibling) {
|
|
5827
|
-
g.nodeName == "BR" && (l = a = { node: g.parentNode, offset:
|
|
5827
|
+
g.nodeName == "BR" && (l = a = { node: g.parentNode, offset: V(g) + 1 });
|
|
5828
5828
|
break;
|
|
5829
5829
|
}
|
|
5830
5830
|
let y = m.pmViewDesc;
|
|
@@ -5832,31 +5832,31 @@ class Tt {
|
|
|
5832
5832
|
break;
|
|
5833
5833
|
}
|
|
5834
5834
|
} else {
|
|
5835
|
-
let m =
|
|
5835
|
+
let m = f.childNodes[p - 1];
|
|
5836
5836
|
d = m && (m.nodeName == "BR" || m.contentEditable == "false");
|
|
5837
5837
|
}
|
|
5838
5838
|
}
|
|
5839
|
-
if (
|
|
5840
|
-
let
|
|
5841
|
-
|
|
5839
|
+
if (oe && u.focusNode && u.focusNode != a.node && u.focusNode.nodeType == 1) {
|
|
5840
|
+
let f = u.focusNode.childNodes[u.focusOffset];
|
|
5841
|
+
f && f.contentEditable == "false" && (i = !0);
|
|
5842
5842
|
}
|
|
5843
5843
|
if (!(i || d && K) && We(l.node, l.offset, u.anchorNode, u.anchorOffset) && We(a.node, a.offset, u.focusNode, u.focusOffset))
|
|
5844
5844
|
return;
|
|
5845
|
-
let
|
|
5845
|
+
let h = !1;
|
|
5846
5846
|
if ((c.extend || e == t) && !d) {
|
|
5847
5847
|
c.collapse(l.node, l.offset);
|
|
5848
5848
|
try {
|
|
5849
|
-
e != t && c.extend(a.node, a.offset),
|
|
5849
|
+
e != t && c.extend(a.node, a.offset), h = !0;
|
|
5850
5850
|
} catch {
|
|
5851
5851
|
}
|
|
5852
5852
|
}
|
|
5853
|
-
if (!
|
|
5853
|
+
if (!h) {
|
|
5854
5854
|
if (e > t) {
|
|
5855
5855
|
let p = l;
|
|
5856
5856
|
l = a, a = p;
|
|
5857
5857
|
}
|
|
5858
|
-
let
|
|
5859
|
-
|
|
5858
|
+
let f = document.createRange();
|
|
5859
|
+
f.setEnd(a.node, a.offset), f.setStart(l.node, l.offset), c.removeAllRanges(), c.addRange(f);
|
|
5860
5860
|
}
|
|
5861
5861
|
}
|
|
5862
5862
|
ignoreMutation(e) {
|
|
@@ -5873,10 +5873,10 @@ class Tt {
|
|
|
5873
5873
|
if (n == o ? e <= o && t >= n : e < o && t > n) {
|
|
5874
5874
|
let l = n + s.border, a = o - s.border;
|
|
5875
5875
|
if (e >= l && t <= a) {
|
|
5876
|
-
this.dirty = e == n || t == o ? Pe : ei, e == l && t == a && (s.contentLost || s.dom.parentNode != this.contentDOM) ? s.dirty =
|
|
5876
|
+
this.dirty = e == n || t == o ? Pe : ei, e == l && t == a && (s.contentLost || s.dom.parentNode != this.contentDOM) ? s.dirty = de : s.markDirty(e - l, t - l);
|
|
5877
5877
|
return;
|
|
5878
5878
|
} else
|
|
5879
|
-
s.dirty = s.dom == s.contentDOM && s.dom.parentNode == this.contentDOM && !s.children.length ? Pe :
|
|
5879
|
+
s.dirty = s.dom == s.contentDOM && s.dom.parentNode == this.contentDOM && !s.children.length ? Pe : de;
|
|
5880
5880
|
}
|
|
5881
5881
|
n = o;
|
|
5882
5882
|
}
|
|
@@ -5917,7 +5917,7 @@ class Ns extends Tt {
|
|
|
5917
5917
|
super(e, [], o, null), this.widget = t, this.widget = t, s = this;
|
|
5918
5918
|
}
|
|
5919
5919
|
matchesWidget(e) {
|
|
5920
|
-
return this.dirty ==
|
|
5920
|
+
return this.dirty == ie && e.type.eq(this.widget.type);
|
|
5921
5921
|
}
|
|
5922
5922
|
parseRule() {
|
|
5923
5923
|
return { ignore: !0 };
|
|
@@ -5965,17 +5965,17 @@ class He extends Tt {
|
|
|
5965
5965
|
return (!o || !o.dom) && (o = Je.renderSpec(document, t.type.spec.toDOM(t, n), null, t.attrs)), new He(e, t, o.dom, o.contentDOM || o.dom, o);
|
|
5966
5966
|
}
|
|
5967
5967
|
parseRule() {
|
|
5968
|
-
return this.dirty &
|
|
5968
|
+
return this.dirty & de || this.mark.type.spec.reparseInView ? null : { mark: this.mark.type.name, attrs: this.mark.attrs, contentElement: this.contentDOM };
|
|
5969
5969
|
}
|
|
5970
5970
|
matchesMark(e) {
|
|
5971
|
-
return this.dirty !=
|
|
5971
|
+
return this.dirty != de && this.mark.eq(e);
|
|
5972
5972
|
}
|
|
5973
5973
|
markDirty(e, t) {
|
|
5974
|
-
if (super.markDirty(e, t), this.dirty !=
|
|
5974
|
+
if (super.markDirty(e, t), this.dirty != ie) {
|
|
5975
5975
|
let n = this.parent;
|
|
5976
5976
|
for (; !n.node; )
|
|
5977
5977
|
n = n.parent;
|
|
5978
|
-
n.dirty < this.dirty && (n.dirty = this.dirty), this.dirty =
|
|
5978
|
+
n.dirty < this.dirty && (n.dirty = this.dirty), this.dirty = ie;
|
|
5979
5979
|
}
|
|
5980
5980
|
}
|
|
5981
5981
|
slice(e, t, n) {
|
|
@@ -6019,8 +6019,8 @@ class Te extends Tt {
|
|
|
6019
6019
|
throw new RangeError("Text must be rendered as a DOM text node");
|
|
6020
6020
|
} else u || ({ dom: u, contentDOM: d } = Je.renderSpec(document, t.type.spec.toDOM(t), null, t.attrs));
|
|
6021
6021
|
!d && !t.isText && u.nodeName != "BR" && (u.hasAttribute("contenteditable") || (u.contentEditable = "false"), t.type.spec.draggable && (u.draggable = !0));
|
|
6022
|
-
let
|
|
6023
|
-
return u = Is(u, n, t), c ? a = new Zl(e, t, n, i, u, d || null,
|
|
6022
|
+
let h = u;
|
|
6023
|
+
return u = Is(u, n, t), c ? a = new Zl(e, t, n, i, u, d || null, h, c, s, o + 1) : t.isText ? new on(e, t, n, i, u, h, s) : new Te(e, t, n, i, u, d || null, h, s, o + 1);
|
|
6024
6024
|
}
|
|
6025
6025
|
parseRule() {
|
|
6026
6026
|
if (this.node.type.spec.reparseInView)
|
|
@@ -6043,7 +6043,7 @@ class Te extends Tt {
|
|
|
6043
6043
|
return e;
|
|
6044
6044
|
}
|
|
6045
6045
|
matchesNode(e, t, n) {
|
|
6046
|
-
return this.dirty ==
|
|
6046
|
+
return this.dirty == ie && e.eq(this.node) && qt(t, this.outerDeco) && n.eq(this.innerDeco);
|
|
6047
6047
|
}
|
|
6048
6048
|
get size() {
|
|
6049
6049
|
return this.node.nodeSize;
|
|
@@ -6059,15 +6059,15 @@ class Te extends Tt {
|
|
|
6059
6059
|
let n = 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 ea(this, o && o.node, e);
|
|
6060
6060
|
ra(this.node, this.innerDeco, (c, u, d) => {
|
|
6061
6061
|
c.spec.marks ? a.syncToMarks(c.spec.marks, n, e) : c.type.side >= 0 && !d && a.syncToMarks(u == this.node.childCount ? D.none : this.node.child(u).marks, n, e), a.placeWidget(c, e, i);
|
|
6062
|
-
}, (c, u, d,
|
|
6062
|
+
}, (c, u, d, h) => {
|
|
6063
6063
|
a.syncToMarks(c.marks, n, e);
|
|
6064
|
-
let
|
|
6065
|
-
a.findNodeMatch(c, u, d,
|
|
6064
|
+
let f;
|
|
6065
|
+
a.findNodeMatch(c, u, d, h) || l && e.state.selection.from > i && e.state.selection.to < i + c.nodeSize && (f = a.findIndexWithChild(s.node)) > -1 && a.updateNodeAt(c, u, d, f, e) || a.updateNextNode(c, u, d, e, h, i) || a.addNode(c, u, d, e, i), i += c.nodeSize;
|
|
6066
6066
|
}), a.syncToMarks([], n, e), this.node.isTextblock && a.addTextblockHacks(), a.destroyRest(), (a.changed || this.dirty == Pe) && (o && this.protectLocalComposition(e, o), vs(this.contentDOM, this.children, e), rt && ia(this.dom));
|
|
6067
6067
|
}
|
|
6068
6068
|
localCompositionInfo(e, t) {
|
|
6069
6069
|
let { from: n, to: i } = e.state.selection;
|
|
6070
|
-
if (!(e.state.selection instanceof
|
|
6070
|
+
if (!(e.state.selection instanceof T) || n < t || i > t + this.node.content.size)
|
|
6071
6071
|
return null;
|
|
6072
6072
|
let s = e.input.compositionNode;
|
|
6073
6073
|
if (!s || !this.dom.contains(s.parentNode))
|
|
@@ -6095,10 +6095,10 @@ class Te extends Tt {
|
|
|
6095
6095
|
// If this desc must be updated to match the given node decoration,
|
|
6096
6096
|
// do so and return true.
|
|
6097
6097
|
update(e, t, n, i) {
|
|
6098
|
-
return this.dirty ==
|
|
6098
|
+
return this.dirty == de || !e.sameMarkup(this.node) ? !1 : (this.updateInner(e, t, n, i), !0);
|
|
6099
6099
|
}
|
|
6100
6100
|
updateInner(e, t, n, i) {
|
|
6101
|
-
this.updateOuterDeco(t), this.node = e, this.innerDeco = n, this.contentDOM && this.updateChildren(i, this.posAtStart), this.dirty =
|
|
6101
|
+
this.updateOuterDeco(t), this.node = e, this.innerDeco = n, this.contentDOM && this.updateChildren(i, this.posAtStart), this.dirty = ie;
|
|
6102
6102
|
}
|
|
6103
6103
|
updateOuterDeco(e) {
|
|
6104
6104
|
if (qt(e, this.outerDeco))
|
|
@@ -6134,7 +6134,7 @@ class on extends Te {
|
|
|
6134
6134
|
return { skip: e || !0 };
|
|
6135
6135
|
}
|
|
6136
6136
|
update(e, t, n, i) {
|
|
6137
|
-
return this.dirty ==
|
|
6137
|
+
return this.dirty == de || this.dirty != ie && !this.inParent() || !e.sameMarkup(this.node) ? !1 : (this.updateOuterDeco(t), (this.dirty != ie || e.text != this.node.text) && e.text != this.nodeDOM.nodeValue && (this.nodeDOM.nodeValue = e.text, i.trackWrites == this.nodeDOM && (i.trackWrites = null)), this.node = e, this.dirty = ie, !0);
|
|
6138
6138
|
}
|
|
6139
6139
|
inParent() {
|
|
6140
6140
|
let e = this.parent.contentDOM;
|
|
@@ -6157,7 +6157,7 @@ class on extends Te {
|
|
|
6157
6157
|
return new on(this.parent, i, this.outerDeco, this.innerDeco, s, s, n);
|
|
6158
6158
|
}
|
|
6159
6159
|
markDirty(e, t) {
|
|
6160
|
-
super.markDirty(e, t), this.dom != this.nodeDOM && (e == 0 || t == this.nodeDOM.nodeValue.length) && (this.dirty =
|
|
6160
|
+
super.markDirty(e, t), this.dom != this.nodeDOM && (e == 0 || t == this.nodeDOM.nodeValue.length) && (this.dirty = de);
|
|
6161
6161
|
}
|
|
6162
6162
|
get domAtom() {
|
|
6163
6163
|
return !1;
|
|
@@ -6171,7 +6171,7 @@ class As extends Tt {
|
|
|
6171
6171
|
return { ignore: !0 };
|
|
6172
6172
|
}
|
|
6173
6173
|
matchesHack(e) {
|
|
6174
|
-
return this.dirty ==
|
|
6174
|
+
return this.dirty == ie && this.dom.nodeName == e;
|
|
6175
6175
|
}
|
|
6176
6176
|
get domAtom() {
|
|
6177
6177
|
return !0;
|
|
@@ -6188,7 +6188,7 @@ class Zl extends Te {
|
|
|
6188
6188
|
// through. If it does, and there's a `contentDOM` node, our logic
|
|
6189
6189
|
// updates the children.
|
|
6190
6190
|
update(e, t, n, i) {
|
|
6191
|
-
if (this.dirty ==
|
|
6191
|
+
if (this.dirty == de)
|
|
6192
6192
|
return !1;
|
|
6193
6193
|
if (this.spec.update && (this.node.type == e.type || this.spec.multiType)) {
|
|
6194
6194
|
let s = this.spec.update(e, t, n);
|
|
@@ -6233,22 +6233,22 @@ function vs(r, e, t) {
|
|
|
6233
6233
|
n = ni(n), i = !0;
|
|
6234
6234
|
i && t.trackWrites == r && (t.trackWrites = null);
|
|
6235
6235
|
}
|
|
6236
|
-
const
|
|
6236
|
+
const ht = function(r) {
|
|
6237
6237
|
r && (this.nodeName = r);
|
|
6238
6238
|
};
|
|
6239
|
-
|
|
6240
|
-
const Re = [new
|
|
6239
|
+
ht.prototype = /* @__PURE__ */ Object.create(null);
|
|
6240
|
+
const Re = [new ht()];
|
|
6241
6241
|
function Kn(r, e, t) {
|
|
6242
6242
|
if (r.length == 0)
|
|
6243
6243
|
return Re;
|
|
6244
|
-
let n = t ? Re[0] : new
|
|
6244
|
+
let n = t ? Re[0] : new ht(), i = [n];
|
|
6245
6245
|
for (let s = 0; s < r.length; s++) {
|
|
6246
6246
|
let o = r[s].type.attrs;
|
|
6247
6247
|
if (o) {
|
|
6248
|
-
o.nodeName && i.push(n = new
|
|
6248
|
+
o.nodeName && i.push(n = new ht(o.nodeName));
|
|
6249
6249
|
for (let l in o) {
|
|
6250
6250
|
let a = o[l];
|
|
6251
|
-
a != null && (t && i.length == 1 && i.push(n = new
|
|
6251
|
+
a != null && (t && i.length == 1 && i.push(n = new ht(e.isInline ? "span" : "div")), l == "class" ? n.class = (n.class ? n.class + " " : "") + a : l == "style" ? n.style = (n.style ? n.style + ";" : "") + a : l != "nodeName" && (n[l] = a));
|
|
6252
6252
|
}
|
|
6253
6253
|
}
|
|
6254
6254
|
}
|
|
@@ -6329,7 +6329,7 @@ class ea {
|
|
|
6329
6329
|
for (; i < o && (i == s - 1 ? this.top : this.stack[i + 1 << 1]).matchesMark(e[i]) && e[i].type.spec.spanning !== !1; )
|
|
6330
6330
|
i++;
|
|
6331
6331
|
for (; i < s; )
|
|
6332
|
-
this.destroyRest(), this.top.dirty =
|
|
6332
|
+
this.destroyRest(), this.top.dirty = ie, this.index = this.stack.pop(), this.top = this.stack.pop(), s--;
|
|
6333
6333
|
for (; s < e.length; ) {
|
|
6334
6334
|
this.stack.push(this.top, this.index + 1);
|
|
6335
6335
|
let l = -1;
|
|
@@ -6367,7 +6367,7 @@ class ea {
|
|
|
6367
6367
|
}
|
|
6368
6368
|
updateNodeAt(e, t, n, i, s) {
|
|
6369
6369
|
let o = this.top.children[i];
|
|
6370
|
-
return o.dirty ==
|
|
6370
|
+
return o.dirty == de && o.dom == o.contentDOM && (o.dirty = Pe), o.update(e, t, n, s) ? (this.destroyBetween(this.index, i), this.index++, !0) : !1;
|
|
6371
6371
|
}
|
|
6372
6372
|
findIndexWithChild(e) {
|
|
6373
6373
|
for (; ; ) {
|
|
@@ -6395,11 +6395,11 @@ class ea {
|
|
|
6395
6395
|
let c = this.preMatch.matched.get(a);
|
|
6396
6396
|
if (c != null && c != s)
|
|
6397
6397
|
return !1;
|
|
6398
|
-
let u = a.dom, d,
|
|
6399
|
-
if (!
|
|
6398
|
+
let u = a.dom, d, h = this.isLocked(u) && !(e.isText && a.node && a.node.isText && a.nodeDOM.nodeValue == e.text && a.dirty != de && qt(t, a.outerDeco));
|
|
6399
|
+
if (!h && a.update(e, t, n, i))
|
|
6400
6400
|
return this.destroyBetween(this.index, l), a.dom != u && (this.changed = !0), this.index++, !0;
|
|
6401
|
-
if (!
|
|
6402
|
-
return this.destroyBetween(this.index, l), this.top.children[this.index] = d, d.contentDOM && (d.dirty = Pe, d.updateChildren(i, o + 1), d.dirty =
|
|
6401
|
+
if (!h && (d = this.recreateWrapper(a, e, t, n, i, o)))
|
|
6402
|
+
return this.destroyBetween(this.index, l), this.top.children[this.index] = d, d.contentDOM && (d.dirty = Pe, d.updateChildren(i, o + 1), d.dirty = ie), this.changed = !0, this.index++, !0;
|
|
6403
6403
|
break;
|
|
6404
6404
|
}
|
|
6405
6405
|
}
|
|
@@ -6508,29 +6508,29 @@ function ra(r, e, t, n) {
|
|
|
6508
6508
|
t(d[g], c, !!a);
|
|
6509
6509
|
} else
|
|
6510
6510
|
t(u, c, !!a);
|
|
6511
|
-
let
|
|
6511
|
+
let h, f;
|
|
6512
6512
|
if (a)
|
|
6513
|
-
|
|
6513
|
+
f = -1, h = a, a = null;
|
|
6514
6514
|
else if (c < r.childCount)
|
|
6515
|
-
|
|
6515
|
+
f = c, h = r.child(c++);
|
|
6516
6516
|
else
|
|
6517
6517
|
break;
|
|
6518
6518
|
for (let g = 0; g < l.length; g++)
|
|
6519
6519
|
l[g].to <= s && l.splice(g--, 1);
|
|
6520
6520
|
for (; o < i.length && i[o].from <= s && i[o].to > s; )
|
|
6521
6521
|
l.push(i[o++]);
|
|
6522
|
-
let p = s +
|
|
6523
|
-
if (
|
|
6522
|
+
let p = s + h.nodeSize;
|
|
6523
|
+
if (h.isText) {
|
|
6524
6524
|
let g = p;
|
|
6525
6525
|
o < i.length && i[o].from < g && (g = i[o].from);
|
|
6526
6526
|
for (let y = 0; y < l.length; y++)
|
|
6527
6527
|
l[y].to < g && (g = l[y].to);
|
|
6528
|
-
g < p && (a =
|
|
6528
|
+
g < p && (a = h.cut(g - s), h = h.cut(0, g - s), p = g, f = -1);
|
|
6529
6529
|
} else
|
|
6530
6530
|
for (; o < i.length && i[o].to < p; )
|
|
6531
6531
|
o++;
|
|
6532
|
-
let m =
|
|
6533
|
-
n(
|
|
6532
|
+
let m = h.isInline && !h.isLeaf ? l.filter((g) => !g.inline) : l.slice();
|
|
6533
|
+
n(h, m, e.forChild(s, h), f), s = p;
|
|
6534
6534
|
}
|
|
6535
6535
|
}
|
|
6536
6536
|
function ia(r) {
|
|
@@ -6584,19 +6584,19 @@ function ar(r, e = null) {
|
|
|
6584
6584
|
i = i.parent;
|
|
6585
6585
|
let d = i.node;
|
|
6586
6586
|
if (i && d.isAtom && C.isSelectable(d) && i.parent && !(d.isInline && Dl(t.focusNode, t.focusOffset, i.dom))) {
|
|
6587
|
-
let
|
|
6588
|
-
c = new C(o ==
|
|
6587
|
+
let h = i.posBefore;
|
|
6588
|
+
c = new C(o == h ? l : n.resolve(h));
|
|
6589
6589
|
}
|
|
6590
6590
|
} else {
|
|
6591
6591
|
if (t instanceof r.dom.ownerDocument.defaultView.Selection && t.rangeCount > 1) {
|
|
6592
|
-
let d = o,
|
|
6593
|
-
for (let
|
|
6594
|
-
let p = t.getRangeAt(
|
|
6595
|
-
d = Math.min(d, r.docView.posFromDOM(p.startContainer, p.startOffset, 1)),
|
|
6592
|
+
let d = o, h = o;
|
|
6593
|
+
for (let f = 0; f < t.rangeCount; f++) {
|
|
6594
|
+
let p = t.getRangeAt(f);
|
|
6595
|
+
d = Math.min(d, r.docView.posFromDOM(p.startContainer, p.startOffset, 1)), h = Math.max(h, r.docView.posFromDOM(p.endContainer, p.endOffset, -1));
|
|
6596
6596
|
}
|
|
6597
6597
|
if (d < 0)
|
|
6598
6598
|
return null;
|
|
6599
|
-
[a, o] =
|
|
6599
|
+
[a, o] = h == r.state.selection.anchor ? [h, d] : [d, h], l = n.resolve(o);
|
|
6600
6600
|
} else
|
|
6601
6601
|
a = r.docView.posFromDOM(t.anchorNode, t.anchorOffset, 1);
|
|
6602
6602
|
if (a < 0)
|
|
@@ -6612,7 +6612,7 @@ function ar(r, e = null) {
|
|
|
6612
6612
|
function Ps(r) {
|
|
6613
6613
|
return r.editable ? r.hasFocus() : Bs(r) && document.activeElement && document.activeElement.contains(r.dom);
|
|
6614
6614
|
}
|
|
6615
|
-
function
|
|
6615
|
+
function ge(r, e = !1) {
|
|
6616
6616
|
let t = r.state.selection;
|
|
6617
6617
|
if (Rs(r, t), !!Ps(r)) {
|
|
6618
6618
|
if (!e && r.input.mouseDown && r.input.mouseDown.allowDefault && J) {
|
|
@@ -6626,7 +6626,7 @@ function me(r, e = !1) {
|
|
|
6626
6626
|
la(r);
|
|
6627
6627
|
else {
|
|
6628
6628
|
let { anchor: n, head: i } = t, s, o;
|
|
6629
|
-
ri && !(t instanceof
|
|
6629
|
+
ri && !(t instanceof T) && (t.$from.parent.inlineContent || (s = ii(r, t.from)), !t.empty && !t.$from.parent.inlineContent && (o = ii(r, t.to))), r.docView.setSelection(n, i, r, e), ri && (s && si(s), o && si(o)), t.visible ? r.dom.classList.remove("ProseMirror-hideselection") : (r.dom.classList.add("ProseMirror-hideselection"), "onselectionchange" in document && oa(r));
|
|
6630
6630
|
}
|
|
6631
6631
|
r.domObserver.setCurSelection(), r.domObserver.connectSelection();
|
|
6632
6632
|
}
|
|
@@ -6664,7 +6664,7 @@ function la(r) {
|
|
|
6664
6664
|
if (!e)
|
|
6665
6665
|
return;
|
|
6666
6666
|
let n = r.cursorWrapper.dom, i = n.nodeName == "IMG";
|
|
6667
|
-
i ? t.setStart(n.parentNode,
|
|
6667
|
+
i ? t.setStart(n.parentNode, V(n) + 1) : t.setStart(n, 0), t.collapse(!0), e.removeAllRanges(), e.addRange(t), !i && !r.state.selection.visible && G && Ee <= 11 && (n.disabled = !0, n.disabled = !1);
|
|
6668
6668
|
}
|
|
6669
6669
|
function Rs(r, e) {
|
|
6670
6670
|
if (e instanceof C) {
|
|
@@ -6677,7 +6677,7 @@ function oi(r) {
|
|
|
6677
6677
|
r.lastSelectedViewDesc && (r.lastSelectedViewDesc.parent && r.lastSelectedViewDesc.deselectNode(), r.lastSelectedViewDesc = void 0);
|
|
6678
6678
|
}
|
|
6679
6679
|
function cr(r, e, t, n) {
|
|
6680
|
-
return r.someProp("createSelectionBetween", (i) => i(r, e, t)) ||
|
|
6680
|
+
return r.someProp("createSelectionBetween", (i) => i(r, e, t)) || T.between(e, t, n);
|
|
6681
6681
|
}
|
|
6682
6682
|
function li(r) {
|
|
6683
6683
|
return r.editable && !r.hasFocus() ? !1 : Bs(r);
|
|
@@ -6705,28 +6705,28 @@ function be(r, e) {
|
|
|
6705
6705
|
}
|
|
6706
6706
|
function ai(r, e, t) {
|
|
6707
6707
|
let n = r.state.selection;
|
|
6708
|
-
if (n instanceof
|
|
6708
|
+
if (n instanceof T)
|
|
6709
6709
|
if (t.indexOf("s") > -1) {
|
|
6710
6710
|
let { $head: i } = n, s = i.textOffset ? null : e < 0 ? i.nodeBefore : i.nodeAfter;
|
|
6711
6711
|
if (!s || s.isText || !s.isLeaf)
|
|
6712
6712
|
return !1;
|
|
6713
6713
|
let o = r.state.doc.resolve(i.pos + s.nodeSize * (e < 0 ? -1 : 1));
|
|
6714
|
-
return be(r, new
|
|
6714
|
+
return be(r, new T(n.$anchor, o));
|
|
6715
6715
|
} else if (n.empty) {
|
|
6716
6716
|
if (r.endOfTextblock(e > 0 ? "forward" : "backward")) {
|
|
6717
6717
|
let i = _n(r.state, e);
|
|
6718
6718
|
return i && i instanceof C ? be(r, i) : !1;
|
|
6719
|
-
} else if (!(
|
|
6719
|
+
} else if (!(te && t.indexOf("m") > -1)) {
|
|
6720
6720
|
let i = n.$head, s = i.textOffset ? null : e < 0 ? i.nodeBefore : i.nodeAfter, o;
|
|
6721
6721
|
if (!s || s.isText)
|
|
6722
6722
|
return !1;
|
|
6723
6723
|
let l = e < 0 ? i.pos - s.nodeSize : i.pos;
|
|
6724
|
-
return s.isAtom || (o = r.docView.descAt(l)) && !o.contentDOM ? C.isSelectable(s) ? be(r, new C(e < 0 ? r.state.doc.resolve(i.pos - s.nodeSize) : i)) : Et ? be(r, new
|
|
6724
|
+
return s.isAtom || (o = r.docView.descAt(l)) && !o.contentDOM ? C.isSelectable(s) ? be(r, new C(e < 0 ? r.state.doc.resolve(i.pos - s.nodeSize) : i)) : Et ? be(r, new T(r.state.doc.resolve(e < 0 ? l : l + s.nodeSize))) : !1 : !1;
|
|
6725
6725
|
}
|
|
6726
6726
|
} else return !1;
|
|
6727
6727
|
else {
|
|
6728
6728
|
if (n instanceof C && n.node.isInline)
|
|
6729
|
-
return be(r, new
|
|
6729
|
+
return be(r, new T(e > 0 ? n.$to : n.$from));
|
|
6730
6730
|
{
|
|
6731
6731
|
let i = _n(r.state, e);
|
|
6732
6732
|
return i ? be(r, i) : !1;
|
|
@@ -6736,7 +6736,7 @@ function ai(r, e, t) {
|
|
|
6736
6736
|
function Kt(r) {
|
|
6737
6737
|
return r.nodeType == 3 ? r.nodeValue.length : r.childNodes.length;
|
|
6738
6738
|
}
|
|
6739
|
-
function
|
|
6739
|
+
function ft(r, e) {
|
|
6740
6740
|
let t = r.pmViewDesc;
|
|
6741
6741
|
return t && t.size == 0 && (e < 0 || r.nextSibling || r.nodeName != "BR");
|
|
6742
6742
|
}
|
|
@@ -6748,13 +6748,13 @@ function ca(r) {
|
|
|
6748
6748
|
if (!t)
|
|
6749
6749
|
return;
|
|
6750
6750
|
let i, s, o = !1;
|
|
6751
|
-
for (
|
|
6751
|
+
for (oe && t.nodeType == 1 && n < Kt(t) && ft(t.childNodes[n], -1) && (o = !0); ; )
|
|
6752
6752
|
if (n > 0) {
|
|
6753
6753
|
if (t.nodeType != 1)
|
|
6754
6754
|
break;
|
|
6755
6755
|
{
|
|
6756
6756
|
let l = t.childNodes[n - 1];
|
|
6757
|
-
if (
|
|
6757
|
+
if (ft(l, -1))
|
|
6758
6758
|
i = t, s = --n;
|
|
6759
6759
|
else if (l.nodeType == 3)
|
|
6760
6760
|
t = l, n = t.nodeValue.length;
|
|
@@ -6766,8 +6766,8 @@ function ca(r) {
|
|
|
6766
6766
|
break;
|
|
6767
6767
|
{
|
|
6768
6768
|
let l = t.previousSibling;
|
|
6769
|
-
for (; l &&
|
|
6770
|
-
i = t.parentNode, s =
|
|
6769
|
+
for (; l && ft(l, -1); )
|
|
6770
|
+
i = t.parentNode, s = V(l), l = l.previousSibling;
|
|
6771
6771
|
if (l)
|
|
6772
6772
|
t = l, n = Kt(t);
|
|
6773
6773
|
else {
|
|
@@ -6789,7 +6789,7 @@ function ua(r) {
|
|
|
6789
6789
|
if (t.nodeType != 1)
|
|
6790
6790
|
break;
|
|
6791
6791
|
let l = t.childNodes[n];
|
|
6792
|
-
if (
|
|
6792
|
+
if (ft(l, 1))
|
|
6793
6793
|
s = t, o = ++n;
|
|
6794
6794
|
else
|
|
6795
6795
|
break;
|
|
@@ -6798,8 +6798,8 @@ function ua(r) {
|
|
|
6798
6798
|
break;
|
|
6799
6799
|
{
|
|
6800
6800
|
let l = t.nextSibling;
|
|
6801
|
-
for (; l &&
|
|
6802
|
-
s = l.parentNode, o =
|
|
6801
|
+
for (; l && ft(l, 1); )
|
|
6802
|
+
s = l.parentNode, o = V(l) + 1, l = l.nextSibling;
|
|
6803
6803
|
if (l)
|
|
6804
6804
|
t = l, n = 0, i = Kt(t);
|
|
6805
6805
|
else {
|
|
@@ -6817,7 +6817,7 @@ function zs(r) {
|
|
|
6817
6817
|
}
|
|
6818
6818
|
function da(r, e) {
|
|
6819
6819
|
for (; r && e == r.childNodes.length && !Mt(r); )
|
|
6820
|
-
e =
|
|
6820
|
+
e = V(r) + 1, r = r.parentNode;
|
|
6821
6821
|
for (; r && e < r.childNodes.length; ) {
|
|
6822
6822
|
let t = r.childNodes[e];
|
|
6823
6823
|
if (t.nodeType == 3)
|
|
@@ -6827,9 +6827,9 @@ function da(r, e) {
|
|
|
6827
6827
|
r = t, e = 0;
|
|
6828
6828
|
}
|
|
6829
6829
|
}
|
|
6830
|
-
function
|
|
6830
|
+
function ha(r, e) {
|
|
6831
6831
|
for (; r && !e && !Mt(r); )
|
|
6832
|
-
e =
|
|
6832
|
+
e = V(r), r = r.parentNode;
|
|
6833
6833
|
for (; r && e; ) {
|
|
6834
6834
|
let t = r.childNodes[e - 1];
|
|
6835
6835
|
if (t.nodeType == 3)
|
|
@@ -6842,7 +6842,7 @@ function fa(r, e) {
|
|
|
6842
6842
|
function Gn(r, e, t) {
|
|
6843
6843
|
if (e.nodeType != 3) {
|
|
6844
6844
|
let s, o;
|
|
6845
|
-
(o = da(e, t)) ? (e = o, t = 0) : (s =
|
|
6845
|
+
(o = da(e, t)) ? (e = o, t = 0) : (s = ha(e, t)) && (e = s, t = s.nodeValue.length);
|
|
6846
6846
|
}
|
|
6847
6847
|
let n = r.domSelection();
|
|
6848
6848
|
if (!n)
|
|
@@ -6854,7 +6854,7 @@ function Gn(r, e, t) {
|
|
|
6854
6854
|
r.domObserver.setCurSelection();
|
|
6855
6855
|
let { state: i } = r;
|
|
6856
6856
|
setTimeout(() => {
|
|
6857
|
-
r.state == i &&
|
|
6857
|
+
r.state == i && ge(r);
|
|
6858
6858
|
}, 50);
|
|
6859
6859
|
}
|
|
6860
6860
|
function ci(r, e) {
|
|
@@ -6876,7 +6876,7 @@ function ci(r, e) {
|
|
|
6876
6876
|
}
|
|
6877
6877
|
function ui(r, e, t) {
|
|
6878
6878
|
let n = r.state.selection;
|
|
6879
|
-
if (n instanceof
|
|
6879
|
+
if (n instanceof T && !n.empty || t.indexOf("s") > -1 || te && t.indexOf("m") > -1)
|
|
6880
6880
|
return !1;
|
|
6881
6881
|
let { $from: i, $to: s } = n;
|
|
6882
6882
|
if (!i.parent.inlineContent || r.endOfTextblock(e < 0 ? "up" : "down")) {
|
|
@@ -6891,7 +6891,7 @@ function ui(r, e, t) {
|
|
|
6891
6891
|
return !1;
|
|
6892
6892
|
}
|
|
6893
6893
|
function di(r, e) {
|
|
6894
|
-
if (!(r.state.selection instanceof
|
|
6894
|
+
if (!(r.state.selection instanceof T))
|
|
6895
6895
|
return !0;
|
|
6896
6896
|
let { $head: t, $anchor: n, empty: i } = r.state.selection;
|
|
6897
6897
|
if (!t.sameParent(n))
|
|
@@ -6907,16 +6907,16 @@ function di(r, e) {
|
|
|
6907
6907
|
}
|
|
6908
6908
|
return !1;
|
|
6909
6909
|
}
|
|
6910
|
-
function
|
|
6910
|
+
function hi(r, e, t) {
|
|
6911
6911
|
r.domObserver.stop(), e.contentEditable = t, r.domObserver.start();
|
|
6912
6912
|
}
|
|
6913
|
-
function
|
|
6913
|
+
function fa(r) {
|
|
6914
6914
|
if (!K || r.state.selection.$head.parentOffset > 0)
|
|
6915
6915
|
return !1;
|
|
6916
6916
|
let { focusNode: e, focusOffset: t } = r.domSelectionRange();
|
|
6917
6917
|
if (e && e.nodeType == 1 && t == 0 && e.firstChild && e.firstChild.contentEditable == "false") {
|
|
6918
6918
|
let n = e.firstChild;
|
|
6919
|
-
|
|
6919
|
+
hi(r, n, "true"), setTimeout(() => hi(r, n, "false"), 20);
|
|
6920
6920
|
}
|
|
6921
6921
|
return !1;
|
|
6922
6922
|
}
|
|
@@ -6926,44 +6926,44 @@ function pa(r) {
|
|
|
6926
6926
|
}
|
|
6927
6927
|
function ma(r, e) {
|
|
6928
6928
|
let t = e.keyCode, n = pa(e);
|
|
6929
|
-
if (t == 8 ||
|
|
6929
|
+
if (t == 8 || te && t == 72 && n == "c")
|
|
6930
6930
|
return di(r, -1) || Ue(r, -1);
|
|
6931
|
-
if (t == 46 && !e.shiftKey ||
|
|
6931
|
+
if (t == 46 && !e.shiftKey || te && t == 68 && n == "c")
|
|
6932
6932
|
return di(r, 1) || Ue(r, 1);
|
|
6933
6933
|
if (t == 13 || t == 27)
|
|
6934
6934
|
return !0;
|
|
6935
|
-
if (t == 37 ||
|
|
6935
|
+
if (t == 37 || te && t == 66 && n == "c") {
|
|
6936
6936
|
let i = t == 37 ? ci(r, r.state.selection.from) == "ltr" ? -1 : 1 : -1;
|
|
6937
6937
|
return ai(r, i, n) || Ue(r, i);
|
|
6938
|
-
} else if (t == 39 ||
|
|
6938
|
+
} else if (t == 39 || te && t == 70 && n == "c") {
|
|
6939
6939
|
let i = t == 39 ? ci(r, r.state.selection.from) == "ltr" ? 1 : -1 : 1;
|
|
6940
6940
|
return ai(r, i, n) || Ue(r, i);
|
|
6941
6941
|
} else {
|
|
6942
|
-
if (t == 38 ||
|
|
6942
|
+
if (t == 38 || te && t == 80 && n == "c")
|
|
6943
6943
|
return ui(r, -1, n) || Ue(r, -1);
|
|
6944
|
-
if (t == 40 ||
|
|
6945
|
-
return
|
|
6946
|
-
if (n == (
|
|
6944
|
+
if (t == 40 || te && t == 78 && n == "c")
|
|
6945
|
+
return fa(r) || ui(r, 1, n) || Ue(r, 1);
|
|
6946
|
+
if (n == (te ? "m" : "c") && (t == 66 || t == 73 || t == 89 || t == 90))
|
|
6947
6947
|
return !0;
|
|
6948
6948
|
}
|
|
6949
6949
|
return !1;
|
|
6950
6950
|
}
|
|
6951
6951
|
function ur(r, e) {
|
|
6952
|
-
r.someProp("transformCopied", (
|
|
6953
|
-
e =
|
|
6952
|
+
r.someProp("transformCopied", (f) => {
|
|
6953
|
+
e = f(e, r);
|
|
6954
6954
|
});
|
|
6955
6955
|
let t = [], { content: n, openStart: i, openEnd: s } = e;
|
|
6956
6956
|
for (; i > 1 && s > 1 && n.childCount == 1 && n.firstChild.childCount == 1; ) {
|
|
6957
6957
|
i--, s--;
|
|
6958
|
-
let
|
|
6959
|
-
t.push(
|
|
6958
|
+
let f = n.firstChild;
|
|
6959
|
+
t.push(f.type.name, f.attrs != f.type.defaultAttrs ? f.attrs : null), n = f.content;
|
|
6960
6960
|
}
|
|
6961
6961
|
let o = r.someProp("clipboardSerializer") || Je.fromSchema(r.state.schema), l = Ws(), a = l.createElement("div");
|
|
6962
6962
|
a.appendChild(o.serializeFragment(n, { document: l }));
|
|
6963
6963
|
let c = a.firstChild, u, d = 0;
|
|
6964
6964
|
for (; c && c.nodeType == 1 && (u = js[c.nodeName.toLowerCase()]); ) {
|
|
6965
|
-
for (let
|
|
6966
|
-
let p = l.createElement(u[
|
|
6965
|
+
for (let f = u.length - 1; f >= 0; f--) {
|
|
6966
|
+
let p = l.createElement(u[f]);
|
|
6967
6967
|
for (; a.firstChild; )
|
|
6968
6968
|
p.appendChild(a.firstChild);
|
|
6969
6969
|
a.appendChild(p), d++;
|
|
@@ -6971,10 +6971,10 @@ function ur(r, e) {
|
|
|
6971
6971
|
c = a.firstChild;
|
|
6972
6972
|
}
|
|
6973
6973
|
c && c.nodeType == 1 && c.setAttribute("data-pm-slice", `${i} ${s}${d ? ` -${d}` : ""} ${JSON.stringify(t)}`);
|
|
6974
|
-
let
|
|
6974
|
+
let h = r.someProp("clipboardTextSerializer", (f) => f(e, r)) || e.content.textBetween(0, e.content.size, `
|
|
6975
6975
|
|
|
6976
6976
|
`);
|
|
6977
|
-
return { dom: a, text:
|
|
6977
|
+
return { dom: a, text: h, slice: e };
|
|
6978
6978
|
}
|
|
6979
6979
|
function Fs(r, e, t, n, i) {
|
|
6980
6980
|
let s = i.parent.type.spec.code, o, l;
|
|
@@ -6982,19 +6982,19 @@ function Fs(r, e, t, n, i) {
|
|
|
6982
6982
|
return null;
|
|
6983
6983
|
let a = e && (n || s || !t);
|
|
6984
6984
|
if (a) {
|
|
6985
|
-
if (r.someProp("transformPastedText", (
|
|
6986
|
-
e =
|
|
6985
|
+
if (r.someProp("transformPastedText", (h) => {
|
|
6986
|
+
e = h(e, s || n, r);
|
|
6987
6987
|
}), s)
|
|
6988
6988
|
return e ? new k(b.from(r.state.schema.text(e.replace(/\r\n?/g, `
|
|
6989
6989
|
`))), 0, 0) : k.empty;
|
|
6990
|
-
let d = r.someProp("clipboardTextParser", (
|
|
6990
|
+
let d = r.someProp("clipboardTextParser", (h) => h(e, i, n, r));
|
|
6991
6991
|
if (d)
|
|
6992
6992
|
l = d;
|
|
6993
6993
|
else {
|
|
6994
|
-
let
|
|
6994
|
+
let h = i.marks(), { schema: f } = r.state, p = Je.fromSchema(f);
|
|
6995
6995
|
o = document.createElement("div"), e.split(/(?:\r\n?|\n)+/).forEach((m) => {
|
|
6996
6996
|
let g = o.appendChild(document.createElement("p"));
|
|
6997
|
-
m && g.appendChild(p.serializeNode(
|
|
6997
|
+
m && g.appendChild(p.serializeNode(f.text(m, h)));
|
|
6998
6998
|
});
|
|
6999
6999
|
}
|
|
7000
7000
|
} else
|
|
@@ -7004,28 +7004,28 @@ function Fs(r, e, t, n, i) {
|
|
|
7004
7004
|
let c = o && o.querySelector("[data-pm-slice]"), u = c && /^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice") || "");
|
|
7005
7005
|
if (u && u[3])
|
|
7006
7006
|
for (let d = +u[3]; d > 0; d--) {
|
|
7007
|
-
let
|
|
7008
|
-
for (;
|
|
7009
|
-
|
|
7010
|
-
if (!
|
|
7007
|
+
let h = o.firstChild;
|
|
7008
|
+
for (; h && h.nodeType != 1; )
|
|
7009
|
+
h = h.nextSibling;
|
|
7010
|
+
if (!h)
|
|
7011
7011
|
break;
|
|
7012
|
-
o =
|
|
7012
|
+
o = h;
|
|
7013
7013
|
}
|
|
7014
7014
|
if (l || (l = (r.someProp("clipboardParser") || r.someProp("domParser") || dt.fromSchema(r.state.schema)).parseSlice(o, {
|
|
7015
7015
|
preserveWhitespace: !!(a || u),
|
|
7016
7016
|
context: i,
|
|
7017
|
-
ruleFromNode(
|
|
7018
|
-
return
|
|
7017
|
+
ruleFromNode(h) {
|
|
7018
|
+
return h.nodeName == "BR" && !h.nextSibling && h.parentNode && !ga.test(h.parentNode.nodeName) ? { ignore: !0 } : null;
|
|
7019
7019
|
}
|
|
7020
7020
|
})), u)
|
|
7021
|
-
l = Sa(
|
|
7021
|
+
l = Sa(fi(l, +u[1], +u[2]), u[4]);
|
|
7022
7022
|
else if (l = k.maxOpen(ya(l.content, i), !0), l.openStart || l.openEnd) {
|
|
7023
|
-
let d = 0,
|
|
7024
|
-
for (let
|
|
7023
|
+
let d = 0, h = 0;
|
|
7024
|
+
for (let f = l.content.firstChild; d < l.openStart && !f.type.spec.isolating; d++, f = f.firstChild)
|
|
7025
7025
|
;
|
|
7026
|
-
for (let
|
|
7026
|
+
for (let f = l.content.lastChild; h < l.openEnd && !f.type.spec.isolating; h++, f = f.lastChild)
|
|
7027
7027
|
;
|
|
7028
|
-
l =
|
|
7028
|
+
l = fi(l, d, h);
|
|
7029
7029
|
}
|
|
7030
7030
|
return r.someProp("transformPasted", (d) => {
|
|
7031
7031
|
l = d(l, r);
|
|
@@ -7079,7 +7079,7 @@ function Yn(r, e, t, n, i, s) {
|
|
|
7079
7079
|
let o = e < 0 ? r.firstChild : r.lastChild, l = o.content;
|
|
7080
7080
|
return r.childCount > 1 && (s = 0), i < n - 1 && (l = Yn(l, e, t, n, i + 1, s)), i >= t && (l = e < 0 ? o.contentMatchAt(0).fillBefore(l, s <= i).append(l) : l.append(o.contentMatchAt(o.childCount).fillBefore(b.empty, !0))), r.replaceChild(e < 0 ? 0 : r.childCount - 1, o.copy(l));
|
|
7081
7081
|
}
|
|
7082
|
-
function
|
|
7082
|
+
function fi(r, e, t) {
|
|
7083
7083
|
return e < r.openStart && (r = new k(Yn(r.content, -1, e, r.openStart, 0, r.openEnd), e, r.openEnd)), t < r.openEnd && (r = new k(Yn(r.content, 1, t, r.openEnd, 0, 0), r.openStart, t)), r;
|
|
7084
7084
|
}
|
|
7085
7085
|
const js = {
|
|
@@ -7187,7 +7187,7 @@ function Oa(r, e) {
|
|
|
7187
7187
|
}
|
|
7188
7188
|
_.keydown = (r, e) => {
|
|
7189
7189
|
let t = e;
|
|
7190
|
-
if (r.input.shiftKey = t.keyCode == 16 || t.shiftKey, !Js(r, t) && (r.input.lastKeyCode = t.keyCode, r.input.lastKeyCodeTime = Date.now(), !(
|
|
7190
|
+
if (r.input.shiftKey = t.keyCode == 16 || t.shiftKey, !Js(r, t) && (r.input.lastKeyCode = t.keyCode, r.input.lastKeyCodeTime = Date.now(), !(pe && J && t.keyCode == 13)))
|
|
7191
7191
|
if (t.keyCode != 229 && r.domObserver.forceFlush(), rt && t.keyCode == 13 && !t.ctrlKey && !t.altKey && !t.metaKey) {
|
|
7192
7192
|
let n = Date.now();
|
|
7193
7193
|
r.input.lastIOSEnter = n, r.input.lastIOSEnterFallbackTimeout = setTimeout(() => {
|
|
@@ -7200,14 +7200,14 @@ _.keyup = (r, e) => {
|
|
|
7200
7200
|
};
|
|
7201
7201
|
_.keypress = (r, e) => {
|
|
7202
7202
|
let t = e;
|
|
7203
|
-
if (Js(r, t) || !t.charCode || t.ctrlKey && !t.altKey ||
|
|
7203
|
+
if (Js(r, t) || !t.charCode || t.ctrlKey && !t.altKey || te && t.metaKey)
|
|
7204
7204
|
return;
|
|
7205
7205
|
if (r.someProp("handleKeyPress", (i) => i(r, t))) {
|
|
7206
7206
|
t.preventDefault();
|
|
7207
7207
|
return;
|
|
7208
7208
|
}
|
|
7209
7209
|
let n = r.state.selection;
|
|
7210
|
-
if (!(n instanceof
|
|
7210
|
+
if (!(n instanceof T) || !n.$from.sameParent(n.$to)) {
|
|
7211
7211
|
let i = String.fromCharCode(t.charCode);
|
|
7212
7212
|
!/[\r\n]/.test(i) && !r.someProp("handleTextInput", (s) => s(r, n.$from.pos, n.$to.pos, i)) && r.dispatch(r.state.tr.insertText(i).scrollIntoView()), t.preventDefault();
|
|
7213
7213
|
}
|
|
@@ -7219,7 +7219,7 @@ function Na(r, e) {
|
|
|
7219
7219
|
let t = e.x - r.clientX, n = e.y - r.clientY;
|
|
7220
7220
|
return t * t + n * n < 100;
|
|
7221
7221
|
}
|
|
7222
|
-
function
|
|
7222
|
+
function hr(r, e, t, n, i) {
|
|
7223
7223
|
if (n == -1)
|
|
7224
7224
|
return !1;
|
|
7225
7225
|
let s = r.state.doc.resolve(n);
|
|
@@ -7256,25 +7256,25 @@ function va(r, e) {
|
|
|
7256
7256
|
return i != null ? (Qe(r, C.create(r.state.doc, i)), !0) : !1;
|
|
7257
7257
|
}
|
|
7258
7258
|
function Da(r, e, t, n, i) {
|
|
7259
|
-
return
|
|
7259
|
+
return hr(r, "handleClickOn", e, t, n) || r.someProp("handleClick", (s) => s(r, e, n)) || (i ? va(r, t) : Aa(r, t));
|
|
7260
7260
|
}
|
|
7261
7261
|
function Ia(r, e, t, n) {
|
|
7262
|
-
return
|
|
7262
|
+
return hr(r, "handleDoubleClickOn", e, t, n) || r.someProp("handleDoubleClick", (i) => i(r, e, n));
|
|
7263
7263
|
}
|
|
7264
7264
|
function Pa(r, e, t, n) {
|
|
7265
|
-
return
|
|
7265
|
+
return hr(r, "handleTripleClickOn", e, t, n) || r.someProp("handleTripleClick", (i) => i(r, e, n)) || Ra(r, t, n);
|
|
7266
7266
|
}
|
|
7267
7267
|
function Ra(r, e, t) {
|
|
7268
7268
|
if (t.button != 0)
|
|
7269
7269
|
return !1;
|
|
7270
7270
|
let n = r.state.doc;
|
|
7271
7271
|
if (e == -1)
|
|
7272
|
-
return n.inlineContent ? (Qe(r,
|
|
7272
|
+
return n.inlineContent ? (Qe(r, T.create(n, 0, n.content.size)), !0) : !1;
|
|
7273
7273
|
let i = n.resolve(e);
|
|
7274
7274
|
for (let s = i.depth + 1; s > 0; s--) {
|
|
7275
7275
|
let o = s > i.depth ? i.nodeAfter : i.node(s), l = i.before(s);
|
|
7276
7276
|
if (o.inlineContent)
|
|
7277
|
-
Qe(r,
|
|
7277
|
+
Qe(r, T.create(n, l + 1, l + 1 + o.content.size));
|
|
7278
7278
|
else if (C.isSelectable(o))
|
|
7279
7279
|
Qe(r, C.create(n, l));
|
|
7280
7280
|
else
|
|
@@ -7282,14 +7282,14 @@ function Ra(r, e, t) {
|
|
|
7282
7282
|
return !0;
|
|
7283
7283
|
}
|
|
7284
7284
|
}
|
|
7285
|
-
function
|
|
7285
|
+
function fr(r) {
|
|
7286
7286
|
return Ut(r);
|
|
7287
7287
|
}
|
|
7288
|
-
const Hs =
|
|
7288
|
+
const Hs = te ? "metaKey" : "ctrlKey";
|
|
7289
7289
|
U.mousedown = (r, e) => {
|
|
7290
7290
|
let t = e;
|
|
7291
7291
|
r.input.shiftKey = t.shiftKey;
|
|
7292
|
-
let n =
|
|
7292
|
+
let n = fr(r), i = Date.now(), s = "singleClick";
|
|
7293
7293
|
i - r.input.lastClick.time < 500 && Na(t, r.input.lastClick) && !t[Hs] && (r.input.lastClick.type == "singleClick" ? s = "doubleClick" : r.input.lastClick.type == "doubleClick" && (s = "tripleClick")), r.input.lastClick = { time: i, x: t.clientX, y: t.clientY, type: s };
|
|
7294
7294
|
let o = r.posAtCoords(ln(t));
|
|
7295
7295
|
o && (s == "singleClick" ? (r.input.mouseDown && r.input.mouseDown.done(), r.input.mouseDown = new Ba(r, o, t, !!n)) : (s == "doubleClick" ? Ia : Pa)(r, o.pos, o.inside, t) ? t.preventDefault() : we(r, "pointer"));
|
|
@@ -7311,13 +7311,13 @@ class Ba {
|
|
|
7311
7311
|
node: s,
|
|
7312
7312
|
pos: o,
|
|
7313
7313
|
addAttr: !!(this.target && !this.target.draggable),
|
|
7314
|
-
setUneditable: !!(this.target &&
|
|
7314
|
+
setUneditable: !!(this.target && oe && !this.target.hasAttribute("contentEditable"))
|
|
7315
7315
|
}), this.target && this.mightDrag && (this.mightDrag.addAttr || this.mightDrag.setUneditable) && (this.view.domObserver.stop(), this.mightDrag.addAttr && (this.target.draggable = !0), this.mightDrag.setUneditable && setTimeout(() => {
|
|
7316
7316
|
this.view.input.mouseDown == this && this.target.setAttribute("contentEditable", "false");
|
|
7317
7317
|
}, 20), this.view.domObserver.start()), e.root.addEventListener("mouseup", this.up = this.up.bind(this)), e.root.addEventListener("mousemove", this.move = this.move.bind(this)), we(e, "pointer");
|
|
7318
7318
|
}
|
|
7319
7319
|
done() {
|
|
7320
|
-
this.view.root.removeEventListener("mouseup", this.up), this.view.root.removeEventListener("mousemove", this.move), this.mightDrag && this.target && (this.view.domObserver.stop(), this.mightDrag.addAttr && this.target.removeAttribute("draggable"), this.mightDrag.setUneditable && this.target.removeAttribute("contentEditable"), this.view.domObserver.start()), this.delayedSelectionSync && setTimeout(() =>
|
|
7320
|
+
this.view.root.removeEventListener("mouseup", this.up), this.view.root.removeEventListener("mousemove", this.move), this.mightDrag && this.target && (this.view.domObserver.stop(), this.mightDrag.addAttr && this.target.removeAttribute("draggable"), this.mightDrag.setUneditable && this.target.removeAttribute("contentEditable"), this.view.domObserver.start()), this.delayedSelectionSync && setTimeout(() => ge(this.view)), this.view.input.mouseDown = null;
|
|
7321
7321
|
}
|
|
7322
7322
|
up(e) {
|
|
7323
7323
|
if (this.done(), !this.view.dom.contains(e.target))
|
|
@@ -7341,23 +7341,23 @@ class Ba {
|
|
|
7341
7341
|
}
|
|
7342
7342
|
}
|
|
7343
7343
|
U.touchstart = (r) => {
|
|
7344
|
-
r.input.lastTouch = Date.now(),
|
|
7344
|
+
r.input.lastTouch = Date.now(), fr(r), we(r, "pointer");
|
|
7345
7345
|
};
|
|
7346
7346
|
U.touchmove = (r) => {
|
|
7347
7347
|
r.input.lastTouch = Date.now(), we(r, "pointer");
|
|
7348
7348
|
};
|
|
7349
|
-
U.contextmenu = (r) =>
|
|
7349
|
+
U.contextmenu = (r) => fr(r);
|
|
7350
7350
|
function Js(r, e) {
|
|
7351
7351
|
return r.composing ? !0 : K && Math.abs(e.timeStamp - r.input.compositionEndedAt) < 500 ? (r.input.compositionEndedAt = -2e8, !0) : !1;
|
|
7352
7352
|
}
|
|
7353
|
-
const za =
|
|
7353
|
+
const za = pe ? 5e3 : -1;
|
|
7354
7354
|
_.compositionstart = _.compositionupdate = (r) => {
|
|
7355
7355
|
if (!r.composing) {
|
|
7356
7356
|
r.domObserver.flush();
|
|
7357
7357
|
let { state: e } = r, t = e.selection.$to;
|
|
7358
|
-
if (e.selection instanceof
|
|
7358
|
+
if (e.selection instanceof T && (e.storedMarks || !t.textOffset && t.parentOffset && t.nodeBefore.marks.some((n) => n.type.spec.inclusive === !1)))
|
|
7359
7359
|
r.markCursor = r.state.storedMarks || t.marks(), Ut(r, !0), r.markCursor = null;
|
|
7360
|
-
else if (Ut(r, !e.selection.empty),
|
|
7360
|
+
else if (Ut(r, !e.selection.empty), oe && e.selection.empty && t.parentOffset && !t.textOffset && t.nodeBefore.marks.length) {
|
|
7361
7361
|
let n = r.domSelectionRange();
|
|
7362
7362
|
for (let i = n.focusNode, s = n.focusOffset; i && i.nodeType == 1 && s != 0; ) {
|
|
7363
7363
|
let o = s < 0 ? i.lastChild : i.childNodes[s - 1];
|
|
@@ -7409,7 +7409,7 @@ function La() {
|
|
|
7409
7409
|
return r.initEvent("event", !0, !0), r.timeStamp;
|
|
7410
7410
|
}
|
|
7411
7411
|
function Ut(r, e = !1) {
|
|
7412
|
-
if (!(
|
|
7412
|
+
if (!(pe && r.domObserver.flushingSoon >= 0)) {
|
|
7413
7413
|
if (r.domObserver.forceFlush(), Ks(r), e || r.docView && r.docView.dirty) {
|
|
7414
7414
|
let t = ar(r);
|
|
7415
7415
|
return t && !t.eq(r.state.selection) ? r.dispatch(r.state.tr.setSelection(t)) : (r.markCursor || e) && !r.state.selection.empty ? r.dispatch(r.state.tr.deleteSelection()) : r.updateState(r.state), !0;
|
|
@@ -7466,7 +7466,7 @@ function Us(r) {
|
|
|
7466
7466
|
}
|
|
7467
7467
|
_.paste = (r, e) => {
|
|
7468
7468
|
let t = e;
|
|
7469
|
-
if (r.composing && !
|
|
7469
|
+
if (r.composing && !pe)
|
|
7470
7470
|
return;
|
|
7471
7471
|
let n = bt ? null : t.clipboardData, i = r.input.shiftKey && r.input.lastKeyCode != 45;
|
|
7472
7472
|
n && kt(r, Us(n), n.getData("text/html"), i, t) ? t.preventDefault() : ja(r, t);
|
|
@@ -7476,7 +7476,7 @@ class _s {
|
|
|
7476
7476
|
this.slice = e, this.move = t, this.node = n;
|
|
7477
7477
|
}
|
|
7478
7478
|
}
|
|
7479
|
-
const Wa =
|
|
7479
|
+
const Wa = te ? "altKey" : "ctrlKey";
|
|
7480
7480
|
function Gs(r, e) {
|
|
7481
7481
|
let t = r.someProp("dragCopies", (n) => !n(e));
|
|
7482
7482
|
return t ?? !e[Wa];
|
|
@@ -7530,21 +7530,21 @@ _.drop = (r, e) => {
|
|
|
7530
7530
|
let { node: p } = n;
|
|
7531
7531
|
p ? p.replace(c) : c.deleteSelection();
|
|
7532
7532
|
}
|
|
7533
|
-
let u = c.mapping.map(a), d = o.openStart == 0 && o.openEnd == 0 && o.content.childCount == 1,
|
|
7534
|
-
if (d ? c.replaceRangeWith(u, u, o.content.firstChild) : c.replaceRange(u, u, o), c.doc.eq(
|
|
7533
|
+
let u = c.mapping.map(a), d = o.openStart == 0 && o.openEnd == 0 && o.content.childCount == 1, h = c.doc;
|
|
7534
|
+
if (d ? c.replaceRangeWith(u, u, o.content.firstChild) : c.replaceRange(u, u, o), c.doc.eq(h))
|
|
7535
7535
|
return;
|
|
7536
|
-
let
|
|
7537
|
-
if (d && C.isSelectable(o.content.firstChild) &&
|
|
7538
|
-
c.setSelection(new C(
|
|
7536
|
+
let f = c.doc.resolve(u);
|
|
7537
|
+
if (d && C.isSelectable(o.content.firstChild) && f.nodeAfter && f.nodeAfter.sameMarkup(o.content.firstChild))
|
|
7538
|
+
c.setSelection(new C(f));
|
|
7539
7539
|
else {
|
|
7540
7540
|
let p = c.mapping.map(a);
|
|
7541
|
-
c.mapping.maps[c.mapping.maps.length - 1].forEach((m, g, y, S) => p = S), c.setSelection(cr(r,
|
|
7541
|
+
c.mapping.maps[c.mapping.maps.length - 1].forEach((m, g, y, S) => p = S), c.setSelection(cr(r, f, c.doc.resolve(p)));
|
|
7542
7542
|
}
|
|
7543
7543
|
r.focus(), r.dispatch(c.setMeta("uiEvent", "drop"));
|
|
7544
7544
|
};
|
|
7545
7545
|
U.focus = (r) => {
|
|
7546
7546
|
r.input.lastFocus = Date.now(), r.focused || (r.domObserver.stop(), r.dom.classList.add("ProseMirror-focused"), r.domObserver.start(), r.focused = !0, setTimeout(() => {
|
|
7547
|
-
r.docView && r.hasFocus() && !r.domObserver.currentSelection.eq(r.domSelectionRange()) &&
|
|
7547
|
+
r.docView && r.hasFocus() && !r.domObserver.currentSelection.eq(r.domSelectionRange()) && ge(r);
|
|
7548
7548
|
}, 20));
|
|
7549
7549
|
};
|
|
7550
7550
|
U.blur = (r, e) => {
|
|
@@ -7552,7 +7552,7 @@ U.blur = (r, e) => {
|
|
|
7552
7552
|
r.focused && (r.domObserver.stop(), r.dom.classList.remove("ProseMirror-focused"), r.domObserver.start(), t.relatedTarget && r.dom.contains(t.relatedTarget) && r.domObserver.currentSelection.clear(), r.focused = !1);
|
|
7553
7553
|
};
|
|
7554
7554
|
U.beforeinput = (r, e) => {
|
|
7555
|
-
if (J &&
|
|
7555
|
+
if (J && pe && e.inputType == "deleteContentBackward") {
|
|
7556
7556
|
r.domObserver.flushSoon();
|
|
7557
7557
|
let { domChangeCount: n } = r.input;
|
|
7558
7558
|
setTimeout(() => {
|
|
@@ -7582,7 +7582,7 @@ class _t {
|
|
|
7582
7582
|
}
|
|
7583
7583
|
map(e, t, n, i) {
|
|
7584
7584
|
let { pos: s, deleted: o } = e.mapResult(t.from + i, this.side < 0 ? -1 : 1);
|
|
7585
|
-
return o ? null : new
|
|
7585
|
+
return o ? null : new re(s - n, s - n, this);
|
|
7586
7586
|
}
|
|
7587
7587
|
valid() {
|
|
7588
7588
|
return !0;
|
|
@@ -7600,7 +7600,7 @@ class Oe {
|
|
|
7600
7600
|
}
|
|
7601
7601
|
map(e, t, n, i) {
|
|
7602
7602
|
let s = e.map(t.from + i, this.spec.inclusiveStart ? -1 : 1) - n, o = e.map(t.to + i, this.spec.inclusiveEnd ? 1 : -1) - n;
|
|
7603
|
-
return s >= o ? null : new
|
|
7603
|
+
return s >= o ? null : new re(s, o, this);
|
|
7604
7604
|
}
|
|
7605
7605
|
valid(e, t) {
|
|
7606
7606
|
return t.from < t.to;
|
|
@@ -7623,7 +7623,7 @@ class pr {
|
|
|
7623
7623
|
if (s.deleted)
|
|
7624
7624
|
return null;
|
|
7625
7625
|
let o = e.mapResult(t.to + i, -1);
|
|
7626
|
-
return o.deleted || o.pos <= s.pos ? null : new
|
|
7626
|
+
return o.deleted || o.pos <= s.pos ? null : new re(s.pos - n, o.pos - n, this);
|
|
7627
7627
|
}
|
|
7628
7628
|
valid(e, t) {
|
|
7629
7629
|
let { index: n, offset: i } = e.content.findIndex(t.from), s;
|
|
@@ -7635,7 +7635,7 @@ class pr {
|
|
|
7635
7635
|
destroy() {
|
|
7636
7636
|
}
|
|
7637
7637
|
}
|
|
7638
|
-
class
|
|
7638
|
+
class re {
|
|
7639
7639
|
/**
|
|
7640
7640
|
@internal
|
|
7641
7641
|
*/
|
|
@@ -7646,7 +7646,7 @@ class ne {
|
|
|
7646
7646
|
@internal
|
|
7647
7647
|
*/
|
|
7648
7648
|
copy(e, t) {
|
|
7649
|
-
return new
|
|
7649
|
+
return new re(e, t, this.type);
|
|
7650
7650
|
}
|
|
7651
7651
|
/**
|
|
7652
7652
|
@internal
|
|
@@ -7669,14 +7669,14 @@ class ne {
|
|
|
7669
7669
|
widget's current document position.
|
|
7670
7670
|
*/
|
|
7671
7671
|
static widget(e, t, n) {
|
|
7672
|
-
return new
|
|
7672
|
+
return new re(e, e, new _t(t, n));
|
|
7673
7673
|
}
|
|
7674
7674
|
/**
|
|
7675
7675
|
Creates an inline decoration, which adds the given attributes to
|
|
7676
7676
|
each inline node between `from` and `to`.
|
|
7677
7677
|
*/
|
|
7678
7678
|
static inline(e, t, n, i) {
|
|
7679
|
-
return new
|
|
7679
|
+
return new re(e, t, new Oe(n, i));
|
|
7680
7680
|
}
|
|
7681
7681
|
/**
|
|
7682
7682
|
Creates a node decoration. `from` and `to` should point precisely
|
|
@@ -7684,7 +7684,7 @@ class ne {
|
|
|
7684
7684
|
node, will receive the given attributes.
|
|
7685
7685
|
*/
|
|
7686
7686
|
static node(e, t, n, i) {
|
|
7687
|
-
return new
|
|
7687
|
+
return new re(e, t, new pr(n, i));
|
|
7688
7688
|
}
|
|
7689
7689
|
/**
|
|
7690
7690
|
The spec provided when creating this decoration. Can be useful
|
|
@@ -7707,7 +7707,7 @@ class ne {
|
|
|
7707
7707
|
}
|
|
7708
7708
|
}
|
|
7709
7709
|
const Ge = [], Le = {};
|
|
7710
|
-
class
|
|
7710
|
+
class B {
|
|
7711
7711
|
/**
|
|
7712
7712
|
@internal
|
|
7713
7713
|
*/
|
|
@@ -7761,7 +7761,7 @@ class z {
|
|
|
7761
7761
|
let a = this.local[l].map(e, n, i);
|
|
7762
7762
|
a && a.type.valid(t, a) ? (o || (o = [])).push(a) : s.onRemove && s.onRemove(this.local[l].spec);
|
|
7763
7763
|
}
|
|
7764
|
-
return this.children.length ? Ha(this.children, o || [], e, t, n, i, s) : o ? new
|
|
7764
|
+
return this.children.length ? Ha(this.children, o || [], e, t, n, i, s) : o ? new B(o.sort($e), Ge) : H;
|
|
7765
7765
|
}
|
|
7766
7766
|
/**
|
|
7767
7767
|
Add the given array of decorations to the ones in the set,
|
|
@@ -7770,7 +7770,7 @@ class z {
|
|
|
7770
7770
|
structure.
|
|
7771
7771
|
*/
|
|
7772
7772
|
add(e, t) {
|
|
7773
|
-
return t.length ? this == H ?
|
|
7773
|
+
return t.length ? this == H ? B.create(e, t) : this.addInner(e, t, 0) : this;
|
|
7774
7774
|
}
|
|
7775
7775
|
addInner(e, t, n) {
|
|
7776
7776
|
let i, s = 0;
|
|
@@ -7785,7 +7785,7 @@ class z {
|
|
|
7785
7785
|
let o = Ys(s ? Zs(t) : t, -n);
|
|
7786
7786
|
for (let l = 0; l < o.length; l++)
|
|
7787
7787
|
o[l].type.valid(e, o[l]) || o.splice(l--, 1);
|
|
7788
|
-
return new
|
|
7788
|
+
return new B(o.length ? this.local.concat(o).sort($e) : this.local, i || this.children);
|
|
7789
7789
|
}
|
|
7790
7790
|
/**
|
|
7791
7791
|
Create a new set that contains the decorations in this set, minus
|
|
@@ -7812,13 +7812,13 @@ class z {
|
|
|
7812
7812
|
for (let l = 0; l < i.length; l++)
|
|
7813
7813
|
i[l].eq(o, t) && (i == this.local && (i = this.local.slice()), i.splice(l--, 1));
|
|
7814
7814
|
}
|
|
7815
|
-
return n == this.children && i == this.local ? this : i.length || n.length ? new
|
|
7815
|
+
return n == this.children && i == this.local ? this : i.length || n.length ? new B(i, n) : H;
|
|
7816
7816
|
}
|
|
7817
7817
|
forChild(e, t) {
|
|
7818
7818
|
if (this == H)
|
|
7819
7819
|
return this;
|
|
7820
7820
|
if (t.isLeaf)
|
|
7821
|
-
return
|
|
7821
|
+
return B.empty;
|
|
7822
7822
|
let n, i;
|
|
7823
7823
|
for (let l = 0; l < this.children.length; l += 3)
|
|
7824
7824
|
if (this.children[l] >= e) {
|
|
@@ -7834,7 +7834,7 @@ class z {
|
|
|
7834
7834
|
}
|
|
7835
7835
|
}
|
|
7836
7836
|
if (i) {
|
|
7837
|
-
let l = new
|
|
7837
|
+
let l = new B(i.sort($e), Ge);
|
|
7838
7838
|
return n ? new xe([l, n]) : l;
|
|
7839
7839
|
}
|
|
7840
7840
|
return n || H;
|
|
@@ -7845,7 +7845,7 @@ class z {
|
|
|
7845
7845
|
eq(e) {
|
|
7846
7846
|
if (this == e)
|
|
7847
7847
|
return !0;
|
|
7848
|
-
if (!(e instanceof
|
|
7848
|
+
if (!(e instanceof B) || this.local.length != e.local.length || this.children.length != e.children.length)
|
|
7849
7849
|
return !1;
|
|
7850
7850
|
for (let t = 0; t < this.local.length; t++)
|
|
7851
7851
|
if (!this.local[t].eq(e.local[t]))
|
|
@@ -7878,9 +7878,9 @@ class z {
|
|
|
7878
7878
|
e(this);
|
|
7879
7879
|
}
|
|
7880
7880
|
}
|
|
7881
|
-
|
|
7882
|
-
|
|
7883
|
-
const H =
|
|
7881
|
+
B.empty = new B([], []);
|
|
7882
|
+
B.removeOverlap = mr;
|
|
7883
|
+
const H = B.empty;
|
|
7884
7884
|
class xe {
|
|
7885
7885
|
constructor(e) {
|
|
7886
7886
|
this.members = e;
|
|
@@ -7891,7 +7891,7 @@ class xe {
|
|
|
7891
7891
|
}
|
|
7892
7892
|
forChild(e, t) {
|
|
7893
7893
|
if (t.isLeaf)
|
|
7894
|
-
return
|
|
7894
|
+
return B.empty;
|
|
7895
7895
|
let n = [];
|
|
7896
7896
|
for (let i = 0; i < this.members.length; i++) {
|
|
7897
7897
|
let s = this.members[i].forChild(e, t);
|
|
@@ -7931,7 +7931,7 @@ class xe {
|
|
|
7931
7931
|
case 1:
|
|
7932
7932
|
return e[0];
|
|
7933
7933
|
default:
|
|
7934
|
-
return new xe(e.every((t) => t instanceof
|
|
7934
|
+
return new xe(e.every((t) => t instanceof B) ? e : e.reduce((t, n) => t.concat(n instanceof B ? n : n.members), []));
|
|
7935
7935
|
}
|
|
7936
7936
|
}
|
|
7937
7937
|
forEachSet(e) {
|
|
@@ -7943,14 +7943,14 @@ function Ha(r, e, t, n, i, s, o) {
|
|
|
7943
7943
|
let l = r.slice();
|
|
7944
7944
|
for (let c = 0, u = s; c < t.maps.length; c++) {
|
|
7945
7945
|
let d = 0;
|
|
7946
|
-
t.maps[c].forEach((
|
|
7947
|
-
let g = m - p - (
|
|
7946
|
+
t.maps[c].forEach((h, f, p, m) => {
|
|
7947
|
+
let g = m - p - (f - h);
|
|
7948
7948
|
for (let y = 0; y < l.length; y += 3) {
|
|
7949
7949
|
let S = l[y + 1];
|
|
7950
|
-
if (S < 0 ||
|
|
7950
|
+
if (S < 0 || h > S + u - d)
|
|
7951
7951
|
continue;
|
|
7952
7952
|
let w = l[y] + u - d;
|
|
7953
|
-
|
|
7953
|
+
f >= w ? l[y + 1] = h <= w ? -2 : -1 : h >= u && g && (l[y] += g, l[y + 1] += g);
|
|
7954
7954
|
}
|
|
7955
7955
|
d += g;
|
|
7956
7956
|
}), u = t.maps[c].map(u, -1);
|
|
@@ -7967,10 +7967,10 @@ function Ha(r, e, t, n, i, s, o) {
|
|
|
7967
7967
|
a = !0;
|
|
7968
7968
|
continue;
|
|
7969
7969
|
}
|
|
7970
|
-
let
|
|
7971
|
-
if (g && m == d && m + g.nodeSize ==
|
|
7970
|
+
let h = t.map(r[c + 1] + s, -1), f = h - i, { index: p, offset: m } = n.content.findIndex(d), g = n.maybeChild(p);
|
|
7971
|
+
if (g && m == d && m + g.nodeSize == f) {
|
|
7972
7972
|
let y = l[c + 2].mapInner(t, g, u + 1, r[c] + s + 1, o);
|
|
7973
|
-
y != H ? (l[c] = d, l[c + 1] =
|
|
7973
|
+
y != H ? (l[c] = d, l[c + 1] = f, l[c + 2] = y) : (l[c + 1] = -2, a = !0);
|
|
7974
7974
|
} else
|
|
7975
7975
|
a = !0;
|
|
7976
7976
|
}
|
|
@@ -7979,14 +7979,14 @@ function Ha(r, e, t, n, i, s, o) {
|
|
|
7979
7979
|
e = u.local;
|
|
7980
7980
|
for (let d = 0; d < l.length; d += 3)
|
|
7981
7981
|
l[d + 1] < 0 && (l.splice(d, 3), d -= 3);
|
|
7982
|
-
for (let d = 0,
|
|
7983
|
-
let
|
|
7984
|
-
for (;
|
|
7985
|
-
|
|
7986
|
-
l.splice(
|
|
7982
|
+
for (let d = 0, h = 0; d < u.children.length; d += 3) {
|
|
7983
|
+
let f = u.children[d];
|
|
7984
|
+
for (; h < l.length && l[h] < f; )
|
|
7985
|
+
h += 3;
|
|
7986
|
+
l.splice(h, 0, u.children[d], u.children[d + 1], u.children[d + 2]);
|
|
7987
7987
|
}
|
|
7988
7988
|
}
|
|
7989
|
-
return new
|
|
7989
|
+
return new B(e.sort($e), l);
|
|
7990
7990
|
}
|
|
7991
7991
|
function Ys(r, e) {
|
|
7992
7992
|
if (!e || !r.length)
|
|
@@ -7994,7 +7994,7 @@ function Ys(r, e) {
|
|
|
7994
7994
|
let t = [];
|
|
7995
7995
|
for (let n = 0; n < r.length; n++) {
|
|
7996
7996
|
let i = r[n];
|
|
7997
|
-
t.push(new
|
|
7997
|
+
t.push(new re(i.from + e, i.to + e, i.type));
|
|
7998
7998
|
}
|
|
7999
7999
|
return t;
|
|
8000
8000
|
}
|
|
@@ -8038,7 +8038,7 @@ function Gt(r, e, t, n) {
|
|
|
8038
8038
|
let o = Ys(s ? Zs(r) : r, -t).sort($e);
|
|
8039
8039
|
for (let l = 0; l < o.length; l++)
|
|
8040
8040
|
o[l].type.valid(e, o[l]) || (n.onRemove && n.onRemove(o[l].spec), o.splice(l--, 1));
|
|
8041
|
-
return o.length || i.length ? new
|
|
8041
|
+
return o.length || i.length ? new B(o, i) : H;
|
|
8042
8042
|
}
|
|
8043
8043
|
function $e(r, e) {
|
|
8044
8044
|
return r.from - e.from || r.to - e.to;
|
|
@@ -8071,7 +8071,7 @@ function Tn(r) {
|
|
|
8071
8071
|
return r.someProp("decorations", (t) => {
|
|
8072
8072
|
let n = t(r.state);
|
|
8073
8073
|
n && n != H && e.push(n);
|
|
8074
|
-
}), r.cursorWrapper && e.push(
|
|
8074
|
+
}), r.cursorWrapper && e.push(B.create(r.state.doc, [r.cursorWrapper.deco])), xe.from(e);
|
|
8075
8075
|
}
|
|
8076
8076
|
const qa = {
|
|
8077
8077
|
childList: !0,
|
|
@@ -8140,7 +8140,7 @@ class _a {
|
|
|
8140
8140
|
onSelectionChange() {
|
|
8141
8141
|
if (li(this.view)) {
|
|
8142
8142
|
if (this.suppressingSelectionUpdates)
|
|
8143
|
-
return
|
|
8143
|
+
return ge(this.view);
|
|
8144
8144
|
if (G && Ee <= 11 && !this.view.state.selection.empty) {
|
|
8145
8145
|
let e = this.view.domSelectionRange();
|
|
8146
8146
|
if (e.focusNode && We(e.focusNode, e.focusOffset, e.anchorNode, e.anchorOffset))
|
|
@@ -8188,21 +8188,21 @@ class _a {
|
|
|
8188
8188
|
let d = this.registerMutation(t[u], a);
|
|
8189
8189
|
d && (s = s < 0 ? d.from : Math.min(d.from, s), o = o < 0 ? d.to : Math.max(d.to, o), d.typeOver && (l = !0));
|
|
8190
8190
|
}
|
|
8191
|
-
if (
|
|
8191
|
+
if (oe && a.length) {
|
|
8192
8192
|
let u = a.filter((d) => d.nodeName == "BR");
|
|
8193
8193
|
if (u.length == 2) {
|
|
8194
|
-
let [d,
|
|
8195
|
-
d.parentNode && d.parentNode.parentNode ==
|
|
8194
|
+
let [d, h] = u;
|
|
8195
|
+
d.parentNode && d.parentNode.parentNode == h.parentNode ? h.remove() : d.remove();
|
|
8196
8196
|
} else {
|
|
8197
8197
|
let { focusNode: d } = this.currentSelection;
|
|
8198
|
-
for (let
|
|
8199
|
-
let
|
|
8200
|
-
|
|
8198
|
+
for (let h of u) {
|
|
8199
|
+
let f = h.parentNode;
|
|
8200
|
+
f && f.nodeName == "LI" && (!d || Xa(e, d) != f) && h.remove();
|
|
8201
8201
|
}
|
|
8202
8202
|
}
|
|
8203
8203
|
}
|
|
8204
8204
|
let c = null;
|
|
8205
|
-
s < 0 && i && e.input.lastFocus > Date.now() - 200 && Math.max(e.input.lastTouch, e.input.lastClick.time) < Date.now() - 300 && sn(n) && (c = ar(e)) && c.eq(O.near(e.state.doc.resolve(0), 1)) ? (e.input.lastFocus = 0,
|
|
8205
|
+
s < 0 && i && e.input.lastFocus > Date.now() - 200 && Math.max(e.input.lastTouch, e.input.lastClick.time) < Date.now() - 300 && sn(n) && (c = ar(e)) && c.eq(O.near(e.state.doc.resolve(0), 1)) ? (e.input.lastFocus = 0, ge(e), this.currentSelection.set(n), e.scrollToSelection()) : (s > -1 || i) && (s > -1 && (e.docView.markDirty(s, o), Ga(e)), this.handleDOMChange(s, o, l, a), e.docView && e.docView.dirty ? e.updateState(e.state) : this.currentSelection.eq(n) || ge(e), this.currentSelection.set(n));
|
|
8206
8206
|
}
|
|
8207
8207
|
registerMutation(e, t) {
|
|
8208
8208
|
if (t.indexOf(e.target) > -1)
|
|
@@ -8221,10 +8221,10 @@ class _a {
|
|
|
8221
8221
|
let i = e.previousSibling, s = e.nextSibling;
|
|
8222
8222
|
if (G && Ee <= 11 && e.addedNodes.length)
|
|
8223
8223
|
for (let u = 0; u < e.addedNodes.length; u++) {
|
|
8224
|
-
let { previousSibling: d, nextSibling:
|
|
8225
|
-
(!d || Array.prototype.indexOf.call(e.addedNodes, d) < 0) && (i = d), (!
|
|
8224
|
+
let { previousSibling: d, nextSibling: h } = e.addedNodes[u];
|
|
8225
|
+
(!d || Array.prototype.indexOf.call(e.addedNodes, d) < 0) && (i = d), (!h || Array.prototype.indexOf.call(e.addedNodes, h) < 0) && (s = h);
|
|
8226
8226
|
}
|
|
8227
|
-
let o = i && i.parentNode == e.target ?
|
|
8227
|
+
let o = i && i.parentNode == e.target ? V(i) + 1 : 0, l = n.localPosFromDOM(e.target, o, -1), a = s && s.parentNode == e.target ? V(s) : e.target.childNodes.length, c = n.localPosFromDOM(e.target, a, 1);
|
|
8228
8228
|
return { from: l, to: c };
|
|
8229
8229
|
} else return e.type == "attributes" ? { from: n.posAtStart - n.border, to: n.posAtEnd + n.border } : (this.lastChangedTextNode = e.target, {
|
|
8230
8230
|
from: n.posAtStart,
|
|
@@ -8240,7 +8240,7 @@ class _a {
|
|
|
8240
8240
|
let gi = /* @__PURE__ */ new WeakMap(), yi = !1;
|
|
8241
8241
|
function Ga(r) {
|
|
8242
8242
|
if (!gi.has(r) && (gi.set(r, null), ["normal", "nowrap", "pre-line"].indexOf(getComputedStyle(r.dom).whiteSpace) !== -1)) {
|
|
8243
|
-
if (r.requiresGeckoHackNode =
|
|
8243
|
+
if (r.requiresGeckoHackNode = oe, yi)
|
|
8244
8244
|
return;
|
|
8245
8245
|
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."), yi = !0;
|
|
8246
8246
|
}
|
|
@@ -8281,16 +8281,16 @@ function Za(r, e, t) {
|
|
|
8281
8281
|
if (!S || S.size)
|
|
8282
8282
|
break;
|
|
8283
8283
|
}
|
|
8284
|
-
let d = r.state.doc,
|
|
8285
|
-
topNode:
|
|
8286
|
-
topMatch:
|
|
8284
|
+
let d = r.state.doc, h = r.someProp("domParser") || dt.fromSchema(r.state.schema), f = d.resolve(o), p = null, m = h.parse(n, {
|
|
8285
|
+
topNode: f.parent,
|
|
8286
|
+
topMatch: f.parent.contentMatchAt(f.index()),
|
|
8287
8287
|
topOpen: !0,
|
|
8288
8288
|
from: i,
|
|
8289
8289
|
to: s,
|
|
8290
|
-
preserveWhitespace:
|
|
8290
|
+
preserveWhitespace: f.parent.type.whitespace == "pre" ? "full" : !0,
|
|
8291
8291
|
findPositions: c,
|
|
8292
8292
|
ruleFromNode: Qa,
|
|
8293
|
-
context:
|
|
8293
|
+
context: f
|
|
8294
8294
|
});
|
|
8295
8295
|
if (c && c[0].pos != null) {
|
|
8296
8296
|
let g = c[0].pos, y = c[1] && c[1].pos;
|
|
@@ -8316,73 +8316,73 @@ const ec = /^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|df
|
|
|
8316
8316
|
function tc(r, e, t, n, i) {
|
|
8317
8317
|
let s = r.input.compositionPendingChanges || (r.composing ? r.input.compositionID : 0);
|
|
8318
8318
|
if (r.input.compositionPendingChanges = 0, e < 0) {
|
|
8319
|
-
let
|
|
8320
|
-
if (
|
|
8321
|
-
if (J &&
|
|
8319
|
+
let E = r.input.lastSelectionTime > Date.now() - 50 ? r.input.lastSelectionOrigin : null, ee = ar(r, E);
|
|
8320
|
+
if (ee && !r.state.selection.eq(ee)) {
|
|
8321
|
+
if (J && pe && r.input.lastKeyCode === 13 && Date.now() - 100 < r.input.lastKeyCodeTime && r.someProp("handleKeyDown", (Ao) => Ao(r, De(13, "Enter"))))
|
|
8322
8322
|
return;
|
|
8323
|
-
let Ot = r.state.tr.setSelection(
|
|
8324
|
-
|
|
8323
|
+
let Ot = r.state.tr.setSelection(ee);
|
|
8324
|
+
E == "pointer" ? Ot.setMeta("pointer", !0) : E == "key" && Ot.scrollIntoView(), s && Ot.setMeta("composition", s), r.dispatch(Ot);
|
|
8325
8325
|
}
|
|
8326
8326
|
return;
|
|
8327
8327
|
}
|
|
8328
8328
|
let o = r.state.doc.resolve(e), l = o.sharedDepth(t);
|
|
8329
8329
|
e = o.before(l + 1), t = r.state.doc.resolve(t).after(l + 1);
|
|
8330
|
-
let a = r.state.selection, c = Za(r, e, t), u = r.state.doc, d = u.slice(c.from, c.to),
|
|
8331
|
-
r.input.lastKeyCode === 8 && Date.now() - 100 < r.input.lastKeyCodeTime ? (
|
|
8332
|
-
let p = ic(d.content, c.doc.content, c.from,
|
|
8333
|
-
if (p && r.input.domChangeCount++, (rt && r.input.lastIOSEnter > Date.now() - 225 ||
|
|
8330
|
+
let a = r.state.selection, c = Za(r, e, t), u = r.state.doc, d = u.slice(c.from, c.to), h, f;
|
|
8331
|
+
r.input.lastKeyCode === 8 && Date.now() - 100 < r.input.lastKeyCodeTime ? (h = r.state.selection.to, f = "end") : (h = r.state.selection.from, f = "start"), r.input.lastKeyCode = null;
|
|
8332
|
+
let p = ic(d.content, c.doc.content, c.from, h, f);
|
|
8333
|
+
if (p && r.input.domChangeCount++, (rt && r.input.lastIOSEnter > Date.now() - 225 || pe) && i.some((E) => E.nodeType == 1 && !ec.test(E.nodeName)) && (!p || p.endA >= p.endB) && r.someProp("handleKeyDown", (E) => E(r, De(13, "Enter")))) {
|
|
8334
8334
|
r.input.lastIOSEnter = 0;
|
|
8335
8335
|
return;
|
|
8336
8336
|
}
|
|
8337
8337
|
if (!p)
|
|
8338
|
-
if (n && a instanceof
|
|
8338
|
+
if (n && a instanceof T && !a.empty && a.$head.sameParent(a.$anchor) && !r.composing && !(c.sel && c.sel.anchor != c.sel.head))
|
|
8339
8339
|
p = { start: a.from, endA: a.to, endB: a.to };
|
|
8340
8340
|
else {
|
|
8341
8341
|
if (c.sel) {
|
|
8342
|
-
let
|
|
8343
|
-
if (
|
|
8344
|
-
let
|
|
8345
|
-
s &&
|
|
8342
|
+
let E = ki(r, r.state.doc, c.sel);
|
|
8343
|
+
if (E && !E.eq(r.state.selection)) {
|
|
8344
|
+
let ee = r.state.tr.setSelection(E);
|
|
8345
|
+
s && ee.setMeta("composition", s), r.dispatch(ee);
|
|
8346
8346
|
}
|
|
8347
8347
|
}
|
|
8348
8348
|
return;
|
|
8349
8349
|
}
|
|
8350
|
-
r.state.selection.from < r.state.selection.to && p.start == p.endB && r.state.selection instanceof
|
|
8350
|
+
r.state.selection.from < r.state.selection.to && p.start == p.endB && r.state.selection instanceof T && (p.start > r.state.selection.from && p.start <= r.state.selection.from + 2 && r.state.selection.from >= c.from ? p.start = r.state.selection.from : p.endA < r.state.selection.to && p.endA >= r.state.selection.to - 2 && r.state.selection.to <= c.to && (p.endB += r.state.selection.to - p.endA, p.endA = r.state.selection.to)), G && 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--);
|
|
8351
8351
|
let m = c.doc.resolveNoCache(p.start - c.from), g = c.doc.resolveNoCache(p.endB - c.from), y = u.resolve(p.start), S = m.sameParent(g) && m.parent.inlineContent && y.end() >= p.endA, w;
|
|
8352
|
-
if ((rt && r.input.lastIOSEnter > Date.now() - 225 && (!S || i.some((
|
|
8352
|
+
if ((rt && r.input.lastIOSEnter > Date.now() - 225 && (!S || i.some((E) => E.nodeName == "DIV" || E.nodeName == "P")) || !S && m.pos < c.doc.content.size && (!m.sameParent(g) || !m.parent.inlineContent) && (w = O.findFrom(c.doc.resolve(m.pos + 1), 1, !0)) && w.head > m.pos) && r.someProp("handleKeyDown", (E) => E(r, De(13, "Enter")))) {
|
|
8353
8353
|
r.input.lastIOSEnter = 0;
|
|
8354
8354
|
return;
|
|
8355
8355
|
}
|
|
8356
|
-
if (r.state.selection.anchor > p.start && rc(u, p.start, p.endA, m, g) && r.someProp("handleKeyDown", (
|
|
8357
|
-
|
|
8356
|
+
if (r.state.selection.anchor > p.start && rc(u, p.start, p.endA, m, g) && r.someProp("handleKeyDown", (E) => E(r, De(8, "Backspace")))) {
|
|
8357
|
+
pe && J && r.domObserver.suppressSelectionUpdates();
|
|
8358
8358
|
return;
|
|
8359
8359
|
}
|
|
8360
|
-
J && p.endB == p.start && (r.input.lastChromeDelete = Date.now()),
|
|
8361
|
-
r.someProp("handleKeyDown", function(
|
|
8362
|
-
return
|
|
8360
|
+
J && p.endB == p.start && (r.input.lastChromeDelete = Date.now()), pe && !S && 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(() => {
|
|
8361
|
+
r.someProp("handleKeyDown", function(E) {
|
|
8362
|
+
return E(r, De(13, "Enter"));
|
|
8363
8363
|
});
|
|
8364
8364
|
}, 20));
|
|
8365
|
-
let v = p.start, A = p.endA, M,
|
|
8365
|
+
let v = p.start, A = p.endA, M, I, W;
|
|
8366
8366
|
if (S) {
|
|
8367
8367
|
if (m.pos == g.pos)
|
|
8368
|
-
G && Ee <= 11 && m.parentOffset == 0 && (r.domObserver.suppressSelectionUpdates(), setTimeout(() =>
|
|
8368
|
+
G && Ee <= 11 && m.parentOffset == 0 && (r.domObserver.suppressSelectionUpdates(), setTimeout(() => ge(r), 20)), M = r.state.tr.delete(v, A), I = u.resolve(p.start).marksAcross(u.resolve(p.endA));
|
|
8369
8369
|
else if (
|
|
8370
8370
|
// Adding or removing a mark
|
|
8371
|
-
p.endA == p.endB && (
|
|
8371
|
+
p.endA == p.endB && (W = nc(m.parent.content.cut(m.parentOffset, g.parentOffset), y.parent.content.cut(y.parentOffset, p.endA - y.start())))
|
|
8372
8372
|
)
|
|
8373
|
-
M = r.state.tr,
|
|
8373
|
+
M = r.state.tr, W.type == "add" ? M.addMark(v, A, W.mark) : M.removeMark(v, A, W.mark);
|
|
8374
8374
|
else if (m.parent.child(m.index()).isText && m.index() == g.index() - (g.textOffset ? 0 : 1)) {
|
|
8375
|
-
let
|
|
8376
|
-
if (r.someProp("handleTextInput", (
|
|
8375
|
+
let E = m.parent.textBetween(m.parentOffset, g.parentOffset);
|
|
8376
|
+
if (r.someProp("handleTextInput", (ee) => ee(r, v, A, E)))
|
|
8377
8377
|
return;
|
|
8378
|
-
M = r.state.tr.insertText(
|
|
8378
|
+
M = r.state.tr.insertText(E, v, A);
|
|
8379
8379
|
}
|
|
8380
8380
|
}
|
|
8381
8381
|
if (M || (M = r.state.tr.replace(v, A, c.doc.slice(p.start - c.from, p.endB - c.from))), c.sel) {
|
|
8382
|
-
let
|
|
8383
|
-
|
|
8382
|
+
let E = ki(r, M.doc, c.sel);
|
|
8383
|
+
E && !(J && r.composing && E.empty && (p.start != p.endB || r.input.lastChromeDelete < Date.now() - 100) && (E.head == v || E.head == M.mapping.map(A) - 1) || G && E.empty && E.head == v) && M.setSelection(E);
|
|
8384
8384
|
}
|
|
8385
|
-
|
|
8385
|
+
I && M.ensureMarks(I), s && M.setMeta("composition", s), r.dispatch(M.scrollIntoView());
|
|
8386
8386
|
}
|
|
8387
8387
|
function ki(r, e, t) {
|
|
8388
8388
|
return Math.max(t.anchor, t.head) > e.content.size ? null : cr(r, e.resolve(t.anchor), e.resolve(t.head));
|
|
@@ -8525,23 +8525,23 @@ class sc {
|
|
|
8525
8525
|
e.storedMarks && this.composing && (Ks(this), o = !0), this.state = e;
|
|
8526
8526
|
let l = i.plugins != e.plugins || this._props.plugins != t.plugins;
|
|
8527
8527
|
if (l || this._props.plugins != t.plugins || this._props.nodeViews != t.nodeViews) {
|
|
8528
|
-
let
|
|
8529
|
-
lc(
|
|
8528
|
+
let f = Mi(this);
|
|
8529
|
+
lc(f, this.nodeViews) && (this.nodeViews = f, s = !0);
|
|
8530
8530
|
}
|
|
8531
8531
|
(l || t.handleDOMEvents != this._props.handleDOMEvents) && Xn(this), this.editable = wi(this), Ci(this);
|
|
8532
8532
|
let a = Tn(this), c = Si(this), u = i.plugins != e.plugins && !i.doc.eq(e.doc) ? "reset" : e.scrollToSelection > i.scrollToSelection ? "to selection" : "preserve", d = s || !this.docView.matchesNode(e.doc, c, a);
|
|
8533
8533
|
(d || !e.selection.eq(i.selection)) && (o = !0);
|
|
8534
|
-
let
|
|
8534
|
+
let h = u == "preserve" && o && this.dom.style.overflowAnchor == null && Ll(this);
|
|
8535
8535
|
if (o) {
|
|
8536
8536
|
this.domObserver.stop();
|
|
8537
|
-
let
|
|
8537
|
+
let f = d && (G || J) && !this.composing && !i.selection.empty && !e.selection.empty && oc(i.selection, e.selection);
|
|
8538
8538
|
if (d) {
|
|
8539
8539
|
let p = J ? this.trackWrites = this.domSelectionRange().focusNode : null;
|
|
8540
|
-
this.composing && (this.input.compositionNode = Fa(this)), (s || !this.docView.update(e.doc, c, a, this)) && (this.docView.updateOuterDeco(c), this.docView.destroy(), this.docView = ti(e.doc, c, a, this.dom, this)), p && !this.trackWrites && (
|
|
8540
|
+
this.composing && (this.input.compositionNode = Fa(this)), (s || !this.docView.update(e.doc, c, a, this)) && (this.docView.updateOuterDeco(c), this.docView.destroy(), this.docView = ti(e.doc, c, a, this.dom, this)), p && !this.trackWrites && (f = !0);
|
|
8541
8541
|
}
|
|
8542
|
-
|
|
8542
|
+
f || !(this.input.mouseDown && this.domObserver.currentSelection.eq(this.domSelectionRange()) && aa(this)) ? ge(this, f) : (Rs(this, e.selection), this.domObserver.setCurSelection()), this.domObserver.start();
|
|
8543
8543
|
}
|
|
8544
|
-
this.updatePluginViews(i), !((n = this.dragging) === null || n === void 0) && n.node && !i.doc.eq(e.doc) && this.updateDraggedNode(this.dragging, i), u == "reset" ? this.dom.scrollTop = 0 : u == "to selection" ? this.scrollToSelection() :
|
|
8544
|
+
this.updatePluginViews(i), !((n = this.dragging) === null || n === void 0) && n.node && !i.doc.eq(e.doc) && this.updateDraggedNode(this.dragging, i), u == "reset" ? this.dom.scrollTop = 0 : u == "to selection" ? this.scrollToSelection() : h && $l(h);
|
|
8545
8545
|
}
|
|
8546
8546
|
/**
|
|
8547
8547
|
@internal
|
|
@@ -8628,7 +8628,7 @@ class sc {
|
|
|
8628
8628
|
Focus the editor.
|
|
8629
8629
|
*/
|
|
8630
8630
|
focus() {
|
|
8631
|
-
this.domObserver.stop(), this.editable && Vl(this.dom),
|
|
8631
|
+
this.domObserver.stop(), this.editable && Vl(this.dom), ge(this), this.domObserver.start();
|
|
8632
8632
|
}
|
|
8633
8633
|
/**
|
|
8634
8634
|
Get the document root in which the editor exists. This will
|
|
@@ -8808,12 +8808,12 @@ function Si(r) {
|
|
|
8808
8808
|
if (typeof t == "function" && (t = t(r.state)), t)
|
|
8809
8809
|
for (let n in t)
|
|
8810
8810
|
n == "class" ? e.class += " " + t[n] : n == "style" ? e.style = (e.style ? e.style + ";" : "") + t[n] : !e[n] && n != "contenteditable" && n != "nodeName" && (e[n] = String(t[n]));
|
|
8811
|
-
}), e.translate || (e.translate = "no"), [
|
|
8811
|
+
}), e.translate || (e.translate = "no"), [re.node(0, r.state.doc.content.size, e)];
|
|
8812
8812
|
}
|
|
8813
8813
|
function Ci(r) {
|
|
8814
8814
|
if (r.markCursor) {
|
|
8815
8815
|
let e = document.createElement("img");
|
|
8816
|
-
e.className = "ProseMirror-separator", e.setAttribute("mark-placeholder", "true"), e.setAttribute("alt", ""), r.cursorWrapper = { dom: e, deco:
|
|
8816
|
+
e.className = "ProseMirror-separator", e.setAttribute("mark-placeholder", "true"), e.setAttribute("alt", ""), r.cursorWrapper = { dom: e, deco: re.widget(r.state.selection.from, e, { raw: !0, marks: r.markCursor }) };
|
|
8817
8817
|
} else
|
|
8818
8818
|
r.cursorWrapper = null;
|
|
8819
8819
|
}
|
|
@@ -8926,17 +8926,17 @@ var Ne = {
|
|
|
8926
8926
|
221: "}",
|
|
8927
8927
|
222: '"'
|
|
8928
8928
|
}, ac = typeof navigator < "u" && /Mac/.test(navigator.platform), cc = typeof navigator < "u" && /MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);
|
|
8929
|
-
for (var
|
|
8930
|
-
for (var
|
|
8931
|
-
for (var
|
|
8932
|
-
Ne[
|
|
8929
|
+
for (var j = 0; j < 10; j++) Ne[48 + j] = Ne[96 + j] = String(j);
|
|
8930
|
+
for (var j = 1; j <= 24; j++) Ne[j + 111] = "F" + j;
|
|
8931
|
+
for (var j = 65; j <= 90; j++)
|
|
8932
|
+
Ne[j] = String.fromCharCode(j + 32), Yt[j] = String.fromCharCode(j);
|
|
8933
8933
|
for (var Nn in Ne) Yt.hasOwnProperty(Nn) || (Yt[Nn] = Ne[Nn]);
|
|
8934
8934
|
function uc(r) {
|
|
8935
8935
|
var e = ac && r.metaKey && r.shiftKey && !r.ctrlKey && !r.altKey || cc && r.shiftKey && r.key && r.key.length == 1 || r.key == "Unidentified", t = !e && r.key || (r.shiftKey ? Yt : Ne)[r.keyCode] || r.key || "Unidentified";
|
|
8936
8936
|
return t == "Esc" && (t = "Escape"), t == "Del" && (t = "Delete"), t == "Left" && (t = "ArrowLeft"), t == "Up" && (t = "ArrowUp"), t == "Right" && (t = "ArrowRight"), t == "Down" && (t = "ArrowDown"), t;
|
|
8937
8937
|
}
|
|
8938
8938
|
const dc = typeof navigator < "u" ? /Mac|iP(hone|[oa]d)/.test(navigator.platform) : !1;
|
|
8939
|
-
function
|
|
8939
|
+
function hc(r) {
|
|
8940
8940
|
let e = r.split(/-(?!$)/), t = e[e.length - 1];
|
|
8941
8941
|
t == "Space" && (t = " ");
|
|
8942
8942
|
let n, i, s, o;
|
|
@@ -8957,10 +8957,10 @@ function fc(r) {
|
|
|
8957
8957
|
}
|
|
8958
8958
|
return n && (t = "Alt-" + t), i && (t = "Ctrl-" + t), o && (t = "Meta-" + t), s && (t = "Shift-" + t), t;
|
|
8959
8959
|
}
|
|
8960
|
-
function
|
|
8960
|
+
function fc(r) {
|
|
8961
8961
|
let e = /* @__PURE__ */ Object.create(null);
|
|
8962
8962
|
for (let t in r)
|
|
8963
|
-
e[
|
|
8963
|
+
e[hc(t)] = r[t];
|
|
8964
8964
|
return e;
|
|
8965
8965
|
}
|
|
8966
8966
|
function An(r, e, t = !0) {
|
|
@@ -8970,7 +8970,7 @@ function pc(r) {
|
|
|
8970
8970
|
return new Q({ props: { handleKeyDown: mc(r) } });
|
|
8971
8971
|
}
|
|
8972
8972
|
function mc(r) {
|
|
8973
|
-
let e =
|
|
8973
|
+
let e = fc(r);
|
|
8974
8974
|
return function(t, n) {
|
|
8975
8975
|
let i = uc(n), s, o = e[An(i, n)];
|
|
8976
8976
|
if (o && o(t.state, t.dispatch, t))
|
|
@@ -9054,11 +9054,11 @@ function to(r, e, t) {
|
|
|
9054
9054
|
l = u;
|
|
9055
9055
|
}
|
|
9056
9056
|
let c = nn(r.doc, s, a, k.empty);
|
|
9057
|
-
if (!c || c.from != s || c instanceof
|
|
9057
|
+
if (!c || c.from != s || c instanceof P && c.slice.size >= a - s)
|
|
9058
9058
|
return !1;
|
|
9059
9059
|
if (t) {
|
|
9060
9060
|
let u = r.tr.step(c);
|
|
9061
|
-
u.setSelection(
|
|
9061
|
+
u.setSelection(T.create(u.doc, s)), t(u.scrollIntoView());
|
|
9062
9062
|
}
|
|
9063
9063
|
return !0;
|
|
9064
9064
|
}
|
|
@@ -9200,7 +9200,7 @@ const Sc = (r, e) => {
|
|
|
9200
9200
|
return !1;
|
|
9201
9201
|
if (e) {
|
|
9202
9202
|
let o = (!n.parentOffset && i.index() < i.parent.childCount ? n : i).pos, l = r.tr.insert(o, s.createAndFill());
|
|
9203
|
-
l.setSelection(
|
|
9203
|
+
l.setSelection(T.create(l.doc, o + 1)), e(l.scrollIntoView());
|
|
9204
9204
|
}
|
|
9205
9205
|
return !0;
|
|
9206
9206
|
}, ao = (r, e) => {
|
|
@@ -9209,7 +9209,7 @@ const Sc = (r, e) => {
|
|
|
9209
9209
|
return !1;
|
|
9210
9210
|
if (t.depth > 1 && t.after() != t.end(-1)) {
|
|
9211
9211
|
let s = t.before();
|
|
9212
|
-
if (
|
|
9212
|
+
if (me(r.doc, s))
|
|
9213
9213
|
return e && e(r.tr.split(s).scrollIntoView()), !0;
|
|
9214
9214
|
}
|
|
9215
9215
|
let n = t.blockRange(), i = n && st(n);
|
|
@@ -9219,26 +9219,26 @@ function Cc(r) {
|
|
|
9219
9219
|
return (e, t) => {
|
|
9220
9220
|
let { $from: n, $to: i } = e.selection;
|
|
9221
9221
|
if (e.selection instanceof C && e.selection.node.isBlock)
|
|
9222
|
-
return !n.parentOffset || !
|
|
9222
|
+
return !n.parentOffset || !me(e.doc, n.pos) ? !1 : (t && t(e.tr.split(n.pos).scrollIntoView()), !0);
|
|
9223
9223
|
if (!n.depth)
|
|
9224
9224
|
return !1;
|
|
9225
9225
|
let s = [], o, l, a = !1, c = !1;
|
|
9226
|
-
for (let
|
|
9227
|
-
if (n.node(
|
|
9228
|
-
a = n.end(
|
|
9226
|
+
for (let f = n.depth; ; f--)
|
|
9227
|
+
if (n.node(f).isBlock) {
|
|
9228
|
+
a = n.end(f) == n.pos + (n.depth - f), c = n.start(f) == n.pos - (n.depth - f), l = kr(n.node(f - 1).contentMatchAt(n.indexAfter(f - 1))), s.unshift(a && l ? { type: l } : null), o = f;
|
|
9229
9229
|
break;
|
|
9230
9230
|
} else {
|
|
9231
|
-
if (
|
|
9231
|
+
if (f == 1)
|
|
9232
9232
|
return !1;
|
|
9233
9233
|
s.unshift(null);
|
|
9234
9234
|
}
|
|
9235
9235
|
let u = e.tr;
|
|
9236
|
-
(e.selection instanceof
|
|
9237
|
-
let d = u.mapping.map(n.pos),
|
|
9238
|
-
if (
|
|
9236
|
+
(e.selection instanceof T || e.selection instanceof Z) && u.deleteSelection();
|
|
9237
|
+
let d = u.mapping.map(n.pos), h = me(u.doc, d, s.length, s);
|
|
9238
|
+
if (h || (s[0] = l ? { type: l } : null, h = me(u.doc, d, s.length, s)), !h)
|
|
9239
9239
|
return !1;
|
|
9240
9240
|
if (u.split(d, s.length, s), !a && c && n.node(o).type != l) {
|
|
9241
|
-
let
|
|
9241
|
+
let f = u.mapping.map(n.before(o)), p = u.doc.resolve(f);
|
|
9242
9242
|
l && n.node(o - 1).canReplaceWith(p.index(), p.index() + 1, l) && u.setNodeMarkup(u.mapping.map(n.before(o)), l);
|
|
9243
9243
|
}
|
|
9244
9244
|
return t && t(u.scrollIntoView()), !0;
|
|
@@ -9259,31 +9259,31 @@ function co(r, e, t, n) {
|
|
|
9259
9259
|
let c = !a && e.parent.canReplace(e.index(), e.index() + 1);
|
|
9260
9260
|
if (c && (o = (l = i.contentMatchAt(i.childCount)).findWrapping(s.type)) && l.matchType(o[0] || s.type).validEnd) {
|
|
9261
9261
|
if (t) {
|
|
9262
|
-
let
|
|
9262
|
+
let f = e.pos + s.nodeSize, p = b.empty;
|
|
9263
9263
|
for (let y = o.length - 1; y >= 0; y--)
|
|
9264
9264
|
p = b.from(o[y].create(null, p));
|
|
9265
9265
|
p = b.from(i.copy(p));
|
|
9266
|
-
let m = r.tr.step(new
|
|
9266
|
+
let m = r.tr.step(new z(e.pos - 1, f, e.pos, f, new k(p, 1, 0), o.length, !0)), g = m.doc.resolve(f + 2 * o.length);
|
|
9267
9267
|
g.nodeAfter && g.nodeAfter.type == i.type && qe(m.doc, g.pos) && m.join(g.pos), t(m.scrollIntoView());
|
|
9268
9268
|
}
|
|
9269
9269
|
return !0;
|
|
9270
9270
|
}
|
|
9271
|
-
let u = s.type.spec.isolating || n > 0 && a ? null : O.findFrom(e, 1), d = u && u.$from.blockRange(u.$to),
|
|
9272
|
-
if (
|
|
9273
|
-
return t && t(r.tr.lift(d,
|
|
9271
|
+
let u = s.type.spec.isolating || n > 0 && a ? null : O.findFrom(e, 1), d = u && u.$from.blockRange(u.$to), h = d && st(d);
|
|
9272
|
+
if (h != null && h >= e.depth)
|
|
9273
|
+
return t && t(r.tr.lift(d, h).scrollIntoView()), !0;
|
|
9274
9274
|
if (c && it(s, "start", !0) && it(i, "end")) {
|
|
9275
|
-
let
|
|
9276
|
-
for (; p.push(
|
|
9277
|
-
|
|
9275
|
+
let f = i, p = [];
|
|
9276
|
+
for (; p.push(f), !f.isTextblock; )
|
|
9277
|
+
f = f.lastChild;
|
|
9278
9278
|
let m = s, g = 1;
|
|
9279
9279
|
for (; !m.isTextblock; m = m.firstChild)
|
|
9280
9280
|
g++;
|
|
9281
|
-
if (
|
|
9281
|
+
if (f.canReplace(f.childCount, f.childCount, m.content)) {
|
|
9282
9282
|
if (t) {
|
|
9283
9283
|
let y = b.empty;
|
|
9284
9284
|
for (let w = p.length - 1; w >= 0; w--)
|
|
9285
9285
|
y = b.from(p[w].copy(y));
|
|
9286
|
-
let S = r.tr.step(new
|
|
9286
|
+
let S = r.tr.step(new z(e.pos - p.length, e.pos + s.nodeSize, e.pos + g, e.pos + s.nodeSize - g, new k(y, p.length, 0), 0, !0));
|
|
9287
9287
|
t(S.scrollIntoView());
|
|
9288
9288
|
}
|
|
9289
9289
|
return !0;
|
|
@@ -9299,7 +9299,7 @@ function uo(r) {
|
|
|
9299
9299
|
return !1;
|
|
9300
9300
|
s--;
|
|
9301
9301
|
}
|
|
9302
|
-
return i.node(s).isTextblock ? (t && t(e.tr.setSelection(
|
|
9302
|
+
return i.node(s).isTextblock ? (t && t(e.tr.setSelection(T.create(e.doc, r < 0 ? i.start(s) : i.end(s)))), !0) : !1;
|
|
9303
9303
|
};
|
|
9304
9304
|
}
|
|
9305
9305
|
const Tc = uo(-1), Oc = uo(1);
|
|
@@ -9375,13 +9375,13 @@ function Dc(r, e, t, n, i) {
|
|
|
9375
9375
|
let s = b.empty;
|
|
9376
9376
|
for (let u = t.length - 1; u >= 0; u--)
|
|
9377
9377
|
s = b.from(t[u].type.create(t[u].attrs, s));
|
|
9378
|
-
r.step(new
|
|
9378
|
+
r.step(new z(e.start - (n ? 2 : 0), e.end, e.start, e.end, new k(s, 0, 0), t.length, !0));
|
|
9379
9379
|
let o = 0;
|
|
9380
9380
|
for (let u = 0; u < t.length; u++)
|
|
9381
9381
|
t[u].type == i && (o = u + 1);
|
|
9382
9382
|
let l = t.length - o, a = e.start + t.length - (n ? 2 : 0), c = e.parent;
|
|
9383
|
-
for (let u = e.startIndex, d = e.endIndex,
|
|
9384
|
-
!
|
|
9383
|
+
for (let u = e.startIndex, d = e.endIndex, h = !0; u < d; u++, h = !1)
|
|
9384
|
+
!h && me(r.doc, a, l) && (r.split(a, l), a += 2 * l), a += c.child(u).nodeSize;
|
|
9385
9385
|
return r;
|
|
9386
9386
|
}
|
|
9387
9387
|
function Ic(r) {
|
|
@@ -9392,7 +9392,7 @@ function Ic(r) {
|
|
|
9392
9392
|
}
|
|
9393
9393
|
function Pc(r, e, t, n) {
|
|
9394
9394
|
let i = r.tr, s = n.end, o = n.$to.end(n.depth);
|
|
9395
|
-
s < o && (i.step(new
|
|
9395
|
+
s < o && (i.step(new z(s - 1, o, s, o, new k(b.from(t.create(null, n.parent.copy())), 1, 0), 1, !0)), n = new Ht(i.doc.resolve(n.$from.pos), i.doc.resolve(o), n.depth));
|
|
9396
9396
|
const l = st(n);
|
|
9397
9397
|
if (l == null)
|
|
9398
9398
|
return !1;
|
|
@@ -9402,16 +9402,16 @@ function Pc(r, e, t, n) {
|
|
|
9402
9402
|
}
|
|
9403
9403
|
function Rc(r, e, t) {
|
|
9404
9404
|
let n = r.tr, i = t.parent;
|
|
9405
|
-
for (let
|
|
9406
|
-
|
|
9405
|
+
for (let f = t.end, p = t.endIndex - 1, m = t.startIndex; p > m; p--)
|
|
9406
|
+
f -= i.child(p).nodeSize, n.delete(f - 1, f + 1);
|
|
9407
9407
|
let s = n.doc.resolve(t.start), o = s.nodeAfter;
|
|
9408
9408
|
if (n.mapping.map(t.end) != t.start + s.nodeAfter.nodeSize)
|
|
9409
9409
|
return !1;
|
|
9410
9410
|
let l = t.startIndex == 0, a = t.endIndex == i.childCount, c = s.node(-1), u = s.index(-1);
|
|
9411
9411
|
if (!c.canReplace(u + (l ? 0 : 1), u + 1, o.content.append(a ? b.empty : b.from(i))))
|
|
9412
9412
|
return !1;
|
|
9413
|
-
let d = s.pos,
|
|
9414
|
-
return n.step(new
|
|
9413
|
+
let d = s.pos, h = d + o.nodeSize;
|
|
9414
|
+
return n.step(new z(d - (l ? 1 : 0), h + (a ? 1 : 0), d + 1, h - 1, new k((l ? b.empty : b.from(i.copy(b.empty))).append(a ? b.empty : b.from(i.copy(b.empty))), l ? 0 : 1, a ? 0 : 1), l ? 0 : 1)), e(n.scrollIntoView()), !0;
|
|
9415
9415
|
}
|
|
9416
9416
|
function Bc(r) {
|
|
9417
9417
|
return function(e, t) {
|
|
@@ -9425,8 +9425,8 @@ function Bc(r) {
|
|
|
9425
9425
|
if (a.type != r)
|
|
9426
9426
|
return !1;
|
|
9427
9427
|
if (t) {
|
|
9428
|
-
let c = a.lastChild && a.lastChild.type == l.type, u = b.from(c ? r.create() : null), d = new k(b.from(r.create(null, b.from(l.type.create(null, u)))), c ? 3 : 1, 0),
|
|
9429
|
-
t(e.tr.step(new
|
|
9428
|
+
let c = a.lastChild && a.lastChild.type == l.type, u = b.from(c ? r.create() : null), d = new k(b.from(r.create(null, b.from(l.type.create(null, u)))), c ? 3 : 1, 0), h = s.start, f = s.end;
|
|
9429
|
+
t(e.tr.step(new z(h - (c ? 3 : 1), f, h, f, d, 1, !0)).scrollIntoView());
|
|
9430
9430
|
}
|
|
9431
9431
|
return !0;
|
|
9432
9432
|
};
|
|
@@ -9480,9 +9480,9 @@ class cn {
|
|
|
9480
9480
|
return () => this.createCan();
|
|
9481
9481
|
}
|
|
9482
9482
|
createChain(e, t = !0) {
|
|
9483
|
-
const { rawCommands: n, editor: i, state: s } = this, { view: o } = i, l = [], a = !!e, c = e || s.tr, u = () => (!a && t && !c.getMeta("preventDispatch") && !this.hasCustomState && o.dispatch(c), l.every((
|
|
9484
|
-
...Object.fromEntries(Object.entries(n).map(([
|
|
9485
|
-
const g = this.buildProps(c, t), y =
|
|
9483
|
+
const { rawCommands: n, editor: i, state: s } = this, { view: o } = i, l = [], a = !!e, c = e || s.tr, u = () => (!a && t && !c.getMeta("preventDispatch") && !this.hasCustomState && o.dispatch(c), l.every((h) => h === !0)), d = {
|
|
9484
|
+
...Object.fromEntries(Object.entries(n).map(([h, f]) => [h, (...m) => {
|
|
9485
|
+
const g = this.buildProps(c, t), y = f(...m)(g);
|
|
9486
9486
|
return l.push(y), d;
|
|
9487
9487
|
}])),
|
|
9488
9488
|
run: u
|
|
@@ -9555,7 +9555,7 @@ function un(r) {
|
|
|
9555
9555
|
markExtensions: n
|
|
9556
9556
|
};
|
|
9557
9557
|
}
|
|
9558
|
-
function
|
|
9558
|
+
function ho(r) {
|
|
9559
9559
|
const e = [], { nodeExtensions: t, markExtensions: n } = un(r), i = [...t, ...n], s = {
|
|
9560
9560
|
default: null,
|
|
9561
9561
|
rendered: !0,
|
|
@@ -9575,13 +9575,13 @@ function fo(r) {
|
|
|
9575
9575
|
return;
|
|
9576
9576
|
a().forEach((u) => {
|
|
9577
9577
|
u.types.forEach((d) => {
|
|
9578
|
-
Object.entries(u.attributes).forEach(([
|
|
9578
|
+
Object.entries(u.attributes).forEach(([h, f]) => {
|
|
9579
9579
|
e.push({
|
|
9580
9580
|
type: d,
|
|
9581
|
-
name:
|
|
9581
|
+
name: h,
|
|
9582
9582
|
attribute: {
|
|
9583
9583
|
...s,
|
|
9584
|
-
...
|
|
9584
|
+
...f
|
|
9585
9585
|
}
|
|
9586
9586
|
});
|
|
9587
9587
|
});
|
|
@@ -9597,19 +9597,19 @@ function fo(r) {
|
|
|
9597
9597
|
return;
|
|
9598
9598
|
const c = a();
|
|
9599
9599
|
Object.entries(c).forEach(([u, d]) => {
|
|
9600
|
-
const
|
|
9600
|
+
const h = {
|
|
9601
9601
|
...s,
|
|
9602
9602
|
...d
|
|
9603
9603
|
};
|
|
9604
|
-
typeof (
|
|
9604
|
+
typeof (h == null ? void 0 : h.default) == "function" && (h.default = h.default()), h != null && h.isRequired && (h == null ? void 0 : h.default) === void 0 && delete h.default, e.push({
|
|
9605
9605
|
type: o.name,
|
|
9606
9606
|
name: u,
|
|
9607
|
-
attribute:
|
|
9607
|
+
attribute: h
|
|
9608
9608
|
});
|
|
9609
9609
|
});
|
|
9610
9610
|
}), e;
|
|
9611
9611
|
}
|
|
9612
|
-
function
|
|
9612
|
+
function L(r, e) {
|
|
9613
9613
|
if (typeof r == "string") {
|
|
9614
9614
|
if (!e.nodes[r])
|
|
9615
9615
|
throw Error(`There is no node type named '${r}'. Maybe you forgot to add the extension?`);
|
|
@@ -9631,11 +9631,11 @@ function Fc(...r) {
|
|
|
9631
9631
|
} else if (i === "style") {
|
|
9632
9632
|
const l = s ? s.split(";").map((u) => u.trim()).filter(Boolean) : [], a = n[i] ? n[i].split(";").map((u) => u.trim()).filter(Boolean) : [], c = /* @__PURE__ */ new Map();
|
|
9633
9633
|
a.forEach((u) => {
|
|
9634
|
-
const [d,
|
|
9635
|
-
c.set(d,
|
|
9634
|
+
const [d, h] = u.split(":").map((f) => f.trim());
|
|
9635
|
+
c.set(d, h);
|
|
9636
9636
|
}), l.forEach((u) => {
|
|
9637
|
-
const [d,
|
|
9638
|
-
c.set(d,
|
|
9637
|
+
const [d, h] = u.split(":").map((f) => f.trim());
|
|
9638
|
+
c.set(d, h);
|
|
9639
9639
|
}), n[i] = Array.from(c.entries()).map(([u, d]) => `${u}: ${d}`).join("; ");
|
|
9640
9640
|
} else
|
|
9641
9641
|
n[i] = s;
|
|
@@ -9647,11 +9647,11 @@ function Zn(r, e) {
|
|
|
9647
9647
|
[t.name]: r.attrs[t.name]
|
|
9648
9648
|
}).reduce((t, n) => Fc(t, n), {});
|
|
9649
9649
|
}
|
|
9650
|
-
function
|
|
9650
|
+
function fo(r) {
|
|
9651
9651
|
return typeof r == "function";
|
|
9652
9652
|
}
|
|
9653
9653
|
function N(r, e = void 0, ...t) {
|
|
9654
|
-
return
|
|
9654
|
+
return fo(r) ? e ? r.bind(e)(...t) : r(...t) : r;
|
|
9655
9655
|
}
|
|
9656
9656
|
function Lc(r = {}) {
|
|
9657
9657
|
return Object.keys(r).length === 0 && r.constructor === Object;
|
|
@@ -9685,20 +9685,20 @@ function Ni(r) {
|
|
|
9685
9685
|
}
|
|
9686
9686
|
function Vc(r, e) {
|
|
9687
9687
|
var t;
|
|
9688
|
-
const n =
|
|
9688
|
+
const n = ho(r), { nodeExtensions: i, markExtensions: s } = un(r), o = (t = i.find((c) => x(c, "topNode"))) === null || t === void 0 ? void 0 : t.name, l = Object.fromEntries(i.map((c) => {
|
|
9689
9689
|
const u = n.filter((y) => y.type === c.name), d = {
|
|
9690
9690
|
name: c.name,
|
|
9691
9691
|
options: c.options,
|
|
9692
9692
|
storage: c.storage,
|
|
9693
9693
|
editor: e
|
|
9694
|
-
},
|
|
9694
|
+
}, h = r.reduce((y, S) => {
|
|
9695
9695
|
const w = x(S, "extendNodeSchema", d);
|
|
9696
9696
|
return {
|
|
9697
9697
|
...y,
|
|
9698
9698
|
...w ? w(c) : {}
|
|
9699
9699
|
};
|
|
9700
|
-
}, {}),
|
|
9701
|
-
...
|
|
9700
|
+
}, {}), f = Ni({
|
|
9701
|
+
...h,
|
|
9702
9702
|
content: N(x(c, "content", d)),
|
|
9703
9703
|
marks: N(x(c, "marks", d)),
|
|
9704
9704
|
group: N(x(c, "group", d)),
|
|
@@ -9716,28 +9716,28 @@ function Vc(r, e) {
|
|
|
9716
9716
|
return [y.name, { default: (S = y == null ? void 0 : y.attribute) === null || S === void 0 ? void 0 : S.default }];
|
|
9717
9717
|
}))
|
|
9718
9718
|
}), p = N(x(c, "parseHTML", d));
|
|
9719
|
-
p && (
|
|
9719
|
+
p && (f.parseDOM = p.map((y) => Oi(y, u)));
|
|
9720
9720
|
const m = x(c, "renderHTML", d);
|
|
9721
|
-
m && (
|
|
9721
|
+
m && (f.toDOM = (y) => m({
|
|
9722
9722
|
node: y,
|
|
9723
9723
|
HTMLAttributes: Zn(y, u)
|
|
9724
9724
|
}));
|
|
9725
9725
|
const g = x(c, "renderText", d);
|
|
9726
|
-
return g && (
|
|
9726
|
+
return g && (f.toText = g), [c.name, f];
|
|
9727
9727
|
})), a = Object.fromEntries(s.map((c) => {
|
|
9728
9728
|
const u = n.filter((g) => g.type === c.name), d = {
|
|
9729
9729
|
name: c.name,
|
|
9730
9730
|
options: c.options,
|
|
9731
9731
|
storage: c.storage,
|
|
9732
9732
|
editor: e
|
|
9733
|
-
},
|
|
9733
|
+
}, h = r.reduce((g, y) => {
|
|
9734
9734
|
const S = x(y, "extendMarkSchema", d);
|
|
9735
9735
|
return {
|
|
9736
9736
|
...g,
|
|
9737
9737
|
...S ? S(c) : {}
|
|
9738
9738
|
};
|
|
9739
|
-
}, {}),
|
|
9740
|
-
...
|
|
9739
|
+
}, {}), f = Ni({
|
|
9740
|
+
...h,
|
|
9741
9741
|
inclusive: N(x(c, "inclusive", d)),
|
|
9742
9742
|
excludes: N(x(c, "excludes", d)),
|
|
9743
9743
|
group: N(x(c, "group", d)),
|
|
@@ -9748,12 +9748,12 @@ function Vc(r, e) {
|
|
|
9748
9748
|
return [g.name, { default: (y = g == null ? void 0 : g.attribute) === null || y === void 0 ? void 0 : y.default }];
|
|
9749
9749
|
}))
|
|
9750
9750
|
}), p = N(x(c, "parseHTML", d));
|
|
9751
|
-
p && (
|
|
9751
|
+
p && (f.parseDOM = p.map((g) => Oi(g, u)));
|
|
9752
9752
|
const m = x(c, "renderHTML", d);
|
|
9753
|
-
return m && (
|
|
9753
|
+
return m && (f.toDOM = (g) => m({
|
|
9754
9754
|
mark: g,
|
|
9755
9755
|
HTMLAttributes: Zn(g, u)
|
|
9756
|
-
})), [c.name,
|
|
9756
|
+
})), [c.name, f];
|
|
9757
9757
|
}));
|
|
9758
9758
|
return new ts({
|
|
9759
9759
|
topNode: o,
|
|
@@ -9805,31 +9805,31 @@ function vt(r) {
|
|
|
9805
9805
|
const c = a.state.doc.resolve(n);
|
|
9806
9806
|
if (
|
|
9807
9807
|
// check for code node
|
|
9808
|
-
c.parent.type.spec.code || !((e = c.nodeBefore || c.nodeAfter) === null || e === void 0) && e.marks.find((
|
|
9808
|
+
c.parent.type.spec.code || !((e = c.nodeBefore || c.nodeAfter) === null || e === void 0) && e.marks.find((h) => h.type.spec.code)
|
|
9809
9809
|
)
|
|
9810
9810
|
return !1;
|
|
9811
9811
|
let u = !1;
|
|
9812
9812
|
const d = jc(c) + s;
|
|
9813
|
-
return o.forEach((
|
|
9813
|
+
return o.forEach((h) => {
|
|
9814
9814
|
if (u)
|
|
9815
9815
|
return;
|
|
9816
|
-
const
|
|
9817
|
-
if (!
|
|
9816
|
+
const f = Wc(d, h.find);
|
|
9817
|
+
if (!f)
|
|
9818
9818
|
return;
|
|
9819
9819
|
const p = a.state.tr, m = an({
|
|
9820
9820
|
state: a.state,
|
|
9821
9821
|
transaction: p
|
|
9822
9822
|
}), g = {
|
|
9823
|
-
from: n - (
|
|
9823
|
+
from: n - (f[0].length - s.length),
|
|
9824
9824
|
to: i
|
|
9825
9825
|
}, { commands: y, chain: S, can: w } = new cn({
|
|
9826
9826
|
editor: t,
|
|
9827
9827
|
state: m
|
|
9828
9828
|
});
|
|
9829
|
-
|
|
9829
|
+
h.handler({
|
|
9830
9830
|
state: m,
|
|
9831
9831
|
range: g,
|
|
9832
|
-
match:
|
|
9832
|
+
match: f,
|
|
9833
9833
|
commands: y,
|
|
9834
9834
|
chain: S,
|
|
9835
9835
|
can: w
|
|
@@ -9855,11 +9855,11 @@ function Hc(r) {
|
|
|
9855
9855
|
return !!a && setTimeout(() => {
|
|
9856
9856
|
let { text: u } = a;
|
|
9857
9857
|
typeof u == "string" ? u = u : u = Sr(b.from(u), o.schema);
|
|
9858
|
-
const { from: d } = a,
|
|
9858
|
+
const { from: d } = a, h = d + u.length;
|
|
9859
9859
|
vt({
|
|
9860
9860
|
editor: e,
|
|
9861
9861
|
from: d,
|
|
9862
|
-
to:
|
|
9862
|
+
to: h,
|
|
9863
9863
|
text: u,
|
|
9864
9864
|
rules: t,
|
|
9865
9865
|
plugin: n
|
|
@@ -9988,17 +9988,17 @@ function Uc(r) {
|
|
|
9988
9988
|
editor: e,
|
|
9989
9989
|
state: t
|
|
9990
9990
|
}), d = [];
|
|
9991
|
-
return t.doc.nodesBetween(n, i, (
|
|
9992
|
-
if (!
|
|
9991
|
+
return t.doc.nodesBetween(n, i, (f, p) => {
|
|
9992
|
+
if (!f.isTextblock || f.type.spec.code)
|
|
9993
9993
|
return;
|
|
9994
|
-
const m = Math.max(n, p), g = Math.min(i, p +
|
|
9994
|
+
const m = Math.max(n, p), g = Math.min(i, p + f.content.size), y = f.textBetween(m - p, g - p, void 0, "");
|
|
9995
9995
|
Kc(y, s.find, o).forEach((w) => {
|
|
9996
9996
|
if (w.index === void 0)
|
|
9997
9997
|
return;
|
|
9998
9998
|
const v = m + w.index + 1, A = v + w[0].length, M = {
|
|
9999
9999
|
from: t.tr.mapping.map(v),
|
|
10000
10000
|
to: t.tr.mapping.map(A)
|
|
10001
|
-
},
|
|
10001
|
+
}, I = s.handler({
|
|
10002
10002
|
state: t,
|
|
10003
10003
|
range: M,
|
|
10004
10004
|
match: w,
|
|
@@ -10008,9 +10008,9 @@ function Uc(r) {
|
|
|
10008
10008
|
pasteEvent: o,
|
|
10009
10009
|
dropEvent: l
|
|
10010
10010
|
});
|
|
10011
|
-
d.push(
|
|
10011
|
+
d.push(I);
|
|
10012
10012
|
});
|
|
10013
|
-
}), d.every((
|
|
10013
|
+
}), d.every((f) => f !== null);
|
|
10014
10014
|
}
|
|
10015
10015
|
let It = null;
|
|
10016
10016
|
const _c = (r) => {
|
|
@@ -10028,7 +10028,7 @@ function Gc(r) {
|
|
|
10028
10028
|
} catch {
|
|
10029
10029
|
l = null;
|
|
10030
10030
|
}
|
|
10031
|
-
const a = ({ state: u, from: d, to:
|
|
10031
|
+
const a = ({ state: u, from: d, to: h, rule: f, pasteEvt: p }) => {
|
|
10032
10032
|
const m = u.tr, g = an({
|
|
10033
10033
|
state: u,
|
|
10034
10034
|
transaction: m
|
|
@@ -10037,8 +10037,8 @@ function Gc(r) {
|
|
|
10037
10037
|
editor: e,
|
|
10038
10038
|
state: g,
|
|
10039
10039
|
from: Math.max(d - 1, 0),
|
|
10040
|
-
to:
|
|
10041
|
-
rule:
|
|
10040
|
+
to: h.b - 1,
|
|
10041
|
+
rule: f,
|
|
10042
10042
|
pasteEvent: p,
|
|
10043
10043
|
dropEvent: l
|
|
10044
10044
|
}) || !m.steps.length)) {
|
|
@@ -10053,58 +10053,58 @@ function Gc(r) {
|
|
|
10053
10053
|
return t.map((u) => new Q({
|
|
10054
10054
|
// we register a global drag handler to track the current drag source element
|
|
10055
10055
|
view(d) {
|
|
10056
|
-
const
|
|
10056
|
+
const h = (p) => {
|
|
10057
10057
|
var m;
|
|
10058
10058
|
n = !((m = d.dom.parentElement) === null || m === void 0) && m.contains(p.target) ? d.dom.parentElement : null, n && (It = e);
|
|
10059
|
-
},
|
|
10059
|
+
}, f = () => {
|
|
10060
10060
|
It && (It = null);
|
|
10061
10061
|
};
|
|
10062
|
-
return window.addEventListener("dragstart",
|
|
10062
|
+
return window.addEventListener("dragstart", h), window.addEventListener("dragend", f), {
|
|
10063
10063
|
destroy() {
|
|
10064
|
-
window.removeEventListener("dragstart",
|
|
10064
|
+
window.removeEventListener("dragstart", h), window.removeEventListener("dragend", f);
|
|
10065
10065
|
}
|
|
10066
10066
|
};
|
|
10067
10067
|
},
|
|
10068
10068
|
props: {
|
|
10069
10069
|
handleDOMEvents: {
|
|
10070
|
-
drop: (d,
|
|
10071
|
-
if (s = n === d.dom.parentElement, l =
|
|
10072
|
-
const
|
|
10073
|
-
|
|
10074
|
-
const p =
|
|
10075
|
-
p &&
|
|
10070
|
+
drop: (d, h) => {
|
|
10071
|
+
if (s = n === d.dom.parentElement, l = h, !s) {
|
|
10072
|
+
const f = It;
|
|
10073
|
+
f && setTimeout(() => {
|
|
10074
|
+
const p = f.state.selection;
|
|
10075
|
+
p && f.commands.deleteRange({ from: p.from, to: p.to });
|
|
10076
10076
|
}, 10);
|
|
10077
10077
|
}
|
|
10078
10078
|
return !1;
|
|
10079
10079
|
},
|
|
10080
|
-
paste: (d,
|
|
10081
|
-
var
|
|
10082
|
-
const p = (
|
|
10083
|
-
return o =
|
|
10080
|
+
paste: (d, h) => {
|
|
10081
|
+
var f;
|
|
10082
|
+
const p = (f = h.clipboardData) === null || f === void 0 ? void 0 : f.getData("text/html");
|
|
10083
|
+
return o = h, i = !!(p != null && p.includes("data-pm-slice")), !1;
|
|
10084
10084
|
}
|
|
10085
10085
|
}
|
|
10086
10086
|
},
|
|
10087
|
-
appendTransaction: (d,
|
|
10087
|
+
appendTransaction: (d, h, f) => {
|
|
10088
10088
|
const p = d[0], m = p.getMeta("uiEvent") === "paste" && !i, g = p.getMeta("uiEvent") === "drop" && !s, y = p.getMeta("applyPasteRules"), S = !!y;
|
|
10089
10089
|
if (!m && !g && !S)
|
|
10090
10090
|
return;
|
|
10091
10091
|
if (S) {
|
|
10092
10092
|
let { text: A } = y;
|
|
10093
|
-
typeof A == "string" ? A = A : A = Sr(b.from(A),
|
|
10094
|
-
const { from: M } = y,
|
|
10093
|
+
typeof A == "string" ? A = A : A = Sr(b.from(A), f.schema);
|
|
10094
|
+
const { from: M } = y, I = M + A.length, W = _c(A);
|
|
10095
10095
|
return a({
|
|
10096
10096
|
rule: u,
|
|
10097
|
-
state:
|
|
10097
|
+
state: f,
|
|
10098
10098
|
from: M,
|
|
10099
|
-
to: { b:
|
|
10100
|
-
pasteEvt:
|
|
10099
|
+
to: { b: I },
|
|
10100
|
+
pasteEvt: W
|
|
10101
10101
|
});
|
|
10102
10102
|
}
|
|
10103
|
-
const w =
|
|
10103
|
+
const w = h.doc.content.findDiffStart(f.doc.content), v = h.doc.content.findDiffEnd(f.doc.content);
|
|
10104
10104
|
if (!(!qc(w) || !v || w === v.b))
|
|
10105
10105
|
return a({
|
|
10106
10106
|
rule: u,
|
|
10107
|
-
state:
|
|
10107
|
+
state: f,
|
|
10108
10108
|
from: w,
|
|
10109
10109
|
to: v,
|
|
10110
10110
|
pasteEvt: o
|
|
@@ -10195,10 +10195,10 @@ class Xe {
|
|
|
10195
10195
|
}
|
|
10196
10196
|
const d = pc(u);
|
|
10197
10197
|
a.push(d);
|
|
10198
|
-
const
|
|
10199
|
-
Ai(o, e.options.enableInputRules) &&
|
|
10200
|
-
const
|
|
10201
|
-
Ai(o, e.options.enablePasteRules) &&
|
|
10198
|
+
const h = x(o, "addInputRules", l);
|
|
10199
|
+
Ai(o, e.options.enableInputRules) && h && n.push(...h());
|
|
10200
|
+
const f = x(o, "addPasteRules", l);
|
|
10201
|
+
Ai(o, e.options.enablePasteRules) && f && i.push(...f());
|
|
10202
10202
|
const p = x(o, "addProseMirrorPlugins", l);
|
|
10203
10203
|
if (p) {
|
|
10204
10204
|
const m = p();
|
|
@@ -10223,7 +10223,7 @@ class Xe {
|
|
|
10223
10223
|
* @returns An array of attributes
|
|
10224
10224
|
*/
|
|
10225
10225
|
get attributes() {
|
|
10226
|
-
return
|
|
10226
|
+
return ho(this.extensions);
|
|
10227
10227
|
}
|
|
10228
10228
|
/**
|
|
10229
10229
|
* Get all node views from the extensions.
|
|
@@ -10237,23 +10237,23 @@ class Xe {
|
|
|
10237
10237
|
options: n.options,
|
|
10238
10238
|
storage: n.storage,
|
|
10239
10239
|
editor: e,
|
|
10240
|
-
type:
|
|
10240
|
+
type: L(n.name, this.schema)
|
|
10241
10241
|
}, o = x(n, "addNodeView", s);
|
|
10242
10242
|
if (!o)
|
|
10243
10243
|
return [];
|
|
10244
|
-
const l = (a, c, u, d,
|
|
10245
|
-
const
|
|
10244
|
+
const l = (a, c, u, d, h) => {
|
|
10245
|
+
const f = Zn(a, i);
|
|
10246
10246
|
return o()({
|
|
10247
10247
|
// pass-through
|
|
10248
10248
|
node: a,
|
|
10249
10249
|
view: c,
|
|
10250
10250
|
getPos: u,
|
|
10251
10251
|
decorations: d,
|
|
10252
|
-
innerDecorations:
|
|
10252
|
+
innerDecorations: h,
|
|
10253
10253
|
// tiptap-specific
|
|
10254
10254
|
editor: e,
|
|
10255
10255
|
extension: n,
|
|
10256
|
-
HTMLAttributes:
|
|
10256
|
+
HTMLAttributes: f
|
|
10257
10257
|
});
|
|
10258
10258
|
};
|
|
10259
10259
|
return [n.name, l];
|
|
@@ -10321,18 +10321,18 @@ function po(r, e, t) {
|
|
|
10321
10321
|
`, textSerializers: o = {} } = t || {};
|
|
10322
10322
|
let l = "";
|
|
10323
10323
|
return r.nodesBetween(n, i, (a, c, u, d) => {
|
|
10324
|
-
var
|
|
10324
|
+
var h;
|
|
10325
10325
|
a.isBlock && c > n && (l += s);
|
|
10326
|
-
const
|
|
10327
|
-
if (
|
|
10328
|
-
return u && (l +=
|
|
10326
|
+
const f = o == null ? void 0 : o[a.type.name];
|
|
10327
|
+
if (f)
|
|
10328
|
+
return u && (l += f({
|
|
10329
10329
|
node: a,
|
|
10330
10330
|
pos: c,
|
|
10331
10331
|
parent: u,
|
|
10332
10332
|
index: d,
|
|
10333
10333
|
range: e
|
|
10334
10334
|
})), !1;
|
|
10335
|
-
a.isText && (l += (
|
|
10335
|
+
a.isText && (l += (h = a == null ? void 0 : a.text) === null || h === void 0 ? void 0 : h.slice(Math.max(n, c) - c, i - c));
|
|
10336
10336
|
}), l;
|
|
10337
10337
|
}
|
|
10338
10338
|
function mo(r) {
|
|
@@ -10348,7 +10348,7 @@ const Xc = Y.create({
|
|
|
10348
10348
|
addProseMirrorPlugins() {
|
|
10349
10349
|
return [
|
|
10350
10350
|
new Q({
|
|
10351
|
-
key: new
|
|
10351
|
+
key: new le("clipboardTextSerializer"),
|
|
10352
10352
|
props: {
|
|
10353
10353
|
clipboardTextSerializer: () => {
|
|
10354
10354
|
const { editor: r } = this, { state: e, schema: t } = r, { doc: n, selection: i } = e, { ranges: s } = i, o = Math.min(...s.map((u) => u.$from.pos)), l = Math.max(...s.map((u) => u.$to.pos)), a = mo(t);
|
|
@@ -10370,22 +10370,22 @@ const Xc = Y.create({
|
|
|
10370
10370
|
r.doc.nodesBetween(s.pos, o.pos, (l, a) => {
|
|
10371
10371
|
if (l.type.isText)
|
|
10372
10372
|
return;
|
|
10373
|
-
const { doc: c, mapping: u } = e, d = c.resolve(u.map(a)),
|
|
10374
|
-
if (!
|
|
10373
|
+
const { doc: c, mapping: u } = e, d = c.resolve(u.map(a)), h = c.resolve(u.map(a + l.nodeSize)), f = d.blockRange(h);
|
|
10374
|
+
if (!f)
|
|
10375
10375
|
return;
|
|
10376
|
-
const p = st(
|
|
10376
|
+
const p = st(f);
|
|
10377
10377
|
if (l.type.isTextblock) {
|
|
10378
10378
|
const { defaultType: m } = d.parent.contentMatchAt(d.index());
|
|
10379
|
-
e.setNodeMarkup(
|
|
10379
|
+
e.setNodeMarkup(f.start, m);
|
|
10380
10380
|
}
|
|
10381
|
-
(p || p === 0) && e.lift(
|
|
10381
|
+
(p || p === 0) && e.lift(f, p);
|
|
10382
10382
|
});
|
|
10383
10383
|
}), !0;
|
|
10384
10384
|
}, tu = (r) => (e) => r(e), nu = () => ({ state: r, dispatch: e }) => lo(r, e), ru = (r, e) => ({ editor: t, tr: n }) => {
|
|
10385
10385
|
const { state: i } = t, s = i.doc.slice(r.from, r.to);
|
|
10386
10386
|
n.deleteRange(r.from, r.to);
|
|
10387
10387
|
const o = n.mapping.map(e);
|
|
10388
|
-
return n.insert(o, s.content), n.setSelection(new
|
|
10388
|
+
return n.insert(o, s.content), n.setSelection(new T(n.doc.resolve(o - 1))), !0;
|
|
10389
10389
|
}, iu = () => ({ tr: r, dispatch: e }) => {
|
|
10390
10390
|
const { selection: t } = r, n = t.$anchor.node();
|
|
10391
10391
|
if (n.content.size > 0)
|
|
@@ -10401,7 +10401,7 @@ const Xc = Y.create({
|
|
|
10401
10401
|
}
|
|
10402
10402
|
return !1;
|
|
10403
10403
|
}, su = (r) => ({ tr: e, state: t, dispatch: n }) => {
|
|
10404
|
-
const i =
|
|
10404
|
+
const i = L(r, t.schema), s = e.selection.$anchor;
|
|
10405
10405
|
for (let o = s.depth; o > 0; o -= 1)
|
|
10406
10406
|
if (s.node(o).type === i) {
|
|
10407
10407
|
if (n) {
|
|
@@ -10459,8 +10459,8 @@ const uu = (r, e = {}) => ({ tr: t, state: n, dispatch: i }) => {
|
|
|
10459
10459
|
if (i) {
|
|
10460
10460
|
const d = wr(a, s, e);
|
|
10461
10461
|
if (d && d.from <= c && d.to >= u) {
|
|
10462
|
-
const
|
|
10463
|
-
t.setSelection(
|
|
10462
|
+
const h = T.create(o, d.from, d.to);
|
|
10463
|
+
t.setSelection(h);
|
|
10464
10464
|
}
|
|
10465
10465
|
}
|
|
10466
10466
|
return !0;
|
|
@@ -10472,7 +10472,7 @@ const uu = (r, e = {}) => ({ tr: t, state: n, dispatch: i }) => {
|
|
|
10472
10472
|
return !1;
|
|
10473
10473
|
};
|
|
10474
10474
|
function yo(r) {
|
|
10475
|
-
return r instanceof
|
|
10475
|
+
return r instanceof T;
|
|
10476
10476
|
}
|
|
10477
10477
|
function Be(r = 0, e = 0, t = 0) {
|
|
10478
10478
|
return Math.min(Math.max(r, e), t);
|
|
@@ -10486,9 +10486,9 @@ function bo(r, e = null) {
|
|
|
10486
10486
|
if (e === "end")
|
|
10487
10487
|
return n;
|
|
10488
10488
|
const i = t.from, s = n.to;
|
|
10489
|
-
return e === "all" ?
|
|
10489
|
+
return e === "all" ? T.create(r, Be(0, i, s), Be(r.content.size, i, s)) : T.create(r, Be(e, i, s), Be(e, i, s));
|
|
10490
10490
|
}
|
|
10491
|
-
function
|
|
10491
|
+
function hu() {
|
|
10492
10492
|
return navigator.platform === "Android" || /android/i.test(navigator.userAgent);
|
|
10493
10493
|
}
|
|
10494
10494
|
function Mr() {
|
|
@@ -10501,13 +10501,13 @@ function Mr() {
|
|
|
10501
10501
|
"iPod"
|
|
10502
10502
|
].includes(navigator.platform) || navigator.userAgent.includes("Mac") && "ontouchend" in document;
|
|
10503
10503
|
}
|
|
10504
|
-
const
|
|
10504
|
+
const fu = (r = null, e = {}) => ({ editor: t, view: n, tr: i, dispatch: s }) => {
|
|
10505
10505
|
e = {
|
|
10506
10506
|
scrollIntoView: !0,
|
|
10507
10507
|
...e
|
|
10508
10508
|
};
|
|
10509
10509
|
const o = () => {
|
|
10510
|
-
(Mr() ||
|
|
10510
|
+
(Mr() || hu()) && n.dom.focus(), requestAnimationFrame(() => {
|
|
10511
10511
|
t.isDestroyed || (n.focus(), e != null && e.scrollIntoView && t.commands.scrollIntoView());
|
|
10512
10512
|
});
|
|
10513
10513
|
};
|
|
@@ -10583,7 +10583,7 @@ function gu(r, e, t) {
|
|
|
10583
10583
|
if (n < e)
|
|
10584
10584
|
return;
|
|
10585
10585
|
const i = r.steps[n];
|
|
10586
|
-
if (!(i instanceof
|
|
10586
|
+
if (!(i instanceof P || i instanceof z))
|
|
10587
10587
|
return;
|
|
10588
10588
|
const s = r.mapping.maps[n];
|
|
10589
10589
|
let o = 0;
|
|
@@ -10626,20 +10626,20 @@ const yu = (r) => !("type" in r), bu = (r, e, t) => ({ tr: n, dispatch: i, edito
|
|
|
10626
10626
|
const { parent: p } = n.doc.resolve(a);
|
|
10627
10627
|
p.isTextblock && !p.type.spec.code && !p.childCount && (a -= 1, c += 1);
|
|
10628
10628
|
}
|
|
10629
|
-
let
|
|
10629
|
+
let f;
|
|
10630
10630
|
if (u) {
|
|
10631
10631
|
if (Array.isArray(e))
|
|
10632
|
-
|
|
10632
|
+
f = e.map((p) => p.text || "").join("");
|
|
10633
10633
|
else if (e instanceof b) {
|
|
10634
10634
|
let p = "";
|
|
10635
10635
|
e.forEach((m) => {
|
|
10636
10636
|
m.text && (p += m.text);
|
|
10637
|
-
}),
|
|
10638
|
-
} else typeof e == "object" && e && e.text ?
|
|
10639
|
-
n.insertText(
|
|
10637
|
+
}), f = p;
|
|
10638
|
+
} else typeof e == "object" && e && e.text ? f = e.text : f = e;
|
|
10639
|
+
n.insertText(f, a, c);
|
|
10640
10640
|
} else
|
|
10641
|
-
|
|
10642
|
-
t.updateSelection && gu(n, n.steps.length - 1, -1), t.applyInputRules && n.setMeta("applyInputRules", { from: a, text:
|
|
10641
|
+
f = l, n.replaceWith(a, c, f);
|
|
10642
|
+
t.updateSelection && gu(n, n.steps.length - 1, -1), t.applyInputRules && n.setMeta("applyInputRules", { from: a, text: f }), t.applyPasteRules && n.setMeta("applyPasteRules", { from: a, text: f });
|
|
10643
10643
|
}
|
|
10644
10644
|
return !0;
|
|
10645
10645
|
}, ku = () => ({ state: r, dispatch: e }) => bc(r, e), xu = () => ({ state: r, dispatch: e }) => kc(r, e), Su = () => ({ state: r, dispatch: e }) => eo(r, e), Cu = () => ({ state: r, dispatch: e }) => io(r, e), wu = () => ({ state: r, dispatch: e, tr: t }) => {
|
|
@@ -10700,28 +10700,28 @@ const Nu = (r) => ({ editor: e, view: t, tr: n, dispatch: i }) => {
|
|
|
10700
10700
|
}), !0;
|
|
10701
10701
|
};
|
|
10702
10702
|
function Ct(r, e, t = {}) {
|
|
10703
|
-
const { from: n, to: i, empty: s } = r.selection, o = e ?
|
|
10704
|
-
r.doc.nodesBetween(n, i, (d,
|
|
10703
|
+
const { from: n, to: i, empty: s } = r.selection, o = e ? L(e, r.schema) : null, l = [];
|
|
10704
|
+
r.doc.nodesBetween(n, i, (d, h) => {
|
|
10705
10705
|
if (d.isText)
|
|
10706
10706
|
return;
|
|
10707
|
-
const
|
|
10707
|
+
const f = Math.max(n, h), p = Math.min(i, h + d.nodeSize);
|
|
10708
10708
|
l.push({
|
|
10709
10709
|
node: d,
|
|
10710
|
-
from:
|
|
10710
|
+
from: f,
|
|
10711
10711
|
to: p
|
|
10712
10712
|
});
|
|
10713
10713
|
});
|
|
10714
10714
|
const a = i - n, c = l.filter((d) => o ? o.name === d.node.type.name : !0).filter((d) => Xt(d.node.attrs, t, { strict: !1 }));
|
|
10715
|
-
return s ? !!c.length : c.reduce((d,
|
|
10715
|
+
return s ? !!c.length : c.reduce((d, h) => d + h.to - h.from, 0) >= a;
|
|
10716
10716
|
}
|
|
10717
10717
|
const Au = (r, e = {}) => ({ state: t, dispatch: n }) => {
|
|
10718
|
-
const i =
|
|
10718
|
+
const i = L(r, t.schema);
|
|
10719
10719
|
return Ct(t, i, e) ? xc(t, n) : !1;
|
|
10720
10720
|
}, vu = () => ({ state: r, dispatch: e }) => ao(r, e), Du = (r) => ({ state: e, dispatch: t }) => {
|
|
10721
|
-
const n =
|
|
10721
|
+
const n = L(r, e.schema);
|
|
10722
10722
|
return Ic(n)(e, t);
|
|
10723
10723
|
}, Iu = () => ({ state: r, dispatch: e }) => oo(r, e);
|
|
10724
|
-
function
|
|
10724
|
+
function hn(r, e) {
|
|
10725
10725
|
return e.nodes[r] ? "node" : e.marks[r] ? "mark" : null;
|
|
10726
10726
|
}
|
|
10727
10727
|
function Di(r, e) {
|
|
@@ -10730,8 +10730,8 @@ function Di(r, e) {
|
|
|
10730
10730
|
}
|
|
10731
10731
|
const Pu = (r, e) => ({ tr: t, state: n, dispatch: i }) => {
|
|
10732
10732
|
let s = null, o = null;
|
|
10733
|
-
const l =
|
|
10734
|
-
return l ? (l === "node" && (s =
|
|
10733
|
+
const l = hn(typeof r == "string" ? r : r.name, n.schema);
|
|
10734
|
+
return l ? (l === "node" && (s = L(r, n.schema)), l === "mark" && (o = ve(r, n.schema)), i && t.selection.ranges.forEach((a) => {
|
|
10735
10735
|
n.doc.nodesBetween(a.$from.pos, a.$to.pos, (c, u) => {
|
|
10736
10736
|
s && s === c.type && t.setNodeMarkup(u, void 0, Di(c.attrs, e)), o && c.marks.length && c.marks.forEach((d) => {
|
|
10737
10737
|
o === d.type && t.addMark(u, u + c.nodeSize, o.create(Di(d.attrs, e)));
|
|
@@ -10805,7 +10805,7 @@ function Hu(r, e) {
|
|
|
10805
10805
|
return po(r, t, e);
|
|
10806
10806
|
}
|
|
10807
10807
|
function Ju(r, e) {
|
|
10808
|
-
const t =
|
|
10808
|
+
const t = L(e, r.schema), { from: n, to: i } = r.selection, s = [];
|
|
10809
10809
|
r.doc.nodesBetween(n, i, (l) => {
|
|
10810
10810
|
s.push(l);
|
|
10811
10811
|
});
|
|
@@ -10813,7 +10813,7 @@ function Ju(r, e) {
|
|
|
10813
10813
|
return o ? { ...o.attrs } : {};
|
|
10814
10814
|
}
|
|
10815
10815
|
function qu(r, e) {
|
|
10816
|
-
const t =
|
|
10816
|
+
const t = hn(typeof e == "string" ? e : e.name, r.schema);
|
|
10817
10817
|
return t === "node" ? Ju(r, e) : t === "mark" ? So(r, e) : {};
|
|
10818
10818
|
}
|
|
10819
10819
|
function Ft(r, e, t) {
|
|
@@ -10828,12 +10828,12 @@ function er(r, e, t = {}) {
|
|
|
10828
10828
|
return !!(r.storedMarks || r.selection.$from.marks()).filter((d) => s ? s.name === d.type.name : !0).find((d) => Xt(d.attrs, t, { strict: !1 }));
|
|
10829
10829
|
let o = 0;
|
|
10830
10830
|
const l = [];
|
|
10831
|
-
if (i.forEach(({ $from: d, $to:
|
|
10832
|
-
const
|
|
10833
|
-
r.doc.nodesBetween(
|
|
10831
|
+
if (i.forEach(({ $from: d, $to: h }) => {
|
|
10832
|
+
const f = d.pos, p = h.pos;
|
|
10833
|
+
r.doc.nodesBetween(f, p, (m, g) => {
|
|
10834
10834
|
if (!m.isText && !m.marks.length)
|
|
10835
10835
|
return;
|
|
10836
|
-
const y = Math.max(
|
|
10836
|
+
const y = Math.max(f, g), S = Math.min(p, g + m.nodeSize), w = S - y;
|
|
10837
10837
|
o += w, l.push(...m.marks.map((v) => ({
|
|
10838
10838
|
mark: v,
|
|
10839
10839
|
from: y,
|
|
@@ -10842,13 +10842,13 @@ function er(r, e, t = {}) {
|
|
|
10842
10842
|
});
|
|
10843
10843
|
}), o === 0)
|
|
10844
10844
|
return !1;
|
|
10845
|
-
const a = l.filter((d) => s ? s.name === d.mark.type.name : !0).filter((d) => Xt(d.mark.attrs, t, { strict: !1 })).reduce((d,
|
|
10845
|
+
const a = l.filter((d) => s ? s.name === d.mark.type.name : !0).filter((d) => Xt(d.mark.attrs, t, { strict: !1 })).reduce((d, h) => d + h.to - h.from, 0), c = l.filter((d) => s ? d.mark.type !== s && d.mark.type.excludes(s) : !0).reduce((d, h) => d + h.to - h.from, 0);
|
|
10846
10846
|
return (a > 0 ? a + c : a) >= o;
|
|
10847
10847
|
}
|
|
10848
10848
|
function Ku(r, e, t = {}) {
|
|
10849
10849
|
if (!e)
|
|
10850
10850
|
return Ct(r, null, t) || er(r, null, t);
|
|
10851
|
-
const n =
|
|
10851
|
+
const n = hn(e, r.schema);
|
|
10852
10852
|
return n === "node" ? Ct(r, e, t) : n === "mark" ? er(r, e, t) : !1;
|
|
10853
10853
|
}
|
|
10854
10854
|
function Ii(r, e) {
|
|
@@ -10862,7 +10862,7 @@ function Ii(r, e) {
|
|
|
10862
10862
|
}, s = N(x(n, "group", i));
|
|
10863
10863
|
return typeof s != "string" ? !1 : s.split(" ").includes("list");
|
|
10864
10864
|
}
|
|
10865
|
-
function
|
|
10865
|
+
function fn(r, { checkChildren: e = !0, ignoreWhitespace: t = !1 } = {}) {
|
|
10866
10866
|
var n;
|
|
10867
10867
|
if (t) {
|
|
10868
10868
|
if (r.type.name === "hardBreak")
|
|
@@ -10879,7 +10879,7 @@ function hn(r, { checkChildren: e = !0, ignoreWhitespace: t = !1 } = {}) {
|
|
|
10879
10879
|
if (e) {
|
|
10880
10880
|
let i = !0;
|
|
10881
10881
|
return r.content.forEach((s) => {
|
|
10882
|
-
i !== !1 && (
|
|
10882
|
+
i !== !1 && (fn(s, { ignoreWhitespace: t, checkChildren: e }) || (i = !1));
|
|
10883
10883
|
}), i;
|
|
10884
10884
|
}
|
|
10885
10885
|
return !1;
|
|
@@ -10895,12 +10895,12 @@ function Uu(r, e, t) {
|
|
|
10895
10895
|
const { ranges: o } = i;
|
|
10896
10896
|
return o.some(({ $from: l, $to: a }) => {
|
|
10897
10897
|
let c = l.depth === 0 ? r.doc.inlineContent && r.doc.type.allowsMarkType(t) : !1;
|
|
10898
|
-
return r.doc.nodesBetween(l.pos, a.pos, (u, d,
|
|
10898
|
+
return r.doc.nodesBetween(l.pos, a.pos, (u, d, h) => {
|
|
10899
10899
|
if (c)
|
|
10900
10900
|
return !1;
|
|
10901
10901
|
if (u.isInline) {
|
|
10902
|
-
const
|
|
10903
|
-
c =
|
|
10902
|
+
const f = !h || h.type.allowsMarkType(t), p = !!t.isInSet(u.marks) || !u.marks.some((m) => m.type.excludes(t));
|
|
10903
|
+
c = f && p;
|
|
10904
10904
|
}
|
|
10905
10905
|
return !c;
|
|
10906
10906
|
}), c;
|
|
@@ -10918,9 +10918,9 @@ const _u = (r, e = {}) => ({ tr: t, state: n, dispatch: i }) => {
|
|
|
10918
10918
|
} else
|
|
10919
10919
|
l.forEach((c) => {
|
|
10920
10920
|
const u = c.$from.pos, d = c.$to.pos;
|
|
10921
|
-
n.doc.nodesBetween(u, d, (
|
|
10922
|
-
const p = Math.max(
|
|
10923
|
-
|
|
10921
|
+
n.doc.nodesBetween(u, d, (h, f) => {
|
|
10922
|
+
const p = Math.max(f, u), m = Math.min(f + h.nodeSize, d);
|
|
10923
|
+
h.marks.find((y) => y.type === a) ? h.marks.forEach((y) => {
|
|
10924
10924
|
a === y.type && t.addMark(p, m, a.create({
|
|
10925
10925
|
...y.attrs,
|
|
10926
10926
|
...e
|
|
@@ -10930,7 +10930,7 @@ const _u = (r, e = {}) => ({ tr: t, state: n, dispatch: i }) => {
|
|
|
10930
10930
|
});
|
|
10931
10931
|
return Uu(n, t, a);
|
|
10932
10932
|
}, Gu = (r, e) => ({ tr: t }) => (t.setMeta(r, e), !0), Yu = (r, e = {}) => ({ state: t, dispatch: n, chain: i }) => {
|
|
10933
|
-
const s =
|
|
10933
|
+
const s = L(r, t.schema);
|
|
10934
10934
|
let o;
|
|
10935
10935
|
return t.selection.$anchor.sameParent(t.selection.$head) && (o = t.selection.$anchor.parent.attrs), s.isTextblock ? i().command(({ commands: l }) => Ti(s, { ...o, ...e })(t) ? !0 : l.clearNodes()).command(({ state: l }) => Ti(s, { ...o, ...e })(l, n)).run() : (console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'), !1);
|
|
10936
10936
|
}, Xu = (r) => ({ tr: e, dispatch: t }) => {
|
|
@@ -10941,12 +10941,12 @@ const _u = (r, e = {}) => ({ tr: t, state: n, dispatch: i }) => {
|
|
|
10941
10941
|
return !0;
|
|
10942
10942
|
}, Zu = (r) => ({ tr: e, dispatch: t }) => {
|
|
10943
10943
|
if (t) {
|
|
10944
|
-
const { doc: n } = e, { from: i, to: s } = typeof r == "number" ? { from: r, to: r } : r, o =
|
|
10944
|
+
const { doc: n } = e, { from: i, to: s } = typeof r == "number" ? { from: r, to: r } : r, o = T.atStart(n).from, l = T.atEnd(n).to, a = Be(i, o, l), c = Be(s, o, l), u = T.create(n, a, c);
|
|
10945
10945
|
e.setSelection(u);
|
|
10946
10946
|
}
|
|
10947
10947
|
return !0;
|
|
10948
10948
|
}, Qu = (r) => ({ state: e, dispatch: t }) => {
|
|
10949
|
-
const n =
|
|
10949
|
+
const n = L(r, e.schema);
|
|
10950
10950
|
return Bc(n)(e, t);
|
|
10951
10951
|
};
|
|
10952
10952
|
function Pi(r, e) {
|
|
@@ -10959,75 +10959,75 @@ function Pi(r, e) {
|
|
|
10959
10959
|
const ed = ({ keepMarks: r = !0 } = {}) => ({ tr: e, state: t, dispatch: n, editor: i }) => {
|
|
10960
10960
|
const { selection: s, doc: o } = e, { $from: l, $to: a } = s, c = i.extensionManager.attributes, u = Ft(c, l.node().type.name, l.node().attrs);
|
|
10961
10961
|
if (s instanceof C && s.node.isBlock)
|
|
10962
|
-
return !l.parentOffset || !
|
|
10962
|
+
return !l.parentOffset || !me(o, l.pos) ? !1 : (n && (r && Pi(t, i.extensionManager.splittableMarks), e.split(l.pos).scrollIntoView()), !0);
|
|
10963
10963
|
if (!l.parent.isBlock)
|
|
10964
10964
|
return !1;
|
|
10965
|
-
const d = a.parentOffset === a.parent.content.size,
|
|
10966
|
-
let
|
|
10965
|
+
const d = a.parentOffset === a.parent.content.size, h = l.depth === 0 ? void 0 : Wu(l.node(-1).contentMatchAt(l.indexAfter(-1)));
|
|
10966
|
+
let f = d && h ? [
|
|
10967
10967
|
{
|
|
10968
|
-
type:
|
|
10968
|
+
type: h,
|
|
10969
10969
|
attrs: u
|
|
10970
10970
|
}
|
|
10971
|
-
] : void 0, p =
|
|
10972
|
-
if (!
|
|
10971
|
+
] : void 0, p = me(e.doc, e.mapping.map(l.pos), 1, f);
|
|
10972
|
+
if (!f && !p && me(e.doc, e.mapping.map(l.pos), 1, h ? [{ type: h }] : void 0) && (p = !0, f = h ? [
|
|
10973
10973
|
{
|
|
10974
|
-
type:
|
|
10974
|
+
type: h,
|
|
10975
10975
|
attrs: u
|
|
10976
10976
|
}
|
|
10977
10977
|
] : void 0), n) {
|
|
10978
|
-
if (p && (s instanceof
|
|
10978
|
+
if (p && (s instanceof T && e.deleteSelection(), e.split(e.mapping.map(l.pos), 1, f), h && !d && !l.parentOffset && l.parent.type !== h)) {
|
|
10979
10979
|
const m = e.mapping.map(l.before()), g = e.doc.resolve(m);
|
|
10980
|
-
l.node(-1).canReplaceWith(g.index(), g.index() + 1,
|
|
10980
|
+
l.node(-1).canReplaceWith(g.index(), g.index() + 1, h) && e.setNodeMarkup(e.mapping.map(l.before()), h);
|
|
10981
10981
|
}
|
|
10982
10982
|
r && Pi(t, i.extensionManager.splittableMarks), e.scrollIntoView();
|
|
10983
10983
|
}
|
|
10984
10984
|
return p;
|
|
10985
10985
|
}, td = (r, e = {}) => ({ tr: t, state: n, dispatch: i, editor: s }) => {
|
|
10986
10986
|
var o;
|
|
10987
|
-
const l =
|
|
10987
|
+
const l = L(r, n.schema), { $from: a, $to: c } = n.selection, u = n.selection.node;
|
|
10988
10988
|
if (u && u.isBlock || a.depth < 2 || !a.sameParent(c))
|
|
10989
10989
|
return !1;
|
|
10990
10990
|
const d = a.node(-1);
|
|
10991
10991
|
if (d.type !== l)
|
|
10992
10992
|
return !1;
|
|
10993
|
-
const
|
|
10993
|
+
const h = s.extensionManager.attributes;
|
|
10994
10994
|
if (a.parent.content.size === 0 && a.node(-1).childCount === a.indexAfter(-1)) {
|
|
10995
10995
|
if (a.depth === 2 || a.node(-3).type !== l || a.index(-2) !== a.node(-2).childCount - 1)
|
|
10996
10996
|
return !1;
|
|
10997
10997
|
if (i) {
|
|
10998
10998
|
let y = b.empty;
|
|
10999
10999
|
const S = a.index(-1) ? 1 : a.index(-2) ? 2 : 3;
|
|
11000
|
-
for (let
|
|
11001
|
-
y = b.from(a.node(
|
|
11000
|
+
for (let W = a.depth - S; W >= a.depth - 3; W -= 1)
|
|
11001
|
+
y = b.from(a.node(W).copy(y));
|
|
11002
11002
|
const w = a.indexAfter(-1) < a.node(-2).childCount ? 1 : a.indexAfter(-2) < a.node(-3).childCount ? 2 : 3, v = {
|
|
11003
|
-
...Ft(
|
|
11003
|
+
...Ft(h, a.node().type.name, a.node().attrs),
|
|
11004
11004
|
...e
|
|
11005
11005
|
}, A = ((o = l.contentMatch.defaultType) === null || o === void 0 ? void 0 : o.createAndFill(v)) || void 0;
|
|
11006
11006
|
y = y.append(b.from(l.createAndFill(null, A) || void 0));
|
|
11007
11007
|
const M = a.before(a.depth - (S - 1));
|
|
11008
11008
|
t.replace(M, a.after(-w), new k(y, 4 - S, 0));
|
|
11009
|
-
let
|
|
11010
|
-
t.doc.nodesBetween(M, t.doc.content.size, (
|
|
11011
|
-
if (
|
|
11009
|
+
let I = -1;
|
|
11010
|
+
t.doc.nodesBetween(M, t.doc.content.size, (W, E) => {
|
|
11011
|
+
if (I > -1)
|
|
11012
11012
|
return !1;
|
|
11013
|
-
|
|
11014
|
-
}),
|
|
11013
|
+
W.isTextblock && W.content.size === 0 && (I = E + 1);
|
|
11014
|
+
}), I > -1 && t.setSelection(T.near(t.doc.resolve(I))), t.scrollIntoView();
|
|
11015
11015
|
}
|
|
11016
11016
|
return !0;
|
|
11017
11017
|
}
|
|
11018
|
-
const
|
|
11019
|
-
...Ft(
|
|
11018
|
+
const f = c.pos === a.end() ? d.contentMatchAt(0).defaultType : null, p = {
|
|
11019
|
+
...Ft(h, d.type.name, d.attrs),
|
|
11020
11020
|
...e
|
|
11021
11021
|
}, m = {
|
|
11022
|
-
...Ft(
|
|
11022
|
+
...Ft(h, a.node().type.name, a.node().attrs),
|
|
11023
11023
|
...e
|
|
11024
11024
|
};
|
|
11025
11025
|
t.delete(a.pos, c.pos);
|
|
11026
|
-
const g =
|
|
11026
|
+
const g = f ? [
|
|
11027
11027
|
{ type: l, attrs: p },
|
|
11028
|
-
{ type:
|
|
11028
|
+
{ type: f, attrs: m }
|
|
11029
11029
|
] : [{ type: l, attrs: p }];
|
|
11030
|
-
if (!
|
|
11030
|
+
if (!me(t.doc, a.pos, 2))
|
|
11031
11031
|
return !1;
|
|
11032
11032
|
if (i) {
|
|
11033
11033
|
const { selection: y, storedMarks: S } = n, { splittableMarks: w } = s.extensionManager, v = S || y.$to.parentOffset && y.$from.marks();
|
|
@@ -11056,29 +11056,29 @@ const ed = ({ keepMarks: r = !0 } = {}) => ({ tr: e, state: t, dispatch: n, edit
|
|
|
11056
11056
|
const i = r.doc.nodeAt(n);
|
|
11057
11057
|
return t.node.type === (i == null ? void 0 : i.type) && qe(r.doc, n) && r.join(n), !0;
|
|
11058
11058
|
}, nd = (r, e, t, n = {}) => ({ editor: i, tr: s, state: o, dispatch: l, chain: a, commands: c, can: u }) => {
|
|
11059
|
-
const { extensions: d, splittableMarks:
|
|
11059
|
+
const { extensions: d, splittableMarks: h } = i.extensionManager, f = L(r, o.schema), p = L(e, o.schema), { selection: m, storedMarks: g } = o, { $from: y, $to: S } = m, w = y.blockRange(S), v = g || m.$to.parentOffset && m.$from.marks();
|
|
11060
11060
|
if (!w)
|
|
11061
11061
|
return !1;
|
|
11062
11062
|
const A = Er((M) => Ii(M.type.name, d))(m);
|
|
11063
11063
|
if (w.depth >= 1 && A && w.depth - A.depth <= 1) {
|
|
11064
|
-
if (A.node.type ===
|
|
11064
|
+
if (A.node.type === f)
|
|
11065
11065
|
return c.liftListItem(p);
|
|
11066
|
-
if (Ii(A.node.type.name, d) &&
|
|
11067
|
-
return a().command(() => (s.setNodeMarkup(A.pos,
|
|
11066
|
+
if (Ii(A.node.type.name, d) && f.validContent(A.node.content) && l)
|
|
11067
|
+
return a().command(() => (s.setNodeMarkup(A.pos, f), !0)).command(() => Dn(s, f)).command(() => In(s, f)).run();
|
|
11068
11068
|
}
|
|
11069
|
-
return !t || !v || !l ? a().command(() => u().wrapInList(
|
|
11070
|
-
const M = u().wrapInList(
|
|
11071
|
-
return s.ensureMarks(
|
|
11072
|
-
}).wrapInList(
|
|
11069
|
+
return !t || !v || !l ? a().command(() => u().wrapInList(f, n) ? !0 : c.clearNodes()).wrapInList(f, n).command(() => Dn(s, f)).command(() => In(s, f)).run() : a().command(() => {
|
|
11070
|
+
const M = u().wrapInList(f, n), I = v.filter((W) => h.includes(W.type.name));
|
|
11071
|
+
return s.ensureMarks(I), M ? !0 : c.clearNodes();
|
|
11072
|
+
}).wrapInList(f, n).command(() => Dn(s, f)).command(() => In(s, f)).run();
|
|
11073
11073
|
}, rd = (r, e = {}, t = {}) => ({ state: n, commands: i }) => {
|
|
11074
11074
|
const { extendEmptyMarkRange: s = !1 } = t, o = ve(r, n.schema);
|
|
11075
11075
|
return er(n, o, e) ? i.unsetMark(o, { extendEmptyMarkRange: s }) : i.setMark(o, e);
|
|
11076
11076
|
}, id = (r, e, t = {}) => ({ state: n, commands: i }) => {
|
|
11077
|
-
const s =
|
|
11077
|
+
const s = L(r, n.schema), o = L(e, n.schema), l = Ct(n, s, t);
|
|
11078
11078
|
let a;
|
|
11079
11079
|
return n.selection.$anchor.sameParent(n.selection.$head) && (a = n.selection.$anchor.parent.attrs), l ? i.setNode(o, a) : i.setNode(s, { ...a, ...t });
|
|
11080
11080
|
}, sd = (r, e = {}) => ({ state: t, commands: n }) => {
|
|
11081
|
-
const i =
|
|
11081
|
+
const i = L(r, t.schema);
|
|
11082
11082
|
return Ct(t, i, e) ? n.lift(i) : n.wrapIn(i, e);
|
|
11083
11083
|
}, od = () => ({ state: r, dispatch: e }) => {
|
|
11084
11084
|
const t = r.plugins;
|
|
@@ -11111,24 +11111,24 @@ const ed = ({ keepMarks: r = !0 } = {}) => ({ tr: e, state: t, dispatch: n, edit
|
|
|
11111
11111
|
if (!i)
|
|
11112
11112
|
return !0;
|
|
11113
11113
|
if (u && o) {
|
|
11114
|
-
let { from:
|
|
11114
|
+
let { from: h, to: f } = l;
|
|
11115
11115
|
const p = (s = c.marks().find((g) => g.type === a)) === null || s === void 0 ? void 0 : s.attrs, m = wr(c, a, p);
|
|
11116
|
-
m && (
|
|
11116
|
+
m && (h = m.from, f = m.to), t.removeMark(h, f, a);
|
|
11117
11117
|
} else
|
|
11118
|
-
d.forEach((
|
|
11119
|
-
t.removeMark(
|
|
11118
|
+
d.forEach((h) => {
|
|
11119
|
+
t.removeMark(h.$from.pos, h.$to.pos, a);
|
|
11120
11120
|
});
|
|
11121
11121
|
return t.removeStoredMark(a), !0;
|
|
11122
11122
|
}, cd = (r, e = {}) => ({ tr: t, state: n, dispatch: i }) => {
|
|
11123
11123
|
let s = null, o = null;
|
|
11124
|
-
const l =
|
|
11125
|
-
return l ? (l === "node" && (s =
|
|
11124
|
+
const l = hn(typeof r == "string" ? r : r.name, n.schema);
|
|
11125
|
+
return l ? (l === "node" && (s = L(r, n.schema)), l === "mark" && (o = ve(r, n.schema)), i && t.selection.ranges.forEach((a) => {
|
|
11126
11126
|
const c = a.$from.pos, u = a.$to.pos;
|
|
11127
|
-
let d,
|
|
11127
|
+
let d, h, f, p;
|
|
11128
11128
|
t.selection.empty ? n.doc.nodesBetween(c, u, (m, g) => {
|
|
11129
|
-
s && s === m.type && (
|
|
11129
|
+
s && s === m.type && (f = Math.max(g, c), p = Math.min(g + m.nodeSize, u), d = g, h = m);
|
|
11130
11130
|
}) : n.doc.nodesBetween(c, u, (m, g) => {
|
|
11131
|
-
g < c && s && s === m.type && (
|
|
11131
|
+
g < c && s && s === m.type && (f = Math.max(g, c), p = Math.min(g + m.nodeSize, u), d = g, h = m), g >= c && g <= u && (s && s === m.type && t.setNodeMarkup(g, void 0, {
|
|
11132
11132
|
...m.attrs,
|
|
11133
11133
|
...e
|
|
11134
11134
|
}), o && m.marks.length && m.marks.forEach((y) => {
|
|
@@ -11140,24 +11140,24 @@ const ed = ({ keepMarks: r = !0 } = {}) => ({ tr: e, state: t, dispatch: n, edit
|
|
|
11140
11140
|
}));
|
|
11141
11141
|
}
|
|
11142
11142
|
}));
|
|
11143
|
-
}),
|
|
11144
|
-
...
|
|
11143
|
+
}), h && (d !== void 0 && t.setNodeMarkup(d, void 0, {
|
|
11144
|
+
...h.attrs,
|
|
11145
11145
|
...e
|
|
11146
|
-
}), o &&
|
|
11147
|
-
o === m.type && t.addMark(
|
|
11146
|
+
}), o && h.marks.length && h.marks.forEach((m) => {
|
|
11147
|
+
o === m.type && t.addMark(f, p, o.create({
|
|
11148
11148
|
...m.attrs,
|
|
11149
11149
|
...e
|
|
11150
11150
|
}));
|
|
11151
11151
|
}));
|
|
11152
11152
|
}), !0) : !1;
|
|
11153
11153
|
}, ud = (r, e = {}) => ({ state: t, dispatch: n }) => {
|
|
11154
|
-
const i =
|
|
11154
|
+
const i = L(r, t.schema);
|
|
11155
11155
|
return Nc(i, e)(t, n);
|
|
11156
11156
|
}, dd = (r, e = {}) => ({ state: t, dispatch: n }) => {
|
|
11157
|
-
const i =
|
|
11157
|
+
const i = L(r, t.schema);
|
|
11158
11158
|
return Ac(i, e)(t, n);
|
|
11159
11159
|
};
|
|
11160
|
-
var
|
|
11160
|
+
var hd = /* @__PURE__ */ Object.freeze({
|
|
11161
11161
|
__proto__: null,
|
|
11162
11162
|
blur: Zc,
|
|
11163
11163
|
clearContent: Qc,
|
|
@@ -11173,7 +11173,7 @@ var fd = /* @__PURE__ */ Object.freeze({
|
|
|
11173
11173
|
exitCode: cu,
|
|
11174
11174
|
extendMarkRange: uu,
|
|
11175
11175
|
first: du,
|
|
11176
|
-
focus:
|
|
11176
|
+
focus: fu,
|
|
11177
11177
|
forEach: pu,
|
|
11178
11178
|
insertContent: mu,
|
|
11179
11179
|
insertContentAt: bu,
|
|
@@ -11218,11 +11218,11 @@ var fd = /* @__PURE__ */ Object.freeze({
|
|
|
11218
11218
|
wrapIn: ud,
|
|
11219
11219
|
wrapInList: dd
|
|
11220
11220
|
});
|
|
11221
|
-
const
|
|
11221
|
+
const fd = Y.create({
|
|
11222
11222
|
name: "commands",
|
|
11223
11223
|
addCommands() {
|
|
11224
11224
|
return {
|
|
11225
|
-
...
|
|
11225
|
+
...hd
|
|
11226
11226
|
};
|
|
11227
11227
|
}
|
|
11228
11228
|
}), pd = Y.create({
|
|
@@ -11230,7 +11230,7 @@ const hd = Y.create({
|
|
|
11230
11230
|
addProseMirrorPlugins() {
|
|
11231
11231
|
return [
|
|
11232
11232
|
new Q({
|
|
11233
|
-
key: new
|
|
11233
|
+
key: new le("tiptapDrop"),
|
|
11234
11234
|
props: {
|
|
11235
11235
|
handleDrop: (r, e, t, n) => {
|
|
11236
11236
|
this.editor.emit("drop", {
|
|
@@ -11249,14 +11249,14 @@ const hd = Y.create({
|
|
|
11249
11249
|
addProseMirrorPlugins() {
|
|
11250
11250
|
return [
|
|
11251
11251
|
new Q({
|
|
11252
|
-
key: new
|
|
11252
|
+
key: new le("editable"),
|
|
11253
11253
|
props: {
|
|
11254
11254
|
editable: () => this.editor.options.editable
|
|
11255
11255
|
}
|
|
11256
11256
|
})
|
|
11257
11257
|
];
|
|
11258
11258
|
}
|
|
11259
|
-
}), gd = new
|
|
11259
|
+
}), gd = new le("focusEvents"), yd = Y.create({
|
|
11260
11260
|
name: "focusEvents",
|
|
11261
11261
|
addProseMirrorPlugins() {
|
|
11262
11262
|
const { editor: r } = this;
|
|
@@ -11287,8 +11287,8 @@ const hd = Y.create({
|
|
|
11287
11287
|
() => o.undoInputRule(),
|
|
11288
11288
|
// maybe convert first text block node to default node
|
|
11289
11289
|
() => o.command(({ tr: l }) => {
|
|
11290
|
-
const { selection: a, doc: c } = l, { empty: u, $anchor: d } = a, { pos:
|
|
11291
|
-
return !u || !
|
|
11290
|
+
const { selection: a, doc: c } = l, { empty: u, $anchor: d } = a, { pos: h, parent: f } = d, p = d.parent.isTextblock && h > 0 ? l.doc.resolve(h - 1) : d, m = p.parent.type.spec.isolating, g = d.pos - d.parentOffset, y = m && p.parent.childCount === 1 ? g === d.pos : O.atStart(c).from === h;
|
|
11291
|
+
return !u || !f.type.isTextblock || f.textContent.length || !y || y && d.parent.type.name === "paragraph" ? !1 : o.clearNodes();
|
|
11292
11292
|
}),
|
|
11293
11293
|
() => o.deleteSelection(),
|
|
11294
11294
|
() => o.joinBackward(),
|
|
@@ -11335,7 +11335,7 @@ const hd = Y.create({
|
|
|
11335
11335
|
// This is an alternative to ProseMirror's `AllSelection`, which doesn’t work well
|
|
11336
11336
|
// with many other commands.
|
|
11337
11337
|
new Q({
|
|
11338
|
-
key: new
|
|
11338
|
+
key: new le("clearDocument"),
|
|
11339
11339
|
appendTransaction: (r, e, t) => {
|
|
11340
11340
|
if (r.some((m) => m.getMeta("composition")))
|
|
11341
11341
|
return;
|
|
@@ -11343,17 +11343,17 @@ const hd = Y.create({
|
|
|
11343
11343
|
if (!n || i)
|
|
11344
11344
|
return;
|
|
11345
11345
|
const { empty: s, from: o, to: l } = e.selection, a = O.atStart(e.doc).from, c = O.atEnd(e.doc).to;
|
|
11346
|
-
if (s || !(o === a && l === c) || !
|
|
11346
|
+
if (s || !(o === a && l === c) || !fn(t.doc))
|
|
11347
11347
|
return;
|
|
11348
|
-
const
|
|
11348
|
+
const h = t.tr, f = an({
|
|
11349
11349
|
state: t,
|
|
11350
|
-
transaction:
|
|
11350
|
+
transaction: h
|
|
11351
11351
|
}), { commands: p } = new cn({
|
|
11352
11352
|
editor: this.editor,
|
|
11353
|
-
state:
|
|
11353
|
+
state: f
|
|
11354
11354
|
});
|
|
11355
|
-
if (p.clearNodes(), !!
|
|
11356
|
-
return
|
|
11355
|
+
if (p.clearNodes(), !!h.steps.length)
|
|
11356
|
+
return h;
|
|
11357
11357
|
}
|
|
11358
11358
|
})
|
|
11359
11359
|
];
|
|
@@ -11363,7 +11363,7 @@ const hd = Y.create({
|
|
|
11363
11363
|
addProseMirrorPlugins() {
|
|
11364
11364
|
return [
|
|
11365
11365
|
new Q({
|
|
11366
|
-
key: new
|
|
11366
|
+
key: new le("tiptapPaste"),
|
|
11367
11367
|
props: {
|
|
11368
11368
|
handlePaste: (r, e, t) => {
|
|
11369
11369
|
this.editor.emit("paste", {
|
|
@@ -11381,7 +11381,7 @@ const hd = Y.create({
|
|
|
11381
11381
|
addProseMirrorPlugins() {
|
|
11382
11382
|
return [
|
|
11383
11383
|
new Q({
|
|
11384
|
-
key: new
|
|
11384
|
+
key: new le("tabindex"),
|
|
11385
11385
|
props: {
|
|
11386
11386
|
attributes: () => this.editor.isEditable ? { tabindex: "0" } : {}
|
|
11387
11387
|
}
|
|
@@ -11695,7 +11695,7 @@ class wd extends zc {
|
|
|
11695
11695
|
* @returns The new editor state
|
|
11696
11696
|
*/
|
|
11697
11697
|
registerPlugin(e, t) {
|
|
11698
|
-
const n =
|
|
11698
|
+
const n = fo(t) ? t(e, [...this.state.plugins]) : [...this.state.plugins, e], i = this.state.reconfigure({ plugins: n });
|
|
11699
11699
|
return this.view.updateState(i), i;
|
|
11700
11700
|
}
|
|
11701
11701
|
/**
|
|
@@ -11729,7 +11729,7 @@ class wd extends zc {
|
|
|
11729
11729
|
Xc.configure({
|
|
11730
11730
|
blockSeparator: (t = (e = this.options.coreExtensionOptions) === null || e === void 0 ? void 0 : e.clipboardTextSerializer) === null || t === void 0 ? void 0 : t.blockSeparator
|
|
11731
11731
|
}),
|
|
11732
|
-
|
|
11732
|
+
fd,
|
|
11733
11733
|
yd,
|
|
11734
11734
|
bd,
|
|
11735
11735
|
xd,
|
|
@@ -11897,7 +11897,7 @@ class wd extends zc {
|
|
|
11897
11897
|
* Check if there is no content.
|
|
11898
11898
|
*/
|
|
11899
11899
|
get isEmpty() {
|
|
11900
|
-
return
|
|
11900
|
+
return fn(this.state.doc);
|
|
11901
11901
|
}
|
|
11902
11902
|
/**
|
|
11903
11903
|
* Get the number of characters for the current document.
|
|
@@ -11975,36 +11975,36 @@ let Tr = class tr {
|
|
|
11975
11975
|
})), t;
|
|
11976
11976
|
}
|
|
11977
11977
|
};
|
|
11978
|
-
var Qt = 200,
|
|
11978
|
+
var Qt = 200, F = function() {
|
|
11979
11979
|
};
|
|
11980
|
-
|
|
11981
|
-
return e.length ? (e =
|
|
11980
|
+
F.prototype.append = function(e) {
|
|
11981
|
+
return e.length ? (e = F.from(e), !this.length && e || e.length < Qt && this.leafAppend(e) || this.length < Qt && e.leafPrepend(this) || this.appendInner(e)) : this;
|
|
11982
11982
|
};
|
|
11983
|
-
|
|
11984
|
-
return e.length ?
|
|
11983
|
+
F.prototype.prepend = function(e) {
|
|
11984
|
+
return e.length ? F.from(e).append(this) : this;
|
|
11985
11985
|
};
|
|
11986
|
-
|
|
11986
|
+
F.prototype.appendInner = function(e) {
|
|
11987
11987
|
return new Md(this, e);
|
|
11988
11988
|
};
|
|
11989
|
-
|
|
11990
|
-
return e === void 0 && (e = 0), t === void 0 && (t = this.length), e >= t ?
|
|
11989
|
+
F.prototype.slice = function(e, t) {
|
|
11990
|
+
return e === void 0 && (e = 0), t === void 0 && (t = this.length), e >= t ? F.empty : this.sliceInner(Math.max(0, e), Math.min(this.length, t));
|
|
11991
11991
|
};
|
|
11992
|
-
|
|
11992
|
+
F.prototype.get = function(e) {
|
|
11993
11993
|
if (!(e < 0 || e >= this.length))
|
|
11994
11994
|
return this.getInner(e);
|
|
11995
11995
|
};
|
|
11996
|
-
|
|
11996
|
+
F.prototype.forEach = function(e, t, n) {
|
|
11997
11997
|
t === void 0 && (t = 0), n === void 0 && (n = this.length), t <= n ? this.forEachInner(e, t, n, 0) : this.forEachInvertedInner(e, t, n, 0);
|
|
11998
11998
|
};
|
|
11999
|
-
|
|
11999
|
+
F.prototype.map = function(e, t, n) {
|
|
12000
12000
|
t === void 0 && (t = 0), n === void 0 && (n = this.length);
|
|
12001
12001
|
var i = [];
|
|
12002
12002
|
return this.forEach(function(s, o) {
|
|
12003
12003
|
return i.push(e(s, o));
|
|
12004
12004
|
}, t, n), i;
|
|
12005
12005
|
};
|
|
12006
|
-
|
|
12007
|
-
return e instanceof
|
|
12006
|
+
F.from = function(e) {
|
|
12007
|
+
return e instanceof F ? e : e && e.length ? new wo(e) : F.empty;
|
|
12008
12008
|
};
|
|
12009
12009
|
var wo = /* @__PURE__ */ function(r) {
|
|
12010
12010
|
function e(n) {
|
|
@@ -12037,8 +12037,8 @@ var wo = /* @__PURE__ */ function(r) {
|
|
|
12037
12037
|
}, t.depth.get = function() {
|
|
12038
12038
|
return 0;
|
|
12039
12039
|
}, Object.defineProperties(e.prototype, t), e;
|
|
12040
|
-
}(
|
|
12041
|
-
|
|
12040
|
+
}(F);
|
|
12041
|
+
F.empty = new wo([]);
|
|
12042
12042
|
var Md = /* @__PURE__ */ function(r) {
|
|
12043
12043
|
function e(t, n) {
|
|
12044
12044
|
r.call(this), this.left = t, this.right = n, this.length = t.length + n.length, this.depth = Math.max(t.depth, n.depth) + 1;
|
|
@@ -12071,9 +12071,9 @@ var Md = /* @__PURE__ */ function(r) {
|
|
|
12071
12071
|
}, e.prototype.appendInner = function(n) {
|
|
12072
12072
|
return this.left.depth >= Math.max(this.right.depth, n.depth) + 1 ? new e(this.left, new e(this.right, n)) : new e(this, n);
|
|
12073
12073
|
}, e;
|
|
12074
|
-
}(
|
|
12074
|
+
}(F);
|
|
12075
12075
|
const Ed = 500;
|
|
12076
|
-
class
|
|
12076
|
+
class se {
|
|
12077
12077
|
constructor(e, t) {
|
|
12078
12078
|
this.items = e, this.eventCount = t;
|
|
12079
12079
|
}
|
|
@@ -12091,30 +12091,30 @@ class ie {
|
|
|
12091
12091
|
let i, s;
|
|
12092
12092
|
t && (i = this.remapping(n, this.items.length), s = i.maps.length);
|
|
12093
12093
|
let o = e.tr, l, a, c = [], u = [];
|
|
12094
|
-
return this.items.forEach((d,
|
|
12094
|
+
return this.items.forEach((d, h) => {
|
|
12095
12095
|
if (!d.step) {
|
|
12096
|
-
i || (i = this.remapping(n,
|
|
12096
|
+
i || (i = this.remapping(n, h + 1), s = i.maps.length), s--, u.push(d);
|
|
12097
12097
|
return;
|
|
12098
12098
|
}
|
|
12099
12099
|
if (i) {
|
|
12100
|
-
u.push(new
|
|
12101
|
-
let
|
|
12102
|
-
|
|
12100
|
+
u.push(new ae(d.map));
|
|
12101
|
+
let f = d.step.map(i.slice(s)), p;
|
|
12102
|
+
f && o.maybeStep(f).doc && (p = o.mapping.maps[o.mapping.maps.length - 1], c.push(new ae(p, void 0, void 0, c.length + u.length))), s--, p && i.appendMap(p, s);
|
|
12103
12103
|
} else
|
|
12104
12104
|
o.maybeStep(d.step);
|
|
12105
12105
|
if (d.selection)
|
|
12106
|
-
return l = i ? d.selection.map(i.slice(s)) : d.selection, a = new
|
|
12106
|
+
return l = i ? d.selection.map(i.slice(s)) : d.selection, a = new se(this.items.slice(0, n).append(u.reverse().concat(c)), this.eventCount - 1), !1;
|
|
12107
12107
|
}, this.items.length, 0), { remaining: a, transform: o, selection: l };
|
|
12108
12108
|
}
|
|
12109
12109
|
// Create a new branch with the given transform added.
|
|
12110
12110
|
addTransform(e, t, n, i) {
|
|
12111
12111
|
let s = [], o = this.eventCount, l = this.items, a = !i && l.length ? l.get(l.length - 1) : null;
|
|
12112
12112
|
for (let u = 0; u < e.steps.length; u++) {
|
|
12113
|
-
let d = e.steps[u].invert(e.docs[u]),
|
|
12114
|
-
(
|
|
12113
|
+
let d = e.steps[u].invert(e.docs[u]), h = new ae(e.mapping.maps[u], d, t), f;
|
|
12114
|
+
(f = a && a.merge(h)) && (h = f, u ? s.pop() : l = l.slice(0, l.length - 1)), s.push(h), t && (o++, t = void 0), i || (a = h);
|
|
12115
12115
|
}
|
|
12116
12116
|
let c = o - n.depth;
|
|
12117
|
-
return c > Od && (l = Td(l, c), o -= c), new
|
|
12117
|
+
return c > Od && (l = Td(l, c), o -= c), new se(l.append(s), o);
|
|
12118
12118
|
}
|
|
12119
12119
|
remapping(e, t) {
|
|
12120
12120
|
let n = new gt();
|
|
@@ -12124,7 +12124,7 @@ class ie {
|
|
|
12124
12124
|
}, e, t), n;
|
|
12125
12125
|
}
|
|
12126
12126
|
addMaps(e) {
|
|
12127
|
-
return this.eventCount == 0 ? this : new
|
|
12127
|
+
return this.eventCount == 0 ? this : new se(this.items.append(e.map((t) => new ae(t))), this.eventCount);
|
|
12128
12128
|
}
|
|
12129
12129
|
// When the collab module receives remote changes, the history has
|
|
12130
12130
|
// to know about those, so that it can adjust the steps that were
|
|
@@ -12134,26 +12134,26 @@ class ie {
|
|
|
12134
12134
|
if (!this.eventCount)
|
|
12135
12135
|
return this;
|
|
12136
12136
|
let n = [], i = Math.max(0, this.items.length - t), s = e.mapping, o = e.steps.length, l = this.eventCount;
|
|
12137
|
-
this.items.forEach((
|
|
12138
|
-
|
|
12137
|
+
this.items.forEach((h) => {
|
|
12138
|
+
h.selection && l--;
|
|
12139
12139
|
}, i);
|
|
12140
12140
|
let a = t;
|
|
12141
|
-
this.items.forEach((
|
|
12142
|
-
let
|
|
12143
|
-
if (
|
|
12141
|
+
this.items.forEach((h) => {
|
|
12142
|
+
let f = s.getMirror(--a);
|
|
12143
|
+
if (f == null)
|
|
12144
12144
|
return;
|
|
12145
|
-
o = Math.min(o,
|
|
12146
|
-
let p = s.maps[
|
|
12147
|
-
if (
|
|
12148
|
-
let m = e.steps[
|
|
12149
|
-
g && l++, n.push(new
|
|
12145
|
+
o = Math.min(o, f);
|
|
12146
|
+
let p = s.maps[f];
|
|
12147
|
+
if (h.step) {
|
|
12148
|
+
let m = e.steps[f].invert(e.docs[f]), g = h.selection && h.selection.map(s.slice(a + 1, f));
|
|
12149
|
+
g && l++, n.push(new ae(p, m, g));
|
|
12150
12150
|
} else
|
|
12151
|
-
n.push(new
|
|
12151
|
+
n.push(new ae(p));
|
|
12152
12152
|
}, i);
|
|
12153
12153
|
let c = [];
|
|
12154
|
-
for (let
|
|
12155
|
-
c.push(new
|
|
12156
|
-
let u = this.items.slice(0, i).append(c).append(n), d = new
|
|
12154
|
+
for (let h = t; h < o; h++)
|
|
12155
|
+
c.push(new ae(s.maps[h]));
|
|
12156
|
+
let u = this.items.slice(0, i).append(c).append(n), d = new se(u, l);
|
|
12157
12157
|
return d.emptyItemCount() > Ed && (d = d.compress(this.items.length - n.length)), d;
|
|
12158
12158
|
}
|
|
12159
12159
|
emptyItemCount() {
|
|
@@ -12178,14 +12178,14 @@ class ie {
|
|
|
12178
12178
|
if (n--, c && t.appendMap(c, n), a) {
|
|
12179
12179
|
let u = o.selection && o.selection.map(t.slice(n));
|
|
12180
12180
|
u && s++;
|
|
12181
|
-
let d = new
|
|
12182
|
-
(
|
|
12181
|
+
let d = new ae(c.invert(), a, u), h, f = i.length - 1;
|
|
12182
|
+
(h = i.length && i[f].merge(d)) ? i[f] = h : i.push(d);
|
|
12183
12183
|
}
|
|
12184
12184
|
} else o.map && n--;
|
|
12185
|
-
}, this.items.length, 0), new
|
|
12185
|
+
}, this.items.length, 0), new se(F.from(i.reverse()), s);
|
|
12186
12186
|
}
|
|
12187
12187
|
}
|
|
12188
|
-
|
|
12188
|
+
se.empty = new se(F.empty, 0);
|
|
12189
12189
|
function Td(r, e) {
|
|
12190
12190
|
let t;
|
|
12191
12191
|
return r.forEach((n, i) => {
|
|
@@ -12193,7 +12193,7 @@ function Td(r, e) {
|
|
|
12193
12193
|
return t = i, !1;
|
|
12194
12194
|
}), r.slice(t);
|
|
12195
12195
|
}
|
|
12196
|
-
class
|
|
12196
|
+
class ae {
|
|
12197
12197
|
constructor(e, t, n, i) {
|
|
12198
12198
|
this.map = e, this.step = t, this.selection = n, this.mirrorOffset = i;
|
|
12199
12199
|
}
|
|
@@ -12201,7 +12201,7 @@ class le {
|
|
|
12201
12201
|
if (this.step && e.step && !e.selection) {
|
|
12202
12202
|
let t = e.step.merge(this.step);
|
|
12203
12203
|
if (t)
|
|
12204
|
-
return new
|
|
12204
|
+
return new ae(t.getMap().invert(), t, this.selection);
|
|
12205
12205
|
}
|
|
12206
12206
|
}
|
|
12207
12207
|
}
|
|
@@ -12223,7 +12223,7 @@ function Nd(r, e, t, n) {
|
|
|
12223
12223
|
return o.getMeta(Ve).redo ? new ke(r.done.addTransform(t, void 0, n, Lt(e)), r.undone, Ri(t.mapping.maps), r.prevTime, r.prevComposition) : new ke(r.done, r.undone.addTransform(t, void 0, n, Lt(e)), null, r.prevTime, r.prevComposition);
|
|
12224
12224
|
if (t.getMeta("addToHistory") !== !1 && !(o && o.getMeta("addToHistory") === !1)) {
|
|
12225
12225
|
let l = t.getMeta("composition"), a = r.prevTime == 0 || !o && r.prevComposition != l && (r.prevTime < (t.time || 0) - n.newGroupDelay || !Ad(t, r.prevRanges)), c = o ? Pn(r.prevRanges, t.mapping) : Ri(t.mapping.maps);
|
|
12226
|
-
return new ke(r.done.addTransform(t, a ? e.selection.getBookmark() : void 0, n, Lt(e)),
|
|
12226
|
+
return new ke(r.done.addTransform(t, a ? e.selection.getBookmark() : void 0, n, Lt(e)), se.empty, c, t.time, l ?? r.prevComposition);
|
|
12227
12227
|
} else return (s = t.getMeta("rebased")) ? new ke(r.done.rebased(t, s), r.undone.rebased(t, s), Pn(r.prevRanges, t.mapping), r.prevTime, r.prevComposition) : new ke(r.done.addMaps(t.mapping.maps), r.undone.addMaps(t.mapping.maps), Pn(r.prevRanges, t.mapping), r.prevTime, r.prevComposition);
|
|
12228
12228
|
}
|
|
12229
12229
|
function Ad(r, e) {
|
|
@@ -12273,7 +12273,7 @@ function Lt(r) {
|
|
|
12273
12273
|
}
|
|
12274
12274
|
return Rn;
|
|
12275
12275
|
}
|
|
12276
|
-
const Ve = new
|
|
12276
|
+
const Ve = new le("history"), Dd = new le("closeHistory");
|
|
12277
12277
|
function Id(r = {}) {
|
|
12278
12278
|
return r = {
|
|
12279
12279
|
depth: r.depth || 100,
|
|
@@ -12282,7 +12282,7 @@ function Id(r = {}) {
|
|
|
12282
12282
|
key: Ve,
|
|
12283
12283
|
state: {
|
|
12284
12284
|
init() {
|
|
12285
|
-
return new ke(
|
|
12285
|
+
return new ke(se.empty, se.empty, null, 0, -1);
|
|
12286
12286
|
},
|
|
12287
12287
|
apply(e, t, n) {
|
|
12288
12288
|
return Nd(t, n, e, r);
|
|
@@ -12355,7 +12355,7 @@ const Eo = Mo(!1, !0), To = Mo(!0, !0), Pd = Y.create({
|
|
|
12355
12355
|
addProseMirrorPlugins() {
|
|
12356
12356
|
return [
|
|
12357
12357
|
new Q({
|
|
12358
|
-
key: new
|
|
12358
|
+
key: new le("placeholder"),
|
|
12359
12359
|
props: {
|
|
12360
12360
|
decorations: ({ doc: r, selection: e }) => {
|
|
12361
12361
|
const t = this.editor.isEditable || !this.options.showOnlyWhenEditable, { anchor: n } = e, i = [];
|
|
@@ -12363,11 +12363,11 @@ const Eo = Mo(!1, !0), To = Mo(!0, !0), Pd = Y.create({
|
|
|
12363
12363
|
return null;
|
|
12364
12364
|
const s = this.editor.isEmpty;
|
|
12365
12365
|
return r.descendants((o, l) => {
|
|
12366
|
-
const a = n >= l && n <= l + o.nodeSize, c = !o.isLeaf &&
|
|
12366
|
+
const a = n >= l && n <= l + o.nodeSize, c = !o.isLeaf && fn(o);
|
|
12367
12367
|
if ((a || !this.options.showOnlyCurrent) && c) {
|
|
12368
12368
|
const u = [this.options.emptyNodeClass];
|
|
12369
12369
|
s && u.push(this.options.emptyEditorClass);
|
|
12370
|
-
const d =
|
|
12370
|
+
const d = re.node(l, l + o.nodeSize, {
|
|
12371
12371
|
class: u.join(" "),
|
|
12372
12372
|
"data-placeholder": typeof this.options.placeholder == "function" ? this.options.placeholder({
|
|
12373
12373
|
editor: this.editor,
|
|
@@ -12379,7 +12379,7 @@ const Eo = Mo(!1, !0), To = Mo(!0, !0), Pd = Y.create({
|
|
|
12379
12379
|
i.push(d);
|
|
12380
12380
|
}
|
|
12381
12381
|
return this.options.includeChildren;
|
|
12382
|
-
}),
|
|
12382
|
+
}), B.create(r, i);
|
|
12383
12383
|
}
|
|
12384
12384
|
}
|
|
12385
12385
|
})
|
|
@@ -12670,8 +12670,8 @@ function Hd(r, e, t = null) {
|
|
|
12670
12670
|
if (c.type.name === "note") {
|
|
12671
12671
|
const d = c.attrs.target;
|
|
12672
12672
|
if (d && d.startsWith("#")) {
|
|
12673
|
-
const
|
|
12674
|
-
s.push({ node: c, reference:
|
|
12673
|
+
const h = d.substring(1), f = wt(h);
|
|
12674
|
+
s.push({ node: c, reference: f, originalIndex: s.length }), t && d === `#${t}` && (o = s.length - 1);
|
|
12675
12675
|
}
|
|
12676
12676
|
}
|
|
12677
12677
|
}), s.sort((c, u) => c.reference - u.reference);
|
|
@@ -12684,10 +12684,10 @@ function Hd(r, e, t = null) {
|
|
|
12684
12684
|
if (r = r.replaceWith(n, n + i.nodeSize, a), l !== -1) {
|
|
12685
12685
|
let u = n + 1;
|
|
12686
12686
|
for (let d = 0; d < l; d++) {
|
|
12687
|
-
const
|
|
12688
|
-
|
|
12687
|
+
const h = r.doc.nodeAt(u);
|
|
12688
|
+
h && (u += h.nodeSize);
|
|
12689
12689
|
}
|
|
12690
|
-
r = r.setSelection(
|
|
12690
|
+
r = r.setSelection(T.create(
|
|
12691
12691
|
r.doc,
|
|
12692
12692
|
u + 1
|
|
12693
12693
|
));
|
|
@@ -12795,29 +12795,29 @@ const qd = Oo.extend({
|
|
|
12795
12795
|
addProseMirrorPlugins() {
|
|
12796
12796
|
return [
|
|
12797
12797
|
new Q({
|
|
12798
|
-
key: new
|
|
12798
|
+
key: new le("footnoteRules"),
|
|
12799
12799
|
appendTransaction(r, e, t) {
|
|
12800
12800
|
let n = t.tr, i = null, s = !1, o = /* @__PURE__ */ new Set();
|
|
12801
|
-
if (r.some((a) => a.steps.some((c) => c instanceof
|
|
12801
|
+
if (r.some((a) => a.steps.some((c) => c instanceof P ? c.from === 0 && c.to === e.doc.content.size : !1)))
|
|
12802
12802
|
s = !0;
|
|
12803
12803
|
else
|
|
12804
12804
|
for (let a of r)
|
|
12805
12805
|
if (a.docChanged)
|
|
12806
12806
|
for (let c of a.steps) {
|
|
12807
|
-
if (!(c instanceof
|
|
12807
|
+
if (!(c instanceof P)) continue;
|
|
12808
12808
|
c.slice.size > 0 && c.slice.content.descendants((m, g) => {
|
|
12809
12809
|
if ((m == null ? void 0 : m.type.name) == "anchor")
|
|
12810
12810
|
return i = m.attrs.id, s = !0, !1;
|
|
12811
12811
|
});
|
|
12812
|
-
const d = a.docs[0],
|
|
12812
|
+
const d = a.docs[0], h = a.doc, f = /* @__PURE__ */ new Map(), p = /* @__PURE__ */ new Map();
|
|
12813
12813
|
d.descendants((m, g) => {
|
|
12814
|
-
m.type.name === "anchor" &&
|
|
12815
|
-
}),
|
|
12814
|
+
m.type.name === "anchor" && f.set(m.attrs.id, g);
|
|
12815
|
+
}), h.descendants((m, g) => {
|
|
12816
12816
|
m.type.name === "anchor" && p.set(m.attrs.id, g);
|
|
12817
12817
|
});
|
|
12818
|
-
for (const [m, g] of
|
|
12818
|
+
for (const [m, g] of f)
|
|
12819
12819
|
p.has(m) || (o.add(m), s = !0);
|
|
12820
|
-
(
|
|
12820
|
+
(f.size !== p.size || Array.from(f.entries()).some(([m, g]) => p.get(m) !== g)) && (s = !0);
|
|
12821
12821
|
}
|
|
12822
12822
|
if (o.size > 0 && t.doc.descendants((a, c) => {
|
|
12823
12823
|
if (a.type.name === "note") {
|
|
@@ -12846,12 +12846,12 @@ const qd = Oo.extend({
|
|
|
12846
12846
|
target: `#${i}`,
|
|
12847
12847
|
_reference: "1"
|
|
12848
12848
|
// Will be updated later
|
|
12849
|
-
}),
|
|
12850
|
-
n = n.insert(
|
|
12851
|
-
const
|
|
12852
|
-
n.doc.nodeAt(
|
|
12849
|
+
}), h = c + u.nodeSize - 1;
|
|
12850
|
+
n = n.insert(h, d);
|
|
12851
|
+
const f = h;
|
|
12852
|
+
n.doc.nodeAt(f) && (n = n.setSelection(T.create(
|
|
12853
12853
|
n.doc,
|
|
12854
|
-
|
|
12854
|
+
f + 1
|
|
12855
12855
|
)));
|
|
12856
12856
|
}
|
|
12857
12857
|
return s && (jd(n.doc), n = Jd(n, n.doc), n = Wd(n, n.doc), n = Hd(n, n.doc, i)), n;
|
|
@@ -12974,7 +12974,7 @@ function Qd(r, e, t, n = 3) {
|
|
|
12974
12974
|
}
|
|
12975
12975
|
return `… ${r.substring(i, e)}<mark>${r.substring(e, t)}</mark>${r.substring(t, o + 1)} …`;
|
|
12976
12976
|
}
|
|
12977
|
-
class
|
|
12977
|
+
class eh {
|
|
12978
12978
|
constructor(e, t) {
|
|
12979
12979
|
this.editor = e.tiptap, this.schemaDef = t, this.panel = e.querySelector(".attribute-panel"), this.currentElement = null, this.currentMark = null, this.setupEventListeners(), this.overlay = document.createElement("div"), this.overlay.className = "jinn-tap overlay", this.overlay.style.display = "block", this.overlay.style.position = "fixed", this.overlay.style.pointerEvents = "none", this.overlay.style.zIndex = "1000", this.overlay.style.display = "none";
|
|
12980
12980
|
}
|
|
@@ -13053,17 +13053,17 @@ class ef {
|
|
|
13053
13053
|
u.readOnly = !0;
|
|
13054
13054
|
const d = document.createElement("details");
|
|
13055
13055
|
d.open = !e.attrs[a];
|
|
13056
|
-
const
|
|
13057
|
-
|
|
13058
|
-
const
|
|
13059
|
-
|
|
13056
|
+
const h = document.createElement("summary");
|
|
13057
|
+
h.textContent = "Lookup", d.appendChild(h);
|
|
13058
|
+
const f = document.createElement("pb-authority-lookup");
|
|
13059
|
+
f.setAttribute("type", c.connector.type), f.setAttribute("query", t), f.setAttribute("auto", e.attrs[a] ? "true" : "false"), f.setAttribute("no-occurrences", !0);
|
|
13060
13060
|
const p = document.createElement("pb-authority");
|
|
13061
|
-
if (p.setAttribute("connector", c.connector.name), p.setAttribute("name", c.connector.type), c.connector.user && p.setAttribute("user", c.connector.user),
|
|
13061
|
+
if (p.setAttribute("connector", c.connector.name), p.setAttribute("name", c.connector.type), c.connector.user && p.setAttribute("user", c.connector.user), f.appendChild(p), document.addEventListener("pb-authority-select", (m) => {
|
|
13062
13062
|
const g = `${c.connector.prefix}-${m.detail.properties.ref}`;
|
|
13063
13063
|
u.value = g, d.open = !1, this.handleAttributeUpdate(e, { [a]: g });
|
|
13064
|
-
}), d.appendChild(
|
|
13064
|
+
}), d.appendChild(f), o.appendChild(d), e.attrs[a]) {
|
|
13065
13065
|
const m = e.attrs[a].substring(e.attrs[a].indexOf("-") + 1);
|
|
13066
|
-
|
|
13066
|
+
f.lookup(c.connector.type, m, s).then((g) => {
|
|
13067
13067
|
const y = g.strings;
|
|
13068
13068
|
y.sort((S, w) => w.length - S.length), y.unshift(t), this.updateOccurrences(this.editor, e, y);
|
|
13069
13069
|
});
|
|
@@ -13106,9 +13106,9 @@ class ef {
|
|
|
13106
13106
|
const l = [];
|
|
13107
13107
|
for (const [c, u] of Object.entries(i))
|
|
13108
13108
|
for (const d of u) {
|
|
13109
|
-
const
|
|
13110
|
-
let
|
|
13111
|
-
|
|
13109
|
+
const h = e.state.doc.resolve(d.pos);
|
|
13110
|
+
let f = h.node(), p = null;
|
|
13111
|
+
f.isText || e.state.doc.nodesBetween(d.pos, d.pos + d.length, (M, I) => {
|
|
13112
13112
|
if (M.isText)
|
|
13113
13113
|
return p = M, !1;
|
|
13114
13114
|
});
|
|
@@ -13119,18 +13119,19 @@ class ef {
|
|
|
13119
13119
|
to: d.pos + d.index + d.length,
|
|
13120
13120
|
hasMark: m
|
|
13121
13121
|
});
|
|
13122
|
-
const w = e.state.doc.textBetween(d.pos,
|
|
13122
|
+
const w = e.state.doc.textBetween(d.pos, h.end()), v = Qd(w, d.index, d.index + d.length), A = document.createElement("span");
|
|
13123
13123
|
A.innerHTML = v, y.appendChild(A), g.appendChild(y), o.appendChild(g), y.addEventListener("mouseenter", (M) => {
|
|
13124
13124
|
M.preventDefault(), M.stopPropagation();
|
|
13125
|
-
const
|
|
13126
|
-
if (
|
|
13127
|
-
|
|
13128
|
-
|
|
13129
|
-
|
|
13130
|
-
|
|
13125
|
+
const I = e.view.nodeDOM(d.pos);
|
|
13126
|
+
if (I) {
|
|
13127
|
+
(I.nodeType === Node.TEXT_NODE ? I.parentNode : I).scrollIntoView({ behavior: "instant", block: "center" });
|
|
13128
|
+
let E;
|
|
13129
|
+
if (I.nodeType === Node.TEXT_NODE) {
|
|
13130
|
+
const ee = document.createRange();
|
|
13131
|
+
ee.setStart(I, d.index), ee.setEnd(I, d.index + d.length), E = ee.getBoundingClientRect();
|
|
13131
13132
|
} else
|
|
13132
|
-
|
|
13133
|
-
this.overlay.style.display = "block", this.overlay.style.top =
|
|
13133
|
+
E = I.getBoundingClientRect();
|
|
13134
|
+
this.overlay.style.display = "block", this.overlay.style.top = E.top - 10 + "px", this.overlay.style.left = E.left - 10 + "px", this.overlay.style.width = E.width + 20 + "px", this.overlay.style.height = E.height + 20 + "px", document.body.appendChild(this.overlay);
|
|
13134
13135
|
}
|
|
13135
13136
|
}), y.addEventListener("mouseleave", (M) => {
|
|
13136
13137
|
M.preventDefault(), M.stopPropagation(), this.overlay.style.display = "none";
|
|
@@ -13143,14 +13144,14 @@ class ef {
|
|
|
13143
13144
|
const u = l.filter((d) => !d.checkbox.checked);
|
|
13144
13145
|
if (u.length > 0) {
|
|
13145
13146
|
let d = this.editor.chain().focus();
|
|
13146
|
-
u.forEach((
|
|
13147
|
-
d = d.setTextSelection({ from:
|
|
13147
|
+
u.forEach((h) => {
|
|
13148
|
+
d = d.setTextSelection({ from: h.from, to: h.to }).toggleMark(t.type, t.attrs), h.checkbox.checked = !0;
|
|
13148
13149
|
}), d.run();
|
|
13149
13150
|
}
|
|
13150
13151
|
});
|
|
13151
13152
|
}
|
|
13152
13153
|
}
|
|
13153
|
-
class
|
|
13154
|
+
class th {
|
|
13154
13155
|
constructor(e, t) {
|
|
13155
13156
|
this.editor = e.tiptap, this.attributePanel = t, this.panel = e.querySelector(".navigation-panel"), this.setupEventListeners();
|
|
13156
13157
|
}
|
|
@@ -13170,12 +13171,12 @@ class tf {
|
|
|
13170
13171
|
for (; c > 0; ) {
|
|
13171
13172
|
const d = u.node(c);
|
|
13172
13173
|
if (d) {
|
|
13173
|
-
const
|
|
13174
|
+
const h = {
|
|
13174
13175
|
type: d.type.name,
|
|
13175
13176
|
node: d,
|
|
13176
13177
|
pos: { from: u.start(c), to: u.end(c) }
|
|
13177
13178
|
};
|
|
13178
|
-
s.push(
|
|
13179
|
+
s.push(h);
|
|
13179
13180
|
}
|
|
13180
13181
|
c--;
|
|
13181
13182
|
}
|
|
@@ -13183,8 +13184,8 @@ class tf {
|
|
|
13183
13184
|
let l = document.createElement("ul");
|
|
13184
13185
|
s.reverse().forEach((a, c) => {
|
|
13185
13186
|
const u = document.createElement("li"), d = document.createElement("a");
|
|
13186
|
-
d.setAttribute("href", "#"), d.textContent = a.type, d.addEventListener("click", (
|
|
13187
|
-
|
|
13187
|
+
d.setAttribute("href", "#"), d.textContent = a.type, d.addEventListener("click", (h) => {
|
|
13188
|
+
h.preventDefault(), this.editor.chain().focus().setTextSelection(a.pos).run(), this.attributePanel.showNodeAttributes(a.node);
|
|
13188
13189
|
}), u.appendChild(d), l.appendChild(u);
|
|
13189
13190
|
}), o && o.forEach((a) => {
|
|
13190
13191
|
const c = document.createElement("li"), u = document.createElement("a");
|
|
@@ -13194,7 +13195,7 @@ class tf {
|
|
|
13194
13195
|
}), this.panel.appendChild(l);
|
|
13195
13196
|
}
|
|
13196
13197
|
}
|
|
13197
|
-
class
|
|
13198
|
+
class nh {
|
|
13198
13199
|
/**
|
|
13199
13200
|
* Create a new Toolbar instance.
|
|
13200
13201
|
*
|
|
@@ -13295,43 +13296,43 @@ class nf {
|
|
|
13295
13296
|
}), e.querySelector("ul").appendChild(o);
|
|
13296
13297
|
}
|
|
13297
13298
|
}
|
|
13298
|
-
function
|
|
13299
|
+
function rh(r) {
|
|
13299
13300
|
const e = "#E48500", t = {}, n = [], i = (u) => {
|
|
13300
|
-
let d = parseInt(u.substring(1, 3), 16) / 255,
|
|
13301
|
+
let d = parseInt(u.substring(1, 3), 16) / 255, h = parseInt(u.substring(3, 5), 16) / 255, f = parseInt(u.substring(5, 7), 16) / 255, p = Math.max(d, h, f), m = Math.min(d, h, f), g, y, S = (p + m) / 2;
|
|
13301
13302
|
if (p === m)
|
|
13302
13303
|
g = y = 0;
|
|
13303
13304
|
else {
|
|
13304
13305
|
let w = p - m;
|
|
13305
13306
|
switch (y = S > 0.5 ? w / (2 - p - m) : w / (p + m), p) {
|
|
13306
13307
|
case d:
|
|
13307
|
-
g = (
|
|
13308
|
-
break;
|
|
13309
|
-
case f:
|
|
13310
|
-
g = (h - d) / w + 2;
|
|
13308
|
+
g = (h - f) / w + (h < f ? 6 : 0);
|
|
13311
13309
|
break;
|
|
13312
13310
|
case h:
|
|
13313
|
-
g = (
|
|
13311
|
+
g = (f - d) / w + 2;
|
|
13312
|
+
break;
|
|
13313
|
+
case f:
|
|
13314
|
+
g = (d - h) / w + 4;
|
|
13314
13315
|
break;
|
|
13315
13316
|
}
|
|
13316
13317
|
g /= 6;
|
|
13317
13318
|
}
|
|
13318
13319
|
return [g * 360, y * 100, S * 100];
|
|
13319
|
-
}, s = (u, d,
|
|
13320
|
-
|
|
13321
|
-
const
|
|
13322
|
-
const g = (m + u / 30) % 12, y =
|
|
13320
|
+
}, s = (u, d, h) => {
|
|
13321
|
+
h /= 100;
|
|
13322
|
+
const f = d * Math.min(h, 1 - h) / 100, p = (m) => {
|
|
13323
|
+
const g = (m + u / 30) % 12, y = h - f * Math.max(Math.min(g - 3, 9 - g, 1), -1);
|
|
13323
13324
|
return Math.round(255 * y).toString(16).padStart(2, "0");
|
|
13324
13325
|
};
|
|
13325
13326
|
return `#${p(0)}${p(8)}${p(4)}`;
|
|
13326
13327
|
}, [o, l, a] = i(e);
|
|
13327
13328
|
for (let u = 0; u < 5; u++) {
|
|
13328
|
-
const d = (o + u * 40) % 360,
|
|
13329
|
-
t[`--tei-div-color-${u}`] =
|
|
13329
|
+
const d = (o + u * 40) % 360, h = s(d, l, a);
|
|
13330
|
+
t[`--tei-div-color-${u}`] = h;
|
|
13330
13331
|
}
|
|
13331
13332
|
let c = 5;
|
|
13332
13333
|
return Object.entries(r.schema).forEach(([u, d]) => {
|
|
13333
|
-
const
|
|
13334
|
-
t[`--tei-${u}-color`] = `${
|
|
13334
|
+
const h = (o + c * 60) % 360, f = s(h, l, a);
|
|
13335
|
+
t[`--tei-${u}-color`] = `${f}`, (d.type === "inline" || d.type === "empty") && n.push(`
|
|
13335
13336
|
.debug tei-${u}::after {
|
|
13336
13337
|
background-color: var(--tei-${u}-color);
|
|
13337
13338
|
content: "${u}";
|
|
@@ -13347,14 +13348,14 @@ function rf(r) {
|
|
|
13347
13348
|
`)}
|
|
13348
13349
|
`;
|
|
13349
13350
|
}
|
|
13350
|
-
const
|
|
13351
|
+
const ih = {
|
|
13351
13352
|
rend: {
|
|
13352
13353
|
type: "string"
|
|
13353
13354
|
},
|
|
13354
13355
|
id: {
|
|
13355
13356
|
type: "string"
|
|
13356
13357
|
}
|
|
13357
|
-
},
|
|
13358
|
+
}, sh = {
|
|
13358
13359
|
div: {
|
|
13359
13360
|
type: "block",
|
|
13360
13361
|
defining: !0,
|
|
@@ -13748,8 +13749,8 @@ const sf = {
|
|
|
13748
13749
|
}
|
|
13749
13750
|
}
|
|
13750
13751
|
}, $t = {
|
|
13751
|
-
attributes:
|
|
13752
|
-
schema:
|
|
13752
|
+
attributes: ih,
|
|
13753
|
+
schema: sh
|
|
13753
13754
|
}, rr = document.createElement("style");
|
|
13754
13755
|
rr.textContent = `
|
|
13755
13756
|
jinn-tap {
|
|
@@ -13836,10 +13837,10 @@ rr.textContent = `
|
|
|
13836
13837
|
border-radius: 5px;
|
|
13837
13838
|
}
|
|
13838
13839
|
|
|
13839
|
-
${
|
|
13840
|
+
${rh($t)}
|
|
13840
13841
|
`;
|
|
13841
13842
|
document.querySelector("#jinn-tap-styles") || (rr.id = "jinn-tap-styles", document.head.appendChild(rr));
|
|
13842
|
-
class
|
|
13843
|
+
class oh extends HTMLElement {
|
|
13843
13844
|
static get observedAttributes() {
|
|
13844
13845
|
return ["debug", "url"];
|
|
13845
13846
|
}
|
|
@@ -13902,7 +13903,7 @@ class lf extends HTMLElement {
|
|
|
13902
13903
|
this.dispatchContentChange(), this.dispatchEvent(new CustomEvent("ready"));
|
|
13903
13904
|
},
|
|
13904
13905
|
onUpdate: () => this.dispatchContentChange()
|
|
13905
|
-
}), this.toolbar = new
|
|
13906
|
+
}), this.toolbar = new nh(this, $t), this.attributePanel = new eh(this, $t), this.navigationPanel = new th(this, this.attributePanel);
|
|
13906
13907
|
const i = this.getAttribute("url");
|
|
13907
13908
|
i && this.loadFromUrl(i);
|
|
13908
13909
|
}
|
|
@@ -13948,8 +13949,8 @@ class lf extends HTMLElement {
|
|
|
13948
13949
|
return t.forEach((n) => n.remove()), e;
|
|
13949
13950
|
}
|
|
13950
13951
|
}
|
|
13951
|
-
customElements.define("jinn-tap",
|
|
13952
|
+
customElements.define("jinn-tap", oh);
|
|
13952
13953
|
export {
|
|
13953
|
-
|
|
13954
|
+
oh as JinnTap
|
|
13954
13955
|
};
|
|
13955
13956
|
//# sourceMappingURL=jinn-tap.es.js.map
|