@jinntec/jinntap 1.5.0 → 1.6.0
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 +290 -266
- package/dist/jinn-tap.umd.js +18 -18
- package/package.json +1 -1
package/dist/jinn-tap.es.js
CHANGED
|
@@ -428,7 +428,7 @@ function jt(r, e) {
|
|
|
428
428
|
}
|
|
429
429
|
return !0;
|
|
430
430
|
}
|
|
431
|
-
let
|
|
431
|
+
let v = class zn {
|
|
432
432
|
/**
|
|
433
433
|
@internal
|
|
434
434
|
*/
|
|
@@ -533,7 +533,7 @@ let D = class zn {
|
|
|
533
533
|
return t.sort((n, i) => n.type.rank - i.type.rank), t;
|
|
534
534
|
}
|
|
535
535
|
};
|
|
536
|
-
|
|
536
|
+
v.none = [];
|
|
537
537
|
class Ht extends Error {
|
|
538
538
|
}
|
|
539
539
|
class k {
|
|
@@ -831,7 +831,7 @@ class mt {
|
|
|
831
831
|
marks() {
|
|
832
832
|
let e = this.parent, t = this.index();
|
|
833
833
|
if (e.content.size == 0)
|
|
834
|
-
return
|
|
834
|
+
return v.none;
|
|
835
835
|
if (this.textOffset)
|
|
836
836
|
return e.child(t).marks;
|
|
837
837
|
let n = e.maybeChild(t - 1), i = e.maybeChild(t);
|
|
@@ -994,11 +994,11 @@ class Jt {
|
|
|
994
994
|
}
|
|
995
995
|
}
|
|
996
996
|
const Ro = /* @__PURE__ */ Object.create(null);
|
|
997
|
-
let
|
|
997
|
+
let ue = class Ln {
|
|
998
998
|
/**
|
|
999
999
|
@internal
|
|
1000
1000
|
*/
|
|
1001
|
-
constructor(e, t, n, i =
|
|
1001
|
+
constructor(e, t, n, i = v.none) {
|
|
1002
1002
|
this.type = e, this.attrs = t, this.marks = i, this.content = n || b.empty;
|
|
1003
1003
|
}
|
|
1004
1004
|
/**
|
|
@@ -1112,7 +1112,7 @@ let Me = class Ln {
|
|
|
1112
1112
|
attributes, and marks.
|
|
1113
1113
|
*/
|
|
1114
1114
|
hasMarkup(e, t, n) {
|
|
1115
|
-
return this.type == e && jt(this.attrs, t || e.defaultAttrs || Ro) &&
|
|
1115
|
+
return this.type == e && jt(this.attrs, t || e.defaultAttrs || Ro) && v.sameSet(this.marks, n || v.none);
|
|
1116
1116
|
}
|
|
1117
1117
|
/**
|
|
1118
1118
|
Create a new node with the same markup as this node, containing
|
|
@@ -1322,12 +1322,12 @@ let Me = class Ln {
|
|
|
1322
1322
|
*/
|
|
1323
1323
|
check() {
|
|
1324
1324
|
this.type.checkContent(this.content), this.type.checkAttrs(this.attrs);
|
|
1325
|
-
let e =
|
|
1325
|
+
let e = v.none;
|
|
1326
1326
|
for (let t = 0; t < this.marks.length; t++) {
|
|
1327
1327
|
let n = this.marks[t];
|
|
1328
1328
|
n.type.checkAttrs(n.attrs), e = n.addToSet(e);
|
|
1329
1329
|
}
|
|
1330
|
-
if (!
|
|
1330
|
+
if (!v.sameSet(e, this.marks))
|
|
1331
1331
|
throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map((t) => t.type.name)}`);
|
|
1332
1332
|
this.content.forEach((t) => t.check());
|
|
1333
1333
|
}
|
|
@@ -1363,8 +1363,8 @@ let Me = class Ln {
|
|
|
1363
1363
|
return s.type.checkAttrs(s.attrs), s;
|
|
1364
1364
|
}
|
|
1365
1365
|
};
|
|
1366
|
-
|
|
1367
|
-
class qt extends
|
|
1366
|
+
ue.prototype.text = void 0;
|
|
1367
|
+
class qt extends ue {
|
|
1368
1368
|
/**
|
|
1369
1369
|
@internal
|
|
1370
1370
|
*/
|
|
@@ -1870,7 +1870,7 @@ let Dr = class es {
|
|
|
1870
1870
|
create(e = null, t, n) {
|
|
1871
1871
|
if (this.isText)
|
|
1872
1872
|
throw new Error("NodeType.create can't construct text nodes");
|
|
1873
|
-
return new
|
|
1873
|
+
return new ue(this, this.computeAttrs(e), b.from(t), v.setFrom(n));
|
|
1874
1874
|
}
|
|
1875
1875
|
/**
|
|
1876
1876
|
Like [`create`](https://prosemirror.net/docs/ref/#model.NodeType.create), but check the given content
|
|
@@ -1878,7 +1878,7 @@ let Dr = class es {
|
|
|
1878
1878
|
if it doesn't match.
|
|
1879
1879
|
*/
|
|
1880
1880
|
createChecked(e = null, t, n) {
|
|
1881
|
-
return t = b.from(t), this.checkContent(t), new
|
|
1881
|
+
return t = b.from(t), this.checkContent(t), new ue(this, this.computeAttrs(e), t, v.setFrom(n));
|
|
1882
1882
|
}
|
|
1883
1883
|
/**
|
|
1884
1884
|
Like [`create`](https://prosemirror.net/docs/ref/#model.NodeType.create), but see if it is
|
|
@@ -1896,7 +1896,7 @@ let Dr = class es {
|
|
|
1896
1896
|
t = o.append(t);
|
|
1897
1897
|
}
|
|
1898
1898
|
let i = this.contentMatch.matchFragment(t), s = i && i.fillBefore(b.empty, !0);
|
|
1899
|
-
return s ? new
|
|
1899
|
+
return s ? new ue(this, e, t.append(s), v.setFrom(n)) : null;
|
|
1900
1900
|
}
|
|
1901
1901
|
/**
|
|
1902
1902
|
Returns true if the given fragment is valid content for this node
|
|
@@ -1952,7 +1952,7 @@ let Dr = class es {
|
|
|
1952
1952
|
let t;
|
|
1953
1953
|
for (let n = 0; n < e.length; n++)
|
|
1954
1954
|
this.allowsMarkType(e[n].type) ? t && t.push(e[n]) : t || (t = e.slice(0, n));
|
|
1955
|
-
return t ? t.length ? t :
|
|
1955
|
+
return t ? t.length ? t : v.none : e;
|
|
1956
1956
|
}
|
|
1957
1957
|
/**
|
|
1958
1958
|
@internal
|
|
@@ -1993,7 +1993,7 @@ class tn {
|
|
|
1993
1993
|
constructor(e, t, n, i) {
|
|
1994
1994
|
this.name = e, this.rank = t, this.schema = n, this.spec = i, this.attrs = Qi(e, i.attrs), this.excluded = null;
|
|
1995
1995
|
let s = Yi(this.attrs);
|
|
1996
|
-
this.instance = s ? new
|
|
1996
|
+
this.instance = s ? new v(this, s) : null;
|
|
1997
1997
|
}
|
|
1998
1998
|
/**
|
|
1999
1999
|
Create a mark of this type. `attrs` may be `null` or an object
|
|
@@ -2001,7 +2001,7 @@ class tn {
|
|
|
2001
2001
|
they have defaults, will be added.
|
|
2002
2002
|
*/
|
|
2003
2003
|
create(e = null) {
|
|
2004
|
-
return !e && this.instance ? this.instance : new
|
|
2004
|
+
return !e && this.instance ? this.instance : new v(this, Xi(this.attrs, e));
|
|
2005
2005
|
}
|
|
2006
2006
|
/**
|
|
2007
2007
|
@internal
|
|
@@ -2092,7 +2092,7 @@ class ts {
|
|
|
2092
2092
|
*/
|
|
2093
2093
|
text(e, t) {
|
|
2094
2094
|
let n = this.nodes.text;
|
|
2095
|
-
return new qt(n, n.defaultAttrs, e,
|
|
2095
|
+
return new qt(n, n.defaultAttrs, e, v.setFrom(t));
|
|
2096
2096
|
}
|
|
2097
2097
|
/**
|
|
2098
2098
|
Create a mark with the given type and attributes.
|
|
@@ -2105,14 +2105,14 @@ class ts {
|
|
|
2105
2105
|
bound.
|
|
2106
2106
|
*/
|
|
2107
2107
|
nodeFromJSON(e) {
|
|
2108
|
-
return
|
|
2108
|
+
return ue.fromJSON(this, e);
|
|
2109
2109
|
}
|
|
2110
2110
|
/**
|
|
2111
2111
|
Deserialize a mark from its JSON representation. This method is
|
|
2112
2112
|
bound.
|
|
2113
2113
|
*/
|
|
2114
2114
|
markFromJSON(e) {
|
|
2115
|
-
return
|
|
2115
|
+
return v.fromJSON(this, e);
|
|
2116
2116
|
}
|
|
2117
2117
|
/**
|
|
2118
2118
|
@internal
|
|
@@ -2173,7 +2173,7 @@ let dt = class $n {
|
|
|
2173
2173
|
*/
|
|
2174
2174
|
parse(e, t = {}) {
|
|
2175
2175
|
let n = new Rr(this, t, !1);
|
|
2176
|
-
return n.addAll(e,
|
|
2176
|
+
return n.addAll(e, v.none, t.from, t.to), n.finish();
|
|
2177
2177
|
}
|
|
2178
2178
|
/**
|
|
2179
2179
|
Parses the content of the given DOM node, like
|
|
@@ -2185,7 +2185,7 @@ let dt = class $n {
|
|
|
2185
2185
|
*/
|
|
2186
2186
|
parseSlice(e, t = {}) {
|
|
2187
2187
|
let n = new Rr(this, t, !0);
|
|
2188
|
-
return n.addAll(e,
|
|
2188
|
+
return n.addAll(e, v.none, t.from, t.to), k.maxOpen(n.finish());
|
|
2189
2189
|
}
|
|
2190
2190
|
/**
|
|
2191
2191
|
@internal
|
|
@@ -2307,7 +2307,7 @@ function Pr(r, e, t) {
|
|
|
2307
2307
|
}
|
|
2308
2308
|
class vt {
|
|
2309
2309
|
constructor(e, t, n, i, s, o) {
|
|
2310
|
-
this.type = e, this.attrs = t, this.marks = n, this.solid = i, this.options = o, this.content = [], this.activeMarks =
|
|
2310
|
+
this.type = e, this.attrs = t, this.marks = n, this.solid = i, this.options = o, this.content = [], this.activeMarks = v.none, this.match = s || (o & Bt ? null : e.contentMatch);
|
|
2311
2311
|
}
|
|
2312
2312
|
findWrapping(e) {
|
|
2313
2313
|
if (!this.match) {
|
|
@@ -2342,7 +2342,7 @@ class Rr {
|
|
|
2342
2342
|
constructor(e, t, n) {
|
|
2343
2343
|
this.parser = e, this.options = t, this.isOpen = n, this.open = 0, this.localPreserveWS = !1;
|
|
2344
2344
|
let i = t.topNode, s, o = Pr(null, t.preserveWhitespace, 0) | (n ? Bt : 0);
|
|
2345
|
-
i ? s = new vt(i.type, i.attrs,
|
|
2345
|
+
i ? s = new vt(i.type, i.attrs, v.none, !0, t.topMatch || i.type.contentMatch, o) : n ? s = new vt(null, null, v.none, !0, null, o) : s = new vt(e.schema.topNodeType, null, v.none, !0, null, o), this.nodes = [s], this.find = t.findPositions, this.needsBlock = !1;
|
|
2346
2346
|
}
|
|
2347
2347
|
get top() {
|
|
2348
2348
|
return this.nodes[this.open];
|
|
@@ -2492,7 +2492,7 @@ class Rr {
|
|
|
2492
2492
|
this.closeExtra();
|
|
2493
2493
|
let i = this.top;
|
|
2494
2494
|
i.match && (i.match = i.match.matchType(e.type));
|
|
2495
|
-
let s =
|
|
2495
|
+
let s = v.none;
|
|
2496
2496
|
for (let o of n.concat(e.marks))
|
|
2497
2497
|
(i.type ? i.type.allowsMarkType(o.type) : zr(o.type, e.type)) && (s = o.addToSet(s));
|
|
2498
2498
|
return i.content.push(e.mark(s)), !0;
|
|
@@ -2512,7 +2512,7 @@ class Rr {
|
|
|
2512
2512
|
o.match = o.match && o.match.matchType(e);
|
|
2513
2513
|
let l = Pr(e, s, o.options);
|
|
2514
2514
|
o.options & Bt && o.content.length == 0 && (l |= Bt);
|
|
2515
|
-
let a =
|
|
2515
|
+
let a = v.none;
|
|
2516
2516
|
return n = n.filter((c) => (o.type ? o.type.allowsMarkType(c.type) : zr(c.type, e)) ? (a = c.addToSet(a), !1) : !0), this.nodes.push(new vt(e, t, a, i, null, l)), this.open++, n;
|
|
2517
2517
|
}
|
|
2518
2518
|
// Make sure all nodes above this.open are finished and added to
|
|
@@ -3068,7 +3068,7 @@ class yt {
|
|
|
3068
3068
|
}
|
|
3069
3069
|
}
|
|
3070
3070
|
const bn = /* @__PURE__ */ Object.create(null);
|
|
3071
|
-
class
|
|
3071
|
+
class K {
|
|
3072
3072
|
/**
|
|
3073
3073
|
Get the step map that represents the changes made by this step,
|
|
3074
3074
|
and which can be used to transform between positions in the old
|
|
@@ -3151,7 +3151,7 @@ function sr(r, e, t) {
|
|
|
3151
3151
|
}
|
|
3152
3152
|
return b.fromArray(n);
|
|
3153
3153
|
}
|
|
3154
|
-
class
|
|
3154
|
+
class Ce extends K {
|
|
3155
3155
|
/**
|
|
3156
3156
|
Create a mark step.
|
|
3157
3157
|
*/
|
|
@@ -3167,10 +3167,10 @@ class Se extends q {
|
|
|
3167
3167
|
}
|
|
3168
3168
|
map(e) {
|
|
3169
3169
|
let t = e.mapResult(this.from, 1), n = e.mapResult(this.to, -1);
|
|
3170
|
-
return t.deleted && n.deleted || t.pos >= n.pos ? null : new
|
|
3170
|
+
return t.deleted && n.deleted || t.pos >= n.pos ? null : new Ce(t.pos, n.pos, this.mark);
|
|
3171
3171
|
}
|
|
3172
3172
|
merge(e) {
|
|
3173
|
-
return e instanceof
|
|
3173
|
+
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;
|
|
3174
3174
|
}
|
|
3175
3175
|
toJSON() {
|
|
3176
3176
|
return {
|
|
@@ -3186,11 +3186,11 @@ class Se extends q {
|
|
|
3186
3186
|
static fromJSON(e, t) {
|
|
3187
3187
|
if (typeof t.from != "number" || typeof t.to != "number")
|
|
3188
3188
|
throw new RangeError("Invalid input for AddMarkStep.fromJSON");
|
|
3189
|
-
return new
|
|
3189
|
+
return new Ce(t.from, t.to, e.markFromJSON(t.mark));
|
|
3190
3190
|
}
|
|
3191
3191
|
}
|
|
3192
|
-
|
|
3193
|
-
class ce extends
|
|
3192
|
+
K.jsonID("addMark", Ce);
|
|
3193
|
+
class ce extends K {
|
|
3194
3194
|
/**
|
|
3195
3195
|
Create a mark-removing step.
|
|
3196
3196
|
*/
|
|
@@ -3202,7 +3202,7 @@ class ce extends q {
|
|
|
3202
3202
|
return R.fromReplace(e, this.from, this.to, n);
|
|
3203
3203
|
}
|
|
3204
3204
|
invert() {
|
|
3205
|
-
return new
|
|
3205
|
+
return new Ce(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);
|
|
@@ -3228,8 +3228,8 @@ class ce extends q {
|
|
|
3228
3228
|
return new ce(t.from, t.to, e.markFromJSON(t.mark));
|
|
3229
3229
|
}
|
|
3230
3230
|
}
|
|
3231
|
-
|
|
3232
|
-
class
|
|
3231
|
+
K.jsonID("removeMark", ce);
|
|
3232
|
+
class we extends K {
|
|
3233
3233
|
/**
|
|
3234
3234
|
Create a node mark step.
|
|
3235
3235
|
*/
|
|
@@ -3250,15 +3250,15 @@ class Ce extends q {
|
|
|
3250
3250
|
if (n.length == t.marks.length) {
|
|
3251
3251
|
for (let i = 0; i < t.marks.length; i++)
|
|
3252
3252
|
if (!t.marks[i].isInSet(n))
|
|
3253
|
-
return new
|
|
3254
|
-
return new
|
|
3253
|
+
return new we(this.pos, t.marks[i]);
|
|
3254
|
+
return new we(this.pos, this.mark);
|
|
3255
3255
|
}
|
|
3256
3256
|
}
|
|
3257
3257
|
return new et(this.pos, this.mark);
|
|
3258
3258
|
}
|
|
3259
3259
|
map(e) {
|
|
3260
3260
|
let t = e.mapResult(this.pos, 1);
|
|
3261
|
-
return t.deletedAfter ? null : new
|
|
3261
|
+
return t.deletedAfter ? null : new we(t.pos, this.mark);
|
|
3262
3262
|
}
|
|
3263
3263
|
toJSON() {
|
|
3264
3264
|
return { stepType: "addNodeMark", pos: this.pos, mark: this.mark.toJSON() };
|
|
@@ -3269,11 +3269,11 @@ class Ce extends q {
|
|
|
3269
3269
|
static fromJSON(e, t) {
|
|
3270
3270
|
if (typeof t.pos != "number")
|
|
3271
3271
|
throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");
|
|
3272
|
-
return new
|
|
3272
|
+
return new we(t.pos, e.markFromJSON(t.mark));
|
|
3273
3273
|
}
|
|
3274
3274
|
}
|
|
3275
|
-
|
|
3276
|
-
class et extends
|
|
3275
|
+
K.jsonID("addNodeMark", we);
|
|
3276
|
+
class et extends K {
|
|
3277
3277
|
/**
|
|
3278
3278
|
Create a mark-removing step.
|
|
3279
3279
|
*/
|
|
@@ -3289,7 +3289,7 @@ class et extends q {
|
|
|
3289
3289
|
}
|
|
3290
3290
|
invert(e) {
|
|
3291
3291
|
let t = e.nodeAt(this.pos);
|
|
3292
|
-
return !t || !this.mark.isInSet(t.marks) ? this : new
|
|
3292
|
+
return !t || !this.mark.isInSet(t.marks) ? this : new we(this.pos, this.mark);
|
|
3293
3293
|
}
|
|
3294
3294
|
map(e) {
|
|
3295
3295
|
let t = e.mapResult(this.pos, 1);
|
|
@@ -3307,8 +3307,8 @@ class et extends q {
|
|
|
3307
3307
|
return new et(t.pos, e.markFromJSON(t.mark));
|
|
3308
3308
|
}
|
|
3309
3309
|
}
|
|
3310
|
-
|
|
3311
|
-
class P extends
|
|
3310
|
+
K.jsonID("removeNodeMark", et);
|
|
3311
|
+
class P extends K {
|
|
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
|
|
@@ -3359,8 +3359,8 @@ class P extends q {
|
|
|
3359
3359
|
return new P(t.from, t.to, k.fromJSON(e, t.slice), !!t.structure);
|
|
3360
3360
|
}
|
|
3361
3361
|
}
|
|
3362
|
-
|
|
3363
|
-
class z extends
|
|
3362
|
+
K.jsonID("replace", P);
|
|
3363
|
+
class z extends K {
|
|
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
|
|
@@ -3417,7 +3417,7 @@ class z extends q {
|
|
|
3417
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
|
-
|
|
3420
|
+
K.jsonID("replaceAround", z);
|
|
3421
3421
|
function Hn(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; )
|
|
@@ -3442,7 +3442,7 @@ function tl(r, e, t, n) {
|
|
|
3442
3442
|
let f = Math.max(c, e), h = Math.min(c + a.nodeSize, t), p = n.addToSet(d);
|
|
3443
3443
|
for (let m = 0; m < d.length; m++)
|
|
3444
3444
|
d[m].isInSet(p) || (o && o.to == f && o.mark.eq(d[m]) ? o.to = h : i.push(o = new ce(f, h, d[m])));
|
|
3445
|
-
l && l.to == f ? l.to = h : s.push(l = new
|
|
3445
|
+
l && l.to == f ? l.to = h : s.push(l = new Ce(f, h, n));
|
|
3446
3446
|
}
|
|
3447
3447
|
}), i.forEach((a) => r.step(a)), s.forEach((a) => r.step(a));
|
|
3448
3448
|
}
|
|
@@ -3609,7 +3609,7 @@ function ul(r, e, t, n, i) {
|
|
|
3609
3609
|
throw new RangeError("Invalid content for node type " + t.name);
|
|
3610
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 ge(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;
|
|
@@ -4003,7 +4003,7 @@ function ys(r, e) {
|
|
|
4003
4003
|
}
|
|
4004
4004
|
return t;
|
|
4005
4005
|
}
|
|
4006
|
-
class Ze extends
|
|
4006
|
+
class Ze extends K {
|
|
4007
4007
|
/**
|
|
4008
4008
|
Construct an attribute step.
|
|
4009
4009
|
*/
|
|
@@ -4040,8 +4040,8 @@ class Ze extends q {
|
|
|
4040
4040
|
return new Ze(t.pos, t.attr, t.value);
|
|
4041
4041
|
}
|
|
4042
4042
|
}
|
|
4043
|
-
|
|
4044
|
-
class bt extends
|
|
4043
|
+
K.jsonID("attr", Ze);
|
|
4044
|
+
class bt extends K {
|
|
4045
4045
|
/**
|
|
4046
4046
|
Construct an attribute step.
|
|
4047
4047
|
*/
|
|
@@ -4074,7 +4074,7 @@ class bt extends q {
|
|
|
4074
4074
|
return new bt(t.attr, t.value);
|
|
4075
4075
|
}
|
|
4076
4076
|
}
|
|
4077
|
-
|
|
4077
|
+
K.jsonID("docAttr", bt);
|
|
4078
4078
|
let tt = class extends Error {
|
|
4079
4079
|
};
|
|
4080
4080
|
tt = function r(e) {
|
|
@@ -4253,14 +4253,14 @@ class Cl {
|
|
|
4253
4253
|
Add a mark to the node at position `pos`.
|
|
4254
4254
|
*/
|
|
4255
4255
|
addNodeMark(e, t) {
|
|
4256
|
-
return this.step(new
|
|
4256
|
+
return this.step(new we(e, t)), this;
|
|
4257
4257
|
}
|
|
4258
4258
|
/**
|
|
4259
4259
|
Remove a mark (or a mark of the given type) from the node at
|
|
4260
4260
|
position `pos`.
|
|
4261
4261
|
*/
|
|
4262
4262
|
removeNodeMark(e, t) {
|
|
4263
|
-
if (!(t instanceof
|
|
4263
|
+
if (!(t instanceof v)) {
|
|
4264
4264
|
let n = this.doc.nodeAt(e);
|
|
4265
4265
|
if (!n)
|
|
4266
4266
|
throw new RangeError("No node at position " + e);
|
|
@@ -4743,7 +4743,7 @@ class El extends Cl {
|
|
|
4743
4743
|
this is already the case.
|
|
4744
4744
|
*/
|
|
4745
4745
|
ensureMarks(e) {
|
|
4746
|
-
return
|
|
4746
|
+
return v.sameSet(this.storedMarks || this.selection.$from.marks(), e) || this.setStoredMarks(e), this;
|
|
4747
4747
|
}
|
|
4748
4748
|
/**
|
|
4749
4749
|
Add a mark to the set of stored marks.
|
|
@@ -4788,7 +4788,7 @@ class El extends Cl {
|
|
|
4788
4788
|
*/
|
|
4789
4789
|
replaceSelectionWith(e, t = !0) {
|
|
4790
4790
|
let n = this.selection;
|
|
4791
|
-
return t && (e = e.mark(this.storedMarks || (n.empty ? n.$from.marks() : n.$from.marksAcross(n.$to) ||
|
|
4791
|
+
return t && (e = e.mark(this.storedMarks || (n.empty ? n.$from.marks() : n.$from.marksAcross(n.$to) || v.none))), n.replaceWith(this, e), this;
|
|
4792
4792
|
}
|
|
4793
4793
|
/**
|
|
4794
4794
|
Delete the selection.
|
|
@@ -5048,7 +5048,7 @@ class Ye {
|
|
|
5048
5048
|
let i = new Cn(e.schema, e.plugins), s = new Ye(i);
|
|
5049
5049
|
return i.fields.forEach((o) => {
|
|
5050
5050
|
if (o.name == "doc")
|
|
5051
|
-
s.doc =
|
|
5051
|
+
s.doc = ue.fromJSON(e.schema, t.doc);
|
|
5052
5052
|
else if (o.name == "selection")
|
|
5053
5053
|
s.selection = O.fromJSON(s.doc, t.selection);
|
|
5054
5054
|
else if (o.name == "storedMarks")
|
|
@@ -5122,7 +5122,7 @@ const V = function(r) {
|
|
|
5122
5122
|
return e && e.nodeType == 11 ? e.host : e;
|
|
5123
5123
|
};
|
|
5124
5124
|
let Wn = null;
|
|
5125
|
-
const
|
|
5125
|
+
const pe = 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() {
|
|
@@ -5221,9 +5221,9 @@ function Pl(r, e, t) {
|
|
|
5221
5221
|
return { node: n.startContainer, offset: Math.min(ne(n.startContainer), n.startOffset) };
|
|
5222
5222
|
}
|
|
5223
5223
|
}
|
|
5224
|
-
const
|
|
5224
|
+
const de = typeof navigator < "u" ? navigator : null, Gr = typeof document < "u" ? document : null, Ae = de && de.userAgent || "", Jn = /Edge\/(\d+)/.exec(Ae), xs = /MSIE \d/.exec(Ae), qn = /Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Ae), Y = !!(xs || qn || Jn), Ee = xs ? document.documentMode : qn ? +qn[1] : Jn ? +Jn[1] : 0, oe = !Y && /gecko\/(\d+)/i.test(Ae);
|
|
5225
5225
|
oe && +(/Firefox\/(\d+)/.exec(Ae) || [0, 0])[1];
|
|
5226
|
-
const Kn = !Y && /Chrome\/(\d+)/.exec(Ae), J = !!Kn, Ss = Kn ? +Kn[1] : 0,
|
|
5226
|
+
const Kn = !Y && /Chrome\/(\d+)/.exec(Ae), J = !!Kn, Ss = Kn ? +Kn[1] : 0, U = !Y && !!de && /Apple Computer/.test(de.vendor), rt = U && (/Mobile\/\w+/.test(Ae) || !!de && de.maxTouchPoints > 2), te = rt || (de ? /Mac/.test(de.platform) : !1), Rl = de ? /Win/.test(de.platform) : !1, me = /Android \d/.test(Ae), Tt = !!Gr && "webkitFontSmoothing" in Gr.documentElement.style, Bl = Tt ? +(/\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 Yr(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
|
f = u.getClientRects();
|
|
5325
5325
|
else if (u.nodeType == 3)
|
|
5326
|
-
f =
|
|
5326
|
+
f = pe(u).getClientRects();
|
|
5327
5327
|
else
|
|
5328
5328
|
continue;
|
|
5329
5329
|
for (let h = 0; h < f.length; h++) {
|
|
@@ -5348,7 +5348,7 @@ function jl(r, e) {
|
|
|
5348
5348
|
let t = r.nodeValue.length, n = document.createRange();
|
|
5349
5349
|
for (let i = 0; i < t; i++) {
|
|
5350
5350
|
n.setEnd(r, i + 1), n.setStart(r, i);
|
|
5351
|
-
let s =
|
|
5351
|
+
let s = be(n, 1);
|
|
5352
5352
|
if (s.top != s.bottom && ar(e, s))
|
|
5353
5353
|
return { node: r, offset: i + (e.left >= (s.left + s.right) / 2 ? 1 : 0) };
|
|
5354
5354
|
}
|
|
@@ -5409,7 +5409,7 @@ function ql(r, e) {
|
|
|
5409
5409
|
if (!ar(e, c) || (o = Es(r.dom, e, c), !o))
|
|
5410
5410
|
return null;
|
|
5411
5411
|
}
|
|
5412
|
-
if (
|
|
5412
|
+
if (U)
|
|
5413
5413
|
for (let c = o; n && c; c = nt(c))
|
|
5414
5414
|
c.draggable && (n = void 0);
|
|
5415
5415
|
if (o = Hl(o, e), n) {
|
|
@@ -5427,7 +5427,7 @@ function ql(r, e) {
|
|
|
5427
5427
|
function Xr(r) {
|
|
5428
5428
|
return r.top < r.bottom || r.left < r.right;
|
|
5429
5429
|
}
|
|
5430
|
-
function
|
|
5430
|
+
function be(r, e) {
|
|
5431
5431
|
let t = r.getClientRects();
|
|
5432
5432
|
if (t.length) {
|
|
5433
5433
|
let n = t[e < 0 ? 0 : t.length - 1];
|
|
@@ -5441,11 +5441,11 @@ function Ts(r, e, t) {
|
|
|
5441
5441
|
let { node: n, offset: i, atom: s } = r.docView.domFromPos(e, t < 0 ? -1 : 1), o = Tt || 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 =
|
|
5444
|
+
let a = be(pe(n, i, i), t);
|
|
5445
5445
|
if (oe && i && /\s/.test(n.nodeValue[i - 1]) && i < n.nodeValue.length) {
|
|
5446
|
-
let c =
|
|
5446
|
+
let c = be(pe(n, i - 1, i - 1), -1);
|
|
5447
5447
|
if (c.top == a.top) {
|
|
5448
|
-
let u =
|
|
5448
|
+
let u = be(pe(n, i, i + 1), -1);
|
|
5449
5449
|
if (u.top != a.top)
|
|
5450
5450
|
return ot(u, u.left < c.left);
|
|
5451
5451
|
}
|
|
@@ -5453,7 +5453,7 @@ 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(
|
|
5456
|
+
return t < 0 && !i ? (c++, u = -1) : t >= 0 && i == n.nodeValue.length ? (a--, u = 1) : t < 0 ? a-- : c++, ot(be(pe(n, a, c), u), u < 0);
|
|
5457
5457
|
}
|
|
5458
5458
|
if (!r.state.doc.resolve(e - (s || 0)).parent.inlineContent) {
|
|
5459
5459
|
if (s == null && i && (t < 0 || i == ne(n))) {
|
|
@@ -5469,19 +5469,19 @@ function Ts(r, e, t) {
|
|
|
5469
5469
|
return Mn(n.getBoundingClientRect(), t >= 0);
|
|
5470
5470
|
}
|
|
5471
5471
|
if (s == null && i && (t < 0 || i == ne(n))) {
|
|
5472
|
-
let a = n.childNodes[i - 1], c = a.nodeType == 3 ?
|
|
5472
|
+
let a = n.childNodes[i - 1], c = a.nodeType == 3 ? pe(a, ne(a) - (o ? 0 : 1)) : a.nodeType == 1 && (a.nodeName != "BR" || !a.nextSibling) ? a : null;
|
|
5473
5473
|
if (c)
|
|
5474
|
-
return ot(
|
|
5474
|
+
return ot(be(c, 1), !1);
|
|
5475
5475
|
}
|
|
5476
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 ? pe(a, 0, o ? 0 : 1) : a.nodeType == 1 ? a : null : null;
|
|
5481
5481
|
if (c)
|
|
5482
|
-
return ot(
|
|
5482
|
+
return ot(be(c, -1), !0);
|
|
5483
5483
|
}
|
|
5484
|
-
return ot(
|
|
5484
|
+
return ot(be(n.nodeType == 3 ? pe(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 = pe(l, 0, l.nodeValue.length).getClientRects();
|
|
5528
5528
|
else
|
|
5529
5529
|
continue;
|
|
5530
5530
|
for (let c = 0; c < a.length; c++) {
|
|
@@ -5557,7 +5557,7 @@ let Zr = null, Qr = null, ei = !1;
|
|
|
5557
5557
|
function Yl(r, e, t) {
|
|
5558
5558
|
return Zr == e && Qr == t ? ei : (Zr = e, Qr = t, ei = t == "up" || t == "down" ? Ul(r, e, t) : Gl(r, e, t));
|
|
5559
5559
|
}
|
|
5560
|
-
const ie = 0, ti = 1, Pe = 2,
|
|
5560
|
+
const ie = 0, ti = 1, Pe = 2, fe = 3;
|
|
5561
5561
|
class Ot {
|
|
5562
5562
|
constructor(e, t, n, i) {
|
|
5563
5563
|
this.parent = e, this.children = t, this.dom = n, this.contentDOM = i, this.dirty = ie, n.pmViewDesc = this;
|
|
@@ -5817,7 +5817,7 @@ class Ot {
|
|
|
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 ((oe ||
|
|
5820
|
+
if ((oe || U) && e == t) {
|
|
5821
5821
|
let { node: h, offset: p } = l;
|
|
5822
5822
|
if (h.nodeType == 3) {
|
|
5823
5823
|
if (d = !!(p && h.nodeValue[p - 1] == `
|
|
@@ -5840,7 +5840,7 @@ class Ot {
|
|
|
5840
5840
|
let h = u.focusNode.childNodes[u.focusOffset];
|
|
5841
5841
|
h && h.contentEditable == "false" && (i = !0);
|
|
5842
5842
|
}
|
|
5843
|
-
if (!(i || d &&
|
|
5843
|
+
if (!(i || d && U) && He(l.node, l.offset, u.anchorNode, u.anchorOffset) && He(a.node, a.offset, u.focusNode, u.focusOffset))
|
|
5844
5844
|
return;
|
|
5845
5845
|
let f = !1;
|
|
5846
5846
|
if ((c.extend || e == t) && !d) {
|
|
@@ -5873,10 +5873,10 @@ class Ot {
|
|
|
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 : ti, e == l && t == a && (s.contentLost || s.dom.parentNode != this.contentDOM) ? s.dirty =
|
|
5876
|
+
this.dirty = e == n || t == o ? Pe : ti, e == l && t == a && (s.contentLost || s.dom.parentNode != this.contentDOM) ? s.dirty = fe : 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 : fe;
|
|
5880
5880
|
}
|
|
5881
5881
|
n = o;
|
|
5882
5882
|
}
|
|
@@ -5965,10 +5965,10 @@ class We extends Ot {
|
|
|
5965
5965
|
return (!o || !o.dom) && (o = Je.renderSpec(document, t.type.spec.toDOM(t, n), null, t.attrs)), new We(e, t, o.dom, o.contentDOM || o.dom, o);
|
|
5966
5966
|
}
|
|
5967
5967
|
parseRule() {
|
|
5968
|
-
return this.dirty &
|
|
5968
|
+
return this.dirty & fe || 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 != fe && this.mark.eq(e);
|
|
5972
5972
|
}
|
|
5973
5973
|
markDirty(e, t) {
|
|
5974
5974
|
if (super.markDirty(e, t), this.dirty != ie) {
|
|
@@ -6058,7 +6058,7 @@ class Te extends Ot {
|
|
|
6058
6058
|
updateChildren(e, t) {
|
|
6059
6059
|
let n = this.node.inlineContent, i = t, s = e.composing ? this.localCompositionInfo(e, t) : null, o = s && s.pos > -1 ? s : null, l = s && s.pos < 0, a = new ea(this, o && o.node, e);
|
|
6060
6060
|
ra(this.node, this.innerDeco, (c, u, d) => {
|
|
6061
|
-
c.spec.marks ? a.syncToMarks(c.spec.marks, n, e) : c.type.side >= 0 && !d && a.syncToMarks(u == this.node.childCount ?
|
|
6061
|
+
c.spec.marks ? a.syncToMarks(c.spec.marks, n, e) : c.type.side >= 0 && !d && a.syncToMarks(u == this.node.childCount ? v.none : this.node.child(u).marks, n, e), a.placeWidget(c, e, i);
|
|
6062
6062
|
}, (c, u, d, f) => {
|
|
6063
6063
|
a.syncToMarks(c.marks, n, e);
|
|
6064
6064
|
let h;
|
|
@@ -6095,7 +6095,7 @@ class Te extends Ot {
|
|
|
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 == fe || !e.sameMarkup(this.node) ? !1 : (this.updateInner(e, t, n, i), !0);
|
|
6099
6099
|
}
|
|
6100
6100
|
updateInner(e, t, n, i) {
|
|
6101
6101
|
this.updateOuterDeco(t), this.node = e, this.innerDeco = n, this.contentDOM && this.updateChildren(i, this.posAtStart), this.dirty = ie;
|
|
@@ -6134,7 +6134,7 @@ class ln 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 == fe || 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 ln extends Te {
|
|
|
6157
6157
|
return new ln(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 = fe);
|
|
6161
6161
|
}
|
|
6162
6162
|
get domAtom() {
|
|
6163
6163
|
return !1;
|
|
@@ -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 == fe)
|
|
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);
|
|
@@ -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 == fe && 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,7 +6395,7 @@ 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, f = this.isLocked(u) && !(e.isText && a.node && a.node.isText && a.nodeDOM.nodeValue == e.text && a.dirty !=
|
|
6398
|
+
let u = a.dom, d, f = this.isLocked(u) && !(e.isText && a.node && a.node.isText && a.nodeDOM.nodeValue == e.text && a.dirty != fe && Kt(t, a.outerDeco));
|
|
6399
6399
|
if (!f && 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 (!f && (d = this.recreateWrapper(a, e, t, n, i, o)))
|
|
@@ -6439,7 +6439,7 @@ class ea {
|
|
|
6439
6439
|
for (; e instanceof We; )
|
|
6440
6440
|
t = e, e = t.children[t.children.length - 1];
|
|
6441
6441
|
(!e || // Empty textblock
|
|
6442
|
-
!(e instanceof ln) || /\n$/.test(e.node.text) || this.view.requiresGeckoHackNode && /\s$/.test(e.node.text)) && ((
|
|
6442
|
+
!(e instanceof ln) || /\n$/.test(e.node.text) || this.view.requiresGeckoHackNode && /\s$/.test(e.node.text)) && ((U || J) && e && e.dom.contentEditable == "false" && this.addHackNode("IMG", t), this.addHackNode("BR", this.top));
|
|
6443
6443
|
}
|
|
6444
6444
|
addHackNode(e, t) {
|
|
6445
6445
|
if (t == this.top && this.index < t.children.length && t.children[this.index].matchesHack(e))
|
|
@@ -6612,7 +6612,7 @@ function cr(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 ye(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) {
|
|
@@ -6631,10 +6631,10 @@ function ge(r, e = !1) {
|
|
|
6631
6631
|
r.domObserver.setCurSelection(), r.domObserver.connectSelection();
|
|
6632
6632
|
}
|
|
6633
6633
|
}
|
|
6634
|
-
const ii =
|
|
6634
|
+
const ii = U || J && Ss < 63;
|
|
6635
6635
|
function si(r, e) {
|
|
6636
6636
|
let { node: t, offset: n } = r.docView.domFromPos(e, 0), i = n < t.childNodes.length ? t.childNodes[n] : null, s = n ? t.childNodes[n - 1] : null;
|
|
6637
|
-
if (
|
|
6637
|
+
if (U && i && i.contentEditable == "false")
|
|
6638
6638
|
return En(i);
|
|
6639
6639
|
if ((!i || i.contentEditable == "false") && (!s || s.contentEditable == "false")) {
|
|
6640
6640
|
if (i)
|
|
@@ -6644,7 +6644,7 @@ function si(r, e) {
|
|
|
6644
6644
|
}
|
|
6645
6645
|
}
|
|
6646
6646
|
function En(r) {
|
|
6647
|
-
return r.contentEditable = "true",
|
|
6647
|
+
return r.contentEditable = "true", U && r.draggable && (r.draggable = !1, r.wasDraggable = !0), r;
|
|
6648
6648
|
}
|
|
6649
6649
|
function oi(r) {
|
|
6650
6650
|
r.contentEditable = "false", r.wasDraggable && (r.draggable = !0, r.wasDraggable = null);
|
|
@@ -6700,7 +6700,7 @@ function Gn(r, e) {
|
|
|
6700
6700
|
let { $anchor: t, $head: n } = r.selection, i = e > 0 ? t.max(n) : t.min(n), s = i.parent.inlineContent ? i.depth ? r.doc.resolve(e > 0 ? i.after() : i.before()) : null : i;
|
|
6701
6701
|
return s && O.findFrom(s, e);
|
|
6702
6702
|
}
|
|
6703
|
-
function
|
|
6703
|
+
function ke(r, e) {
|
|
6704
6704
|
return r.dispatch(r.state.tr.setSelection(e).scrollIntoView()), !0;
|
|
6705
6705
|
}
|
|
6706
6706
|
function ci(r, e, t) {
|
|
@@ -6711,25 +6711,25 @@ function ci(r, e, t) {
|
|
|
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
|
|
6714
|
+
return ke(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 = Gn(r.state, e);
|
|
6718
|
-
return i && i instanceof C ?
|
|
6718
|
+
return i && i instanceof C ? ke(r, i) : !1;
|
|
6719
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) ?
|
|
6724
|
+
return s.isAtom || (o = r.docView.descAt(l)) && !o.contentDOM ? C.isSelectable(s) ? ke(r, new C(e < 0 ? r.state.doc.resolve(i.pos - s.nodeSize) : i)) : Tt ? ke(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
|
|
6729
|
+
return ke(r, new T(e > 0 ? n.$to : n.$from));
|
|
6730
6730
|
{
|
|
6731
6731
|
let i = Gn(r.state, e);
|
|
6732
|
-
return i ?
|
|
6732
|
+
return i ? ke(r, i) : !1;
|
|
6733
6733
|
}
|
|
6734
6734
|
}
|
|
6735
6735
|
}
|
|
@@ -6854,7 +6854,7 @@ function Yn(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 && ye(r);
|
|
6858
6858
|
}, 50);
|
|
6859
6859
|
}
|
|
6860
6860
|
function ui(r, e) {
|
|
@@ -6882,11 +6882,11 @@ function di(r, e, t) {
|
|
|
6882
6882
|
if (!i.parent.inlineContent || r.endOfTextblock(e < 0 ? "up" : "down")) {
|
|
6883
6883
|
let o = Gn(r.state, e);
|
|
6884
6884
|
if (o && o instanceof C)
|
|
6885
|
-
return
|
|
6885
|
+
return ke(r, o);
|
|
6886
6886
|
}
|
|
6887
6887
|
if (!i.parent.inlineContent) {
|
|
6888
6888
|
let o = e < 0 ? i : s, l = n instanceof Z ? O.near(o, e) : O.findFrom(o, e);
|
|
6889
|
-
return l ?
|
|
6889
|
+
return l ? ke(r, l) : !1;
|
|
6890
6890
|
}
|
|
6891
6891
|
return !1;
|
|
6892
6892
|
}
|
|
@@ -6911,7 +6911,7 @@ function hi(r, e, t) {
|
|
|
6911
6911
|
r.domObserver.stop(), e.contentEditable = t, r.domObserver.start();
|
|
6912
6912
|
}
|
|
6913
6913
|
function ha(r) {
|
|
6914
|
-
if (!
|
|
6914
|
+
if (!U || r.state.selection.$head.parentOffset > 0)
|
|
6915
6915
|
return !1;
|
|
6916
6916
|
let { focusNode: e, focusOffset: t } = r.domSelectionRange();
|
|
6917
6917
|
if (e && e.nodeType == 1 && t == 0 && e.firstChild && e.firstChild.contentEditable == "false") {
|
|
@@ -7136,22 +7136,22 @@ function Sa(r, e) {
|
|
|
7136
7136
|
}
|
|
7137
7137
|
return new k(i, s, o);
|
|
7138
7138
|
}
|
|
7139
|
-
const
|
|
7139
|
+
const _ = {}, G = {}, Ca = { touchstart: !0, touchmove: !0 };
|
|
7140
7140
|
class wa {
|
|
7141
7141
|
constructor() {
|
|
7142
7142
|
this.shiftKey = !1, this.mouseDown = null, this.lastKeyCode = null, this.lastKeyCodeTime = 0, this.lastClick = { time: 0, x: 0, y: 0, type: "" }, this.lastSelectionOrigin = null, this.lastSelectionTime = 0, this.lastIOSEnter = 0, this.lastIOSEnterFallbackTimeout = -1, this.lastFocus = 0, this.lastTouch = 0, this.lastChromeDelete = 0, this.composing = !1, this.compositionNode = null, this.composingTimeout = -1, this.compositionNodes = [], this.compositionEndedAt = -2e8, this.compositionID = 1, this.compositionPendingChanges = 0, this.domChangeCount = 0, this.eventHandlers = /* @__PURE__ */ Object.create(null), this.hideSelectionGuard = null;
|
|
7143
7143
|
}
|
|
7144
7144
|
}
|
|
7145
7145
|
function Ma(r) {
|
|
7146
|
-
for (let e in
|
|
7147
|
-
let t =
|
|
7146
|
+
for (let e in _) {
|
|
7147
|
+
let t = _[e];
|
|
7148
7148
|
r.dom.addEventListener(e, r.input.eventHandlers[e] = (n) => {
|
|
7149
|
-
Ta(r, n) && !fr(r, n) && (r.editable || !(n.type in
|
|
7149
|
+
Ta(r, n) && !fr(r, n) && (r.editable || !(n.type in G)) && t(r, n);
|
|
7150
7150
|
}, Ca[e] ? { passive: !0 } : void 0);
|
|
7151
7151
|
}
|
|
7152
|
-
|
|
7152
|
+
U && r.dom.addEventListener("input", () => null), Zn(r);
|
|
7153
7153
|
}
|
|
7154
|
-
function
|
|
7154
|
+
function Me(r, e) {
|
|
7155
7155
|
r.input.lastSelectionOrigin = e, r.input.lastSelectionTime = Date.now();
|
|
7156
7156
|
}
|
|
7157
7157
|
function Ea(r) {
|
|
@@ -7183,22 +7183,22 @@ function Ta(r, e) {
|
|
|
7183
7183
|
return !0;
|
|
7184
7184
|
}
|
|
7185
7185
|
function Oa(r, e) {
|
|
7186
|
-
!fr(r, e) &&
|
|
7186
|
+
!fr(r, e) && _[e.type] && (r.editable || !(e.type in G)) && _[e.type](r, e);
|
|
7187
7187
|
}
|
|
7188
|
-
|
|
7188
|
+
G.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(), !(me && 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(() => {
|
|
7194
7194
|
r.input.lastIOSEnter == n && (r.someProp("handleKeyDown", (i) => i(r, De(13, "Enter"))), r.input.lastIOSEnter = 0);
|
|
7195
7195
|
}, 200);
|
|
7196
|
-
} else r.someProp("handleKeyDown", (n) => n(r, t)) || ma(r, t) ? t.preventDefault() :
|
|
7196
|
+
} else r.someProp("handleKeyDown", (n) => n(r, t)) || ma(r, t) ? t.preventDefault() : Me(r, "key");
|
|
7197
7197
|
};
|
|
7198
|
-
|
|
7198
|
+
G.keyup = (r, e) => {
|
|
7199
7199
|
e.keyCode == 16 && (r.input.shiftKey = !1);
|
|
7200
7200
|
};
|
|
7201
|
-
|
|
7201
|
+
G.keypress = (r, e) => {
|
|
7202
7202
|
let t = e;
|
|
7203
7203
|
if (Js(r, t) || !t.charCode || t.ctrlKey && !t.altKey || te && t.metaKey)
|
|
7204
7204
|
return;
|
|
@@ -7286,13 +7286,13 @@ function pr(r) {
|
|
|
7286
7286
|
return _t(r);
|
|
7287
7287
|
}
|
|
7288
7288
|
const Ws = te ? "metaKey" : "ctrlKey";
|
|
7289
|
-
|
|
7289
|
+
_.mousedown = (r, e) => {
|
|
7290
7290
|
let t = e;
|
|
7291
7291
|
r.input.shiftKey = t.shiftKey;
|
|
7292
7292
|
let n = pr(r), i = Date.now(), s = "singleClick";
|
|
7293
7293
|
i - r.input.lastClick.time < 500 && Na(t, r.input.lastClick) && !t[Ws] && (r.input.lastClick.type == "singleClick" ? s = "doubleClick" : r.input.lastClick.type == "doubleClick" && (s = "tripleClick")), r.input.lastClick = { time: i, x: t.clientX, y: t.clientY, type: s };
|
|
7294
7294
|
let o = r.posAtCoords(an(t));
|
|
7295
|
-
o && (s == "singleClick" ? (r.input.mouseDown && r.input.mouseDown.done(), r.input.mouseDown = new Ba(r, o, t, !!n)) : (s == "doubleClick" ? Ia : Pa)(r, o.pos, o.inside, t) ? t.preventDefault() :
|
|
7295
|
+
o && (s == "singleClick" ? (r.input.mouseDown && r.input.mouseDown.done(), r.input.mouseDown = new Ba(r, o, t, !!n)) : (s == "doubleClick" ? Ia : Pa)(r, o.pos, o.inside, t) ? t.preventDefault() : Me(r, "pointer"));
|
|
7296
7296
|
};
|
|
7297
7297
|
class Ba {
|
|
7298
7298
|
constructor(e, t, n, i) {
|
|
@@ -7314,44 +7314,44 @@ class Ba {
|
|
|
7314
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
|
-
}, 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)),
|
|
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)), Me(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(() => ye(this.view)), this.view.input.mouseDown = null;
|
|
7321
7321
|
}
|
|
7322
7322
|
up(e) {
|
|
7323
7323
|
if (this.done(), !this.view.dom.contains(e.target))
|
|
7324
7324
|
return;
|
|
7325
7325
|
let t = this.pos;
|
|
7326
|
-
this.view.state.doc != this.startDoc && (t = this.view.posAtCoords(an(e))), this.updateAllowDefault(e), this.allowDefault || !t ?
|
|
7327
|
-
|
|
7326
|
+
this.view.state.doc != this.startDoc && (t = this.view.posAtCoords(an(e))), this.updateAllowDefault(e), this.allowDefault || !t ? Me(this.view, "pointer") : Da(this.view, t.pos, t.inside, e, this.selectNode) ? e.preventDefault() : e.button == 0 && (this.flushed || // Safari ignores clicks on draggable elements
|
|
7327
|
+
U && this.mightDrag && !this.mightDrag.node.isAtom || // Chrome will sometimes treat a node selection as a
|
|
7328
7328
|
// cursor, but still report that the node is selected
|
|
7329
7329
|
// when asked through getSelection. You'll then get a
|
|
7330
7330
|
// situation where clicking at the point where that
|
|
7331
7331
|
// (hidden) cursor is doesn't change the selection, and
|
|
7332
7332
|
// thus doesn't get a reaction from ProseMirror. This
|
|
7333
7333
|
// works around that.
|
|
7334
|
-
J && !this.view.state.selection.visible && Math.min(Math.abs(t.pos - this.view.state.selection.from), Math.abs(t.pos - this.view.state.selection.to)) <= 2) ? (Qe(this.view, O.near(this.view.state.doc.resolve(t.pos))), e.preventDefault()) :
|
|
7334
|
+
J && !this.view.state.selection.visible && Math.min(Math.abs(t.pos - this.view.state.selection.from), Math.abs(t.pos - this.view.state.selection.to)) <= 2) ? (Qe(this.view, O.near(this.view.state.doc.resolve(t.pos))), e.preventDefault()) : Me(this.view, "pointer");
|
|
7335
7335
|
}
|
|
7336
7336
|
move(e) {
|
|
7337
|
-
this.updateAllowDefault(e),
|
|
7337
|
+
this.updateAllowDefault(e), Me(this.view, "pointer"), e.buttons == 0 && this.done();
|
|
7338
7338
|
}
|
|
7339
7339
|
updateAllowDefault(e) {
|
|
7340
7340
|
!this.allowDefault && (Math.abs(this.event.x - e.clientX) > 4 || Math.abs(this.event.y - e.clientY) > 4) && (this.allowDefault = !0);
|
|
7341
7341
|
}
|
|
7342
7342
|
}
|
|
7343
|
-
|
|
7344
|
-
r.input.lastTouch = Date.now(), pr(r),
|
|
7343
|
+
_.touchstart = (r) => {
|
|
7344
|
+
r.input.lastTouch = Date.now(), pr(r), Me(r, "pointer");
|
|
7345
7345
|
};
|
|
7346
|
-
|
|
7347
|
-
r.input.lastTouch = Date.now(),
|
|
7346
|
+
_.touchmove = (r) => {
|
|
7347
|
+
r.input.lastTouch = Date.now(), Me(r, "pointer");
|
|
7348
7348
|
};
|
|
7349
|
-
|
|
7349
|
+
_.contextmenu = (r) => pr(r);
|
|
7350
7350
|
function Js(r, e) {
|
|
7351
|
-
return r.composing ? !0 :
|
|
7351
|
+
return r.composing ? !0 : U && Math.abs(e.timeStamp - r.input.compositionEndedAt) < 500 ? (r.input.compositionEndedAt = -2e8, !0) : !1;
|
|
7352
7352
|
}
|
|
7353
|
-
const za =
|
|
7354
|
-
|
|
7353
|
+
const za = me ? 5e3 : -1;
|
|
7354
|
+
G.compositionstart = G.compositionupdate = (r) => {
|
|
7355
7355
|
if (!r.composing) {
|
|
7356
7356
|
r.domObserver.flush();
|
|
7357
7357
|
let { state: e } = r, t = e.selection.$to;
|
|
@@ -7375,7 +7375,7 @@ _.compositionstart = _.compositionupdate = (r) => {
|
|
|
7375
7375
|
}
|
|
7376
7376
|
qs(r, za);
|
|
7377
7377
|
};
|
|
7378
|
-
|
|
7378
|
+
G.compositionend = (r, e) => {
|
|
7379
7379
|
r.composing && (r.input.composing = !1, r.input.compositionEndedAt = e.timeStamp, r.input.compositionPendingChanges = r.domObserver.pendingRecords().length ? r.input.compositionID : 0, r.input.compositionNode = null, r.input.compositionPendingChanges && Promise.resolve().then(() => r.domObserver.flush()), r.input.compositionID++, qs(r, 20));
|
|
7380
7380
|
};
|
|
7381
7381
|
function qs(r, e) {
|
|
@@ -7409,7 +7409,7 @@ function La() {
|
|
|
7409
7409
|
return r.initEvent("event", !0, !0), r.timeStamp;
|
|
7410
7410
|
}
|
|
7411
7411
|
function _t(r, e = !1) {
|
|
7412
|
-
if (!(
|
|
7412
|
+
if (!(me && r.domObserver.flushingSoon >= 0)) {
|
|
7413
7413
|
if (r.domObserver.forceFlush(), Ks(r), e || r.docView && r.docView.dirty) {
|
|
7414
7414
|
let t = cr(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;
|
|
@@ -7428,7 +7428,7 @@ function $a(r, e) {
|
|
|
7428
7428
|
}, 50);
|
|
7429
7429
|
}
|
|
7430
7430
|
const kt = Y && Ee < 15 || rt && Bl < 604;
|
|
7431
|
-
|
|
7431
|
+
_.copy = G.cut = (r, e) => {
|
|
7432
7432
|
let t = e, n = r.state.selection, i = t.type == "cut";
|
|
7433
7433
|
if (n.empty)
|
|
7434
7434
|
return;
|
|
@@ -7464,9 +7464,9 @@ function Us(r) {
|
|
|
7464
7464
|
let t = r.getData("text/uri-list");
|
|
7465
7465
|
return t ? t.replace(/\r?\n/g, " ") : "";
|
|
7466
7466
|
}
|
|
7467
|
-
|
|
7467
|
+
G.paste = (r, e) => {
|
|
7468
7468
|
let t = e;
|
|
7469
|
-
if (r.composing && !
|
|
7469
|
+
if (r.composing && !me)
|
|
7470
7470
|
return;
|
|
7471
7471
|
let n = kt ? null : t.clipboardData, i = r.input.shiftKey && r.input.lastKeyCode != 45;
|
|
7472
7472
|
n && xt(r, Us(n), n.getData("text/html"), i, t) ? t.preventDefault() : ja(r, t);
|
|
@@ -7481,7 +7481,7 @@ function Gs(r, e) {
|
|
|
7481
7481
|
let t = r.someProp("dragCopies", (n) => !n(e));
|
|
7482
7482
|
return t ?? !e[Ha];
|
|
7483
7483
|
}
|
|
7484
|
-
|
|
7484
|
+
_.dragstart = (r, e) => {
|
|
7485
7485
|
let t = e, n = r.input.mouseDown;
|
|
7486
7486
|
if (n && n.done(), !t.dataTransfer)
|
|
7487
7487
|
return;
|
|
@@ -7497,14 +7497,14 @@ U.dragstart = (r, e) => {
|
|
|
7497
7497
|
let l = (o || r.state.selection).content(), { dom: a, text: c, slice: u } = dr(r, l);
|
|
7498
7498
|
(!t.dataTransfer.files.length || !J || Ss > 120) && t.dataTransfer.clearData(), t.dataTransfer.setData(kt ? "Text" : "text/html", a.innerHTML), t.dataTransfer.effectAllowed = "copyMove", kt || t.dataTransfer.setData("text/plain", c), r.dragging = new _s(u, Gs(r, t), o);
|
|
7499
7499
|
};
|
|
7500
|
-
|
|
7500
|
+
_.dragend = (r) => {
|
|
7501
7501
|
let e = r.dragging;
|
|
7502
7502
|
window.setTimeout(() => {
|
|
7503
7503
|
r.dragging == e && (r.dragging = null);
|
|
7504
7504
|
}, 50);
|
|
7505
7505
|
};
|
|
7506
|
-
|
|
7507
|
-
|
|
7506
|
+
G.dragover = G.dragenter = (r, e) => e.preventDefault();
|
|
7507
|
+
G.drop = (r, e) => {
|
|
7508
7508
|
let t = e, n = r.dragging;
|
|
7509
7509
|
if (r.dragging = null, !t.dataTransfer)
|
|
7510
7510
|
return;
|
|
@@ -7542,17 +7542,17 @@ _.drop = (r, e) => {
|
|
|
7542
7542
|
}
|
|
7543
7543
|
r.focus(), r.dispatch(c.setMeta("uiEvent", "drop"));
|
|
7544
7544
|
};
|
|
7545
|
-
|
|
7545
|
+
_.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()) && ye(r);
|
|
7548
7548
|
}, 20));
|
|
7549
7549
|
};
|
|
7550
|
-
|
|
7550
|
+
_.blur = (r, e) => {
|
|
7551
7551
|
let t = 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
|
-
|
|
7555
|
-
if (J &&
|
|
7554
|
+
_.beforeinput = (r, e) => {
|
|
7555
|
+
if (J && me && e.inputType == "deleteContentBackward") {
|
|
7556
7556
|
r.domObserver.flushSoon();
|
|
7557
7557
|
let { domChangeCount: n } = r.input;
|
|
7558
7558
|
setTimeout(() => {
|
|
@@ -7563,8 +7563,8 @@ U.beforeinput = (r, e) => {
|
|
|
7563
7563
|
}, 50);
|
|
7564
7564
|
}
|
|
7565
7565
|
};
|
|
7566
|
-
for (let r in
|
|
7567
|
-
|
|
7566
|
+
for (let r in G)
|
|
7567
|
+
_[r] = G[r];
|
|
7568
7568
|
function St(r, e) {
|
|
7569
7569
|
if (r == e)
|
|
7570
7570
|
return !0;
|
|
@@ -7835,7 +7835,7 @@ class B {
|
|
|
7835
7835
|
}
|
|
7836
7836
|
if (i) {
|
|
7837
7837
|
let l = new B(i.sort($e), Ge);
|
|
7838
|
-
return n ? new
|
|
7838
|
+
return n ? new Se([l, n]) : l;
|
|
7839
7839
|
}
|
|
7840
7840
|
return n || W;
|
|
7841
7841
|
}
|
|
@@ -7881,13 +7881,13 @@ class B {
|
|
|
7881
7881
|
B.empty = new B([], []);
|
|
7882
7882
|
B.removeOverlap = gr;
|
|
7883
7883
|
const W = B.empty;
|
|
7884
|
-
class
|
|
7884
|
+
class Se {
|
|
7885
7885
|
constructor(e) {
|
|
7886
7886
|
this.members = e;
|
|
7887
7887
|
}
|
|
7888
7888
|
map(e, t) {
|
|
7889
7889
|
const n = this.members.map((i) => i.map(e, t, Le));
|
|
7890
|
-
return
|
|
7890
|
+
return Se.from(n);
|
|
7891
7891
|
}
|
|
7892
7892
|
forChild(e, t) {
|
|
7893
7893
|
if (t.isLeaf)
|
|
@@ -7895,12 +7895,12 @@ class xe {
|
|
|
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);
|
|
7898
|
-
s != W && (s instanceof
|
|
7898
|
+
s != W && (s instanceof Se ? n = n.concat(s.members) : n.push(s));
|
|
7899
7899
|
}
|
|
7900
|
-
return
|
|
7900
|
+
return Se.from(n);
|
|
7901
7901
|
}
|
|
7902
7902
|
eq(e) {
|
|
7903
|
-
if (!(e instanceof
|
|
7903
|
+
if (!(e instanceof Se) || e.members.length != this.members.length)
|
|
7904
7904
|
return !1;
|
|
7905
7905
|
for (let t = 0; t < this.members.length; t++)
|
|
7906
7906
|
if (!this.members[t].eq(e.members[t]))
|
|
@@ -7931,7 +7931,7 @@ class xe {
|
|
|
7931
7931
|
case 1:
|
|
7932
7932
|
return e[0];
|
|
7933
7933
|
default:
|
|
7934
|
-
return new
|
|
7934
|
+
return new Se(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) {
|
|
@@ -8071,7 +8071,7 @@ function On(r) {
|
|
|
8071
8071
|
return r.someProp("decorations", (t) => {
|
|
8072
8072
|
let n = t(r.state);
|
|
8073
8073
|
n && n != W && e.push(n);
|
|
8074
|
-
}), r.cursorWrapper && e.push(B.create(r.state.doc, [r.cursorWrapper.deco])),
|
|
8074
|
+
}), r.cursorWrapper && e.push(B.create(r.state.doc, [r.cursorWrapper.deco])), Se.from(e);
|
|
8075
8075
|
}
|
|
8076
8076
|
const qa = {
|
|
8077
8077
|
childList: !0,
|
|
@@ -8140,7 +8140,7 @@ class _a {
|
|
|
8140
8140
|
onSelectionChange() {
|
|
8141
8141
|
if (ai(this.view)) {
|
|
8142
8142
|
if (this.suppressingSelectionUpdates)
|
|
8143
|
-
return
|
|
8143
|
+
return ye(this.view);
|
|
8144
8144
|
if (Y && Ee <= 11 && !this.view.state.selection.empty) {
|
|
8145
8145
|
let e = this.view.domSelectionRange();
|
|
8146
8146
|
if (e.focusNode && He(e.focusNode, e.focusOffset, e.anchorNode, e.anchorOffset))
|
|
@@ -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 && on(n) && (c = cr(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 && on(n) && (c = cr(e)) && c.eq(O.near(e.state.doc.resolve(0), 1)) ? (e.input.lastFocus = 0, ye(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) || ye(e), this.currentSelection.set(n));
|
|
8206
8206
|
}
|
|
8207
8207
|
registerMutation(e, t) {
|
|
8208
8208
|
if (t.indexOf(e.target) > -1)
|
|
@@ -8303,10 +8303,10 @@ function Qa(r) {
|
|
|
8303
8303
|
if (e)
|
|
8304
8304
|
return e.parseRule();
|
|
8305
8305
|
if (r.nodeName == "BR" && r.parentNode) {
|
|
8306
|
-
if (
|
|
8306
|
+
if (U && /^(ul|ol)$/i.test(r.parentNode.nodeName)) {
|
|
8307
8307
|
let t = document.createElement("div");
|
|
8308
8308
|
return t.appendChild(document.createElement("li")), { skip: t };
|
|
8309
|
-
} else if (r.parentNode.lastChild == r ||
|
|
8309
|
+
} else if (r.parentNode.lastChild == r || U && /^(tr|table)$/i.test(r.parentNode.nodeName))
|
|
8310
8310
|
return { ignore: !0 };
|
|
8311
8311
|
} else if (r.nodeName == "IMG" && r.getAttribute("mark-placeholder"))
|
|
8312
8312
|
return { ignore: !0 };
|
|
@@ -8318,7 +8318,7 @@ function tc(r, e, t, n, i) {
|
|
|
8318
8318
|
if (r.input.compositionPendingChanges = 0, e < 0) {
|
|
8319
8319
|
let E = r.input.lastSelectionTime > Date.now() - 50 ? r.input.lastSelectionOrigin : null, ee = cr(r, E);
|
|
8320
8320
|
if (ee && !r.state.selection.eq(ee)) {
|
|
8321
|
-
if (J &&
|
|
8321
|
+
if (J && me && r.input.lastKeyCode === 13 && Date.now() - 100 < r.input.lastKeyCodeTime && r.someProp("handleKeyDown", (Ao) => Ao(r, De(13, "Enter"))))
|
|
8322
8322
|
return;
|
|
8323
8323
|
let Nt = r.state.tr.setSelection(ee);
|
|
8324
8324
|
E == "pointer" ? Nt.setMeta("pointer", !0) : E == "key" && Nt.scrollIntoView(), s && Nt.setMeta("composition", s), r.dispatch(Nt);
|
|
@@ -8330,7 +8330,7 @@ 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), f, h;
|
|
8331
8331
|
r.input.lastKeyCode === 8 && Date.now() - 100 < r.input.lastKeyCodeTime ? (f = r.state.selection.to, h = "end") : (f = r.state.selection.from, h = "start"), r.input.lastKeyCode = null;
|
|
8332
8332
|
let p = ic(d.content, c.doc.content, c.from, f, h);
|
|
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 || me) && 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
|
}
|
|
@@ -8354,33 +8354,33 @@ function tc(r, e, t, n, i) {
|
|
|
8354
8354
|
return;
|
|
8355
8355
|
}
|
|
8356
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
|
-
|
|
8357
|
+
me && J && r.domObserver.suppressSelectionUpdates();
|
|
8358
8358
|
return;
|
|
8359
8359
|
}
|
|
8360
|
-
J && p.endB == p.start && (r.input.lastChromeDelete = Date.now()),
|
|
8360
|
+
J && p.endB == p.start && (r.input.lastChromeDelete = Date.now()), me && !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
8361
|
r.someProp("handleKeyDown", function(E) {
|
|
8362
8362
|
return E(r, De(13, "Enter"));
|
|
8363
8363
|
});
|
|
8364
8364
|
}, 20));
|
|
8365
|
-
let
|
|
8365
|
+
let D = p.start, A = p.endA, M, I, H;
|
|
8366
8366
|
if (S) {
|
|
8367
8367
|
if (m.pos == g.pos)
|
|
8368
|
-
Y && Ee <= 11 && m.parentOffset == 0 && (r.domObserver.suppressSelectionUpdates(), setTimeout(() =>
|
|
8368
|
+
Y && Ee <= 11 && m.parentOffset == 0 && (r.domObserver.suppressSelectionUpdates(), setTimeout(() => ye(r), 20)), M = r.state.tr.delete(D, A), I = u.resolve(p.start).marksAcross(u.resolve(p.endA));
|
|
8369
8369
|
else if (
|
|
8370
8370
|
// Adding or removing a mark
|
|
8371
8371
|
p.endA == p.endB && (H = 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, H.type == "add" ? M.addMark(
|
|
8373
|
+
M = r.state.tr, H.type == "add" ? M.addMark(D, A, H.mark) : M.removeMark(D, A, H.mark);
|
|
8374
8374
|
else if (m.parent.child(m.index()).isText && m.index() == g.index() - (g.textOffset ? 0 : 1)) {
|
|
8375
8375
|
let E = m.parent.textBetween(m.parentOffset, g.parentOffset);
|
|
8376
|
-
if (r.someProp("handleTextInput", (ee) => ee(r,
|
|
8376
|
+
if (r.someProp("handleTextInput", (ee) => ee(r, D, A, E)))
|
|
8377
8377
|
return;
|
|
8378
|
-
M = r.state.tr.insertText(E,
|
|
8378
|
+
M = r.state.tr.insertText(E, D, A);
|
|
8379
8379
|
}
|
|
8380
8380
|
}
|
|
8381
|
-
if (M || (M = r.state.tr.replace(
|
|
8381
|
+
if (M || (M = r.state.tr.replace(D, A, c.doc.slice(p.start - c.from, p.endB - c.from))), c.sel) {
|
|
8382
8382
|
let E = xi(r, M.doc, c.sel);
|
|
8383
|
-
E && !(J && r.composing && E.empty && (p.start != p.endB || r.input.lastChromeDelete < Date.now() - 100) && (E.head ==
|
|
8383
|
+
E && !(J && r.composing && E.empty && (p.start != p.endB || r.input.lastChromeDelete < Date.now() - 100) && (E.head == D || E.head == M.mapping.map(A) - 1) || Y && E.empty && E.head == D) && M.setSelection(E);
|
|
8384
8384
|
}
|
|
8385
8385
|
I && M.ensureMarks(I), s && M.setMeta("composition", s), r.dispatch(M.scrollIntoView());
|
|
8386
8386
|
}
|
|
@@ -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 = ni(e.doc, c, a, this.dom, this)), p && !this.trackWrites && (h = !0);
|
|
8541
8541
|
}
|
|
8542
|
-
h || !(this.input.mouseDown && this.domObserver.currentSelection.eq(this.domSelectionRange()) && aa(this)) ?
|
|
8542
|
+
h || !(this.input.mouseDown && this.domObserver.currentSelection.eq(this.domSelectionRange()) && aa(this)) ? ye(this, h) : (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() : f && $l(f);
|
|
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), ye(this), this.domObserver.start();
|
|
8632
8632
|
}
|
|
8633
8633
|
/**
|
|
8634
8634
|
Get the document root in which the editor exists. This will
|
|
@@ -8793,7 +8793,7 @@ class sc {
|
|
|
8793
8793
|
*/
|
|
8794
8794
|
domSelectionRange() {
|
|
8795
8795
|
let e = this.domSelection();
|
|
8796
|
-
return e ?
|
|
8796
|
+
return e ? U && this.root.nodeType === 11 && Il(this.dom.ownerDocument) == this.dom && Ya(this, e) || e : { focusNode: null, focusOffset: 0, anchorNode: null, anchorOffset: 0 };
|
|
8797
8797
|
}
|
|
8798
8798
|
/**
|
|
8799
8799
|
@internal
|
|
@@ -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 (ge(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 || !ge(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;
|
|
@@ -9234,8 +9234,8 @@ function Cc(r) {
|
|
|
9234
9234
|
}
|
|
9235
9235
|
let u = e.tr;
|
|
9236
9236
|
(e.selection instanceof T || e.selection instanceof Z) && u.deleteSelection();
|
|
9237
|
-
let d = u.mapping.map(n.pos), f =
|
|
9238
|
-
if (f || (s[0] = l ? { type: l } : null, f =
|
|
9237
|
+
let d = u.mapping.map(n.pos), f = ge(u.doc, d, s.length, s);
|
|
9238
|
+
if (f || (s[0] = l ? { type: l } : null, f = ge(u.doc, d, s.length, s)), !f)
|
|
9239
9239
|
return !1;
|
|
9240
9240
|
if (u.split(d, s.length, s), !a && c && n.node(o).type != l) {
|
|
9241
9241
|
let h = u.mapping.map(n.before(o)), p = u.doc.resolve(h);
|
|
@@ -9381,7 +9381,7 @@ function Dc(r, e, t, n, i) {
|
|
|
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, f = !0; u < d; u++, f = !1)
|
|
9384
|
-
!f &&
|
|
9384
|
+
!f && ge(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) {
|
|
@@ -10000,8 +10000,8 @@ function _c(r) {
|
|
|
10000
10000
|
Uc(y, s.find, o).forEach((w) => {
|
|
10001
10001
|
if (w.index === void 0)
|
|
10002
10002
|
return;
|
|
10003
|
-
const
|
|
10004
|
-
from: t.tr.mapping.map(
|
|
10003
|
+
const D = m + w.index + 1, A = D + w[0].length, M = {
|
|
10004
|
+
from: t.tr.mapping.map(D),
|
|
10005
10005
|
to: t.tr.mapping.map(A)
|
|
10006
10006
|
}, I = s.handler({
|
|
10007
10007
|
state: t,
|
|
@@ -10105,13 +10105,13 @@ function Yc(r) {
|
|
|
10105
10105
|
pasteEvt: H
|
|
10106
10106
|
});
|
|
10107
10107
|
}
|
|
10108
|
-
const w = f.doc.content.findDiffStart(h.doc.content),
|
|
10109
|
-
if (!(!Kc(w) || !
|
|
10108
|
+
const w = f.doc.content.findDiffStart(h.doc.content), D = f.doc.content.findDiffEnd(h.doc.content);
|
|
10109
|
+
if (!(!Kc(w) || !D || w === D.b))
|
|
10110
10110
|
return a({
|
|
10111
10111
|
rule: u,
|
|
10112
10112
|
state: h,
|
|
10113
10113
|
from: w,
|
|
10114
|
-
to:
|
|
10114
|
+
to: D,
|
|
10115
10115
|
pasteEvt: o
|
|
10116
10116
|
});
|
|
10117
10117
|
}
|
|
@@ -10285,7 +10285,7 @@ class Xe {
|
|
|
10285
10285
|
});
|
|
10286
10286
|
}
|
|
10287
10287
|
}
|
|
10288
|
-
class
|
|
10288
|
+
class q {
|
|
10289
10289
|
constructor(e = {}) {
|
|
10290
10290
|
this.type = "extension", this.name = "extension", this.parent = null, this.child = null, this.config = {
|
|
10291
10291
|
name: this.name,
|
|
@@ -10301,7 +10301,7 @@ class G {
|
|
|
10301
10301
|
})) || {};
|
|
10302
10302
|
}
|
|
10303
10303
|
static create(e = {}) {
|
|
10304
|
-
return new
|
|
10304
|
+
return new q(e);
|
|
10305
10305
|
}
|
|
10306
10306
|
configure(e = {}) {
|
|
10307
10307
|
const t = this.extend({
|
|
@@ -10311,7 +10311,7 @@ class G {
|
|
|
10311
10311
|
return t.name = this.name, t.parent = this.parent, t;
|
|
10312
10312
|
}
|
|
10313
10313
|
extend(e = {}) {
|
|
10314
|
-
const t = new
|
|
10314
|
+
const t = new q({ ...this.config, ...e });
|
|
10315
10315
|
return t.parent = this, this.child = t, t.name = e.name ? e.name : t.parent.name, e.defaultOptions && Object.keys(e.defaultOptions).length > 0 && console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${t.name}".`), t.options = N(x(t, "addOptions", {
|
|
10316
10316
|
name: t.name
|
|
10317
10317
|
})), t.storage = N(x(t, "addStorage", {
|
|
@@ -10343,7 +10343,7 @@ function po(r, e, t) {
|
|
|
10343
10343
|
function mo(r) {
|
|
10344
10344
|
return Object.fromEntries(Object.entries(r.nodes).filter(([, e]) => e.spec.toText).map(([e, t]) => [e, t.spec.toText]));
|
|
10345
10345
|
}
|
|
10346
|
-
const Zc =
|
|
10346
|
+
const Zc = q.create({
|
|
10347
10347
|
name: "clipboardTextSerializer",
|
|
10348
10348
|
addOptions() {
|
|
10349
10349
|
return {
|
|
@@ -10535,7 +10535,7 @@ function Rt(r) {
|
|
|
10535
10535
|
return ko(t);
|
|
10536
10536
|
}
|
|
10537
10537
|
function Qt(r, e, t) {
|
|
10538
|
-
if (r instanceof
|
|
10538
|
+
if (r instanceof ue || r instanceof b)
|
|
10539
10539
|
return r;
|
|
10540
10540
|
t = {
|
|
10541
10541
|
slice: !0,
|
|
@@ -10839,8 +10839,8 @@ function tr(r, e, t = {}) {
|
|
|
10839
10839
|
if (!m.isText && !m.marks.length)
|
|
10840
10840
|
return;
|
|
10841
10841
|
const y = Math.max(h, g), S = Math.min(p, g + m.nodeSize), w = S - y;
|
|
10842
|
-
o += w, l.push(...m.marks.map((
|
|
10843
|
-
mark:
|
|
10842
|
+
o += w, l.push(...m.marks.map((D) => ({
|
|
10843
|
+
mark: D,
|
|
10844
10844
|
from: y,
|
|
10845
10845
|
to: S
|
|
10846
10846
|
})));
|
|
@@ -10964,7 +10964,7 @@ function Ri(r, e) {
|
|
|
10964
10964
|
const td = ({ keepMarks: r = !0 } = {}) => ({ tr: e, state: t, dispatch: n, editor: i }) => {
|
|
10965
10965
|
const { selection: s, doc: o } = e, { $from: l, $to: a } = s, c = i.extensionManager.attributes, u = Lt(c, l.node().type.name, l.node().attrs);
|
|
10966
10966
|
if (s instanceof C && s.node.isBlock)
|
|
10967
|
-
return !l.parentOffset || !
|
|
10967
|
+
return !l.parentOffset || !ge(o, l.pos) ? !1 : (n && (r && Ri(t, i.extensionManager.splittableMarks), e.split(l.pos).scrollIntoView()), !0);
|
|
10968
10968
|
if (!l.parent.isBlock)
|
|
10969
10969
|
return !1;
|
|
10970
10970
|
const d = a.parentOffset === a.parent.content.size, f = l.depth === 0 ? void 0 : Wu(l.node(-1).contentMatchAt(l.indexAfter(-1)));
|
|
@@ -10973,8 +10973,8 @@ const td = ({ keepMarks: r = !0 } = {}) => ({ tr: e, state: t, dispatch: n, edit
|
|
|
10973
10973
|
type: f,
|
|
10974
10974
|
attrs: u
|
|
10975
10975
|
}
|
|
10976
|
-
] : void 0, p =
|
|
10977
|
-
if (!h && !p &&
|
|
10976
|
+
] : void 0, p = ge(e.doc, e.mapping.map(l.pos), 1, h);
|
|
10977
|
+
if (!h && !p && ge(e.doc, e.mapping.map(l.pos), 1, f ? [{ type: f }] : void 0) && (p = !0, h = f ? [
|
|
10978
10978
|
{
|
|
10979
10979
|
type: f,
|
|
10980
10980
|
attrs: u
|
|
@@ -11004,10 +11004,10 @@ const td = ({ keepMarks: r = !0 } = {}) => ({ tr: e, state: t, dispatch: n, edit
|
|
|
11004
11004
|
const S = a.index(-1) ? 1 : a.index(-2) ? 2 : 3;
|
|
11005
11005
|
for (let H = a.depth - S; H >= a.depth - 3; H -= 1)
|
|
11006
11006
|
y = b.from(a.node(H).copy(y));
|
|
11007
|
-
const w = a.indexAfter(-1) < a.node(-2).childCount ? 1 : a.indexAfter(-2) < a.node(-3).childCount ? 2 : 3,
|
|
11007
|
+
const w = a.indexAfter(-1) < a.node(-2).childCount ? 1 : a.indexAfter(-2) < a.node(-3).childCount ? 2 : 3, D = {
|
|
11008
11008
|
...Lt(f, a.node().type.name, a.node().attrs),
|
|
11009
11009
|
...e
|
|
11010
|
-
}, A = ((o = l.contentMatch.defaultType) === null || o === void 0 ? void 0 : o.createAndFill(
|
|
11010
|
+
}, A = ((o = l.contentMatch.defaultType) === null || o === void 0 ? void 0 : o.createAndFill(D)) || void 0;
|
|
11011
11011
|
y = y.append(b.from(l.createAndFill(null, A) || void 0));
|
|
11012
11012
|
const M = a.before(a.depth - (S - 1));
|
|
11013
11013
|
t.replace(M, a.after(-w), new k(y, 4 - S, 0));
|
|
@@ -11032,13 +11032,13 @@ const td = ({ keepMarks: r = !0 } = {}) => ({ tr: e, state: t, dispatch: n, edit
|
|
|
11032
11032
|
{ type: l, attrs: p },
|
|
11033
11033
|
{ type: h, attrs: m }
|
|
11034
11034
|
] : [{ type: l, attrs: p }];
|
|
11035
|
-
if (!
|
|
11035
|
+
if (!ge(t.doc, a.pos, 2))
|
|
11036
11036
|
return !1;
|
|
11037
11037
|
if (i) {
|
|
11038
|
-
const { selection: y, storedMarks: S } = n, { splittableMarks: w } = s.extensionManager,
|
|
11039
|
-
if (t.split(a.pos, 2, g).scrollIntoView(), !
|
|
11038
|
+
const { selection: y, storedMarks: S } = n, { splittableMarks: w } = s.extensionManager, D = S || y.$to.parentOffset && y.$from.marks();
|
|
11039
|
+
if (t.split(a.pos, 2, g).scrollIntoView(), !D || !i)
|
|
11040
11040
|
return !0;
|
|
11041
|
-
const A =
|
|
11041
|
+
const A = D.filter((M) => w.includes(M.type.name));
|
|
11042
11042
|
t.ensureMarks(A);
|
|
11043
11043
|
}
|
|
11044
11044
|
return !0;
|
|
@@ -11061,7 +11061,7 @@ const td = ({ keepMarks: r = !0 } = {}) => ({ tr: e, state: t, dispatch: n, edit
|
|
|
11061
11061
|
const i = r.doc.nodeAt(n);
|
|
11062
11062
|
return t.node.type === (i == null ? void 0 : i.type) && qe(r.doc, n) && r.join(n), !0;
|
|
11063
11063
|
}, rd = (r, e, t, n = {}) => ({ editor: i, tr: s, state: o, dispatch: l, chain: a, commands: c, can: u }) => {
|
|
11064
|
-
const { extensions: d, splittableMarks: f } = i.extensionManager, h = L(r, o.schema), p = L(e, o.schema), { selection: m, storedMarks: g } = o, { $from: y, $to: S } = m, w = y.blockRange(S),
|
|
11064
|
+
const { extensions: d, splittableMarks: f } = i.extensionManager, h = L(r, o.schema), p = L(e, o.schema), { selection: m, storedMarks: g } = o, { $from: y, $to: S } = m, w = y.blockRange(S), D = g || m.$to.parentOffset && m.$from.marks();
|
|
11065
11065
|
if (!w)
|
|
11066
11066
|
return !1;
|
|
11067
11067
|
const A = Tr((M) => Pi(M.type.name, d))(m);
|
|
@@ -11071,8 +11071,8 @@ const td = ({ keepMarks: r = !0 } = {}) => ({ tr: e, state: t, dispatch: n, edit
|
|
|
11071
11071
|
if (Pi(A.node.type.name, d) && h.validContent(A.node.content) && l)
|
|
11072
11072
|
return a().command(() => (s.setNodeMarkup(A.pos, h), !0)).command(() => In(s, h)).command(() => Pn(s, h)).run();
|
|
11073
11073
|
}
|
|
11074
|
-
return !t || !
|
|
11075
|
-
const M = u().wrapInList(h, n), I =
|
|
11074
|
+
return !t || !D || !l ? a().command(() => u().wrapInList(h, n) ? !0 : c.clearNodes()).wrapInList(h, n).command(() => In(s, h)).command(() => Pn(s, h)).run() : a().command(() => {
|
|
11075
|
+
const M = u().wrapInList(h, n), I = D.filter((H) => f.includes(H.type.name));
|
|
11076
11076
|
return s.ensureMarks(I), M ? !0 : c.clearNodes();
|
|
11077
11077
|
}).wrapInList(h, n).command(() => In(s, h)).command(() => Pn(s, h)).run();
|
|
11078
11078
|
}, id = (r, e = {}, t = {}) => ({ state: n, commands: i }) => {
|
|
@@ -11223,14 +11223,14 @@ var hd = /* @__PURE__ */ Object.freeze({
|
|
|
11223
11223
|
wrapIn: dd,
|
|
11224
11224
|
wrapInList: fd
|
|
11225
11225
|
});
|
|
11226
|
-
const pd =
|
|
11226
|
+
const pd = q.create({
|
|
11227
11227
|
name: "commands",
|
|
11228
11228
|
addCommands() {
|
|
11229
11229
|
return {
|
|
11230
11230
|
...hd
|
|
11231
11231
|
};
|
|
11232
11232
|
}
|
|
11233
|
-
}), md =
|
|
11233
|
+
}), md = q.create({
|
|
11234
11234
|
name: "drop",
|
|
11235
11235
|
addProseMirrorPlugins() {
|
|
11236
11236
|
return [
|
|
@@ -11249,7 +11249,7 @@ const pd = G.create({
|
|
|
11249
11249
|
})
|
|
11250
11250
|
];
|
|
11251
11251
|
}
|
|
11252
|
-
}), gd =
|
|
11252
|
+
}), gd = q.create({
|
|
11253
11253
|
name: "editable",
|
|
11254
11254
|
addProseMirrorPlugins() {
|
|
11255
11255
|
return [
|
|
@@ -11261,7 +11261,7 @@ const pd = G.create({
|
|
|
11261
11261
|
})
|
|
11262
11262
|
];
|
|
11263
11263
|
}
|
|
11264
|
-
}), yd = new le("focusEvents"), bd =
|
|
11264
|
+
}), yd = new le("focusEvents"), bd = q.create({
|
|
11265
11265
|
name: "focusEvents",
|
|
11266
11266
|
addProseMirrorPlugins() {
|
|
11267
11267
|
const { editor: r } = this;
|
|
@@ -11285,7 +11285,7 @@ const pd = G.create({
|
|
|
11285
11285
|
})
|
|
11286
11286
|
];
|
|
11287
11287
|
}
|
|
11288
|
-
}), kd =
|
|
11288
|
+
}), kd = q.create({
|
|
11289
11289
|
name: "keymap",
|
|
11290
11290
|
addKeyboardShortcuts() {
|
|
11291
11291
|
const r = () => this.editor.commands.first(({ commands: o }) => [
|
|
@@ -11363,7 +11363,7 @@ const pd = G.create({
|
|
|
11363
11363
|
})
|
|
11364
11364
|
];
|
|
11365
11365
|
}
|
|
11366
|
-
}), xd =
|
|
11366
|
+
}), xd = q.create({
|
|
11367
11367
|
name: "paste",
|
|
11368
11368
|
addProseMirrorPlugins() {
|
|
11369
11369
|
return [
|
|
@@ -11381,7 +11381,7 @@ const pd = G.create({
|
|
|
11381
11381
|
})
|
|
11382
11382
|
];
|
|
11383
11383
|
}
|
|
11384
|
-
}), Sd =
|
|
11384
|
+
}), Sd = q.create({
|
|
11385
11385
|
name: "tabindex",
|
|
11386
11386
|
addProseMirrorPlugins() {
|
|
11387
11387
|
return [
|
|
@@ -12226,7 +12226,7 @@ class ae {
|
|
|
12226
12226
|
}
|
|
12227
12227
|
}
|
|
12228
12228
|
}
|
|
12229
|
-
class
|
|
12229
|
+
class xe {
|
|
12230
12230
|
constructor(e, t, n, i, s) {
|
|
12231
12231
|
this.done = e, this.undone = t, this.prevRanges = n, this.prevTime = i, this.prevComposition = s;
|
|
12232
12232
|
}
|
|
@@ -12236,16 +12236,16 @@ function Ad(r, e, t, n) {
|
|
|
12236
12236
|
let i = t.getMeta(Ve), s;
|
|
12237
12237
|
if (i)
|
|
12238
12238
|
return i.historyState;
|
|
12239
|
-
t.getMeta(Id) && (r = new
|
|
12239
|
+
t.getMeta(Id) && (r = new xe(r.done, r.undone, null, 0, -1));
|
|
12240
12240
|
let o = t.getMeta("appendedTransaction");
|
|
12241
12241
|
if (t.steps.length == 0)
|
|
12242
12242
|
return r;
|
|
12243
12243
|
if (o && o.getMeta(Ve))
|
|
12244
|
-
return o.getMeta(Ve).redo ? new
|
|
12244
|
+
return o.getMeta(Ve).redo ? new xe(r.done.addTransform(t, void 0, n, $t(e)), r.undone, Bi(t.mapping.maps), r.prevTime, r.prevComposition) : new xe(r.done, r.undone.addTransform(t, void 0, n, $t(e)), null, r.prevTime, r.prevComposition);
|
|
12245
12245
|
if (t.getMeta("addToHistory") !== !1 && !(o && o.getMeta("addToHistory") === !1)) {
|
|
12246
12246
|
let l = t.getMeta("composition"), a = r.prevTime == 0 || !o && r.prevComposition != l && (r.prevTime < (t.time || 0) - n.newGroupDelay || !vd(t, r.prevRanges)), c = o ? Rn(r.prevRanges, t.mapping) : Bi(t.mapping.maps);
|
|
12247
|
-
return new
|
|
12248
|
-
} else return (s = t.getMeta("rebased")) ? new
|
|
12247
|
+
return new xe(r.done.addTransform(t, a ? e.selection.getBookmark() : void 0, n, $t(e)), se.empty, c, t.time, l ?? r.prevComposition);
|
|
12248
|
+
} else return (s = t.getMeta("rebased")) ? new xe(r.done.rebased(t, s), r.undone.rebased(t, s), Rn(r.prevRanges, t.mapping), r.prevTime, r.prevComposition) : new xe(r.done.addMaps(t.mapping.maps), r.undone.addMaps(t.mapping.maps), Rn(r.prevRanges, t.mapping), r.prevTime, r.prevComposition);
|
|
12249
12249
|
}
|
|
12250
12250
|
function vd(r, e) {
|
|
12251
12251
|
if (!e)
|
|
@@ -12278,7 +12278,7 @@ function Dd(r, e, t) {
|
|
|
12278
12278
|
let n = $t(e), i = Ve.get(e).spec.config, s = (t ? r.undone : r.done).popEvent(e, n);
|
|
12279
12279
|
if (!s)
|
|
12280
12280
|
return null;
|
|
12281
|
-
let o = s.selection.resolve(s.transform.doc), l = (t ? r.done : r.undone).addTransform(s.transform, e.selection.getBookmark(), i, n), a = new
|
|
12281
|
+
let o = s.selection.resolve(s.transform.doc), l = (t ? r.done : r.undone).addTransform(s.transform, e.selection.getBookmark(), i, n), a = new xe(t ? l : s.remaining, t ? s.remaining : l, null, 0, -1);
|
|
12282
12282
|
return s.transform.setSelection(o).setMeta(Ve, { redo: t, historyState: a });
|
|
12283
12283
|
}
|
|
12284
12284
|
let Bn = !1, zi = null;
|
|
@@ -12303,7 +12303,7 @@ function Pd(r = {}) {
|
|
|
12303
12303
|
key: Ve,
|
|
12304
12304
|
state: {
|
|
12305
12305
|
init() {
|
|
12306
|
-
return new
|
|
12306
|
+
return new xe(se.empty, se.empty, null, 0, -1);
|
|
12307
12307
|
},
|
|
12308
12308
|
apply(e, t, n) {
|
|
12309
12309
|
return Ad(t, n, e, r);
|
|
@@ -12332,7 +12332,7 @@ function Mo(r, e) {
|
|
|
12332
12332
|
return !0;
|
|
12333
12333
|
};
|
|
12334
12334
|
}
|
|
12335
|
-
const Eo = Mo(!1, !0), To = Mo(!0, !0), Rd =
|
|
12335
|
+
const Eo = Mo(!1, !0), To = Mo(!0, !0), Rd = q.create({
|
|
12336
12336
|
name: "history",
|
|
12337
12337
|
addOptions() {
|
|
12338
12338
|
return {
|
|
@@ -12361,7 +12361,7 @@ const Eo = Mo(!1, !0), To = Mo(!0, !0), Rd = G.create({
|
|
|
12361
12361
|
"Shift-Mod-я": () => this.editor.commands.redo()
|
|
12362
12362
|
};
|
|
12363
12363
|
}
|
|
12364
|
-
}), Bd =
|
|
12364
|
+
}), Bd = q.create({
|
|
12365
12365
|
name: "placeholder",
|
|
12366
12366
|
addOptions() {
|
|
12367
12367
|
return {
|
|
@@ -12545,11 +12545,8 @@ const Fd = Or.create({
|
|
|
12545
12545
|
}), r;
|
|
12546
12546
|
},
|
|
12547
12547
|
addCommands() {
|
|
12548
|
-
const r = this.name.charAt(0).toUpperCase() + this.name.slice(1);
|
|
12549
12548
|
return {
|
|
12550
|
-
[`
|
|
12551
|
-
[`wrap${r}`]: () => ({ commands: e, attributes: t }) => e.wrapIn(this.name, t),
|
|
12552
|
-
[`lift${r}`]: () => ({ commands: e, attributes: t }) => e.lift(this.name, t)
|
|
12549
|
+
[`wrap${this.name.charAt(0).toUpperCase() + this.name.slice(1)}`]: () => ({ commands: e, attributes: t }) => e.wrapIn(this.name, t)
|
|
12553
12550
|
};
|
|
12554
12551
|
}
|
|
12555
12552
|
}), Vd = mn.extend({
|
|
@@ -12822,7 +12819,7 @@ const Ud = Oo.extend({
|
|
|
12822
12819
|
};
|
|
12823
12820
|
};
|
|
12824
12821
|
}
|
|
12825
|
-
}), _d =
|
|
12822
|
+
}), _d = q.create({
|
|
12826
12823
|
name: "footnoteRules",
|
|
12827
12824
|
priority: 1e3,
|
|
12828
12825
|
addProseMirrorPlugins() {
|
|
@@ -12937,7 +12934,7 @@ const Yd = Fd.extend({
|
|
|
12937
12934
|
}), Zd = Co({
|
|
12938
12935
|
find: /--(?!-)/,
|
|
12939
12936
|
replace: "–"
|
|
12940
|
-
}), Qd =
|
|
12937
|
+
}), Qd = q.create({
|
|
12941
12938
|
name: "inputRules",
|
|
12942
12939
|
addInputRules() {
|
|
12943
12940
|
return [
|
|
@@ -12945,6 +12942,16 @@ const Yd = Fd.extend({
|
|
|
12945
12942
|
Zd
|
|
12946
12943
|
];
|
|
12947
12944
|
}
|
|
12945
|
+
}), ef = q.create({
|
|
12946
|
+
name: "jinnTapCommands",
|
|
12947
|
+
addCommands() {
|
|
12948
|
+
return {
|
|
12949
|
+
moveUp: () => ({ commands: r }) => {
|
|
12950
|
+
const { from: e } = this.editor.state.selection, n = this.editor.state.doc.resolve(e).node();
|
|
12951
|
+
r.lift(n.type, n.attrs);
|
|
12952
|
+
}
|
|
12953
|
+
};
|
|
12954
|
+
}
|
|
12948
12955
|
});
|
|
12949
12956
|
function No(r, e, t) {
|
|
12950
12957
|
let n = null;
|
|
@@ -12958,7 +12965,7 @@ function No(r, e, t) {
|
|
|
12958
12965
|
return (((o = s.text) == null ? void 0 : o.length) || 0) - (((l = i.text) == null ? void 0 : l.length) || 0);
|
|
12959
12966
|
})), n;
|
|
12960
12967
|
}
|
|
12961
|
-
function
|
|
12968
|
+
function tf(r, e = []) {
|
|
12962
12969
|
const t = {}, n = [];
|
|
12963
12970
|
return r.state.doc.nodesBetween(0, r.state.doc.content.size, (i, s) => {
|
|
12964
12971
|
i.isText && e.forEach((o) => {
|
|
@@ -12972,11 +12979,11 @@ function ef(r, e = []) {
|
|
|
12972
12979
|
});
|
|
12973
12980
|
}), t;
|
|
12974
12981
|
}
|
|
12975
|
-
function
|
|
12982
|
+
function nf(r) {
|
|
12976
12983
|
const t = new DOMParser().parseFromString(r, "application/xml"), n = t.querySelector("parsererror");
|
|
12977
12984
|
return n ? (console.error("XML Parsing Error:", n.textContent), null) : t;
|
|
12978
12985
|
}
|
|
12979
|
-
function
|
|
12986
|
+
function rf(r) {
|
|
12980
12987
|
if (!r) return "";
|
|
12981
12988
|
const e = [], t = r.querySelectorAll("text > body > *"), n = (i) => {
|
|
12982
12989
|
if (i.nodeType === Node.ELEMENT_NODE) {
|
|
@@ -12994,11 +13001,11 @@ function nf(r) {
|
|
|
12994
13001
|
e.push(s.outerHTML);
|
|
12995
13002
|
}), e.join("");
|
|
12996
13003
|
}
|
|
12997
|
-
function
|
|
12998
|
-
const e =
|
|
12999
|
-
return e.documentElement.namespaceURI === "http://www.tei-c.org/ns/1.0" ?
|
|
13004
|
+
function sf(r) {
|
|
13005
|
+
const e = nf(r);
|
|
13006
|
+
return e.documentElement.namespaceURI === "http://www.tei-c.org/ns/1.0" ? rf(e) : xml;
|
|
13000
13007
|
}
|
|
13001
|
-
function
|
|
13008
|
+
function of(r, e, t, n = 3) {
|
|
13002
13009
|
let i = e - 1, s = 0;
|
|
13003
13010
|
for (; i >= 0; ) {
|
|
13004
13011
|
if (/[\p{P}\s]/.test(r.charAt(i))) {
|
|
@@ -13021,7 +13028,7 @@ function sf(r, e, t, n = 3) {
|
|
|
13021
13028
|
}
|
|
13022
13029
|
return `… ${r.substring(i, e)}<mark>${r.substring(e, t)}</mark>${r.substring(t, o + 1)} …`;
|
|
13023
13030
|
}
|
|
13024
|
-
class
|
|
13031
|
+
class lf {
|
|
13025
13032
|
constructor(e, t) {
|
|
13026
13033
|
this.editor = e.tiptap, this.schemaDef = t, this.panel = e.querySelector(".attribute-panel"), this.currentElement = null, this.currentMark = null, this.setupEventListeners(), this.overlay = document.createElement("div"), this.overlay.className = "jinn-tap overlay", this.overlay.style.display = "block", this.overlay.style.position = "fixed", this.overlay.style.pointerEvents = "none", this.overlay.style.zIndex = "1000", this.overlay.style.display = "none";
|
|
13027
13034
|
}
|
|
@@ -13135,10 +13142,22 @@ class of {
|
|
|
13135
13142
|
a !== "" ? t[l] = a : i.push(l);
|
|
13136
13143
|
console.log("<jinn-tap> pendingChanges: %o, cleared: %o", t, i);
|
|
13137
13144
|
const { from: s, to: o } = this.editor.state.selection;
|
|
13138
|
-
this.editor.chain().focus().extendMarkRange(e.type).run(),
|
|
13145
|
+
if (e instanceof v && this.editor.chain().focus().extendMarkRange(e.type).run(), Object.keys(t).length > 0)
|
|
13146
|
+
if (e instanceof v)
|
|
13147
|
+
i.length > 0 && this.editor.commands.resetAttributes(e.type, i), this.editor.chain().focus().updateAttributes(e.type, t).setTextSelection({ from: s, to: o }).run();
|
|
13148
|
+
else {
|
|
13149
|
+
let l = null;
|
|
13150
|
+
if (this.editor.state.doc.nodesBetween(0, this.editor.state.doc.content.size, (a, c) => {
|
|
13151
|
+
if (a.eq(e))
|
|
13152
|
+
return l = c, !1;
|
|
13153
|
+
}), l !== null) {
|
|
13154
|
+
const a = this.editor.state.tr;
|
|
13155
|
+
a.setNodeMarkup(l, e.type, { ...e.attrs, ...t }), this.editor.view.dispatch(a);
|
|
13156
|
+
}
|
|
13157
|
+
}
|
|
13139
13158
|
}
|
|
13140
13159
|
updateOccurrences(e, t, n) {
|
|
13141
|
-
const i =
|
|
13160
|
+
const i = tf(e, n), s = document.createElement("div");
|
|
13142
13161
|
s.classList.add("occurrences"), s.innerHTML = `
|
|
13143
13162
|
<h5>Other Occurrences
|
|
13144
13163
|
<div role="group">
|
|
@@ -13166,14 +13185,14 @@ class of {
|
|
|
13166
13185
|
to: d.pos + d.index + d.length,
|
|
13167
13186
|
hasMark: m
|
|
13168
13187
|
});
|
|
13169
|
-
const w = e.state.doc.textBetween(d.pos, f.end()),
|
|
13170
|
-
A.innerHTML =
|
|
13188
|
+
const w = e.state.doc.textBetween(d.pos, f.end()), D = of(w, d.index, d.index + d.length), A = document.createElement("span");
|
|
13189
|
+
A.innerHTML = D, y.appendChild(A), g.appendChild(y), o.appendChild(g), y.addEventListener("mouseenter", (M) => {
|
|
13171
13190
|
M.preventDefault(), M.stopPropagation();
|
|
13172
13191
|
const I = e.view.nodeDOM(d.pos);
|
|
13173
13192
|
if (I) {
|
|
13174
|
-
(I.nodeType ===
|
|
13193
|
+
(I.nodeType === ue.TEXT_NODE ? I.parentNode : I).scrollIntoView({ behavior: "instant", block: "center" });
|
|
13175
13194
|
let E;
|
|
13176
|
-
if (I.nodeType ===
|
|
13195
|
+
if (I.nodeType === ue.TEXT_NODE) {
|
|
13177
13196
|
const ee = document.createRange();
|
|
13178
13197
|
ee.setStart(I, d.index), ee.setEnd(I, d.index + d.length), E = ee.getBoundingClientRect();
|
|
13179
13198
|
} else
|
|
@@ -13198,7 +13217,7 @@ class of {
|
|
|
13198
13217
|
});
|
|
13199
13218
|
}
|
|
13200
13219
|
}
|
|
13201
|
-
class
|
|
13220
|
+
class af {
|
|
13202
13221
|
constructor(e, t) {
|
|
13203
13222
|
this.editor = e.tiptap, this.attributePanel = t, this.panel = e.querySelector(".navigation-panel"), this.setupEventListeners();
|
|
13204
13223
|
}
|
|
@@ -13232,7 +13251,7 @@ class lf {
|
|
|
13232
13251
|
s.reverse().forEach((a, c) => {
|
|
13233
13252
|
const u = document.createElement("li"), d = document.createElement("a");
|
|
13234
13253
|
d.setAttribute("href", "#"), d.textContent = a.type, d.addEventListener("click", (f) => {
|
|
13235
|
-
f.preventDefault(), this.editor.chain().focus().setTextSelection(a.pos).run(), this.attributePanel.showNodeAttributes(a.node);
|
|
13254
|
+
f.preventDefault(), this.editor.chain().focus().setTextSelection({ from: a.pos.from - 1, to: a.pos.to + 1 }).run(), this.attributePanel.showNodeAttributes(a.node);
|
|
13236
13255
|
}), u.appendChild(d), l.appendChild(u);
|
|
13237
13256
|
}), o && o.forEach((a) => {
|
|
13238
13257
|
const c = document.createElement("li"), u = document.createElement("a");
|
|
@@ -13242,16 +13261,22 @@ class lf {
|
|
|
13242
13261
|
}), this.panel.appendChild(l);
|
|
13243
13262
|
}
|
|
13244
13263
|
}
|
|
13245
|
-
class
|
|
13264
|
+
class cf {
|
|
13246
13265
|
/**
|
|
13247
13266
|
* Create a new Toolbar instance.
|
|
13248
13267
|
*
|
|
13249
13268
|
* @param {Object} editor - The editor instance.
|
|
13250
13269
|
* @param {Object} schemaDef - The schema definition.
|
|
13251
|
-
* @param {Element} toolbarSlot - The toolbar slot element.
|
|
13252
13270
|
*/
|
|
13253
13271
|
constructor(e, t) {
|
|
13254
|
-
this.editor = e.tiptap, this.toolbar = e.querySelector(".toolbar"), this.schemaDef = t, this.addButtons(t)
|
|
13272
|
+
this.editor = e.tiptap, this.toolbar = e.querySelector(".toolbar"), this.schemaDef = t, this.addButtons(t), t.toolbar && Object.entries(t.toolbar).forEach(([s, o]) => {
|
|
13273
|
+
const l = this.createButton(s, s, o);
|
|
13274
|
+
l.addEventListener("click", (c) => {
|
|
13275
|
+
c.preventDefault(), o.command && this.editor.chain().focus()[o.command]().run();
|
|
13276
|
+
});
|
|
13277
|
+
const a = document.createElement("li");
|
|
13278
|
+
a.appendChild(l), this.toolbar.appendChild(a);
|
|
13279
|
+
});
|
|
13255
13280
|
const n = document.createElement("a");
|
|
13256
13281
|
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) => {
|
|
13257
13282
|
s.preventDefault();
|
|
@@ -13365,7 +13390,7 @@ class af {
|
|
|
13365
13390
|
}), e.querySelector("ul").appendChild(o);
|
|
13366
13391
|
}
|
|
13367
13392
|
}
|
|
13368
|
-
function
|
|
13393
|
+
function uf(r) {
|
|
13369
13394
|
const e = "#E48500", t = {}, n = [], i = (u) => {
|
|
13370
13395
|
let d = parseInt(u.substring(1, 3), 16) / 255, f = parseInt(u.substring(3, 5), 16) / 255, h = parseInt(u.substring(5, 7), 16) / 255, p = Math.max(d, f, h), m = Math.min(d, f, h), g, y, S = (p + m) / 2;
|
|
13371
13396
|
if (p === m)
|
|
@@ -13417,14 +13442,19 @@ function cf(r) {
|
|
|
13417
13442
|
`)}
|
|
13418
13443
|
`;
|
|
13419
13444
|
}
|
|
13420
|
-
const
|
|
13445
|
+
const df = {
|
|
13421
13446
|
rend: {
|
|
13422
13447
|
type: "string"
|
|
13423
13448
|
},
|
|
13424
13449
|
id: {
|
|
13425
13450
|
type: "string"
|
|
13426
13451
|
}
|
|
13427
|
-
},
|
|
13452
|
+
}, ff = {
|
|
13453
|
+
"Move Up": {
|
|
13454
|
+
command: "moveUp",
|
|
13455
|
+
label: "<i class='bi bi-unindent'></i>"
|
|
13456
|
+
}
|
|
13457
|
+
}, hf = {
|
|
13428
13458
|
div: {
|
|
13429
13459
|
type: "block",
|
|
13430
13460
|
defining: !0,
|
|
@@ -13441,22 +13471,14 @@ const uf = {
|
|
|
13441
13471
|
"Mod-Shift-e": {
|
|
13442
13472
|
attributes: {},
|
|
13443
13473
|
command: "wrapDiv"
|
|
13444
|
-
},
|
|
13445
|
-
"Mod-Alt-e": {
|
|
13446
|
-
attributes: {},
|
|
13447
|
-
command: "liftDiv"
|
|
13448
13474
|
}
|
|
13449
13475
|
},
|
|
13450
13476
|
toolbar: {
|
|
13451
13477
|
Division: {
|
|
13478
|
+
select: "Blocks",
|
|
13452
13479
|
attributes: {},
|
|
13453
13480
|
command: "wrapDiv",
|
|
13454
13481
|
label: "<i class='bi bi-body-text'></i>"
|
|
13455
|
-
},
|
|
13456
|
-
"Unwrap nodes in division": {
|
|
13457
|
-
attributes: {},
|
|
13458
|
-
command: "liftDiv",
|
|
13459
|
-
label: "<i class='bi bi-arrow-up-left'></i>"
|
|
13460
13482
|
}
|
|
13461
13483
|
}
|
|
13462
13484
|
},
|
|
@@ -13855,8 +13877,9 @@ const uf = {
|
|
|
13855
13877
|
}
|
|
13856
13878
|
}
|
|
13857
13879
|
}, Vt = {
|
|
13858
|
-
attributes:
|
|
13859
|
-
|
|
13880
|
+
attributes: df,
|
|
13881
|
+
toolbar: ff,
|
|
13882
|
+
schema: hf
|
|
13860
13883
|
}, ir = document.createElement("style");
|
|
13861
13884
|
ir.textContent = `
|
|
13862
13885
|
jinn-tap {
|
|
@@ -13943,10 +13966,10 @@ ir.textContent = `
|
|
|
13943
13966
|
border-radius: 5px;
|
|
13944
13967
|
}
|
|
13945
13968
|
|
|
13946
|
-
${
|
|
13969
|
+
${uf(Vt)}
|
|
13947
13970
|
`;
|
|
13948
13971
|
document.querySelector("#jinn-tap-styles") || (ir.id = "jinn-tap-styles", document.head.appendChild(ir));
|
|
13949
|
-
class
|
|
13972
|
+
class pf extends HTMLElement {
|
|
13950
13973
|
static get observedAttributes() {
|
|
13951
13974
|
return ["debug", "url"];
|
|
13952
13975
|
}
|
|
@@ -13961,7 +13984,7 @@ class ff extends HTMLElement {
|
|
|
13961
13984
|
const t = await fetch(e);
|
|
13962
13985
|
if (!t.ok)
|
|
13963
13986
|
throw new Error(`HTTP error! status: ${t.status}`);
|
|
13964
|
-
const n = await t.text(), i =
|
|
13987
|
+
const n = await t.text(), i = sf(n);
|
|
13965
13988
|
this.editor ? this.content = i : this._pendingContent = i;
|
|
13966
13989
|
} catch (t) {
|
|
13967
13990
|
console.error("Error loading content from URL:", t), this.dispatchEvent(new CustomEvent("error", {
|
|
@@ -13993,6 +14016,7 @@ class ff extends HTMLElement {
|
|
|
13993
14016
|
extensions: [
|
|
13994
14017
|
...n,
|
|
13995
14018
|
Qd,
|
|
14019
|
+
ef,
|
|
13996
14020
|
_d,
|
|
13997
14021
|
Rd,
|
|
13998
14022
|
Bd.configure({
|
|
@@ -14010,7 +14034,7 @@ class ff extends HTMLElement {
|
|
|
14010
14034
|
this.dispatchContentChange(), this.dispatchEvent(new CustomEvent("ready"));
|
|
14011
14035
|
},
|
|
14012
14036
|
onUpdate: () => this.dispatchContentChange()
|
|
14013
|
-
}), this.
|
|
14037
|
+
}), this.attributePanel = new lf(this, Vt), this.navigationPanel = new af(this, this.attributePanel), this.toolbar = new cf(this, Vt);
|
|
14014
14038
|
const i = this.getAttribute("url");
|
|
14015
14039
|
i && this.loadFromUrl(i);
|
|
14016
14040
|
}
|
|
@@ -14057,8 +14081,8 @@ class ff extends HTMLElement {
|
|
|
14057
14081
|
return t.forEach((n) => n.remove()), e;
|
|
14058
14082
|
}
|
|
14059
14083
|
}
|
|
14060
|
-
customElements.define("jinn-tap",
|
|
14084
|
+
customElements.define("jinn-tap", pf);
|
|
14061
14085
|
export {
|
|
14062
|
-
|
|
14086
|
+
pf as JinnTap
|
|
14063
14087
|
};
|
|
14064
14088
|
//# sourceMappingURL=jinn-tap.es.js.map
|