@jinntec/jinntap 1.1.1 → 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 +401 -391
- package/dist/jinn-tap.umd.js +20 -17
- 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++) {
|
|
@@ -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)
|
|
@@ -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; )
|
|
@@ -3441,7 +3441,7 @@ function tl(r, e, t, n) {
|
|
|
3441
3441
|
if (!n.isInSet(d) && u.type.allowsMarkType(n.type)) {
|
|
3442
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 == h && o.mark.eq(d[m]) ? o.to = f : i.push(o = new
|
|
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
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));
|
|
@@ -3469,22 +3469,22 @@ function nl(r, e, t, n) {
|
|
|
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
3482
|
for (let h = 0; h < c.marks.length; h++)
|
|
3483
|
-
t.allowsMarkType(c.marks[h].type) || r.step(new
|
|
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
3485
|
let h, f = /\r?\n|\r/g, p;
|
|
3486
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
|
|
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;
|
|
@@ -3517,7 +3517,7 @@ function il(r, e, t) {
|
|
|
3517
3517
|
let h = b.empty, f = 0;
|
|
3518
3518
|
for (let p = s, m = !1; p > t; p--)
|
|
3519
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
|
|
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)
|
|
@@ -3569,7 +3569,7 @@ function al(r, e, t, n, i) {
|
|
|
3569
3569
|
}
|
|
3570
3570
|
c === !1 && hs(r, o, l, s), sr(r, r.mapping.slice(s).map(l, 1), n, void 0, c === null);
|
|
3571
3571
|
let u = r.mapping.slice(s), d = u.map(l, 1), h = u.map(l + o.nodeSize, 1);
|
|
3572
|
-
return r.step(new
|
|
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
|
}
|
|
@@ -3607,9 +3607,9 @@ 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;
|
|
@@ -3633,7 +3633,7 @@ 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();
|
|
@@ -3676,7 +3676,7 @@ function fl(r, e, t) {
|
|
|
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
|
|
@@ -3919,7 +3919,7 @@ 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);
|
|
@@ -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;
|
|
@@ -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;
|
|
@@ -5122,7 +5122,7 @@ const j = function(r) {
|
|
|
5122
5122
|
return e && e.nodeType == 11 ? e.host : e;
|
|
5123
5123
|
};
|
|
5124
5124
|
let Wn = null;
|
|
5125
|
-
const
|
|
5125
|
+
const fe = function(r, e, t) {
|
|
5126
5126
|
let n = Wn || (Wn = document.createRange());
|
|
5127
5127
|
return n.setEnd(r, t ?? r.nodeValue.length), n.setStart(r, e || 0), n;
|
|
5128
5128
|
}, Ol = function() {
|
|
@@ -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,7 +5258,7 @@ 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 {
|
|
@@ -5323,7 +5323,7 @@ function Ms(r, e) {
|
|
|
5323
5323
|
if (u.nodeType == 1)
|
|
5324
5324
|
h = u.getClientRects();
|
|
5325
5325
|
else if (u.nodeType == 3)
|
|
5326
|
-
h =
|
|
5326
|
+
h = fe(u).getClientRects();
|
|
5327
5327
|
else
|
|
5328
5328
|
continue;
|
|
5329
5329
|
for (let f = 0; f < h.length; f++) {
|
|
@@ -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,14 +5438,14 @@ 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
|
-
let a = ye(
|
|
5445
|
-
if (
|
|
5446
|
-
let c = ye(
|
|
5444
|
+
let a = ye(fe(n, i, i), t);
|
|
5445
|
+
if (oe && i && /\s/.test(n.nodeValue[i - 1]) && i < n.nodeValue.length) {
|
|
5446
|
+
let c = ye(fe(n, i - 1, i - 1), -1);
|
|
5447
5447
|
if (c.top == a.top) {
|
|
5448
|
-
let u = ye(
|
|
5448
|
+
let u = ye(fe(n, i, i + 1), -1);
|
|
5449
5449
|
if (u.top != a.top)
|
|
5450
5450
|
return ot(u, u.left < c.left);
|
|
5451
5451
|
}
|
|
@@ -5453,35 +5453,35 @@ function Ts(r, e, t) {
|
|
|
5453
5453
|
return a;
|
|
5454
5454
|
} else {
|
|
5455
5455
|
let a = i, c = i, u = t < 0 ? 1 : -1;
|
|
5456
|
-
return t < 0 && !i ? (c++, u = -1) : t >= 0 && i == n.nodeValue.length ? (a--, u = 1) : t < 0 ? a-- : c++, ot(ye(
|
|
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 ?
|
|
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;
|
|
5480
|
-
let c = a ? a.nodeType == 3 ?
|
|
5480
|
+
let c = a ? a.nodeType == 3 ? fe(a, 0, o ? 0 : 1) : a.nodeType == 1 ? a : null : null;
|
|
5481
5481
|
if (c)
|
|
5482
5482
|
return ot(ye(c, -1), !0);
|
|
5483
5483
|
}
|
|
5484
|
-
return ot(ye(n.nodeType == 3 ?
|
|
5484
|
+
return ot(ye(n.nodeType == 3 ? fe(n) : n, -t), t >= 0);
|
|
5485
5485
|
}
|
|
5486
5486
|
function ot(r, e) {
|
|
5487
5487
|
if (r.width == 0)
|
|
@@ -5524,7 +5524,7 @@ function Ul(r, e, t) {
|
|
|
5524
5524
|
if (l.nodeType == 1)
|
|
5525
5525
|
a = l.getClientRects();
|
|
5526
5526
|
else if (l.nodeType == 3)
|
|
5527
|
-
a =
|
|
5527
|
+
a = fe(l, 0, l.nodeValue.length).getClientRects();
|
|
5528
5528
|
else
|
|
5529
5529
|
continue;
|
|
5530
5530
|
for (let c = 0; c < a.length; c++) {
|
|
@@ -5557,10 +5557,10 @@ 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
|
|
@@ -5767,7 +5767,7 @@ class Tt {
|
|
|
5767
5767
|
for (let d = l; d > 0; d--) {
|
|
5768
5768
|
let h = this.children[d - 1];
|
|
5769
5769
|
if (h.size && h.dom.parentNode == this.contentDOM && !h.emptyChildAt(1)) {
|
|
5770
|
-
i =
|
|
5770
|
+
i = V(h.dom) + 1;
|
|
5771
5771
|
break;
|
|
5772
5772
|
}
|
|
5773
5773
|
e -= h.size;
|
|
@@ -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;
|
|
@@ -5817,14 +5817,14 @@ class Tt {
|
|
|
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 ((
|
|
5820
|
+
if ((oe || K) && e == t) {
|
|
5821
5821
|
let { node: f, offset: p } = l;
|
|
5822
5822
|
if (f.nodeType == 3) {
|
|
5823
5823
|
if (d = !!(p && f.nodeValue[p - 1] == `
|
|
5824
5824
|
`), d && p == f.nodeValue.length)
|
|
5825
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;
|
|
@@ -5836,7 +5836,7 @@ class Tt {
|
|
|
5836
5836
|
d = m && (m.nodeName == "BR" || m.contentEditable == "false");
|
|
5837
5837
|
}
|
|
5838
5838
|
}
|
|
5839
|
-
if (
|
|
5839
|
+
if (oe && u.focusNode && u.focusNode != a.node && u.focusNode.nodeType == 1) {
|
|
5840
5840
|
let f = u.focusNode.childNodes[u.focusOffset];
|
|
5841
5841
|
f && f.contentEditable == "false" && (i = !0);
|
|
5842
5842
|
}
|
|
@@ -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) {
|
|
@@ -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;
|
|
@@ -6067,7 +6067,7 @@ class Te extends Tt {
|
|
|
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);
|
|
@@ -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, h = this.isLocked(u) && !(e.isText && a.node && a.node.isText && a.nodeDOM.nodeValue == e.text && a.dirty !=
|
|
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
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
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 =
|
|
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
|
}
|
|
@@ -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;
|
|
@@ -6748,7 +6748,7 @@ 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;
|
|
@@ -6767,7 +6767,7 @@ function ca(r) {
|
|
|
6767
6767
|
{
|
|
6768
6768
|
let l = t.previousSibling;
|
|
6769
6769
|
for (; l && ft(l, -1); )
|
|
6770
|
-
i = t.parentNode, s =
|
|
6770
|
+
i = t.parentNode, s = V(l), l = l.previousSibling;
|
|
6771
6771
|
if (l)
|
|
6772
6772
|
t = l, n = Kt(t);
|
|
6773
6773
|
else {
|
|
@@ -6799,7 +6799,7 @@ function ua(r) {
|
|
|
6799
6799
|
{
|
|
6800
6800
|
let l = t.nextSibling;
|
|
6801
6801
|
for (; l && ft(l, 1); )
|
|
6802
|
-
s = l.parentNode, o =
|
|
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)
|
|
@@ -6829,7 +6829,7 @@ function da(r, e) {
|
|
|
6829
6829
|
}
|
|
6830
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)
|
|
@@ -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))
|
|
@@ -6926,24 +6926,24 @@ 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 ||
|
|
6944
|
+
if (t == 40 || te && t == 78 && n == "c")
|
|
6945
6945
|
return fa(r) || ui(r, 1, n) || Ue(r, 1);
|
|
6946
|
-
if (n == (
|
|
6946
|
+
if (n == (te ? "m" : "c") && (t == 66 || t == 73 || t == 89 || t == 90))
|
|
6947
6947
|
return !0;
|
|
6948
6948
|
}
|
|
6949
6949
|
return !1;
|
|
@@ -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
|
}
|
|
@@ -7269,12 +7269,12 @@ function Ra(r, e, t) {
|
|
|
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
|
|
@@ -7285,7 +7285,7 @@ function Ra(r, e, t) {
|
|
|
7285
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;
|
|
@@ -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))
|
|
@@ -7350,14 +7350,14 @@ 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];
|
|
@@ -7544,7 +7544,7 @@ _.drop = (r, e) => {
|
|
|
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) {
|
|
@@ -7986,7 +7986,7 @@ function Ha(r, e, t, n, i, s, o) {
|
|
|
7986
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,7 +8188,7 @@ 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
8194
|
let [d, h] = u;
|
|
@@ -8202,7 +8202,7 @@ class _a {
|
|
|
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)
|
|
@@ -8224,7 +8224,7 @@ class _a {
|
|
|
8224
8224
|
let { previousSibling: d, nextSibling: h } = e.addedNodes[u];
|
|
8225
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
|
}
|
|
@@ -8316,12 +8316,12 @@ 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
|
}
|
|
@@ -8330,59 +8330,59 @@ function tc(r, e, t, n, i) {
|
|
|
8330
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
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
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 ||
|
|
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));
|
|
@@ -8539,7 +8539,7 @@ class sc {
|
|
|
8539
8539
|
let p = J ? this.trackWrites = this.domSelectionRange().focusNode : null;
|
|
8540
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
|
-
f || !(this.input.mouseDown && this.domObserver.currentSelection.eq(this.domSelectionRange()) && aa(this)) ?
|
|
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
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
|
}
|
|
@@ -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,10 +8926,10 @@ 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";
|
|
@@ -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,7 +9219,7 @@ 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;
|
|
@@ -9233,9 +9233,9 @@ function Cc(r) {
|
|
|
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), h =
|
|
9238
|
-
if (h || (s[0] = l ? { type: l } : null, h =
|
|
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
9241
|
let f = u.mapping.map(n.before(o)), p = u.doc.resolve(f);
|
|
@@ -9263,7 +9263,7 @@ function co(r, e, t, n) {
|
|
|
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;
|
|
@@ -9283,7 +9283,7 @@ function co(r, e, t, n) {
|
|
|
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
9383
|
for (let u = e.startIndex, d = e.endIndex, h = !0; u < d; u++, h = !1)
|
|
9384
|
-
!h &&
|
|
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;
|
|
@@ -9411,7 +9411,7 @@ function Rc(r, e, t) {
|
|
|
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
9413
|
let d = s.pos, h = d + o.nodeSize;
|
|
9414
|
-
return n.step(new
|
|
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) {
|
|
@@ -9426,7 +9426,7 @@ function Bc(r) {
|
|
|
9426
9426
|
return !1;
|
|
9427
9427
|
if (t) {
|
|
9428
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
|
|
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
|
};
|
|
@@ -9609,7 +9609,7 @@ function ho(r) {
|
|
|
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?`);
|
|
@@ -9998,7 +9998,7 @@ function Uc(r) {
|
|
|
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,7 +10008,7 @@ function Uc(r) {
|
|
|
10008
10008
|
pasteEvent: o,
|
|
10009
10009
|
dropEvent: l
|
|
10010
10010
|
});
|
|
10011
|
-
d.push(
|
|
10011
|
+
d.push(I);
|
|
10012
10012
|
});
|
|
10013
10013
|
}), d.every((f) => f !== null);
|
|
10014
10014
|
}
|
|
@@ -10091,13 +10091,13 @@ function Gc(r) {
|
|
|
10091
10091
|
if (S) {
|
|
10092
10092
|
let { text: A } = y;
|
|
10093
10093
|
typeof A == "string" ? A = A : A = Sr(b.from(A), f.schema);
|
|
10094
|
-
const { from: M } = y,
|
|
10094
|
+
const { from: M } = y, I = M + A.length, W = _c(A);
|
|
10095
10095
|
return a({
|
|
10096
10096
|
rule: u,
|
|
10097
10097
|
state: f,
|
|
10098
10098
|
from: M,
|
|
10099
|
-
to: { b:
|
|
10100
|
-
pasteEvt:
|
|
10099
|
+
to: { b: I },
|
|
10100
|
+
pasteEvt: W
|
|
10101
10101
|
});
|
|
10102
10102
|
}
|
|
10103
10103
|
const w = h.doc.content.findDiffStart(f.doc.content), v = h.doc.content.findDiffEnd(f.doc.content);
|
|
@@ -10237,7 +10237,7 @@ 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 [];
|
|
@@ -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);
|
|
@@ -10385,7 +10385,7 @@ const Xc = Y.create({
|
|
|
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,7 +10459,7 @@ 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 h =
|
|
10462
|
+
const h = T.create(o, d.from, d.to);
|
|
10463
10463
|
t.setSelection(h);
|
|
10464
10464
|
}
|
|
10465
10465
|
}
|
|
@@ -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,7 +10486,7 @@ 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
10491
|
function hu() {
|
|
10492
10492
|
return navigator.platform === "Android" || /android/i.test(navigator.userAgent);
|
|
@@ -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;
|
|
@@ -10700,7 +10700,7 @@ 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 ?
|
|
10703
|
+
const { from: n, to: i, empty: s } = r.selection, o = e ? L(e, r.schema) : null, l = [];
|
|
10704
10704
|
r.doc.nodesBetween(n, i, (d, h) => {
|
|
10705
10705
|
if (d.isText)
|
|
10706
10706
|
return;
|
|
@@ -10715,10 +10715,10 @@ function Ct(r, e, t = {}) {
|
|
|
10715
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
10724
|
function hn(r, e) {
|
|
@@ -10731,7 +10731,7 @@ function Di(r, e) {
|
|
|
10731
10731
|
const Pu = (r, e) => ({ tr: t, state: n, dispatch: i }) => {
|
|
10732
10732
|
let s = null, o = null;
|
|
10733
10733
|
const l = hn(typeof r == "string" ? r : r.name, n.schema);
|
|
10734
|
-
return l ? (l === "node" && (s =
|
|
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
|
});
|
|
@@ -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,7 +10959,7 @@ 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
10965
|
const d = a.parentOffset === a.parent.content.size, h = l.depth === 0 ? void 0 : Wu(l.node(-1).contentMatchAt(l.indexAfter(-1)));
|
|
@@ -10968,14 +10968,14 @@ const ed = ({ keepMarks: r = !0 } = {}) => ({ tr: e, state: t, dispatch: n, edit
|
|
|
10968
10968
|
type: h,
|
|
10969
10969
|
attrs: u
|
|
10970
10970
|
}
|
|
10971
|
-
] : void 0, p =
|
|
10972
|
-
if (!f && !p &&
|
|
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
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
10980
|
l.node(-1).canReplaceWith(g.index(), g.index() + 1, h) && e.setNodeMarkup(e.mapping.map(l.before()), h);
|
|
10981
10981
|
}
|
|
@@ -10984,7 +10984,7 @@ const ed = ({ keepMarks: r = !0 } = {}) => ({ tr: e, state: t, dispatch: n, edit
|
|
|
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);
|
|
@@ -10997,8 +10997,8 @@ const ed = ({ keepMarks: r = !0 } = {}) => ({ tr: e, state: t, dispatch: n, edit
|
|
|
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
11003
|
...Ft(h, a.node().type.name, a.node().attrs),
|
|
11004
11004
|
...e
|
|
@@ -11006,12 +11006,12 @@ const ed = ({ keepMarks: r = !0 } = {}) => ({ tr: e, state: t, dispatch: n, edit
|
|
|
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
|
}
|
|
@@ -11027,7 +11027,7 @@ const ed = ({ keepMarks: r = !0 } = {}) => ({ tr: e, state: t, dispatch: n, edit
|
|
|
11027
11027
|
{ type: l, attrs: p },
|
|
11028
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,7 +11056,7 @@ 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: h } = i.extensionManager, f =
|
|
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);
|
|
@@ -11067,18 +11067,18 @@ const ed = ({ keepMarks: r = !0 } = {}) => ({ tr: e, state: t, dispatch: n, edit
|
|
|
11067
11067
|
return a().command(() => (s.setNodeMarkup(A.pos, f), !0)).command(() => Dn(s, f)).command(() => In(s, f)).run();
|
|
11068
11068
|
}
|
|
11069
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),
|
|
11071
|
-
return s.ensureMarks(
|
|
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
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;
|
|
@@ -11122,7 +11122,7 @@ const ed = ({ keepMarks: r = !0 } = {}) => ({ tr: e, state: t, dispatch: n, edit
|
|
|
11122
11122
|
}, cd = (r, e = {}) => ({ tr: t, state: n, dispatch: i }) => {
|
|
11123
11123
|
let s = null, o = null;
|
|
11124
11124
|
const l = hn(typeof r == "string" ? r : r.name, n.schema);
|
|
11125
|
-
return l ? (l === "node" && (s =
|
|
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
11127
|
let d, h, f, p;
|
|
11128
11128
|
t.selection.empty ? n.doc.nodesBetween(c, u, (m, g) => {
|
|
@@ -11151,10 +11151,10 @@ const ed = ({ keepMarks: r = !0 } = {}) => ({ tr: e, state: t, dispatch: n, edit
|
|
|
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
11160
|
var hd = /* @__PURE__ */ Object.freeze({
|
|
@@ -11230,7 +11230,7 @@ const fd = 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 fd = 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;
|
|
@@ -11335,7 +11335,7 @@ const fd = 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;
|
|
@@ -11363,7 +11363,7 @@ const fd = 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 fd = 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
|
}
|
|
@@ -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
|
}
|
|
@@ -12097,24 +12097,24 @@ class ie {
|
|
|
12097
12097
|
return;
|
|
12098
12098
|
}
|
|
12099
12099
|
if (i) {
|
|
12100
|
-
u.push(new
|
|
12100
|
+
u.push(new ae(d.map));
|
|
12101
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
|
|
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]), h = new
|
|
12113
|
+
let d = e.steps[u].invert(e.docs[u]), h = new ae(e.mapping.maps[u], d, t), f;
|
|
12114
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
|
|
@@ -12146,14 +12146,14 @@ class ie {
|
|
|
12146
12146
|
let p = s.maps[f];
|
|
12147
12147
|
if (h.step) {
|
|
12148
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
|
|
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
12154
|
for (let h = t; h < o; h++)
|
|
12155
|
-
c.push(new
|
|
12156
|
-
let u = this.items.slice(0, i).append(c).append(n), d = new
|
|
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
|
|
12181
|
+
let d = new ae(c.invert(), a, u), h, f = i.length - 1;
|
|
12182
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 = [];
|
|
@@ -12367,7 +12367,7 @@ const Eo = Mo(!1, !0), To = Mo(!0, !0), Pd = Y.create({
|
|
|
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
|
})
|
|
@@ -12687,7 +12687,7 @@ function Hd(r, e, t = null) {
|
|
|
12687
12687
|
const h = r.doc.nodeAt(u);
|
|
12688
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,16 +12795,16 @@ 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;
|
|
@@ -12849,7 +12849,7 @@ const qd = Oo.extend({
|
|
|
12849
12849
|
}), h = c + u.nodeSize - 1;
|
|
12850
12850
|
n = n.insert(h, d);
|
|
12851
12851
|
const f = h;
|
|
12852
|
-
n.doc.nodeAt(f) && (n = n.setSelection(
|
|
12852
|
+
n.doc.nodeAt(f) && (n = n.setSelection(T.create(
|
|
12853
12853
|
n.doc,
|
|
12854
12854
|
f + 1
|
|
12855
12855
|
)));
|
|
@@ -13108,7 +13108,7 @@ class eh {
|
|
|
13108
13108
|
for (const d of u) {
|
|
13109
13109
|
const h = e.state.doc.resolve(d.pos);
|
|
13110
13110
|
let f = h.node(), p = null;
|
|
13111
|
-
f.isText || e.state.doc.nodesBetween(d.pos, d.pos + d.length, (M,
|
|
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
|
});
|
|
@@ -13122,15 +13122,16 @@ class eh {
|
|
|
13122
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";
|
|
@@ -13202,19 +13203,16 @@ class nh {
|
|
|
13202
13203
|
* @param {Object} schemaDef - The schema definition.
|
|
13203
13204
|
* @param {Element} toolbarSlot - The toolbar slot element.
|
|
13204
13205
|
*/
|
|
13205
|
-
constructor(e, t
|
|
13206
|
+
constructor(e, t) {
|
|
13206
13207
|
this.editor = e.tiptap, this.toolbar = e.querySelector(".toolbar"), this.schemaDef = t, this.addButtons(t);
|
|
13207
|
-
const
|
|
13208
|
-
|
|
13209
|
-
|
|
13210
|
-
const
|
|
13211
|
-
|
|
13212
|
-
});
|
|
13213
|
-
const s = document.createElement("li");
|
|
13214
|
-
s.appendChild(i), this.toolbar.appendChild(s), n && Array.from(n.children).forEach((l) => {
|
|
13215
|
-
const a = document.createElement("li");
|
|
13216
|
-
a.appendChild(l.cloneNode(!0)), this.toolbar.appendChild(a);
|
|
13208
|
+
const n = document.createElement("a");
|
|
13209
|
+
n.href = "#", n.dataset.tooltip = "Toggle debug mode", n.dataset.placement = "bottom", n.className = "outline toolbar-button", n.innerHTML = '<i class="bi bi-question-circle"></i>', n.title = "Toggle debug mode", n.addEventListener("click", (s) => {
|
|
13210
|
+
s.preventDefault();
|
|
13211
|
+
const o = this.toolbar.closest("jinn-tap");
|
|
13212
|
+
o.hasAttribute("debug") ? o.removeAttribute("debug") : o.setAttribute("debug", "");
|
|
13217
13213
|
});
|
|
13214
|
+
const i = document.createElement("li");
|
|
13215
|
+
i.appendChild(n), this.toolbar.appendChild(i);
|
|
13218
13216
|
}
|
|
13219
13217
|
addButtons(e) {
|
|
13220
13218
|
const t = Object.entries(e.schema).sort(([, i], [, s]) => {
|
|
@@ -13869,26 +13867,25 @@ class oh extends HTMLElement {
|
|
|
13869
13867
|
this.setupEditor();
|
|
13870
13868
|
}
|
|
13871
13869
|
setupEditor() {
|
|
13872
|
-
const e =
|
|
13873
|
-
|
|
13874
|
-
const n = t.querySelector('[slot="toolbar"]');
|
|
13875
|
-
n && n.remove();
|
|
13876
|
-
const i = t.innerHTML.trim();
|
|
13877
|
-
this.innerHTML = `
|
|
13870
|
+
const e = document.createElement("div");
|
|
13871
|
+
e.innerHTML = this.innerHTML, this.innerHTML = `
|
|
13878
13872
|
<nav>
|
|
13879
|
-
<ul class="toolbar"
|
|
13873
|
+
<ul class="toolbar">
|
|
13874
|
+
<slot name="toolbar"></slot>
|
|
13875
|
+
</ul>
|
|
13880
13876
|
</nav>
|
|
13881
13877
|
<div class="editor-area"></div>
|
|
13882
13878
|
<div class="aside">
|
|
13879
|
+
<slot name="aside"></slot>
|
|
13883
13880
|
<nav class="navigation-panel" aria-label="breadcrumb"></nav>
|
|
13884
13881
|
<div class="attribute-panel"></div>
|
|
13885
13882
|
</div>
|
|
13886
|
-
|
|
13887
|
-
const
|
|
13883
|
+
`, this.applySlots(e);
|
|
13884
|
+
const t = e.innerHTML.trim(), n = Ud($t);
|
|
13888
13885
|
this.editor = new wd({
|
|
13889
13886
|
element: this.querySelector(".editor-area"),
|
|
13890
13887
|
extensions: [
|
|
13891
|
-
...
|
|
13888
|
+
...n,
|
|
13892
13889
|
Kd,
|
|
13893
13890
|
Pd,
|
|
13894
13891
|
Rd.configure({
|
|
@@ -13896,7 +13893,7 @@ class oh extends HTMLElement {
|
|
|
13896
13893
|
includeChildren: !0
|
|
13897
13894
|
})
|
|
13898
13895
|
],
|
|
13899
|
-
content: this._pendingContent ||
|
|
13896
|
+
content: this._pendingContent || t || `
|
|
13900
13897
|
<tei-div>
|
|
13901
13898
|
<tei-p></tei-p>
|
|
13902
13899
|
</tei-div>
|
|
@@ -13906,9 +13903,9 @@ class oh extends HTMLElement {
|
|
|
13906
13903
|
this.dispatchContentChange(), this.dispatchEvent(new CustomEvent("ready"));
|
|
13907
13904
|
},
|
|
13908
13905
|
onUpdate: () => this.dispatchContentChange()
|
|
13909
|
-
}), this.toolbar = new nh(this, $t
|
|
13910
|
-
const
|
|
13911
|
-
|
|
13906
|
+
}), this.toolbar = new nh(this, $t), this.attributePanel = new eh(this, $t), this.navigationPanel = new th(this, this.attributePanel);
|
|
13907
|
+
const i = this.getAttribute("url");
|
|
13908
|
+
i && this.loadFromUrl(i);
|
|
13912
13909
|
}
|
|
13913
13910
|
dispatchContentChange() {
|
|
13914
13911
|
this.dispatchEvent(new CustomEvent("content-change", {
|
|
@@ -13938,6 +13935,19 @@ class oh extends HTMLElement {
|
|
|
13938
13935
|
get tiptap() {
|
|
13939
13936
|
return this.editor;
|
|
13940
13937
|
}
|
|
13938
|
+
applySlots(e) {
|
|
13939
|
+
const t = this.querySelectorAll("slot");
|
|
13940
|
+
for (const n of t) {
|
|
13941
|
+
const i = n.name, s = e.querySelector(`[slot="${i}"]`);
|
|
13942
|
+
if (s) {
|
|
13943
|
+
const o = document.createElement("div");
|
|
13944
|
+
o.innerHTML = s.outerHTML;
|
|
13945
|
+
const l = n.parentNode;
|
|
13946
|
+
Array.from(o.children).forEach((c) => l.insertBefore(c, n)), s.remove();
|
|
13947
|
+
}
|
|
13948
|
+
}
|
|
13949
|
+
return t.forEach((n) => n.remove()), e;
|
|
13950
|
+
}
|
|
13941
13951
|
}
|
|
13942
13952
|
customElements.define("jinn-tap", oh);
|
|
13943
13953
|
export {
|