asma-ui-richeditor 0.2.13 → 0.2.14
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/asma-ui-richeditor.es.js +692 -692
- package/package.json +1 -4
|
@@ -1949,7 +1949,7 @@ var xt = Object.create(null), k = class {
|
|
|
1949
1949
|
if (e in xt) throw RangeError("Duplicate use of step JSON ID " + e);
|
|
1950
1950
|
return xt[e] = t, t.prototype.jsonID = e, t;
|
|
1951
1951
|
}
|
|
1952
|
-
},
|
|
1952
|
+
}, St = class e {
|
|
1953
1953
|
constructor(e, t) {
|
|
1954
1954
|
this.doc = e, this.failed = t;
|
|
1955
1955
|
}
|
|
@@ -1968,24 +1968,24 @@ var xt = Object.create(null), k = class {
|
|
|
1968
1968
|
}
|
|
1969
1969
|
}
|
|
1970
1970
|
};
|
|
1971
|
-
function
|
|
1971
|
+
function Ct(e, t, n) {
|
|
1972
1972
|
let r = [];
|
|
1973
1973
|
for (let i = 0; i < e.childCount; i++) {
|
|
1974
1974
|
let a = e.child(i);
|
|
1975
|
-
a.content.size && (a = a.copy(
|
|
1975
|
+
a.content.size && (a = a.copy(Ct(a.content, t, a))), a.isInline && (a = t(a, n, i)), r.push(a);
|
|
1976
1976
|
}
|
|
1977
1977
|
return E.fromArray(r);
|
|
1978
1978
|
}
|
|
1979
|
-
var
|
|
1979
|
+
var wt = class e extends k {
|
|
1980
1980
|
constructor(e, t, n) {
|
|
1981
1981
|
super(), this.from = e, this.to = t, this.mark = n;
|
|
1982
1982
|
}
|
|
1983
1983
|
apply(e) {
|
|
1984
|
-
let t = e.slice(this.from, this.to), n = e.resolve(this.from), r = n.node(n.sharedDepth(this.to)), i = new O(
|
|
1985
|
-
return
|
|
1984
|
+
let t = e.slice(this.from, this.to), n = e.resolve(this.from), r = n.node(n.sharedDepth(this.to)), i = new O(Ct(t.content, ((e, t) => e.isAtom && t.type.allowsMarkType(this.mark.type) ? e.mark(this.mark.addToSet(e.marks)) : e), r), t.openStart, t.openEnd);
|
|
1985
|
+
return St.fromReplace(e, this.from, this.to, i);
|
|
1986
1986
|
}
|
|
1987
1987
|
invert() {
|
|
1988
|
-
return new
|
|
1988
|
+
return new Tt(this.from, this.to, this.mark);
|
|
1989
1989
|
}
|
|
1990
1990
|
map(t) {
|
|
1991
1991
|
let n = t.mapResult(this.from, 1), r = t.mapResult(this.to, -1);
|
|
@@ -2007,17 +2007,17 @@ var Ct = class e extends k {
|
|
|
2007
2007
|
return new e(n.from, n.to, t.markFromJSON(n.mark));
|
|
2008
2008
|
}
|
|
2009
2009
|
};
|
|
2010
|
-
k.jsonID("addMark",
|
|
2011
|
-
var
|
|
2010
|
+
k.jsonID("addMark", wt);
|
|
2011
|
+
var Tt = class e extends k {
|
|
2012
2012
|
constructor(e, t, n) {
|
|
2013
2013
|
super(), this.from = e, this.to = t, this.mark = n;
|
|
2014
2014
|
}
|
|
2015
2015
|
apply(e) {
|
|
2016
|
-
let t = e.slice(this.from, this.to), n = new O(
|
|
2017
|
-
return
|
|
2016
|
+
let t = e.slice(this.from, this.to), n = new O(Ct(t.content, ((e) => e.mark(this.mark.removeFromSet(e.marks))), e), t.openStart, t.openEnd);
|
|
2017
|
+
return St.fromReplace(e, this.from, this.to, n);
|
|
2018
2018
|
}
|
|
2019
2019
|
invert() {
|
|
2020
|
-
return new
|
|
2020
|
+
return new wt(this.from, this.to, this.mark);
|
|
2021
2021
|
}
|
|
2022
2022
|
map(t) {
|
|
2023
2023
|
let n = t.mapResult(this.from, 1), r = t.mapResult(this.to, -1);
|
|
@@ -2039,16 +2039,16 @@ var wt = class e extends k {
|
|
|
2039
2039
|
return new e(n.from, n.to, t.markFromJSON(n.mark));
|
|
2040
2040
|
}
|
|
2041
2041
|
};
|
|
2042
|
-
k.jsonID("removeMark",
|
|
2043
|
-
var
|
|
2042
|
+
k.jsonID("removeMark", Tt);
|
|
2043
|
+
var Et = class e extends k {
|
|
2044
2044
|
constructor(e, t) {
|
|
2045
2045
|
super(), this.pos = e, this.mark = t;
|
|
2046
2046
|
}
|
|
2047
2047
|
apply(e) {
|
|
2048
2048
|
let t = e.nodeAt(this.pos);
|
|
2049
|
-
if (!t) return
|
|
2049
|
+
if (!t) return St.fail("No node at mark step's position");
|
|
2050
2050
|
let n = t.type.create(t.attrs, null, this.mark.addToSet(t.marks));
|
|
2051
|
-
return
|
|
2051
|
+
return St.fromReplace(e, this.pos, this.pos + 1, new O(E.from(n), 0, +!t.isLeaf));
|
|
2052
2052
|
}
|
|
2053
2053
|
invert(t) {
|
|
2054
2054
|
let n = t.nodeAt(this.pos);
|
|
@@ -2059,7 +2059,7 @@ var Tt = class e extends k {
|
|
|
2059
2059
|
return new e(this.pos, this.mark);
|
|
2060
2060
|
}
|
|
2061
2061
|
}
|
|
2062
|
-
return new
|
|
2062
|
+
return new Dt(this.pos, this.mark);
|
|
2063
2063
|
}
|
|
2064
2064
|
map(t) {
|
|
2065
2065
|
let n = t.mapResult(this.pos, 1);
|
|
@@ -2077,20 +2077,20 @@ var Tt = class e extends k {
|
|
|
2077
2077
|
return new e(n.pos, t.markFromJSON(n.mark));
|
|
2078
2078
|
}
|
|
2079
2079
|
};
|
|
2080
|
-
k.jsonID("addNodeMark",
|
|
2081
|
-
var
|
|
2080
|
+
k.jsonID("addNodeMark", Et);
|
|
2081
|
+
var Dt = class e extends k {
|
|
2082
2082
|
constructor(e, t) {
|
|
2083
2083
|
super(), this.pos = e, this.mark = t;
|
|
2084
2084
|
}
|
|
2085
2085
|
apply(e) {
|
|
2086
2086
|
let t = e.nodeAt(this.pos);
|
|
2087
|
-
if (!t) return
|
|
2087
|
+
if (!t) return St.fail("No node at mark step's position");
|
|
2088
2088
|
let n = t.type.create(t.attrs, null, this.mark.removeFromSet(t.marks));
|
|
2089
|
-
return
|
|
2089
|
+
return St.fromReplace(e, this.pos, this.pos + 1, new O(E.from(n), 0, +!t.isLeaf));
|
|
2090
2090
|
}
|
|
2091
2091
|
invert(e) {
|
|
2092
2092
|
let t = e.nodeAt(this.pos);
|
|
2093
|
-
return t && this.mark.isInSet(t.marks) ? new
|
|
2093
|
+
return t && this.mark.isInSet(t.marks) ? new Et(this.pos, this.mark) : this;
|
|
2094
2094
|
}
|
|
2095
2095
|
map(t) {
|
|
2096
2096
|
let n = t.mapResult(this.pos, 1);
|
|
@@ -2108,13 +2108,13 @@ var Et = class e extends k {
|
|
|
2108
2108
|
return new e(n.pos, t.markFromJSON(n.mark));
|
|
2109
2109
|
}
|
|
2110
2110
|
};
|
|
2111
|
-
k.jsonID("removeNodeMark",
|
|
2112
|
-
var
|
|
2111
|
+
k.jsonID("removeNodeMark", Dt);
|
|
2112
|
+
var Ot = class e extends k {
|
|
2113
2113
|
constructor(e, t, n, r = !1) {
|
|
2114
2114
|
super(), this.from = e, this.to = t, this.slice = n, this.structure = r;
|
|
2115
2115
|
}
|
|
2116
2116
|
apply(e) {
|
|
2117
|
-
return this.structure &&
|
|
2117
|
+
return this.structure && At(e, this.from, this.to) ? St.fail("Structure replace would overwrite content") : St.fromReplace(e, this.from, this.to, this.slice);
|
|
2118
2118
|
}
|
|
2119
2119
|
getMap() {
|
|
2120
2120
|
return new bt([
|
|
@@ -2157,17 +2157,17 @@ var Dt = class e extends k {
|
|
|
2157
2157
|
return new e(n.from, n.to, O.fromJSON(t, n.slice), !!n.structure);
|
|
2158
2158
|
}
|
|
2159
2159
|
};
|
|
2160
|
-
|
|
2161
|
-
var
|
|
2160
|
+
Ot.MAP_BIAS = 1, k.jsonID("replace", Ot);
|
|
2161
|
+
var kt = class e extends k {
|
|
2162
2162
|
constructor(e, t, n, r, i, a, o = !1) {
|
|
2163
2163
|
super(), this.from = e, this.to = t, this.gapFrom = n, this.gapTo = r, this.slice = i, this.insert = a, this.structure = o;
|
|
2164
2164
|
}
|
|
2165
2165
|
apply(e) {
|
|
2166
|
-
if (this.structure && (
|
|
2166
|
+
if (this.structure && (At(e, this.from, this.gapFrom) || At(e, this.gapTo, this.to))) return St.fail("Structure gap-replace would overwrite content");
|
|
2167
2167
|
let t = e.slice(this.gapFrom, this.gapTo);
|
|
2168
|
-
if (t.openStart || t.openEnd) return
|
|
2168
|
+
if (t.openStart || t.openEnd) return St.fail("Gap is not a flat range");
|
|
2169
2169
|
let n = this.slice.insertAt(this.insert, t.content);
|
|
2170
|
-
return n ?
|
|
2170
|
+
return n ? St.fromReplace(e, this.from, this.to, n) : St.fail("Content does not fit in gap");
|
|
2171
2171
|
}
|
|
2172
2172
|
getMap() {
|
|
2173
2173
|
return new bt([
|
|
@@ -2203,7 +2203,7 @@ var Ot = class e extends k {
|
|
|
2203
2203
|
return new e(n.from, n.to, n.gapFrom, n.gapTo, O.fromJSON(t, n.slice), n.insert, !!n.structure);
|
|
2204
2204
|
}
|
|
2205
2205
|
};
|
|
2206
|
-
function
|
|
2206
|
+
function At(e, t, n) {
|
|
2207
2207
|
let r = e.resolve(t), i = n - t, a = r.depth;
|
|
2208
2208
|
for (; i > 0 && a > 0 && r.indexAfter(a) == r.node(a).childCount;) a--, i--;
|
|
2209
2209
|
if (i > 0) {
|
|
@@ -2215,18 +2215,18 @@ function kt(e, t, n) {
|
|
|
2215
2215
|
}
|
|
2216
2216
|
return !1;
|
|
2217
2217
|
}
|
|
2218
|
-
function
|
|
2218
|
+
function jt(e, t, n, r = n.contentMatch, i = !0) {
|
|
2219
2219
|
let a = e.doc.nodeAt(t), o = [], s = t + 1;
|
|
2220
2220
|
for (let t = 0; t < a.childCount; t++) {
|
|
2221
2221
|
let c = a.child(t), l = s + c.nodeSize, u = r.matchType(c.type);
|
|
2222
2222
|
if (u) {
|
|
2223
2223
|
r = u;
|
|
2224
|
-
for (let t = 0; t < c.marks.length; t++) n.allowsMarkType(c.marks[t].type) || e.step(new
|
|
2224
|
+
for (let t = 0; t < c.marks.length; t++) n.allowsMarkType(c.marks[t].type) || e.step(new Tt(s, l, c.marks[t]));
|
|
2225
2225
|
if (i && c.isText && n.whitespace != "pre") {
|
|
2226
2226
|
let e, t, r = /\r?\n|\r/g;
|
|
2227
|
-
for (; e = r.exec(c.text);) t ||= new O(E.from(n.schema.text(" ", n.allowedMarks(c.marks))), 0, 0), o.push(new
|
|
2227
|
+
for (; e = r.exec(c.text);) t ||= new O(E.from(n.schema.text(" ", n.allowedMarks(c.marks))), 0, 0), o.push(new Ot(s + e.index, s + e.index + e[0].length, t));
|
|
2228
2228
|
}
|
|
2229
|
-
} else o.push(new
|
|
2229
|
+
} else o.push(new Ot(s, l, O.empty));
|
|
2230
2230
|
s = l;
|
|
2231
2231
|
}
|
|
2232
2232
|
if (!r.validEnd) {
|
|
@@ -2235,20 +2235,20 @@ function At(e, t, n, r = n.contentMatch, i = !0) {
|
|
|
2235
2235
|
}
|
|
2236
2236
|
for (let t = o.length - 1; t >= 0; t--) e.step(o[t]);
|
|
2237
2237
|
}
|
|
2238
|
-
function
|
|
2238
|
+
function Mt(e, t, n) {
|
|
2239
2239
|
return (t == 0 || e.canReplace(t, e.childCount)) && (n == e.childCount || e.canReplace(0, n));
|
|
2240
2240
|
}
|
|
2241
|
-
function
|
|
2241
|
+
function Nt(e) {
|
|
2242
2242
|
let t = e.parent.content.cutByIndex(e.startIndex, e.endIndex);
|
|
2243
2243
|
for (let n = e.depth, r = 0, i = 0;; --n) {
|
|
2244
2244
|
let a = e.$from.node(n), o = e.$from.index(n) + r, s = e.$to.indexAfter(n) - i;
|
|
2245
2245
|
if (n < e.depth && a.canReplace(o, s, t)) return n;
|
|
2246
|
-
if (n == 0 || a.type.spec.isolating || !
|
|
2246
|
+
if (n == 0 || a.type.spec.isolating || !Mt(a, o, s)) break;
|
|
2247
2247
|
o && (r = 1), s < a.childCount && (i = 1);
|
|
2248
2248
|
}
|
|
2249
2249
|
return null;
|
|
2250
2250
|
}
|
|
2251
|
-
function
|
|
2251
|
+
function Pt(e, t, n = null, r = e) {
|
|
2252
2252
|
let i = function(e, t) {
|
|
2253
2253
|
let { parent: n, startIndex: r, endIndex: i } = e, a = n.contentMatchAt(r).findWrapping(t);
|
|
2254
2254
|
if (!a) return null;
|
|
@@ -2261,18 +2261,18 @@ function Nt(e, t, n = null, r = e) {
|
|
|
2261
2261
|
for (let e = r; s && e < i; e++) s = s.matchType(n.child(e).type);
|
|
2262
2262
|
return s && s.validEnd ? o : null;
|
|
2263
2263
|
}(r, t);
|
|
2264
|
-
return a ? i.map(
|
|
2264
|
+
return a ? i.map(Ft).concat({
|
|
2265
2265
|
type: t,
|
|
2266
2266
|
attrs: n
|
|
2267
|
-
}).concat(a.map(
|
|
2267
|
+
}).concat(a.map(Ft)) : null;
|
|
2268
2268
|
}
|
|
2269
|
-
function
|
|
2269
|
+
function Ft(e) {
|
|
2270
2270
|
return {
|
|
2271
2271
|
type: e,
|
|
2272
2272
|
attrs: null
|
|
2273
2273
|
};
|
|
2274
2274
|
}
|
|
2275
|
-
function
|
|
2275
|
+
function It(e, t, n, r) {
|
|
2276
2276
|
t.forEach(((i, a) => {
|
|
2277
2277
|
if (i.isText) {
|
|
2278
2278
|
let o, s = /\r?\n|\r/g;
|
|
@@ -2283,7 +2283,7 @@ function Ft(e, t, n, r) {
|
|
|
2283
2283
|
}
|
|
2284
2284
|
}));
|
|
2285
2285
|
}
|
|
2286
|
-
function
|
|
2286
|
+
function Lt(e, t, n, r) {
|
|
2287
2287
|
t.forEach(((i, a) => {
|
|
2288
2288
|
if (i.type == i.type.schema.linebreakReplacement) {
|
|
2289
2289
|
let i = e.mapping.slice(r).map(n + 1 + a);
|
|
@@ -2291,7 +2291,7 @@ function It(e, t, n, r) {
|
|
|
2291
2291
|
}
|
|
2292
2292
|
}));
|
|
2293
2293
|
}
|
|
2294
|
-
function
|
|
2294
|
+
function Rt(e, t, n = 1, r) {
|
|
2295
2295
|
let i = e.resolve(t), a = i.depth - n, o = r && r[r.length - 1] || i.parent;
|
|
2296
2296
|
if (a < 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))) return !1;
|
|
2297
2297
|
for (let e = i.depth - 1, t = n - 2; e > a; e--, t--) {
|
|
@@ -2305,11 +2305,11 @@ function Lt(e, t, n = 1, r) {
|
|
|
2305
2305
|
let s = i.indexAfter(a), c = r && r[0];
|
|
2306
2306
|
return i.node(a).canReplaceWith(s, s, c ? c.type : i.node(a + 1).type);
|
|
2307
2307
|
}
|
|
2308
|
-
function
|
|
2308
|
+
function zt(e, t) {
|
|
2309
2309
|
let n = e.resolve(t), r = n.index();
|
|
2310
|
-
return
|
|
2310
|
+
return Bt(n.nodeBefore, n.nodeAfter) && n.parent.canReplace(r, r + 1);
|
|
2311
2311
|
}
|
|
2312
|
-
function
|
|
2312
|
+
function Bt(e, t) {
|
|
2313
2313
|
return !(!e || !t || e.isLeaf || !function(e, t) {
|
|
2314
2314
|
t.content.size || e.type.compatibleContent(t.type);
|
|
2315
2315
|
let n = e.contentMatchAt(e.childCount), { linebreakReplacement: r } = e.type.schema;
|
|
@@ -2320,25 +2320,25 @@ function zt(e, t) {
|
|
|
2320
2320
|
return n.validEnd;
|
|
2321
2321
|
}(e, t));
|
|
2322
2322
|
}
|
|
2323
|
-
function
|
|
2323
|
+
function Vt(e, t, n = -1) {
|
|
2324
2324
|
let r = e.resolve(t);
|
|
2325
2325
|
for (let e = r.depth;; e--) {
|
|
2326
2326
|
let i, a, o = r.index(e);
|
|
2327
|
-
if (e == r.depth ? (i = r.nodeBefore, a = r.nodeAfter) : n > 0 ? (i = r.node(e + 1), o++, a = r.node(e).maybeChild(o)) : (i = r.node(e).maybeChild(o - 1), a = r.node(e + 1)), i && !i.isTextblock &&
|
|
2327
|
+
if (e == r.depth ? (i = r.nodeBefore, a = r.nodeAfter) : n > 0 ? (i = r.node(e + 1), o++, a = r.node(e).maybeChild(o)) : (i = r.node(e).maybeChild(o - 1), a = r.node(e + 1)), i && !i.isTextblock && Bt(i, a) && r.node(e).canReplace(o, o + 1)) return t;
|
|
2328
2328
|
if (e == 0) break;
|
|
2329
2329
|
t = n < 0 ? r.before(e) : r.after(e);
|
|
2330
2330
|
}
|
|
2331
2331
|
}
|
|
2332
|
-
function
|
|
2332
|
+
function Ht(e, t, n = t, r = O.empty) {
|
|
2333
2333
|
if (t == n && !r.size) return null;
|
|
2334
2334
|
let i = e.resolve(t), a = e.resolve(n);
|
|
2335
|
-
return
|
|
2335
|
+
return Ut(i, a, r) ? new Ot(t, n, r) : new Wt(i, a, r).fit();
|
|
2336
2336
|
}
|
|
2337
|
-
function
|
|
2337
|
+
function Ut(e, t, n) {
|
|
2338
2338
|
return !n.openStart && !n.openEnd && e.start() == t.start() && e.parent.canReplace(e.index(), t.index(), n.content);
|
|
2339
2339
|
}
|
|
2340
|
-
k.jsonID("replaceAround",
|
|
2341
|
-
var
|
|
2340
|
+
k.jsonID("replaceAround", kt);
|
|
2341
|
+
var Wt = class {
|
|
2342
2342
|
constructor(e, t, n) {
|
|
2343
2343
|
this.$from = e, this.$to = t, this.unplaced = n, this.frontier = [], this.placed = E.empty;
|
|
2344
2344
|
for (let t = 0; t <= e.depth; t++) {
|
|
@@ -2363,7 +2363,7 @@ var Ut = class {
|
|
|
2363
2363
|
let i = this.placed, a = n.depth, o = r.depth;
|
|
2364
2364
|
for (; a && o && i.childCount == 1;) i = i.firstChild.content, a--, o--;
|
|
2365
2365
|
let s = new O(i, a, o);
|
|
2366
|
-
return e > -1 ? new
|
|
2366
|
+
return e > -1 ? new kt(n.pos, e, this.$to.pos, this.$to.end(), s, t) : s.size || n.pos != this.$to.pos ? new Ot(n.pos, r.pos, s) : null;
|
|
2367
2367
|
}
|
|
2368
2368
|
findFittable() {
|
|
2369
2369
|
let e = this.unplaced.openStart;
|
|
@@ -2377,7 +2377,7 @@ var Ut = class {
|
|
|
2377
2377
|
}
|
|
2378
2378
|
for (let t = 1; t <= 2; t++) for (let n = t == 1 ? e : this.unplaced.openStart; n >= 0; n--) {
|
|
2379
2379
|
let e, r = null;
|
|
2380
|
-
n ? (r =
|
|
2380
|
+
n ? (r = qt(this.unplaced.content, n - 1).firstChild, e = r.content) : e = this.unplaced.content;
|
|
2381
2381
|
let i = e.firstChild;
|
|
2382
2382
|
for (let e = this.depth; e >= 0; e--) {
|
|
2383
2383
|
let a, { type: o, match: s } = this.frontier[e], c = null;
|
|
@@ -2398,15 +2398,15 @@ var Ut = class {
|
|
|
2398
2398
|
}
|
|
2399
2399
|
}
|
|
2400
2400
|
openMore() {
|
|
2401
|
-
let { content: e, openStart: t, openEnd: n } = this.unplaced, r =
|
|
2401
|
+
let { content: e, openStart: t, openEnd: n } = this.unplaced, r = qt(e, t);
|
|
2402
2402
|
return !(!r.childCount || r.firstChild.isLeaf) && (this.unplaced = new O(e, t + 1, Math.max(n, r.size + t >= e.size - n ? t + 1 : 0)), !0);
|
|
2403
2403
|
}
|
|
2404
2404
|
dropNode() {
|
|
2405
|
-
let { content: e, openStart: t, openEnd: n } = this.unplaced, r =
|
|
2405
|
+
let { content: e, openStart: t, openEnd: n } = this.unplaced, r = qt(e, t);
|
|
2406
2406
|
if (r.childCount <= 1 && t > 0) {
|
|
2407
2407
|
let i = e.size - t <= t + r.size;
|
|
2408
|
-
this.unplaced = new O(
|
|
2409
|
-
} else this.unplaced = new O(
|
|
2408
|
+
this.unplaced = new O(Gt(e, t - 1, 1), t - 1, i ? t - 1 : n);
|
|
2409
|
+
} else this.unplaced = new O(Gt(e, t, 1), t, n);
|
|
2410
2410
|
}
|
|
2411
2411
|
placeNodes({ sliceDepth: e, frontierDepth: t, parent: n, inject: r, wrap: i }) {
|
|
2412
2412
|
for (; this.depth > t;) this.closeFrontierNode();
|
|
@@ -2420,10 +2420,10 @@ var Ut = class {
|
|
|
2420
2420
|
for (; c < o.childCount;) {
|
|
2421
2421
|
let e = o.child(c), t = u.matchType(e.type);
|
|
2422
2422
|
if (!t) break;
|
|
2423
|
-
c++, (c > 1 || s == 0 || e.content.size) && (u = t, l.push(
|
|
2423
|
+
c++, (c > 1 || s == 0 || e.content.size) && (u = t, l.push(Jt(e.mark(d.allowedMarks(e.marks)), c == 1 ? s : 0, c == o.childCount ? f : -1)));
|
|
2424
2424
|
}
|
|
2425
2425
|
let p = c == o.childCount;
|
|
2426
|
-
p || (f = -1), this.placed =
|
|
2426
|
+
p || (f = -1), this.placed = Kt(this.placed, t, E.from(l)), this.frontier[t].match = u, p && f < 0 && n && n.type == this.frontier[this.depth].type && this.frontier.length > 1 && this.closeFrontierNode();
|
|
2427
2427
|
for (let e = 0, t = o; e < f; e++) {
|
|
2428
2428
|
let e = t.lastChild;
|
|
2429
2429
|
this.frontier.push({
|
|
@@ -2431,22 +2431,22 @@ var Ut = class {
|
|
|
2431
2431
|
match: e.contentMatchAt(e.childCount)
|
|
2432
2432
|
}), t = e.content;
|
|
2433
2433
|
}
|
|
2434
|
-
this.unplaced = p ? e == 0 ? O.empty : new O(
|
|
2434
|
+
this.unplaced = p ? e == 0 ? O.empty : new O(Gt(a.content, e - 1, 1), e - 1, f < 0 ? a.openEnd : e - 1) : new O(Gt(a.content, e, c), a.openStart, a.openEnd);
|
|
2435
2435
|
}
|
|
2436
2436
|
mustMoveInline() {
|
|
2437
2437
|
if (!this.$to.parent.isTextblock) return -1;
|
|
2438
2438
|
let e, t = this.frontier[this.depth];
|
|
2439
|
-
if (!t.type.isTextblock || !
|
|
2439
|
+
if (!t.type.isTextblock || !Yt(this.$to, this.$to.depth, t.type, t.match, !1) || this.$to.depth == this.depth && (e = this.findCloseLevel(this.$to)) && e.depth == this.depth) return -1;
|
|
2440
2440
|
let { depth: n } = this.$to, r = this.$to.after(n);
|
|
2441
2441
|
for (; n > 1 && r == this.$to.end(--n);) ++r;
|
|
2442
2442
|
return r;
|
|
2443
2443
|
}
|
|
2444
2444
|
findCloseLevel(e) {
|
|
2445
2445
|
e: for (let t = Math.min(this.depth, e.depth); t >= 0; t--) {
|
|
2446
|
-
let { match: n, type: r } = this.frontier[t], i = t < e.depth && e.end(t + 1) == e.pos + (e.depth - (t + 1)), a =
|
|
2446
|
+
let { match: n, type: r } = this.frontier[t], i = t < e.depth && e.end(t + 1) == e.pos + (e.depth - (t + 1)), a = Yt(e, t, r, n, i);
|
|
2447
2447
|
if (a) {
|
|
2448
2448
|
for (let n = t - 1; n >= 0; n--) {
|
|
2449
|
-
let { match: t, type: r } = this.frontier[n], i =
|
|
2449
|
+
let { match: t, type: r } = this.frontier[n], i = Yt(e, n, r, t, !0);
|
|
2450
2450
|
if (!i || i.childCount) continue e;
|
|
2451
2451
|
}
|
|
2452
2452
|
return {
|
|
@@ -2461,7 +2461,7 @@ var Ut = class {
|
|
|
2461
2461
|
let t = this.findCloseLevel(e);
|
|
2462
2462
|
if (!t) return null;
|
|
2463
2463
|
for (; this.depth > t.depth;) this.closeFrontierNode();
|
|
2464
|
-
t.fit.childCount && (this.placed =
|
|
2464
|
+
t.fit.childCount && (this.placed = Kt(this.placed, t.depth, t.fit)), e = t.move;
|
|
2465
2465
|
for (let n = t.depth + 1; n <= e.depth; n++) {
|
|
2466
2466
|
let t = e.node(n), r = t.type.contentMatch.fillBefore(t.content, !0, e.index(n));
|
|
2467
2467
|
this.openFrontierNode(t.type, t.attrs, r);
|
|
@@ -2470,32 +2470,32 @@ var Ut = class {
|
|
|
2470
2470
|
}
|
|
2471
2471
|
openFrontierNode(e, t = null, n) {
|
|
2472
2472
|
let r = this.frontier[this.depth];
|
|
2473
|
-
r.match = r.match.matchType(e), this.placed =
|
|
2473
|
+
r.match = r.match.matchType(e), this.placed = Kt(this.placed, this.depth, E.from(e.create(t, n))), this.frontier.push({
|
|
2474
2474
|
type: e,
|
|
2475
2475
|
match: e.contentMatch
|
|
2476
2476
|
});
|
|
2477
2477
|
}
|
|
2478
2478
|
closeFrontierNode() {
|
|
2479
2479
|
let e = this.frontier.pop().match.fillBefore(E.empty, !0);
|
|
2480
|
-
e.childCount && (this.placed =
|
|
2480
|
+
e.childCount && (this.placed = Kt(this.placed, this.frontier.length, e));
|
|
2481
2481
|
}
|
|
2482
2482
|
};
|
|
2483
|
-
function Wt(e, t, n) {
|
|
2484
|
-
return t == 0 ? e.cutByIndex(n, e.childCount) : e.replaceChild(0, e.firstChild.copy(Wt(e.firstChild.content, t - 1, n)));
|
|
2485
|
-
}
|
|
2486
2483
|
function Gt(e, t, n) {
|
|
2487
|
-
return t == 0 ? e.
|
|
2484
|
+
return t == 0 ? e.cutByIndex(n, e.childCount) : e.replaceChild(0, e.firstChild.copy(Gt(e.firstChild.content, t - 1, n)));
|
|
2485
|
+
}
|
|
2486
|
+
function Kt(e, t, n) {
|
|
2487
|
+
return t == 0 ? e.append(n) : e.replaceChild(e.childCount - 1, e.lastChild.copy(Kt(e.lastChild.content, t - 1, n)));
|
|
2488
2488
|
}
|
|
2489
|
-
function
|
|
2489
|
+
function qt(e, t) {
|
|
2490
2490
|
for (let n = 0; n < t; n++) e = e.firstChild.content;
|
|
2491
2491
|
return e;
|
|
2492
2492
|
}
|
|
2493
|
-
function
|
|
2493
|
+
function Jt(e, t, n) {
|
|
2494
2494
|
if (t <= 0) return e;
|
|
2495
2495
|
let r = e.content;
|
|
2496
|
-
return t > 1 && (r = r.replaceChild(0,
|
|
2496
|
+
return t > 1 && (r = r.replaceChild(0, Jt(r.firstChild, t - 1, r.childCount == 1 ? n - 1 : 0))), t > 0 && (r = e.type.contentMatch.fillBefore(r).append(r), n <= 0 && (r = r.append(e.type.contentMatch.matchFragment(r).fillBefore(E.empty, !0)))), e.copy(r);
|
|
2497
2497
|
}
|
|
2498
|
-
function
|
|
2498
|
+
function Yt(e, t, n, r, i) {
|
|
2499
2499
|
let a = e.node(t), o = i ? e.indexAfter(t) : e.index(t);
|
|
2500
2500
|
if (o == a.childCount && !n.compatibleContent(a.type)) return null;
|
|
2501
2501
|
let s = r.fillBefore(a.content, !0, o);
|
|
@@ -2504,10 +2504,10 @@ function Jt(e, t, n, r, i) {
|
|
|
2504
2504
|
return !1;
|
|
2505
2505
|
}(n, a.content, o) ? s : null;
|
|
2506
2506
|
}
|
|
2507
|
-
function
|
|
2507
|
+
function Xt(e, t, n, r, i) {
|
|
2508
2508
|
if (t < n) {
|
|
2509
2509
|
let i = e.firstChild;
|
|
2510
|
-
e = e.replaceChild(0, i.copy(
|
|
2510
|
+
e = e.replaceChild(0, i.copy(Xt(i.content, t + 1, n, r, i)));
|
|
2511
2511
|
}
|
|
2512
2512
|
if (t > r) {
|
|
2513
2513
|
let t = i.contentMatchAt(0), n = t.fillBefore(e).append(e);
|
|
@@ -2515,7 +2515,7 @@ function Yt(e, t, n, r, i) {
|
|
|
2515
2515
|
}
|
|
2516
2516
|
return e;
|
|
2517
2517
|
}
|
|
2518
|
-
function
|
|
2518
|
+
function Zt(e, t) {
|
|
2519
2519
|
let n = [];
|
|
2520
2520
|
for (let r = Math.min(e.depth, t.depth); r >= 0; r--) {
|
|
2521
2521
|
let i = e.start(r);
|
|
@@ -2524,18 +2524,18 @@ function Xt(e, t) {
|
|
|
2524
2524
|
}
|
|
2525
2525
|
return n;
|
|
2526
2526
|
}
|
|
2527
|
-
var
|
|
2527
|
+
var Qt = class e extends k {
|
|
2528
2528
|
constructor(e, t, n) {
|
|
2529
2529
|
super(), this.pos = e, this.attr = t, this.value = n;
|
|
2530
2530
|
}
|
|
2531
2531
|
apply(e) {
|
|
2532
2532
|
let t = e.nodeAt(this.pos);
|
|
2533
|
-
if (!t) return
|
|
2533
|
+
if (!t) return St.fail("No node at attribute step's position");
|
|
2534
2534
|
let n = Object.create(null);
|
|
2535
2535
|
for (let e in t.attrs) n[e] = t.attrs[e];
|
|
2536
2536
|
n[this.attr] = this.value;
|
|
2537
2537
|
let r = t.type.create(n, null, t.marks);
|
|
2538
|
-
return
|
|
2538
|
+
return St.fromReplace(e, this.pos, this.pos + 1, new O(E.from(r), 0, +!t.isLeaf));
|
|
2539
2539
|
}
|
|
2540
2540
|
getMap() {
|
|
2541
2541
|
return bt.empty;
|
|
@@ -2560,8 +2560,8 @@ var Zt = class e extends k {
|
|
|
2560
2560
|
return new e(n.pos, n.attr, n.value);
|
|
2561
2561
|
}
|
|
2562
2562
|
};
|
|
2563
|
-
k.jsonID("attr",
|
|
2564
|
-
var
|
|
2563
|
+
k.jsonID("attr", Qt);
|
|
2564
|
+
var $t = class e extends k {
|
|
2565
2565
|
constructor(e, t) {
|
|
2566
2566
|
super(), this.attr = e, this.value = t;
|
|
2567
2567
|
}
|
|
@@ -2570,7 +2570,7 @@ var Qt = class e extends k {
|
|
|
2570
2570
|
for (let n in e.attrs) t[n] = e.attrs[n];
|
|
2571
2571
|
t[this.attr] = this.value;
|
|
2572
2572
|
let n = e.type.create(t, e.content, e.marks);
|
|
2573
|
-
return
|
|
2573
|
+
return St.ok(n);
|
|
2574
2574
|
}
|
|
2575
2575
|
getMap() {
|
|
2576
2576
|
return bt.empty;
|
|
@@ -2593,13 +2593,13 @@ var Qt = class e extends k {
|
|
|
2593
2593
|
return new e(n.attr, n.value);
|
|
2594
2594
|
}
|
|
2595
2595
|
};
|
|
2596
|
-
k.jsonID("docAttr",
|
|
2597
|
-
var
|
|
2598
|
-
((
|
|
2596
|
+
k.jsonID("docAttr", $t);
|
|
2597
|
+
var en = Error;
|
|
2598
|
+
((en = function e(t) {
|
|
2599
2599
|
let n = Error.call(this, t);
|
|
2600
2600
|
return n.__proto__ = e.prototype, n;
|
|
2601
|
-
}).prototype = Object.create(Error.prototype)).constructor =
|
|
2602
|
-
var
|
|
2601
|
+
}).prototype = Object.create(Error.prototype)).constructor = en, en.prototype.name = "TransformError";
|
|
2602
|
+
var tn = class {
|
|
2603
2603
|
constructor(e) {
|
|
2604
2604
|
this.doc = e, this.steps = [], this.docs = [], this.mapping = new class e {
|
|
2605
2605
|
constructor(e, t, n = 0, r = e ? e.length : 0) {
|
|
@@ -2668,7 +2668,7 @@ var en = class {
|
|
|
2668
2668
|
}
|
|
2669
2669
|
step(e) {
|
|
2670
2670
|
let t = this.maybeStep(e);
|
|
2671
|
-
if (t.failed) throw new
|
|
2671
|
+
if (t.failed) throw new en(t.failed);
|
|
2672
2672
|
return this;
|
|
2673
2673
|
}
|
|
2674
2674
|
maybeStep(e) {
|
|
@@ -2695,7 +2695,7 @@ var en = class {
|
|
|
2695
2695
|
this.docs.push(this.doc), this.steps.push(e), this.mapping.appendMap(e.getMap()), this.doc = t;
|
|
2696
2696
|
}
|
|
2697
2697
|
replace(e, t = e, n = O.empty) {
|
|
2698
|
-
let r =
|
|
2698
|
+
let r = Ht(this.doc, e, t, n);
|
|
2699
2699
|
return r && this.step(r), this;
|
|
2700
2700
|
}
|
|
2701
2701
|
replaceWith(e, t, n) {
|
|
@@ -2711,8 +2711,8 @@ var en = class {
|
|
|
2711
2711
|
return function(e, t, n, r) {
|
|
2712
2712
|
if (!r.size) return e.deleteRange(t, n);
|
|
2713
2713
|
let i = e.doc.resolve(t), a = e.doc.resolve(n);
|
|
2714
|
-
if (
|
|
2715
|
-
let o =
|
|
2714
|
+
if (Ut(i, a, r)) return e.step(new Ot(t, n, r));
|
|
2715
|
+
let o = Zt(i, a);
|
|
2716
2716
|
o[o.length - 1] == 0 && o.pop();
|
|
2717
2717
|
let s = -(i.depth + 1);
|
|
2718
2718
|
o.unshift(s);
|
|
@@ -2739,7 +2739,7 @@ var en = class {
|
|
|
2739
2739
|
let l = o[(t + c) % o.length], u = !0;
|
|
2740
2740
|
l < 0 && (u = !1, l = -l);
|
|
2741
2741
|
let f = i.node(l - 1), p = i.index(l - 1);
|
|
2742
|
-
if (f.canReplaceWith(p, p, d.type, d.marks)) return e.replace(i.before(l), u ? a.after(l) : n, new O(
|
|
2742
|
+
if (f.canReplaceWith(p, p, d.type, d.marks)) return e.replace(i.before(l), u ? a.after(l) : n, new O(Xt(r.content, 0, r.openStart, s), s, r.openEnd));
|
|
2743
2743
|
}
|
|
2744
2744
|
}
|
|
2745
2745
|
let f = e.steps.length;
|
|
@@ -2785,7 +2785,7 @@ var en = class {
|
|
|
2785
2785
|
r = e.doc.resolve(t), i = e.doc.resolve(n);
|
|
2786
2786
|
}
|
|
2787
2787
|
}
|
|
2788
|
-
let a =
|
|
2788
|
+
let a = Zt(r, i);
|
|
2789
2789
|
for (let t = 0; t < a.length; t++) {
|
|
2790
2790
|
let n = a[t], o = t == a.length - 1;
|
|
2791
2791
|
if (o && n == 0 || r.node(n).type.contentMatch.validEnd) return e.delete(r.start(n), i.end(n));
|
|
@@ -2801,7 +2801,7 @@ var en = class {
|
|
|
2801
2801
|
for (let e = a, t = !1; e > n; e--) t || r.index(e) > 0 ? (t = !0, u = E.from(r.node(e).copy(u)), d++) : c--;
|
|
2802
2802
|
let f = E.empty, p = 0;
|
|
2803
2803
|
for (let e = a, t = !1; e > n; e--) t || i.after(e + 1) < i.end(e) ? (t = !0, f = E.from(i.node(e).copy(f)), p++) : l++;
|
|
2804
|
-
e.step(new
|
|
2804
|
+
e.step(new kt(c, l, o, s, new O(u.append(f), d, p), u.size - d, !0));
|
|
2805
2805
|
}(this, e, t), this;
|
|
2806
2806
|
}
|
|
2807
2807
|
join(e, t = 1) {
|
|
@@ -2814,13 +2814,13 @@ var en = class {
|
|
|
2814
2814
|
let s = e.steps.length;
|
|
2815
2815
|
if (!1 === r) {
|
|
2816
2816
|
let r = e.doc.resolve(t + n);
|
|
2817
|
-
|
|
2817
|
+
Lt(e, r.node(), r.before(), s);
|
|
2818
2818
|
}
|
|
2819
|
-
o.inlineContent &&
|
|
2819
|
+
o.inlineContent && jt(e, t + n - 1, o, a.node().contentMatchAt(a.index()), r == null);
|
|
2820
2820
|
let c = e.mapping.slice(s), l = c.map(t - n);
|
|
2821
|
-
if (e.step(new
|
|
2821
|
+
if (e.step(new Ot(l, c.map(t + n, -1), O.empty, !0)), !0 === r) {
|
|
2822
2822
|
let t = e.doc.resolve(l);
|
|
2823
|
-
|
|
2823
|
+
It(e, t.node(), t.before(), e.steps.length);
|
|
2824
2824
|
}
|
|
2825
2825
|
}(this, e, t), this;
|
|
2826
2826
|
}
|
|
@@ -2835,7 +2835,7 @@ var en = class {
|
|
|
2835
2835
|
r = E.from(n[e].type.create(n[e].attrs, r));
|
|
2836
2836
|
}
|
|
2837
2837
|
let i = t.start, a = t.end;
|
|
2838
|
-
e.step(new
|
|
2838
|
+
e.step(new kt(i, a, i, a, new O(r, 0, 0), n.length, !0));
|
|
2839
2839
|
}(this, e, t), this;
|
|
2840
2840
|
}
|
|
2841
2841
|
setBlockType(e, t = e, n, r = null) {
|
|
@@ -2853,9 +2853,9 @@ var en = class {
|
|
|
2853
2853
|
let e = r.whitespace == "pre", t = !!r.contentMatch.matchType(r.schema.linebreakReplacement);
|
|
2854
2854
|
e && !t ? i = !1 : !e && t && (i = !0);
|
|
2855
2855
|
}
|
|
2856
|
-
!1 === i &&
|
|
2856
|
+
!1 === i && Lt(e, t, n, a), jt(e, e.mapping.slice(a).map(n, 1), r, void 0, i === null);
|
|
2857
2857
|
let s = e.mapping.slice(a), c = s.map(n, 1), l = s.map(n + t.nodeSize, 1);
|
|
2858
|
-
return e.step(new
|
|
2858
|
+
return e.step(new kt(c, l, c + 1, l - 1, new O(E.from(r.create(o, null, t.marks)), 0, 0), 1, !0)), !0 === i && It(e, t, n, a), !1;
|
|
2859
2859
|
}
|
|
2860
2860
|
}));
|
|
2861
2861
|
}(this, e, t, n, r), this;
|
|
@@ -2868,25 +2868,25 @@ var en = class {
|
|
|
2868
2868
|
let o = n.create(r, null, i || a.marks);
|
|
2869
2869
|
if (a.isLeaf) return e.replaceWith(t, t + a.nodeSize, o);
|
|
2870
2870
|
if (!n.validContent(a.content)) throw RangeError("Invalid content for node type " + n.name);
|
|
2871
|
-
e.step(new
|
|
2871
|
+
e.step(new kt(t, t + a.nodeSize, t + 1, t + a.nodeSize - 1, new O(E.from(o), 0, 0), 1, !0));
|
|
2872
2872
|
}(this, e, t, n, r), this;
|
|
2873
2873
|
}
|
|
2874
2874
|
setNodeAttribute(e, t, n) {
|
|
2875
|
-
return this.step(new
|
|
2875
|
+
return this.step(new Qt(e, t, n)), this;
|
|
2876
2876
|
}
|
|
2877
2877
|
setDocAttribute(e, t) {
|
|
2878
|
-
return this.step(new
|
|
2878
|
+
return this.step(new $t(e, t)), this;
|
|
2879
2879
|
}
|
|
2880
2880
|
addNodeMark(e, t) {
|
|
2881
|
-
return this.step(new
|
|
2881
|
+
return this.step(new Et(e, t)), this;
|
|
2882
2882
|
}
|
|
2883
2883
|
removeNodeMark(e, t) {
|
|
2884
2884
|
let n = this.doc.nodeAt(e);
|
|
2885
2885
|
if (!n) throw RangeError("No node at position " + e);
|
|
2886
|
-
if (t instanceof D) t.isInSet(n.marks) && this.step(new
|
|
2886
|
+
if (t instanceof D) t.isInSet(n.marks) && this.step(new Dt(e, t));
|
|
2887
2887
|
else {
|
|
2888
2888
|
let r, i = n.marks, a = [];
|
|
2889
|
-
for (; r = t.isInSet(i);) a.push(new
|
|
2889
|
+
for (; r = t.isInSet(i);) a.push(new Dt(e, r)), i = r.removeFromSet(i);
|
|
2890
2890
|
for (let e = a.length - 1; e >= 0; e--) this.step(a[e]);
|
|
2891
2891
|
}
|
|
2892
2892
|
return this;
|
|
@@ -2899,7 +2899,7 @@ var en = class {
|
|
|
2899
2899
|
let t = r && r[s];
|
|
2900
2900
|
o = E.from(t ? t.type.create(t.attrs, o) : i.node(e).copy(o));
|
|
2901
2901
|
}
|
|
2902
|
-
e.step(new
|
|
2902
|
+
e.step(new Ot(t, t, new O(a.append(o), n, n), !0));
|
|
2903
2903
|
}(this, e, t, n), this;
|
|
2904
2904
|
}
|
|
2905
2905
|
addMark(e, t, n) {
|
|
@@ -2910,8 +2910,8 @@ var en = class {
|
|
|
2910
2910
|
let u = e.marks;
|
|
2911
2911
|
if (!r.isInSet(u) && l.type.allowsMarkType(r.type)) {
|
|
2912
2912
|
let l = Math.max(c, t), d = Math.min(c + e.nodeSize, n), f = r.addToSet(u);
|
|
2913
|
-
for (let e = 0; e < u.length; e++) u[e].isInSet(f) || (i && i.to == l && i.mark.eq(u[e]) ? i.to = d : o.push(i = new
|
|
2914
|
-
a && a.to == l ? a.to = d : s.push(a = new
|
|
2913
|
+
for (let e = 0; e < u.length; e++) u[e].isInSet(f) || (i && i.to == l && i.mark.eq(u[e]) ? i.to = d : o.push(i = new Tt(l, d, u[e])));
|
|
2914
|
+
a && a.to == l ? a.to = d : s.push(a = new wt(l, d, r));
|
|
2915
2915
|
}
|
|
2916
2916
|
})), o.forEach(((t) => e.step(t))), s.forEach(((t) => e.step(t)));
|
|
2917
2917
|
}(this, e, t, n), this;
|
|
@@ -2943,15 +2943,15 @@ var en = class {
|
|
|
2943
2943
|
});
|
|
2944
2944
|
}
|
|
2945
2945
|
}
|
|
2946
|
-
})), i.forEach(((t) => e.step(new
|
|
2946
|
+
})), i.forEach(((t) => e.step(new Tt(t.from, t.to, t.style))));
|
|
2947
2947
|
}(this, e, t, n), this;
|
|
2948
2948
|
}
|
|
2949
2949
|
clearIncompatible(e, t, n) {
|
|
2950
|
-
return
|
|
2950
|
+
return jt(this, e, t, n), this;
|
|
2951
2951
|
}
|
|
2952
|
-
},
|
|
2952
|
+
}, nn = Object.create(null), A = class {
|
|
2953
2953
|
constructor(e, t, n) {
|
|
2954
|
-
this.$anchor = e, this.$head = t, this.ranges = n || [new
|
|
2954
|
+
this.$anchor = e, this.$head = t, this.ranges = n || [new rn(e.min(t), e.max(t))];
|
|
2955
2955
|
}
|
|
2956
2956
|
get anchor() {
|
|
2957
2957
|
return this.$anchor.pos;
|
|
@@ -2985,67 +2985,67 @@ var en = class {
|
|
|
2985
2985
|
let i = e.steps.length, a = this.ranges;
|
|
2986
2986
|
for (let o = 0; o < a.length; o++) {
|
|
2987
2987
|
let { $from: s, $to: c } = a[o], l = e.mapping.slice(i);
|
|
2988
|
-
e.replaceRange(l.map(s.pos), l.map(c.pos), o ? O.empty : t), o == 0 &&
|
|
2988
|
+
e.replaceRange(l.map(s.pos), l.map(c.pos), o ? O.empty : t), o == 0 && fn(e, i, (n ? n.isInline : r && r.isTextblock) ? -1 : 1);
|
|
2989
2989
|
}
|
|
2990
2990
|
}
|
|
2991
2991
|
replaceWith(e, t) {
|
|
2992
2992
|
let n = e.steps.length, r = this.ranges;
|
|
2993
2993
|
for (let i = 0; i < r.length; i++) {
|
|
2994
2994
|
let { $from: a, $to: o } = r[i], s = e.mapping.slice(n), c = s.map(a.pos), l = s.map(o.pos);
|
|
2995
|
-
i ? e.deleteRange(c, l) : (e.replaceRangeWith(c, l, t),
|
|
2995
|
+
i ? e.deleteRange(c, l) : (e.replaceRangeWith(c, l, t), fn(e, n, t.isInline ? -1 : 1));
|
|
2996
2996
|
}
|
|
2997
2997
|
}
|
|
2998
2998
|
static findFrom(e, t, n = !1) {
|
|
2999
|
-
let r = e.parent.inlineContent ? new
|
|
2999
|
+
let r = e.parent.inlineContent ? new j(e) : dn(e.node(0), e.parent, e.pos, e.index(), t, n);
|
|
3000
3000
|
if (r) return r;
|
|
3001
3001
|
for (let r = e.depth - 1; r >= 0; r--) {
|
|
3002
|
-
let i = t < 0 ?
|
|
3002
|
+
let i = t < 0 ? dn(e.node(0), e.node(r), e.before(r + 1), e.index(r), t, n) : dn(e.node(0), e.node(r), e.after(r + 1), e.index(r) + 1, t, n);
|
|
3003
3003
|
if (i) return i;
|
|
3004
3004
|
}
|
|
3005
3005
|
return null;
|
|
3006
3006
|
}
|
|
3007
3007
|
static near(e, t = 1) {
|
|
3008
|
-
return this.findFrom(e, t) || this.findFrom(e, -t) || new
|
|
3008
|
+
return this.findFrom(e, t) || this.findFrom(e, -t) || new ln(e.node(0));
|
|
3009
3009
|
}
|
|
3010
3010
|
static atStart(e) {
|
|
3011
|
-
return
|
|
3011
|
+
return dn(e, e, 0, 0, 1) || new ln(e);
|
|
3012
3012
|
}
|
|
3013
3013
|
static atEnd(e) {
|
|
3014
|
-
return
|
|
3014
|
+
return dn(e, e, e.content.size, e.childCount, -1) || new ln(e);
|
|
3015
3015
|
}
|
|
3016
3016
|
static fromJSON(e, t) {
|
|
3017
3017
|
if (!t || !t.type) throw RangeError("Invalid input for Selection.fromJSON");
|
|
3018
|
-
let n =
|
|
3018
|
+
let n = nn[t.type];
|
|
3019
3019
|
if (!n) throw RangeError(`No selection type ${t.type} defined`);
|
|
3020
3020
|
return n.fromJSON(e, t);
|
|
3021
3021
|
}
|
|
3022
3022
|
static jsonID(e, t) {
|
|
3023
|
-
if (e in
|
|
3024
|
-
return
|
|
3023
|
+
if (e in nn) throw RangeError("Duplicate use of selection JSON ID " + e);
|
|
3024
|
+
return nn[e] = t, t.prototype.jsonID = e, t;
|
|
3025
3025
|
}
|
|
3026
3026
|
getBookmark() {
|
|
3027
|
-
return
|
|
3027
|
+
return j.between(this.$anchor, this.$head).getBookmark();
|
|
3028
3028
|
}
|
|
3029
3029
|
};
|
|
3030
|
-
|
|
3031
|
-
var
|
|
3030
|
+
A.prototype.visible = !0;
|
|
3031
|
+
var rn = class {
|
|
3032
3032
|
constructor(e, t) {
|
|
3033
3033
|
this.$from = e, this.$to = t;
|
|
3034
3034
|
}
|
|
3035
|
-
},
|
|
3036
|
-
function
|
|
3037
|
-
|
|
3035
|
+
}, an = !1;
|
|
3036
|
+
function on(e) {
|
|
3037
|
+
an || e.parent.inlineContent || (an = !0, console.warn("TextSelection endpoint not pointing into a node with inline content (" + e.parent.type.name + ")"));
|
|
3038
3038
|
}
|
|
3039
|
-
var
|
|
3039
|
+
var j = class e extends A {
|
|
3040
3040
|
constructor(e, t = e) {
|
|
3041
|
-
|
|
3041
|
+
on(e), on(t), super(e, t);
|
|
3042
3042
|
}
|
|
3043
3043
|
get $cursor() {
|
|
3044
3044
|
return this.$anchor.pos == this.$head.pos ? this.$head : null;
|
|
3045
3045
|
}
|
|
3046
3046
|
map(t, n) {
|
|
3047
3047
|
let r = t.resolve(n.map(this.head));
|
|
3048
|
-
if (!r.parent.inlineContent) return
|
|
3048
|
+
if (!r.parent.inlineContent) return A.near(r);
|
|
3049
3049
|
let i = t.resolve(n.map(this.anchor));
|
|
3050
3050
|
return new e(i.parent.inlineContent ? i : r, r);
|
|
3051
3051
|
}
|
|
@@ -3059,7 +3059,7 @@ var M = class e extends j {
|
|
|
3059
3059
|
return t instanceof e && t.anchor == this.anchor && t.head == this.head;
|
|
3060
3060
|
}
|
|
3061
3061
|
getBookmark() {
|
|
3062
|
-
return new
|
|
3062
|
+
return new sn(this.anchor, this.head);
|
|
3063
3063
|
}
|
|
3064
3064
|
toJSON() {
|
|
3065
3065
|
return {
|
|
@@ -3079,15 +3079,15 @@ var M = class e extends j {
|
|
|
3079
3079
|
static between(t, n, r) {
|
|
3080
3080
|
let i = t.pos - n.pos;
|
|
3081
3081
|
if (r && !i || (r = i >= 0 ? 1 : -1), !n.parent.inlineContent) {
|
|
3082
|
-
let e =
|
|
3083
|
-
if (!e) return
|
|
3082
|
+
let e = A.findFrom(n, r, !0) || A.findFrom(n, -r, !0);
|
|
3083
|
+
if (!e) return A.near(n, r);
|
|
3084
3084
|
n = e.$head;
|
|
3085
3085
|
}
|
|
3086
|
-
return t.parent.inlineContent || (i == 0 || (t = (
|
|
3086
|
+
return t.parent.inlineContent || (i == 0 || (t = (A.findFrom(t, -r, !0) || A.findFrom(t, r, !0)).$anchor).pos < n.pos != i < 0) && (t = n), new e(t, n);
|
|
3087
3087
|
}
|
|
3088
3088
|
};
|
|
3089
|
-
|
|
3090
|
-
var
|
|
3089
|
+
A.jsonID("text", j);
|
|
3090
|
+
var sn = class e {
|
|
3091
3091
|
constructor(e, t) {
|
|
3092
3092
|
this.anchor = e, this.head = t;
|
|
3093
3093
|
}
|
|
@@ -3095,16 +3095,16 @@ var on = class e {
|
|
|
3095
3095
|
return new e(t.map(this.anchor), t.map(this.head));
|
|
3096
3096
|
}
|
|
3097
3097
|
resolve(e) {
|
|
3098
|
-
return
|
|
3098
|
+
return j.between(e.resolve(this.anchor), e.resolve(this.head));
|
|
3099
3099
|
}
|
|
3100
|
-
},
|
|
3100
|
+
}, M = class e extends A {
|
|
3101
3101
|
constructor(e) {
|
|
3102
3102
|
let t = e.nodeAfter, n = e.node(0).resolve(e.pos + t.nodeSize);
|
|
3103
3103
|
super(e, n), this.node = t;
|
|
3104
3104
|
}
|
|
3105
3105
|
map(t, n) {
|
|
3106
3106
|
let { deleted: r, pos: i } = n.mapResult(this.anchor), a = t.resolve(i);
|
|
3107
|
-
return r ?
|
|
3107
|
+
return r ? A.near(a) : new e(a);
|
|
3108
3108
|
}
|
|
3109
3109
|
content() {
|
|
3110
3110
|
return new O(E.from(this.node), 0, 0);
|
|
@@ -3119,7 +3119,7 @@ var on = class e {
|
|
|
3119
3119
|
};
|
|
3120
3120
|
}
|
|
3121
3121
|
getBookmark() {
|
|
3122
|
-
return new
|
|
3122
|
+
return new cn(this.anchor);
|
|
3123
3123
|
}
|
|
3124
3124
|
static fromJSON(t, n) {
|
|
3125
3125
|
if (typeof n.anchor != "number") throw RangeError("Invalid input for NodeSelection.fromJSON");
|
|
@@ -3132,27 +3132,27 @@ var on = class e {
|
|
|
3132
3132
|
return !e.isText && !1 !== e.type.spec.selectable;
|
|
3133
3133
|
}
|
|
3134
3134
|
};
|
|
3135
|
-
|
|
3136
|
-
var
|
|
3135
|
+
M.prototype.visible = !1, A.jsonID("node", M);
|
|
3136
|
+
var cn = class e {
|
|
3137
3137
|
constructor(e) {
|
|
3138
3138
|
this.anchor = e;
|
|
3139
3139
|
}
|
|
3140
3140
|
map(t) {
|
|
3141
3141
|
let { deleted: n, pos: r } = t.mapResult(this.anchor);
|
|
3142
|
-
return n ? new
|
|
3142
|
+
return n ? new sn(r, r) : new e(r);
|
|
3143
3143
|
}
|
|
3144
3144
|
resolve(e) {
|
|
3145
3145
|
let t = e.resolve(this.anchor), n = t.nodeAfter;
|
|
3146
|
-
return n &&
|
|
3146
|
+
return n && M.isSelectable(n) ? new M(t) : A.near(t);
|
|
3147
3147
|
}
|
|
3148
|
-
},
|
|
3148
|
+
}, ln = class e extends A {
|
|
3149
3149
|
constructor(e) {
|
|
3150
3150
|
super(e.resolve(0), e.resolve(e.content.size));
|
|
3151
3151
|
}
|
|
3152
3152
|
replace(e, t = O.empty) {
|
|
3153
3153
|
if (t == O.empty) {
|
|
3154
3154
|
e.delete(0, e.doc.content.size);
|
|
3155
|
-
let t =
|
|
3155
|
+
let t = A.atStart(e.doc);
|
|
3156
3156
|
t.eq(e.selection) || e.setSelection(t);
|
|
3157
3157
|
} else super.replace(e, t);
|
|
3158
3158
|
}
|
|
@@ -3169,39 +3169,39 @@ var sn = class e {
|
|
|
3169
3169
|
return t instanceof e;
|
|
3170
3170
|
}
|
|
3171
3171
|
getBookmark() {
|
|
3172
|
-
return
|
|
3172
|
+
return un;
|
|
3173
3173
|
}
|
|
3174
3174
|
};
|
|
3175
|
-
|
|
3176
|
-
var
|
|
3175
|
+
A.jsonID("all", ln);
|
|
3176
|
+
var un = {
|
|
3177
3177
|
map() {
|
|
3178
3178
|
return this;
|
|
3179
3179
|
},
|
|
3180
|
-
resolve: (e) => new
|
|
3180
|
+
resolve: (e) => new ln(e)
|
|
3181
3181
|
};
|
|
3182
|
-
function
|
|
3183
|
-
if (t.inlineContent) return
|
|
3182
|
+
function dn(e, t, n, r, i, a = !1) {
|
|
3183
|
+
if (t.inlineContent) return j.create(e, n);
|
|
3184
3184
|
for (let o = r - (i > 0 ? 0 : 1); i > 0 ? o < t.childCount : o >= 0; o += i) {
|
|
3185
3185
|
let r = t.child(o);
|
|
3186
3186
|
if (r.isAtom) {
|
|
3187
|
-
if (!a &&
|
|
3187
|
+
if (!a && M.isSelectable(r)) return M.create(e, n - (i < 0 ? r.nodeSize : 0));
|
|
3188
3188
|
} else {
|
|
3189
|
-
let t =
|
|
3189
|
+
let t = dn(e, r, n + i, i < 0 ? r.childCount : 0, i, a);
|
|
3190
3190
|
if (t) return t;
|
|
3191
3191
|
}
|
|
3192
3192
|
n += r.nodeSize * i;
|
|
3193
3193
|
}
|
|
3194
3194
|
return null;
|
|
3195
3195
|
}
|
|
3196
|
-
function
|
|
3196
|
+
function fn(e, t, n) {
|
|
3197
3197
|
let r = e.steps.length - 1;
|
|
3198
3198
|
if (r < t) return;
|
|
3199
3199
|
let i, a = e.steps[r];
|
|
3200
|
-
(a instanceof
|
|
3200
|
+
(a instanceof Ot || a instanceof kt) && (e.mapping.maps[r].forEach(((e, t, n, r) => {
|
|
3201
3201
|
i ??= r;
|
|
3202
|
-
})), e.setSelection(
|
|
3202
|
+
})), e.setSelection(A.near(e.doc.resolve(i), n)));
|
|
3203
3203
|
}
|
|
3204
|
-
var
|
|
3204
|
+
var pn = class extends tn {
|
|
3205
3205
|
constructor(e) {
|
|
3206
3206
|
super(e.doc), this.curSelectionFor = 0, this.updated = 0, this.meta = Object.create(null), this.time = Date.now(), this.curSelection = e.selection, this.storedMarks = e.storedMarks;
|
|
3207
3207
|
}
|
|
@@ -3256,7 +3256,7 @@ var fn = class extends en {
|
|
|
3256
3256
|
let e = this.doc.resolve(t);
|
|
3257
3257
|
i = n == t ? e.marks() : e.marksAcross(this.doc.resolve(n));
|
|
3258
3258
|
}
|
|
3259
|
-
return this.replaceRangeWith(t, n, r.text(e, i)), this.selection.empty || this.selection.to != t + e.length || this.setSelection(
|
|
3259
|
+
return this.replaceRangeWith(t, n, r.text(e, i)), this.selection.empty || this.selection.to != t + e.length || this.setSelection(A.near(this.selection.$to)), this;
|
|
3260
3260
|
}
|
|
3261
3261
|
}
|
|
3262
3262
|
setMeta(e, t) {
|
|
@@ -3276,38 +3276,38 @@ var fn = class extends en {
|
|
|
3276
3276
|
return (4 & this.updated) > 0;
|
|
3277
3277
|
}
|
|
3278
3278
|
};
|
|
3279
|
-
function
|
|
3279
|
+
function mn(e, t) {
|
|
3280
3280
|
return t && e ? e.bind(t) : e;
|
|
3281
3281
|
}
|
|
3282
|
-
var
|
|
3282
|
+
var hn = class {
|
|
3283
3283
|
constructor(e, t, n) {
|
|
3284
|
-
this.name = e, this.init =
|
|
3284
|
+
this.name = e, this.init = mn(t.init, n), this.apply = mn(t.apply, n);
|
|
3285
3285
|
}
|
|
3286
|
-
},
|
|
3287
|
-
new
|
|
3286
|
+
}, gn = [
|
|
3287
|
+
new hn("doc", {
|
|
3288
3288
|
init: (e) => e.doc || e.schema.topNodeType.createAndFill(),
|
|
3289
3289
|
apply: (e) => e.doc
|
|
3290
3290
|
}),
|
|
3291
|
-
new
|
|
3292
|
-
init: (e, t) => e.selection ||
|
|
3291
|
+
new hn("selection", {
|
|
3292
|
+
init: (e, t) => e.selection || A.atStart(t.doc),
|
|
3293
3293
|
apply: (e) => e.selection
|
|
3294
3294
|
}),
|
|
3295
|
-
new
|
|
3295
|
+
new hn("storedMarks", {
|
|
3296
3296
|
init: (e) => e.storedMarks || null,
|
|
3297
3297
|
apply: (e, t, n, r) => r.selection.$cursor ? e.storedMarks : null
|
|
3298
3298
|
}),
|
|
3299
|
-
new
|
|
3299
|
+
new hn("scrollToSelection", {
|
|
3300
3300
|
init: () => 0,
|
|
3301
3301
|
apply: (e, t) => e.scrolledIntoView ? t + 1 : t
|
|
3302
3302
|
})
|
|
3303
|
-
],
|
|
3303
|
+
], _n = class {
|
|
3304
3304
|
constructor(e, t) {
|
|
3305
|
-
this.schema = e, this.plugins = [], this.pluginsByKey = Object.create(null), this.fields =
|
|
3305
|
+
this.schema = e, this.plugins = [], this.pluginsByKey = Object.create(null), this.fields = gn.slice(), t && t.forEach(((e) => {
|
|
3306
3306
|
if (this.pluginsByKey[e.key]) throw RangeError("Adding different instances of a keyed plugin (" + e.key + ")");
|
|
3307
|
-
this.plugins.push(e), this.pluginsByKey[e.key] = e, e.spec.state && this.fields.push(new
|
|
3307
|
+
this.plugins.push(e), this.pluginsByKey[e.key] = e, e.spec.state && this.fields.push(new hn(e.key, e.spec.state, e));
|
|
3308
3308
|
}));
|
|
3309
3309
|
}
|
|
3310
|
-
},
|
|
3310
|
+
}, vn = class e {
|
|
3311
3311
|
constructor(e) {
|
|
3312
3312
|
this.config = e;
|
|
3313
3313
|
}
|
|
@@ -3374,15 +3374,15 @@ var mn = class {
|
|
|
3374
3374
|
return n;
|
|
3375
3375
|
}
|
|
3376
3376
|
get tr() {
|
|
3377
|
-
return new
|
|
3377
|
+
return new pn(this);
|
|
3378
3378
|
}
|
|
3379
3379
|
static create(t) {
|
|
3380
|
-
let n = new
|
|
3380
|
+
let n = new _n(t.doc ? t.doc.type.schema : t.schema, t.plugins), r = new e(n);
|
|
3381
3381
|
for (let e = 0; e < n.fields.length; e++) r[n.fields[e].name] = n.fields[e].init(t, r);
|
|
3382
3382
|
return r;
|
|
3383
3383
|
}
|
|
3384
3384
|
reconfigure(t) {
|
|
3385
|
-
let n = new
|
|
3385
|
+
let n = new _n(this.schema, t.plugins), r = n.fields, i = new e(n);
|
|
3386
3386
|
for (let e = 0; e < r.length; e++) {
|
|
3387
3387
|
let n = r[e].name;
|
|
3388
3388
|
i[n] = this.hasOwnProperty(n) ? this[n] : r[e].init(t, i);
|
|
@@ -3404,10 +3404,10 @@ var mn = class {
|
|
|
3404
3404
|
static fromJSON(t, n, r) {
|
|
3405
3405
|
if (!n) throw RangeError("Invalid input for EditorState.fromJSON");
|
|
3406
3406
|
if (!t.schema) throw RangeError("Required config field 'schema' missing");
|
|
3407
|
-
let i = new
|
|
3407
|
+
let i = new _n(t.schema, t.plugins), a = new e(i);
|
|
3408
3408
|
return i.fields.forEach(((e) => {
|
|
3409
3409
|
if (e.name == "doc") a.doc = Ne.fromJSON(t.schema, n.doc);
|
|
3410
|
-
else if (e.name == "selection") a.selection =
|
|
3410
|
+
else if (e.name == "selection") a.selection = A.fromJSON(a.doc, n.selection);
|
|
3411
3411
|
else if (e.name == "storedMarks") n.storedMarks && (a.storedMarks = n.storedMarks.map(t.schema.markFromJSON));
|
|
3412
3412
|
else {
|
|
3413
3413
|
if (r) for (let i in r) {
|
|
@@ -3419,27 +3419,27 @@ var mn = class {
|
|
|
3419
3419
|
})), a;
|
|
3420
3420
|
}
|
|
3421
3421
|
};
|
|
3422
|
-
function
|
|
3422
|
+
function yn(e, t, n) {
|
|
3423
3423
|
for (let r in e) {
|
|
3424
3424
|
let i = e[r];
|
|
3425
|
-
i instanceof Function ? i = i.bind(t) : r == "handleDOMEvents" && (i =
|
|
3425
|
+
i instanceof Function ? i = i.bind(t) : r == "handleDOMEvents" && (i = yn(i, t, {})), n[r] = i;
|
|
3426
3426
|
}
|
|
3427
3427
|
return n;
|
|
3428
3428
|
}
|
|
3429
|
-
var
|
|
3429
|
+
var bn = class {
|
|
3430
3430
|
constructor(e) {
|
|
3431
|
-
this.spec = e, this.props = {}, e.props &&
|
|
3431
|
+
this.spec = e, this.props = {}, e.props && yn(e.props, this, this.props), this.key = e.key ? e.key.key : Sn("plugin");
|
|
3432
3432
|
}
|
|
3433
3433
|
getState(e) {
|
|
3434
3434
|
return e[this.key];
|
|
3435
3435
|
}
|
|
3436
|
-
},
|
|
3437
|
-
function
|
|
3438
|
-
return e in
|
|
3436
|
+
}, xn = Object.create(null);
|
|
3437
|
+
function Sn(e) {
|
|
3438
|
+
return e in xn ? e + "$" + ++xn[e] : (xn[e] = 0, e + "$");
|
|
3439
3439
|
}
|
|
3440
|
-
var
|
|
3440
|
+
var Cn = class {
|
|
3441
3441
|
constructor(e = "key") {
|
|
3442
|
-
this.key =
|
|
3442
|
+
this.key = Sn(e);
|
|
3443
3443
|
}
|
|
3444
3444
|
get(e) {
|
|
3445
3445
|
return e.config.pluginsByKey[this.key];
|
|
@@ -3447,24 +3447,24 @@ var Sn = class {
|
|
|
3447
3447
|
getState(e) {
|
|
3448
3448
|
return e[this.key];
|
|
3449
3449
|
}
|
|
3450
|
-
},
|
|
3450
|
+
}, N = function(e) {
|
|
3451
3451
|
for (var t = 0;; t++) if (!(e = e.previousSibling)) return t;
|
|
3452
|
-
},
|
|
3452
|
+
}, wn = function(e) {
|
|
3453
3453
|
let t = e.assignedSlot || e.parentNode;
|
|
3454
3454
|
return t && t.nodeType == 11 ? t.host : t;
|
|
3455
|
-
},
|
|
3456
|
-
let r =
|
|
3455
|
+
}, Tn = null, En = function(e, t, n) {
|
|
3456
|
+
let r = Tn ||= document.createRange();
|
|
3457
3457
|
return r.setEnd(e, n ?? e.nodeValue.length), r.setStart(e, t || 0), r;
|
|
3458
|
-
},
|
|
3459
|
-
return n && (
|
|
3460
|
-
},
|
|
3461
|
-
function
|
|
3458
|
+
}, Dn = function(e, t, n, r) {
|
|
3459
|
+
return n && (kn(e, t, n, r, -1) || kn(e, t, n, r, 1));
|
|
3460
|
+
}, On = /^(img|br|input|textarea|hr)$/i;
|
|
3461
|
+
function kn(e, t, n, r, i) {
|
|
3462
3462
|
for (;;) {
|
|
3463
3463
|
if (e == n && t == r) return !0;
|
|
3464
|
-
if (t == (i < 0 ? 0 :
|
|
3464
|
+
if (t == (i < 0 ? 0 : An(e))) {
|
|
3465
3465
|
let n = e.parentNode;
|
|
3466
|
-
if (!n || n.nodeType != 1 ||
|
|
3467
|
-
t =
|
|
3466
|
+
if (!n || n.nodeType != 1 || jn(e) || On.test(e.nodeName) || e.contentEditable == "false") return !1;
|
|
3467
|
+
t = N(e) + (i < 0 ? 0 : 1), e = n;
|
|
3468
3468
|
} else {
|
|
3469
3469
|
if (e.nodeType != 1) return !1;
|
|
3470
3470
|
{
|
|
@@ -3472,30 +3472,30 @@ function On(e, t, n, r, i) {
|
|
|
3472
3472
|
if (n.nodeType == 1 && n.contentEditable == "false") {
|
|
3473
3473
|
if (!n.pmViewDesc?.ignoreForSelection) return !1;
|
|
3474
3474
|
t += i;
|
|
3475
|
-
} else e = n, t = i < 0 ?
|
|
3475
|
+
} else e = n, t = i < 0 ? An(e) : 0;
|
|
3476
3476
|
}
|
|
3477
3477
|
}
|
|
3478
3478
|
}
|
|
3479
3479
|
}
|
|
3480
|
-
function
|
|
3480
|
+
function An(e) {
|
|
3481
3481
|
return e.nodeType == 3 ? e.nodeValue.length : e.childNodes.length;
|
|
3482
3482
|
}
|
|
3483
|
-
function
|
|
3483
|
+
function jn(e) {
|
|
3484
3484
|
let t;
|
|
3485
3485
|
for (let n = e; n && !(t = n.pmViewDesc); n = n.parentNode);
|
|
3486
3486
|
return t && t.node && t.node.isBlock && (t.dom == e || t.contentDOM == e);
|
|
3487
3487
|
}
|
|
3488
|
-
var
|
|
3489
|
-
return e.focusNode &&
|
|
3488
|
+
var Mn = function(e) {
|
|
3489
|
+
return e.focusNode && Dn(e.focusNode, e.focusOffset, e.anchorNode, e.anchorOffset);
|
|
3490
3490
|
};
|
|
3491
|
-
function
|
|
3491
|
+
function Nn(e, t) {
|
|
3492
3492
|
let n = document.createEvent("Event");
|
|
3493
3493
|
return n.initEvent("keydown", !0, !0), n.keyCode = e, n.key = n.code = t, n;
|
|
3494
3494
|
}
|
|
3495
|
-
var
|
|
3496
|
-
|
|
3497
|
-
var
|
|
3498
|
-
function
|
|
3495
|
+
var Pn = typeof navigator < "u" ? navigator : null, Fn = typeof document < "u" ? document : null, In = Pn && Pn.userAgent || "", Ln = /Edge\/(\d+)/.exec(In), Rn = /MSIE \d/.exec(In), zn = /Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(In), Bn = !!(Rn || zn || Ln), Vn = Rn ? document.documentMode : zn ? +zn[1] : Ln ? +Ln[1] : 0, Hn = !Bn && /gecko\/(\d+)/i.test(In);
|
|
3496
|
+
Hn && (/Firefox\/(\d+)/.exec(In) || [0, 0])[1];
|
|
3497
|
+
var Un = !Bn && /Chrome\/(\d+)/.exec(In), P = !!Un, Wn = Un ? +Un[1] : 0, F = !Bn && !!Pn && /Apple Computer/.test(Pn.vendor), Gn = F && (/Mobile\/\w+/.test(In) || !!Pn && Pn.maxTouchPoints > 2), Kn = Gn || !!Pn && /Mac/.test(Pn.platform), qn = !!Pn && /Win/.test(Pn.platform), Jn = /Android \d/.test(In), Yn = !!Fn && "webkitFontSmoothing" in Fn.documentElement.style, Xn = Yn ? +(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent) || [0, 0])[1] : 0;
|
|
3498
|
+
function Zn(e) {
|
|
3499
3499
|
let t = e.defaultView && e.defaultView.visualViewport;
|
|
3500
3500
|
return t ? {
|
|
3501
3501
|
left: 0,
|
|
@@ -3509,10 +3509,10 @@ function Xn(e) {
|
|
|
3509
3509
|
bottom: e.documentElement.clientHeight
|
|
3510
3510
|
};
|
|
3511
3511
|
}
|
|
3512
|
-
function
|
|
3512
|
+
function Qn(e, t) {
|
|
3513
3513
|
return typeof e == "number" ? e : e[t];
|
|
3514
3514
|
}
|
|
3515
|
-
function
|
|
3515
|
+
function $n(e) {
|
|
3516
3516
|
let t = e.getBoundingClientRect(), n = t.width / e.offsetWidth || 1, r = t.height / e.offsetHeight || 1;
|
|
3517
3517
|
return {
|
|
3518
3518
|
left: t.left,
|
|
@@ -3521,15 +3521,15 @@ function Qn(e) {
|
|
|
3521
3521
|
bottom: t.top + e.clientHeight * r
|
|
3522
3522
|
};
|
|
3523
3523
|
}
|
|
3524
|
-
function
|
|
3524
|
+
function er(e, t, n) {
|
|
3525
3525
|
let r = e.someProp("scrollThreshold") || 0, i = e.someProp("scrollMargin") || 5, a = e.dom.ownerDocument;
|
|
3526
3526
|
for (let o = n || e.dom; o;) {
|
|
3527
3527
|
if (o.nodeType != 1) {
|
|
3528
|
-
o =
|
|
3528
|
+
o = wn(o);
|
|
3529
3529
|
continue;
|
|
3530
3530
|
}
|
|
3531
|
-
let e = o, n = e == a.body, s = n ?
|
|
3532
|
-
if (t.top < s.top +
|
|
3531
|
+
let e = o, n = e == a.body, s = n ? Zn(a) : $n(e), c = 0, l = 0;
|
|
3532
|
+
if (t.top < s.top + Qn(r, "top") ? l = -(s.top - t.top + Qn(i, "top")) : t.bottom > s.bottom - Qn(r, "bottom") && (l = t.bottom - t.top > s.bottom - s.top ? t.top + Qn(i, "top") - s.top : t.bottom - s.bottom + Qn(i, "bottom")), t.left < s.left + Qn(r, "left") ? c = -(s.left - t.left + Qn(i, "left")) : t.right > s.right - Qn(r, "right") && (c = t.right - s.right + Qn(i, "right")), c || l) if (n) a.defaultView.scrollBy(c, l);
|
|
3533
3533
|
else {
|
|
3534
3534
|
let n = e.scrollLeft, r = e.scrollTop;
|
|
3535
3535
|
l && (e.scrollTop += l), c && (e.scrollLeft += c);
|
|
@@ -3543,33 +3543,33 @@ function $n(e, t, n) {
|
|
|
3543
3543
|
}
|
|
3544
3544
|
let u = n ? "fixed" : getComputedStyle(o).position;
|
|
3545
3545
|
if (/^(fixed|sticky)$/.test(u)) break;
|
|
3546
|
-
o = u == "absolute" ? o.offsetParent :
|
|
3546
|
+
o = u == "absolute" ? o.offsetParent : wn(o);
|
|
3547
3547
|
}
|
|
3548
3548
|
}
|
|
3549
|
-
function
|
|
3549
|
+
function tr(e) {
|
|
3550
3550
|
let t = [], n = e.ownerDocument;
|
|
3551
3551
|
for (let r = e; r && (t.push({
|
|
3552
3552
|
dom: r,
|
|
3553
3553
|
top: r.scrollTop,
|
|
3554
3554
|
left: r.scrollLeft
|
|
3555
|
-
}), e != n); r =
|
|
3555
|
+
}), e != n); r = wn(r));
|
|
3556
3556
|
return t;
|
|
3557
3557
|
}
|
|
3558
|
-
function
|
|
3558
|
+
function nr(e, t) {
|
|
3559
3559
|
for (let n = 0; n < e.length; n++) {
|
|
3560
3560
|
let { dom: r, top: i, left: a } = e[n];
|
|
3561
3561
|
r.scrollTop != i + t && (r.scrollTop = i + t), r.scrollLeft != a && (r.scrollLeft = a);
|
|
3562
3562
|
}
|
|
3563
3563
|
}
|
|
3564
|
-
var
|
|
3565
|
-
function
|
|
3564
|
+
var rr = null;
|
|
3565
|
+
function ir(e, t) {
|
|
3566
3566
|
let n, r, i, a, o = 2e8, s = 0, c = t.top, l = t.top;
|
|
3567
3567
|
for (let u = e.firstChild, d = 0; u; u = u.nextSibling, d++) {
|
|
3568
3568
|
let e;
|
|
3569
3569
|
if (u.nodeType == 1) e = u.getClientRects();
|
|
3570
3570
|
else {
|
|
3571
3571
|
if (u.nodeType != 3) continue;
|
|
3572
|
-
e =
|
|
3572
|
+
e = En(u).getClientRects();
|
|
3573
3573
|
}
|
|
3574
3574
|
for (let f = 0; f < e.length; f++) {
|
|
3575
3575
|
let p = e[f];
|
|
@@ -3594,8 +3594,8 @@ function rr(e, t) {
|
|
|
3594
3594
|
let n, r = e.nodeValue.length, i = document.createRange();
|
|
3595
3595
|
for (let a = 0; a < r; a++) {
|
|
3596
3596
|
i.setEnd(e, a + 1), i.setStart(e, a);
|
|
3597
|
-
let r =
|
|
3598
|
-
if (r.top != r.bottom &&
|
|
3597
|
+
let r = lr(i, 1);
|
|
3598
|
+
if (r.top != r.bottom && ar(t, r)) {
|
|
3599
3599
|
n = {
|
|
3600
3600
|
node: e,
|
|
3601
3601
|
offset: a + +(t.left >= (r.left + r.right) / 2)
|
|
@@ -3610,12 +3610,12 @@ function rr(e, t) {
|
|
|
3610
3610
|
}(n, r) : !n || o && n.nodeType == 1 ? {
|
|
3611
3611
|
node: e,
|
|
3612
3612
|
offset: s
|
|
3613
|
-
} :
|
|
3613
|
+
} : ir(n, r);
|
|
3614
3614
|
}
|
|
3615
|
-
function
|
|
3615
|
+
function ar(e, t) {
|
|
3616
3616
|
return e.left >= t.left - 1 && e.left <= t.right + 1 && e.top >= t.top - 1 && e.top <= t.bottom + 1;
|
|
3617
3617
|
}
|
|
3618
|
-
function
|
|
3618
|
+
function or(e, t, n) {
|
|
3619
3619
|
let r = e.childNodes.length;
|
|
3620
3620
|
if (r && n.top < n.bottom) for (let i = Math.max(0, Math.min(r - 1, Math.floor(r * (t.top - n.top) / (n.bottom - n.top)) - 2)), a = i;;) {
|
|
3621
3621
|
let n = e.childNodes[a];
|
|
@@ -3623,27 +3623,27 @@ function ar(e, t, n) {
|
|
|
3623
3623
|
let e = n.getClientRects();
|
|
3624
3624
|
for (let r = 0; r < e.length; r++) {
|
|
3625
3625
|
let i = e[r];
|
|
3626
|
-
if (
|
|
3626
|
+
if (ar(t, i)) return or(n, t, i);
|
|
3627
3627
|
}
|
|
3628
3628
|
}
|
|
3629
3629
|
if ((a = (a + 1) % r) == i) break;
|
|
3630
3630
|
}
|
|
3631
3631
|
return e;
|
|
3632
3632
|
}
|
|
3633
|
-
function
|
|
3633
|
+
function sr(e, t) {
|
|
3634
3634
|
let n, r = e.dom.ownerDocument, i = 0, a = function(e, t, n) {
|
|
3635
3635
|
if (e.caretPositionFromPoint) try {
|
|
3636
3636
|
let r = e.caretPositionFromPoint(t, n);
|
|
3637
3637
|
if (r) return {
|
|
3638
3638
|
node: r.offsetNode,
|
|
3639
|
-
offset: Math.min(
|
|
3639
|
+
offset: Math.min(An(r.offsetNode), r.offset)
|
|
3640
3640
|
};
|
|
3641
3641
|
} catch {}
|
|
3642
3642
|
if (e.caretRangeFromPoint) {
|
|
3643
3643
|
let r = e.caretRangeFromPoint(t, n);
|
|
3644
3644
|
if (r) return {
|
|
3645
3645
|
node: r.startContainer,
|
|
3646
|
-
offset: Math.min(
|
|
3646
|
+
offset: Math.min(An(r.startContainer), r.startOffset)
|
|
3647
3647
|
};
|
|
3648
3648
|
}
|
|
3649
3649
|
}(r, t.left, t.top);
|
|
@@ -3651,19 +3651,19 @@ function or(e, t) {
|
|
|
3651
3651
|
let o, s = (e.root.elementFromPoint ? e.root : r).elementFromPoint(t.left, t.top);
|
|
3652
3652
|
if (!s || !e.dom.contains(s.nodeType == 1 ? s : s.parentNode)) {
|
|
3653
3653
|
let n = e.dom.getBoundingClientRect();
|
|
3654
|
-
if (!
|
|
3654
|
+
if (!ar(t, n) || (s = or(e.dom, t, n), !s)) return null;
|
|
3655
3655
|
}
|
|
3656
|
-
if (
|
|
3656
|
+
if (F) for (let e = s; n && e; e = wn(e)) e.draggable && (n = void 0);
|
|
3657
3657
|
if (s = function(e, t) {
|
|
3658
3658
|
let n = e.parentNode;
|
|
3659
3659
|
return n && /^li$/i.test(n.nodeName) && t.left < e.getBoundingClientRect().left ? n : e;
|
|
3660
3660
|
}(s, t), n) {
|
|
3661
|
-
if (
|
|
3661
|
+
if (Hn && n.nodeType == 1 && (i = Math.min(i, n.childNodes.length), i < n.childNodes.length)) {
|
|
3662
3662
|
let e, r = n.childNodes[i];
|
|
3663
3663
|
r.nodeName == "IMG" && (e = r.getBoundingClientRect()).right <= t.left && e.bottom > t.top && i++;
|
|
3664
3664
|
}
|
|
3665
3665
|
let r;
|
|
3666
|
-
|
|
3666
|
+
Yn && i && n.nodeType == 1 && (r = n.childNodes[i - 1]).nodeType == 1 && r.contentEditable == "false" && r.getBoundingClientRect().top >= t.top && i--, n == e.dom && i == n.childNodes.length - 1 && n.lastChild.nodeType == 1 && t.top > n.lastChild.getBoundingClientRect().bottom ? o = e.state.doc.content.size : i != 0 && n.nodeType == 1 && n.childNodes[i - 1].nodeName == "BR" || (o = function(e, t, n, r) {
|
|
3667
3667
|
let i = -1;
|
|
3668
3668
|
for (let n = t, a = !1; n != e.dom;) {
|
|
3669
3669
|
let t, o = e.docView.nearestDesc(n, !0);
|
|
@@ -3675,7 +3675,7 @@ function or(e, t) {
|
|
|
3675
3675
|
}(e, n, i, t));
|
|
3676
3676
|
}
|
|
3677
3677
|
o ??= function(e, t, n) {
|
|
3678
|
-
let { node: r, offset: i } =
|
|
3678
|
+
let { node: r, offset: i } = ir(t, n), a = -1;
|
|
3679
3679
|
if (r.nodeType == 1 && !r.firstChild) {
|
|
3680
3680
|
let e = r.getBoundingClientRect();
|
|
3681
3681
|
a = e.left != e.right && n.left > (e.left + e.right) / 2 ? 1 : -1;
|
|
@@ -3688,61 +3688,61 @@ function or(e, t) {
|
|
|
3688
3688
|
inside: c ? c.posAtStart - c.border : -1
|
|
3689
3689
|
};
|
|
3690
3690
|
}
|
|
3691
|
-
function
|
|
3691
|
+
function cr(e) {
|
|
3692
3692
|
return e.top < e.bottom || e.left < e.right;
|
|
3693
3693
|
}
|
|
3694
|
-
function
|
|
3694
|
+
function lr(e, t) {
|
|
3695
3695
|
let n = e.getClientRects();
|
|
3696
3696
|
if (n.length) {
|
|
3697
3697
|
let e = n[t < 0 ? 0 : n.length - 1];
|
|
3698
|
-
if (
|
|
3698
|
+
if (cr(e)) return e;
|
|
3699
3699
|
}
|
|
3700
|
-
return Array.prototype.find.call(n,
|
|
3700
|
+
return Array.prototype.find.call(n, cr) || e.getBoundingClientRect();
|
|
3701
3701
|
}
|
|
3702
|
-
var
|
|
3703
|
-
function
|
|
3704
|
-
let { node: r, offset: i, atom: a } = e.docView.domFromPos(t, n < 0 ? -1 : 1), o =
|
|
3702
|
+
var ur = /[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;
|
|
3703
|
+
function dr(e, t, n) {
|
|
3704
|
+
let { node: r, offset: i, atom: a } = e.docView.domFromPos(t, n < 0 ? -1 : 1), o = Yn || Hn;
|
|
3705
3705
|
if (r.nodeType == 3) {
|
|
3706
|
-
if (!o || !
|
|
3706
|
+
if (!o || !ur.test(r.nodeValue) && (n < 0 ? i : i != r.nodeValue.length)) {
|
|
3707
3707
|
let e = i, t = i, a = n < 0 ? 1 : -1;
|
|
3708
|
-
return n < 0 && !i ? (t++, a = -1) : n >= 0 && i == r.nodeValue.length ? (e--, a = 1) : n < 0 ? e-- : t++,
|
|
3708
|
+
return n < 0 && !i ? (t++, a = -1) : n >= 0 && i == r.nodeValue.length ? (e--, a = 1) : n < 0 ? e-- : t++, fr(lr(En(r, e, t), a), a < 0);
|
|
3709
3709
|
}
|
|
3710
3710
|
{
|
|
3711
|
-
let e =
|
|
3712
|
-
if (
|
|
3713
|
-
let t =
|
|
3711
|
+
let e = lr(En(r, i, i), n);
|
|
3712
|
+
if (Hn && i && /\s/.test(r.nodeValue[i - 1]) && i < r.nodeValue.length) {
|
|
3713
|
+
let t = lr(En(r, i - 1, i - 1), -1);
|
|
3714
3714
|
if (t.top == e.top) {
|
|
3715
|
-
let n =
|
|
3716
|
-
if (n.top != e.top) return
|
|
3715
|
+
let n = lr(En(r, i, i + 1), -1);
|
|
3716
|
+
if (n.top != e.top) return fr(n, n.left < t.left);
|
|
3717
3717
|
}
|
|
3718
3718
|
}
|
|
3719
3719
|
return e;
|
|
3720
3720
|
}
|
|
3721
3721
|
}
|
|
3722
3722
|
if (!e.state.doc.resolve(t - (a || 0)).parent.inlineContent) {
|
|
3723
|
-
if (a == null && i && (n < 0 || i ==
|
|
3723
|
+
if (a == null && i && (n < 0 || i == An(r))) {
|
|
3724
3724
|
let e = r.childNodes[i - 1];
|
|
3725
|
-
if (e.nodeType == 1) return
|
|
3725
|
+
if (e.nodeType == 1) return pr(e.getBoundingClientRect(), !1);
|
|
3726
3726
|
}
|
|
3727
|
-
if (a == null && i <
|
|
3727
|
+
if (a == null && i < An(r)) {
|
|
3728
3728
|
let e = r.childNodes[i];
|
|
3729
|
-
if (e.nodeType == 1) return
|
|
3729
|
+
if (e.nodeType == 1) return pr(e.getBoundingClientRect(), !0);
|
|
3730
3730
|
}
|
|
3731
|
-
return
|
|
3731
|
+
return pr(r.getBoundingClientRect(), n >= 0);
|
|
3732
3732
|
}
|
|
3733
|
-
if (a == null && i && (n < 0 || i ==
|
|
3734
|
-
let e = r.childNodes[i - 1], t = e.nodeType == 3 ?
|
|
3735
|
-
if (t) return
|
|
3733
|
+
if (a == null && i && (n < 0 || i == An(r))) {
|
|
3734
|
+
let e = r.childNodes[i - 1], t = e.nodeType == 3 ? En(e, An(e) - +!o) : e.nodeType != 1 || e.nodeName == "BR" && e.nextSibling ? null : e;
|
|
3735
|
+
if (t) return fr(lr(t, 1), !1);
|
|
3736
3736
|
}
|
|
3737
|
-
if (a == null && i <
|
|
3737
|
+
if (a == null && i < An(r)) {
|
|
3738
3738
|
let e = r.childNodes[i];
|
|
3739
3739
|
for (; e.pmViewDesc && e.pmViewDesc.ignoreForCoords;) e = e.nextSibling;
|
|
3740
|
-
let t = e ? e.nodeType == 3 ?
|
|
3741
|
-
if (t) return
|
|
3740
|
+
let t = e ? e.nodeType == 3 ? En(e, 0, +!o) : e.nodeType == 1 ? e : null : null;
|
|
3741
|
+
if (t) return fr(lr(t, -1), !0);
|
|
3742
3742
|
}
|
|
3743
|
-
return
|
|
3743
|
+
return fr(lr(r.nodeType == 3 ? En(r) : r, -n), n >= 0);
|
|
3744
3744
|
}
|
|
3745
|
-
function
|
|
3745
|
+
function fr(e, t) {
|
|
3746
3746
|
if (e.width == 0) return e;
|
|
3747
3747
|
let n = t ? e.left : e.right;
|
|
3748
3748
|
return {
|
|
@@ -3752,7 +3752,7 @@ function dr(e, t) {
|
|
|
3752
3752
|
right: n
|
|
3753
3753
|
};
|
|
3754
3754
|
}
|
|
3755
|
-
function
|
|
3755
|
+
function pr(e, t) {
|
|
3756
3756
|
if (e.height == 0) return e;
|
|
3757
3757
|
let n = t ? e.top : e.bottom;
|
|
3758
3758
|
return {
|
|
@@ -3762,7 +3762,7 @@ function fr(e, t) {
|
|
|
3762
3762
|
right: e.right
|
|
3763
3763
|
};
|
|
3764
3764
|
}
|
|
3765
|
-
function
|
|
3765
|
+
function mr(e, t, n) {
|
|
3766
3766
|
let r = e.state, i = e.root.activeElement;
|
|
3767
3767
|
r != t && e.updateState(t), i != e.dom && e.focus();
|
|
3768
3768
|
try {
|
|
@@ -3771,11 +3771,11 @@ function pr(e, t, n) {
|
|
|
3771
3771
|
r != t && e.updateState(r), i != e.dom && i && i.focus();
|
|
3772
3772
|
}
|
|
3773
3773
|
}
|
|
3774
|
-
var
|
|
3775
|
-
function
|
|
3776
|
-
return
|
|
3774
|
+
var hr = /[\u0590-\u08ac]/, gr = null, _r = null, vr = !1;
|
|
3775
|
+
function yr(e, t, n) {
|
|
3776
|
+
return gr == t && _r == n ? vr : (gr = t, _r = n, vr = n == "up" || n == "down" ? function(e, t, n) {
|
|
3777
3777
|
let r = t.selection, i = n == "up" ? r.$from : r.$to;
|
|
3778
|
-
return
|
|
3778
|
+
return mr(e, t, (() => {
|
|
3779
3779
|
let { node: t } = e.docView.domFromPos(i.pos, n == "up" ? -1 : 1);
|
|
3780
3780
|
for (;;) {
|
|
3781
3781
|
let n = e.docView.nearestDesc(t, !0);
|
|
@@ -3786,13 +3786,13 @@ function vr(e, t, n) {
|
|
|
3786
3786
|
}
|
|
3787
3787
|
t = n.dom.parentNode;
|
|
3788
3788
|
}
|
|
3789
|
-
let r =
|
|
3789
|
+
let r = dr(e, i.pos, 1);
|
|
3790
3790
|
for (let e = t.firstChild; e; e = e.nextSibling) {
|
|
3791
3791
|
let t;
|
|
3792
3792
|
if (e.nodeType == 1) t = e.getClientRects();
|
|
3793
3793
|
else {
|
|
3794
3794
|
if (e.nodeType != 3) continue;
|
|
3795
|
-
t =
|
|
3795
|
+
t = En(e, 0, e.nodeValue.length).getClientRects();
|
|
3796
3796
|
}
|
|
3797
3797
|
for (let e = 0; e < t.length; e++) {
|
|
3798
3798
|
let i = t[e];
|
|
@@ -3805,7 +3805,7 @@ function vr(e, t, n) {
|
|
|
3805
3805
|
let { $head: r } = t.selection;
|
|
3806
3806
|
if (!r.parent.isTextblock) return !1;
|
|
3807
3807
|
let i = r.parentOffset, a = !i, o = i == r.parent.content.size, s = e.domSelection();
|
|
3808
|
-
return s ?
|
|
3808
|
+
return s ? hr.test(r.parent.textContent) && s.modify ? mr(e, t, (() => {
|
|
3809
3809
|
let { focusNode: t, focusOffset: i, anchorNode: a, anchorOffset: o } = e.domSelectionRange(), c = s.caretBidiLevel;
|
|
3810
3810
|
s.modify("move", n, "character");
|
|
3811
3811
|
let l = r.depth ? e.docView.domAfterPos(r.before()) : e.dom, { focusNode: u, focusOffset: d } = e.domSelectionRange(), f = u && !l.contains(u.nodeType == 1 ? u : u.parentNode) || t == u && i == d;
|
|
@@ -3816,7 +3816,7 @@ function vr(e, t, n) {
|
|
|
3816
3816
|
})) : n == "left" || n == "backward" ? a : o : r.pos == r.start() || r.pos == r.end();
|
|
3817
3817
|
}(e, t, n));
|
|
3818
3818
|
}
|
|
3819
|
-
var
|
|
3819
|
+
var br = class {
|
|
3820
3820
|
constructor(e, t, n, r) {
|
|
3821
3821
|
this.parent = e, this.children = t, this.dom = n, this.contentDOM = r, this.dirty = 0, n.pmViewDesc = this;
|
|
3822
3822
|
}
|
|
@@ -3893,7 +3893,7 @@ var yr = class {
|
|
|
3893
3893
|
}
|
|
3894
3894
|
}
|
|
3895
3895
|
let r;
|
|
3896
|
-
if (e == this.dom && this.contentDOM) r = t >
|
|
3896
|
+
if (e == this.dom && this.contentDOM) r = t > N(this.contentDOM);
|
|
3897
3897
|
else if (this.contentDOM && this.contentDOM != this.dom && this.dom.contains(this.contentDOM)) r = 2 & e.compareDocumentPosition(this.contentDOM);
|
|
3898
3898
|
else if (this.dom.firstChild) {
|
|
3899
3899
|
if (t == 0) for (let t = e;; t = t.parentNode) {
|
|
@@ -3959,20 +3959,20 @@ var yr = class {
|
|
|
3959
3959
|
let n = 0, r = 0;
|
|
3960
3960
|
for (let t = 0; n < this.children.length; n++) {
|
|
3961
3961
|
let i = this.children[n], a = t + i.size;
|
|
3962
|
-
if (a > e || i instanceof
|
|
3962
|
+
if (a > e || i instanceof Dr) {
|
|
3963
3963
|
r = e - t;
|
|
3964
3964
|
break;
|
|
3965
3965
|
}
|
|
3966
3966
|
t = a;
|
|
3967
3967
|
}
|
|
3968
3968
|
if (r) return this.children[n].domFromPos(r - this.children[n].border, t);
|
|
3969
|
-
for (let e; n && !(e = this.children[n - 1]).size && e instanceof
|
|
3969
|
+
for (let e; n && !(e = this.children[n - 1]).size && e instanceof xr && e.side >= 0; n--);
|
|
3970
3970
|
if (t <= 0) {
|
|
3971
3971
|
let e, r = !0;
|
|
3972
3972
|
for (; e = n ? this.children[n - 1] : null, e && e.dom.parentNode != this.contentDOM; n--, r = !1);
|
|
3973
3973
|
return e && t && r && !e.border && !e.domAtom ? e.domFromPos(e.size, t) : {
|
|
3974
3974
|
node: this.contentDOM,
|
|
3975
|
-
offset: e ?
|
|
3975
|
+
offset: e ? N(e.dom) + 1 : 0
|
|
3976
3976
|
};
|
|
3977
3977
|
}
|
|
3978
3978
|
{
|
|
@@ -3980,7 +3980,7 @@ var yr = class {
|
|
|
3980
3980
|
for (; e = n < this.children.length ? this.children[n] : null, e && e.dom.parentNode != this.contentDOM; n++, r = !1);
|
|
3981
3981
|
return e && r && !e.border && !e.domAtom ? e.domFromPos(0, t) : {
|
|
3982
3982
|
node: this.contentDOM,
|
|
3983
|
-
offset: e ?
|
|
3983
|
+
offset: e ? N(e.dom) : this.contentDOM.childNodes.length
|
|
3984
3984
|
};
|
|
3985
3985
|
}
|
|
3986
3986
|
}
|
|
@@ -4002,7 +4002,7 @@ var yr = class {
|
|
|
4002
4002
|
for (let t = o; t > 0; t--) {
|
|
4003
4003
|
let n = this.children[t - 1];
|
|
4004
4004
|
if (n.size && n.dom.parentNode == this.contentDOM && !n.emptyChildAt(1)) {
|
|
4005
|
-
r =
|
|
4005
|
+
r = N(n.dom) + 1;
|
|
4006
4006
|
break;
|
|
4007
4007
|
}
|
|
4008
4008
|
e -= n.size;
|
|
@@ -4014,7 +4014,7 @@ var yr = class {
|
|
|
4014
4014
|
for (let e = o + 1; e < this.children.length; e++) {
|
|
4015
4015
|
let n = this.children[e];
|
|
4016
4016
|
if (n.size && n.dom.parentNode == this.contentDOM && !n.emptyChildAt(-1)) {
|
|
4017
|
-
i =
|
|
4017
|
+
i = N(n.dom);
|
|
4018
4018
|
break;
|
|
4019
4019
|
}
|
|
4020
4020
|
t += n.size;
|
|
@@ -4050,14 +4050,14 @@ var yr = class {
|
|
|
4050
4050
|
s = l;
|
|
4051
4051
|
}
|
|
4052
4052
|
let o = this.domFromPos(e, e ? -1 : 1), s = t == e ? o : this.domFromPos(t, t ? -1 : 1), c = n.root.getSelection(), l = n.domSelectionRange(), u = !1;
|
|
4053
|
-
if ((
|
|
4053
|
+
if ((Hn || F) && e == t) {
|
|
4054
4054
|
let { node: e, offset: t } = o;
|
|
4055
4055
|
if (e.nodeType == 3) {
|
|
4056
4056
|
if (u = !(!t || e.nodeValue[t - 1] != "\n"), u && t == e.nodeValue.length) for (let t, n = e; n; n = n.parentNode) {
|
|
4057
4057
|
if (t = n.nextSibling) {
|
|
4058
4058
|
t.nodeName == "BR" && (o = s = {
|
|
4059
4059
|
node: t.parentNode,
|
|
4060
|
-
offset:
|
|
4060
|
+
offset: N(t) + 1
|
|
4061
4061
|
});
|
|
4062
4062
|
break;
|
|
4063
4063
|
}
|
|
@@ -4069,13 +4069,13 @@ var yr = class {
|
|
|
4069
4069
|
u = n && (n.nodeName == "BR" || n.contentEditable == "false");
|
|
4070
4070
|
}
|
|
4071
4071
|
}
|
|
4072
|
-
if (
|
|
4072
|
+
if (Hn && l.focusNode && l.focusNode != s.node && l.focusNode.nodeType == 1) {
|
|
4073
4073
|
let e = l.focusNode.childNodes[l.focusOffset];
|
|
4074
4074
|
e && e.contentEditable == "false" && (r = !0);
|
|
4075
4075
|
}
|
|
4076
|
-
if (!(r || u &&
|
|
4076
|
+
if (!(r || u && F) && Dn(o.node, o.offset, l.anchorNode, l.anchorOffset) && Dn(s.node, s.offset, l.focusNode, l.focusOffset)) return;
|
|
4077
4077
|
let d = !1;
|
|
4078
|
-
if ((c.extend || e == t) && (!u || !
|
|
4078
|
+
if ((c.extend || e == t) && (!u || !Hn)) {
|
|
4079
4079
|
c.collapse(o.node, o.offset);
|
|
4080
4080
|
try {
|
|
4081
4081
|
e != t && c.extend(s.node, s.offset), d = !0;
|
|
@@ -4127,7 +4127,7 @@ var yr = class {
|
|
|
4127
4127
|
isText(e) {
|
|
4128
4128
|
return !1;
|
|
4129
4129
|
}
|
|
4130
|
-
},
|
|
4130
|
+
}, xr = class extends br {
|
|
4131
4131
|
constructor(e, t, n, r) {
|
|
4132
4132
|
let i, a = t.type.toDOM;
|
|
4133
4133
|
if (typeof a == "function" && (a = a(n, (() => i ? i.parent ? i.parent.posBeforeChild(i) : void 0 : r))), !t.type.spec.raw) {
|
|
@@ -4164,7 +4164,7 @@ var yr = class {
|
|
|
4164
4164
|
get side() {
|
|
4165
4165
|
return this.widget.type.side;
|
|
4166
4166
|
}
|
|
4167
|
-
},
|
|
4167
|
+
}, Sr = class extends br {
|
|
4168
4168
|
constructor(e, t, n, r) {
|
|
4169
4169
|
super(e, [], t, null), this.textDOM = n, this.text = r;
|
|
4170
4170
|
}
|
|
@@ -4183,7 +4183,7 @@ var yr = class {
|
|
|
4183
4183
|
ignoreMutation(e) {
|
|
4184
4184
|
return e.type === "characterData" && e.target.nodeValue == e.oldValue;
|
|
4185
4185
|
}
|
|
4186
|
-
},
|
|
4186
|
+
}, Cr = class e extends br {
|
|
4187
4187
|
constructor(e, t, n, r, i) {
|
|
4188
4188
|
super(e, [], n, r), this.mark = t, this.spec = i;
|
|
4189
4189
|
}
|
|
@@ -4210,7 +4210,7 @@ var yr = class {
|
|
|
4210
4210
|
}
|
|
4211
4211
|
slice(t, n, r) {
|
|
4212
4212
|
let i = e.create(this.parent, this.mark, !0, r), a = this.children, o = this.size;
|
|
4213
|
-
n < o && (a =
|
|
4213
|
+
n < o && (a = Br(a, n, o, r)), t > 0 && (a = Br(a, 0, t, r));
|
|
4214
4214
|
for (let e = 0; e < a.length; e++) a[e].parent = i;
|
|
4215
4215
|
return i.children = a, i;
|
|
4216
4216
|
}
|
|
@@ -4220,7 +4220,7 @@ var yr = class {
|
|
|
4220
4220
|
destroy() {
|
|
4221
4221
|
this.spec.destroy && this.spec.destroy(), super.destroy();
|
|
4222
4222
|
}
|
|
4223
|
-
},
|
|
4223
|
+
}, wr = class e extends br {
|
|
4224
4224
|
constructor(e, t, n, r, i, a, o, s, c) {
|
|
4225
4225
|
super(e, [], i, a), this.node = t, this.outerDeco = n, this.innerDeco = r, this.nodeDOM = o;
|
|
4226
4226
|
}
|
|
@@ -4235,7 +4235,7 @@ var yr = class {
|
|
|
4235
4235
|
}
|
|
4236
4236
|
d || n.isText || u.nodeName == "BR" || (u.hasAttribute("contenteditable") || (u.contentEditable = "false"), n.type.spec.draggable && (u.draggable = !0));
|
|
4237
4237
|
let f = u;
|
|
4238
|
-
return u =
|
|
4238
|
+
return u = Fr(u, r, n), l ? s = new Or(t, n, r, i, u, d || null, f, l, a, o + 1) : n.isText ? new Er(t, n, r, i, u, f, a) : new e(t, n, r, i, u, d || null, f, a, o + 1);
|
|
4239
4239
|
}
|
|
4240
4240
|
parseRule() {
|
|
4241
4241
|
if (this.node.type.spec.reparseInView) return null;
|
|
@@ -4257,7 +4257,7 @@ var yr = class {
|
|
|
4257
4257
|
return e;
|
|
4258
4258
|
}
|
|
4259
4259
|
matchesNode(e, t, n) {
|
|
4260
|
-
return this.dirty == 0 && e.eq(this.node) &&
|
|
4260
|
+
return this.dirty == 0 && e.eq(this.node) && Ir(t, this.outerDeco) && n.eq(this.innerDeco);
|
|
4261
4261
|
}
|
|
4262
4262
|
get size() {
|
|
4263
4263
|
return this.node.nodeSize;
|
|
@@ -4266,7 +4266,7 @@ var yr = class {
|
|
|
4266
4266
|
return +!this.node.isLeaf;
|
|
4267
4267
|
}
|
|
4268
4268
|
updateChildren(e, t) {
|
|
4269
|
-
let n = this.node.inlineContent, r = t, i = e.composing ? this.localCompositionInfo(e, t) : null, a = i && i.pos > -1 ? i : null, o = i && i.pos < 0, s = new
|
|
4269
|
+
let n = this.node.inlineContent, r = t, i = e.composing ? this.localCompositionInfo(e, t) : null, a = i && i.pos > -1 ? i : null, o = i && i.pos < 0, s = new Rr(this, a && a.node, e);
|
|
4270
4270
|
(function(e, t, n, r) {
|
|
4271
4271
|
let i = t.locals(e), a = 0;
|
|
4272
4272
|
if (i.length == 0) {
|
|
@@ -4284,7 +4284,7 @@ var yr = class {
|
|
|
4284
4284
|
e.widget && (u ? (d ||= [u]).push(e) : u = e);
|
|
4285
4285
|
}
|
|
4286
4286
|
if (u) if (d) {
|
|
4287
|
-
d.sort(
|
|
4287
|
+
d.sort(zr);
|
|
4288
4288
|
for (let e = 0; e < d.length; e++) n(d[e], l, !!c);
|
|
4289
4289
|
} else n(u, l, !!c);
|
|
4290
4290
|
if (c) p = -1, f = c, c = null;
|
|
@@ -4308,7 +4308,7 @@ var yr = class {
|
|
|
4308
4308
|
}), ((t, a, c, l) => {
|
|
4309
4309
|
let u;
|
|
4310
4310
|
s.syncToMarks(t.marks, n, e, l), s.findNodeMatch(t, a, c, l) || o && e.state.selection.from > r && e.state.selection.to < r + t.nodeSize && (u = s.findIndexWithChild(i.node)) > -1 && s.updateNodeAt(t, a, c, u, e) || s.updateNextNode(t, a, c, e, l, r) || s.addNode(t, a, c, e, r), r += t.nodeSize;
|
|
4311
|
-
})), s.syncToMarks([], n, e, 0), this.node.isTextblock && s.addTextblockHacks(), s.destroyRest(), (s.changed || this.dirty == 2) && (a && this.protectLocalComposition(e, a),
|
|
4311
|
+
})), s.syncToMarks([], n, e, 0), this.node.isTextblock && s.addTextblockHacks(), s.destroyRest(), (s.changed || this.dirty == 2) && (a && this.protectLocalComposition(e, a), kr(this.contentDOM, this.children, e), Gn && function(e) {
|
|
4312
4312
|
if (e.nodeName == "UL" || e.nodeName == "OL") {
|
|
4313
4313
|
let t = e.style.cssText;
|
|
4314
4314
|
e.style.cssText = t + "; list-style: square !important", window.getComputedStyle(e).listStyle, e.style.cssText = t;
|
|
@@ -4317,7 +4317,7 @@ var yr = class {
|
|
|
4317
4317
|
}
|
|
4318
4318
|
localCompositionInfo(e, t) {
|
|
4319
4319
|
let { from: n, to: r } = e.state.selection;
|
|
4320
|
-
if (!(e.state.selection instanceof
|
|
4320
|
+
if (!(e.state.selection instanceof j) || n < t || r > t + this.node.content.size) return null;
|
|
4321
4321
|
let i = e.input.compositionNode;
|
|
4322
4322
|
if (!i || !this.dom.contains(i.parentNode)) return null;
|
|
4323
4323
|
if (this.node.inlineContent) {
|
|
@@ -4360,8 +4360,8 @@ var yr = class {
|
|
|
4360
4360
|
for (; i.nextSibling;) i.parentNode.removeChild(i.nextSibling);
|
|
4361
4361
|
i.pmViewDesc &&= void 0;
|
|
4362
4362
|
}
|
|
4363
|
-
let a = new
|
|
4364
|
-
e.input.compositionNodes.push(a), this.children =
|
|
4363
|
+
let a = new Sr(this, i, t, r);
|
|
4364
|
+
e.input.compositionNodes.push(a), this.children = Br(this.children, n, n + r.length, e, a);
|
|
4365
4365
|
}
|
|
4366
4366
|
update(e, t, n, r) {
|
|
4367
4367
|
return !(this.dirty == 3 || !e.sameMarkup(this.node)) && (this.updateInner(e, t, n, r), !0);
|
|
@@ -4370,9 +4370,9 @@ var yr = class {
|
|
|
4370
4370
|
this.updateOuterDeco(t), this.node = e, this.innerDeco = n, this.contentDOM && this.updateChildren(r, this.posAtStart), this.dirty = 0;
|
|
4371
4371
|
}
|
|
4372
4372
|
updateOuterDeco(e) {
|
|
4373
|
-
if (
|
|
4373
|
+
if (Ir(e, this.outerDeco)) return;
|
|
4374
4374
|
let t = this.nodeDOM.nodeType != 1, n = this.dom;
|
|
4375
|
-
this.dom =
|
|
4375
|
+
this.dom = Nr(this.dom, this.nodeDOM, Mr(this.outerDeco, this.node, t), Mr(e, this.node, t)), this.dom != n && (n.pmViewDesc = void 0, this.dom.pmViewDesc = this), this.outerDeco = e;
|
|
4376
4376
|
}
|
|
4377
4377
|
selectNode() {
|
|
4378
4378
|
this.nodeDOM.nodeType == 1 && (this.nodeDOM.classList.add("ProseMirror-selectednode"), !this.contentDOM && this.node.type.spec.draggable || (this.nodeDOM.draggable = !0));
|
|
@@ -4384,12 +4384,12 @@ var yr = class {
|
|
|
4384
4384
|
return this.node.isAtom;
|
|
4385
4385
|
}
|
|
4386
4386
|
};
|
|
4387
|
-
function
|
|
4388
|
-
|
|
4389
|
-
let a = new
|
|
4387
|
+
function Tr(e, t, n, r, i) {
|
|
4388
|
+
Fr(r, t, e);
|
|
4389
|
+
let a = new wr(void 0, e, t, n, r, r, r, i, 0);
|
|
4390
4390
|
return a.contentDOM && a.updateChildren(i, 0), a;
|
|
4391
4391
|
}
|
|
4392
|
-
var
|
|
4392
|
+
var Er = class e extends wr {
|
|
4393
4393
|
constructor(e, t, n, r, i, a, o) {
|
|
4394
4394
|
super(e, t, n, r, i, null, a, o, 0);
|
|
4395
4395
|
}
|
|
@@ -4431,7 +4431,7 @@ var Tr = class e extends Cr {
|
|
|
4431
4431
|
isText(e) {
|
|
4432
4432
|
return this.node.text == e;
|
|
4433
4433
|
}
|
|
4434
|
-
},
|
|
4434
|
+
}, Dr = class extends br {
|
|
4435
4435
|
parseRule() {
|
|
4436
4436
|
return { ignore: !0 };
|
|
4437
4437
|
}
|
|
@@ -4444,7 +4444,7 @@ var Tr = class e extends Cr {
|
|
|
4444
4444
|
get ignoreForCoords() {
|
|
4445
4445
|
return this.dom.nodeName == "IMG";
|
|
4446
4446
|
}
|
|
4447
|
-
},
|
|
4447
|
+
}, Or = class extends wr {
|
|
4448
4448
|
constructor(e, t, n, r, i, a, o, s, c, l) {
|
|
4449
4449
|
super(e, t, n, r, i, a, o, c, l), this.spec = s;
|
|
4450
4450
|
}
|
|
@@ -4475,56 +4475,56 @@ var Tr = class e extends Cr {
|
|
|
4475
4475
|
return this.spec.ignoreMutation ? this.spec.ignoreMutation(e) : super.ignoreMutation(e);
|
|
4476
4476
|
}
|
|
4477
4477
|
};
|
|
4478
|
-
function
|
|
4478
|
+
function kr(e, t, n) {
|
|
4479
4479
|
let r = e.firstChild, i = !1;
|
|
4480
4480
|
for (let a = 0; a < t.length; a++) {
|
|
4481
4481
|
let o = t[a], s = o.dom;
|
|
4482
4482
|
if (s.parentNode == e) {
|
|
4483
|
-
for (; s != r;) r =
|
|
4483
|
+
for (; s != r;) r = Lr(r), i = !0;
|
|
4484
4484
|
r = r.nextSibling;
|
|
4485
4485
|
} else i = !0, e.insertBefore(s, r);
|
|
4486
|
-
if (o instanceof
|
|
4486
|
+
if (o instanceof Cr) {
|
|
4487
4487
|
let t = r ? r.previousSibling : e.lastChild;
|
|
4488
|
-
|
|
4488
|
+
kr(o.contentDOM, o.children, n), r = t ? t.nextSibling : e.firstChild;
|
|
4489
4489
|
}
|
|
4490
4490
|
}
|
|
4491
|
-
for (; r;) r =
|
|
4491
|
+
for (; r;) r = Lr(r), i = !0;
|
|
4492
4492
|
i && n.trackWrites == e && (n.trackWrites = null);
|
|
4493
4493
|
}
|
|
4494
|
-
var
|
|
4494
|
+
var Ar = function(e) {
|
|
4495
4495
|
e && (this.nodeName = e);
|
|
4496
4496
|
};
|
|
4497
|
-
|
|
4498
|
-
var
|
|
4499
|
-
function
|
|
4500
|
-
if (e.length == 0) return
|
|
4501
|
-
let r = n ?
|
|
4497
|
+
Ar.prototype = Object.create(null);
|
|
4498
|
+
var jr = [new Ar()];
|
|
4499
|
+
function Mr(e, t, n) {
|
|
4500
|
+
if (e.length == 0) return jr;
|
|
4501
|
+
let r = n ? jr[0] : new Ar(), i = [r];
|
|
4502
4502
|
for (let a = 0; a < e.length; a++) {
|
|
4503
4503
|
let o = e[a].type.attrs;
|
|
4504
4504
|
if (o) {
|
|
4505
|
-
o.nodeName && i.push(r = new
|
|
4505
|
+
o.nodeName && i.push(r = new Ar(o.nodeName));
|
|
4506
4506
|
for (let e in o) {
|
|
4507
4507
|
let a = o[e];
|
|
4508
|
-
a != null && (n && i.length == 1 && i.push(r = new
|
|
4508
|
+
a != null && (n && i.length == 1 && i.push(r = new Ar(t.isInline ? "span" : "div")), e == "class" ? r.class = (r.class ? r.class + " " : "") + a : e == "style" ? r.style = (r.style ? r.style + ";" : "") + a : e != "nodeName" && (r[e] = a));
|
|
4509
4509
|
}
|
|
4510
4510
|
}
|
|
4511
4511
|
}
|
|
4512
4512
|
return i;
|
|
4513
4513
|
}
|
|
4514
|
-
function
|
|
4515
|
-
if (n ==
|
|
4514
|
+
function Nr(e, t, n, r) {
|
|
4515
|
+
if (n == jr && r == jr) return t;
|
|
4516
4516
|
let i = t;
|
|
4517
4517
|
for (let t = 0; t < r.length; t++) {
|
|
4518
4518
|
let a = r[t], o = n[t];
|
|
4519
4519
|
if (t) {
|
|
4520
4520
|
let t;
|
|
4521
|
-
o && o.nodeName == a.nodeName && i != e && (t = i.parentNode) && t.nodeName.toLowerCase() == a.nodeName || (t = document.createElement(a.nodeName), t.pmIsDeco = !0, t.appendChild(i), o =
|
|
4521
|
+
o && o.nodeName == a.nodeName && i != e && (t = i.parentNode) && t.nodeName.toLowerCase() == a.nodeName || (t = document.createElement(a.nodeName), t.pmIsDeco = !0, t.appendChild(i), o = jr[0]), i = t;
|
|
4522
4522
|
}
|
|
4523
|
-
|
|
4523
|
+
Pr(i, o || jr[0], a);
|
|
4524
4524
|
}
|
|
4525
4525
|
return i;
|
|
4526
4526
|
}
|
|
4527
|
-
function
|
|
4527
|
+
function Pr(e, t, n) {
|
|
4528
4528
|
for (let r in t) r == "class" || r == "style" || r == "nodeName" || r in n || e.removeAttribute(r);
|
|
4529
4529
|
for (let r in n) r != "class" && r != "style" && r != "nodeName" && n[r] != t[r] && e.setAttribute(r, n[r]);
|
|
4530
4530
|
if (t.class != n.class) {
|
|
@@ -4541,19 +4541,19 @@ function Nr(e, t, n) {
|
|
|
4541
4541
|
n.style && (e.style.cssText += n.style);
|
|
4542
4542
|
}
|
|
4543
4543
|
}
|
|
4544
|
-
function
|
|
4545
|
-
return
|
|
4544
|
+
function Fr(e, t, n) {
|
|
4545
|
+
return Nr(e, e, jr, Mr(t, n, e.nodeType != 1));
|
|
4546
4546
|
}
|
|
4547
|
-
function
|
|
4547
|
+
function Ir(e, t) {
|
|
4548
4548
|
if (e.length != t.length) return !1;
|
|
4549
4549
|
for (let n = 0; n < e.length; n++) if (!e[n].type.eq(t[n].type)) return !1;
|
|
4550
4550
|
return !0;
|
|
4551
4551
|
}
|
|
4552
|
-
function
|
|
4552
|
+
function Lr(e) {
|
|
4553
4553
|
let t = e.nextSibling;
|
|
4554
4554
|
return e.parentNode.removeChild(e), t;
|
|
4555
4555
|
}
|
|
4556
|
-
var
|
|
4556
|
+
var Rr = class {
|
|
4557
4557
|
constructor(e, t, n) {
|
|
4558
4558
|
this.lock = t, this.view = n, this.index = 0, this.stack = [], this.changed = !1, this.top = e, this.preMatch = function(e, t) {
|
|
4559
4559
|
let n = t, r = n.children.length, i = e.childCount, a = /* @__PURE__ */ new Map(), o = [];
|
|
@@ -4561,7 +4561,7 @@ var Lr = class {
|
|
|
4561
4561
|
let s;
|
|
4562
4562
|
for (;;) if (r) {
|
|
4563
4563
|
let e = n.children[r - 1];
|
|
4564
|
-
if (!(e instanceof
|
|
4564
|
+
if (!(e instanceof Cr)) {
|
|
4565
4565
|
s = e, r--;
|
|
4566
4566
|
break;
|
|
4567
4567
|
}
|
|
@@ -4609,7 +4609,7 @@ var Lr = class {
|
|
|
4609
4609
|
}
|
|
4610
4610
|
if (i > -1) i > this.index && (this.changed = !0, this.destroyBetween(this.index, i)), this.top = this.top.children[this.index];
|
|
4611
4611
|
else {
|
|
4612
|
-
let r =
|
|
4612
|
+
let r = Cr.create(this.top, e[a], t, n);
|
|
4613
4613
|
this.top.children.splice(this.index, 0, r), this.top = r, this.changed = !0;
|
|
4614
4614
|
}
|
|
4615
4615
|
this.index = 0, a++;
|
|
@@ -4648,10 +4648,10 @@ var Lr = class {
|
|
|
4648
4648
|
updateNextNode(e, t, n, r, i, a) {
|
|
4649
4649
|
for (let o = this.index; o < this.top.children.length; o++) {
|
|
4650
4650
|
let s = this.top.children[o];
|
|
4651
|
-
if (s instanceof
|
|
4651
|
+
if (s instanceof wr) {
|
|
4652
4652
|
let c = this.preMatch.matched.get(s);
|
|
4653
4653
|
if (c != null && c != i) return !1;
|
|
4654
|
-
let l, u = s.dom, d = this.isLocked(u) && !(e.isText && s.node && s.node.isText && s.nodeDOM.nodeValue == e.text && s.dirty != 3 &&
|
|
4654
|
+
let l, u = s.dom, d = this.isLocked(u) && !(e.isText && s.node && s.node.isText && s.nodeDOM.nodeValue == e.text && s.dirty != 3 && Ir(t, s.outerDeco));
|
|
4655
4655
|
if (!d && s.update(e, t, n, r)) return this.destroyBetween(this.index, o), s.dom != u && (this.changed = !0), this.index++, !0;
|
|
4656
4656
|
if (!d && (l = this.recreateWrapper(s, e, t, n, r, a))) return this.destroyBetween(this.index, o), this.top.children[this.index] = l, l.contentDOM && (l.dirty = 2, l.updateChildren(r, a + 1), l.dirty = 0), this.changed = !0, this.index++, !0;
|
|
4657
4657
|
break;
|
|
@@ -4660,8 +4660,8 @@ var Lr = class {
|
|
|
4660
4660
|
return !1;
|
|
4661
4661
|
}
|
|
4662
4662
|
recreateWrapper(e, t, n, r, i, a) {
|
|
4663
|
-
if (e.dirty || t.isAtom || !e.children.length || !e.node.content.eq(t.content) || !
|
|
4664
|
-
let o =
|
|
4663
|
+
if (e.dirty || t.isAtom || !e.children.length || !e.node.content.eq(t.content) || !Ir(n, e.outerDeco) || !r.eq(e.innerDeco)) return null;
|
|
4664
|
+
let o = wr.create(this.top, t, n, r, i, a);
|
|
4665
4665
|
if (o.contentDOM) {
|
|
4666
4666
|
o.children = e.children, e.children = [];
|
|
4667
4667
|
for (let e of o.children) e.parent = o;
|
|
@@ -4669,27 +4669,27 @@ var Lr = class {
|
|
|
4669
4669
|
return e.destroy(), o;
|
|
4670
4670
|
}
|
|
4671
4671
|
addNode(e, t, n, r, i) {
|
|
4672
|
-
let a =
|
|
4672
|
+
let a = wr.create(this.top, e, t, n, r, i);
|
|
4673
4673
|
a.contentDOM && a.updateChildren(r, i + 1), this.top.children.splice(this.index++, 0, a), this.changed = !0;
|
|
4674
4674
|
}
|
|
4675
4675
|
placeWidget(e, t, n) {
|
|
4676
4676
|
let r = this.index < this.top.children.length ? this.top.children[this.index] : null;
|
|
4677
4677
|
if (!r || !r.matchesWidget(e) || e != r.widget && r.widget.type.toDOM.parentNode) {
|
|
4678
|
-
let r = new
|
|
4678
|
+
let r = new xr(this.top, e, t, n);
|
|
4679
4679
|
this.top.children.splice(this.index++, 0, r), this.changed = !0;
|
|
4680
4680
|
} else this.index++;
|
|
4681
4681
|
}
|
|
4682
4682
|
addTextblockHacks() {
|
|
4683
4683
|
let e = this.top.children[this.index - 1], t = this.top;
|
|
4684
|
-
for (; e instanceof
|
|
4685
|
-
(!e || !(e instanceof
|
|
4684
|
+
for (; e instanceof Cr;) t = e, e = t.children[t.children.length - 1];
|
|
4685
|
+
(!e || !(e instanceof Er) || /\n$/.test(e.node.text) || this.view.requiresGeckoHackNode && /\s$/.test(e.node.text)) && ((F || P) && e && e.dom.contentEditable == "false" && this.addHackNode("IMG", t), this.addHackNode("BR", this.top));
|
|
4686
4686
|
}
|
|
4687
4687
|
addHackNode(e, t) {
|
|
4688
4688
|
if (t == this.top && this.index < t.children.length && t.children[this.index].matchesHack(e)) this.index++;
|
|
4689
4689
|
else {
|
|
4690
4690
|
let n = document.createElement(e);
|
|
4691
4691
|
e == "IMG" && (n.className = "ProseMirror-separator", n.alt = ""), e == "BR" && (n.className = "ProseMirror-trailingBreak");
|
|
4692
|
-
let r = new
|
|
4692
|
+
let r = new Dr(this.top, [], n, null);
|
|
4693
4693
|
t == this.top ? t.children.splice(this.index++, 0, r) : t.children.push(r), this.changed = !0;
|
|
4694
4694
|
}
|
|
4695
4695
|
}
|
|
@@ -4697,10 +4697,10 @@ var Lr = class {
|
|
|
4697
4697
|
return this.lock && (e == this.lock || e.nodeType == 1 && e.contains(this.lock.parentNode));
|
|
4698
4698
|
}
|
|
4699
4699
|
};
|
|
4700
|
-
function
|
|
4700
|
+
function zr(e, t) {
|
|
4701
4701
|
return e.type.side - t.type.side;
|
|
4702
4702
|
}
|
|
4703
|
-
function
|
|
4703
|
+
function Br(e, t, n, r, i) {
|
|
4704
4704
|
let a = [];
|
|
4705
4705
|
for (let o = 0, s = 0; o < e.length; o++) {
|
|
4706
4706
|
let c = e[o], l = s, u = s += c.size;
|
|
@@ -4708,25 +4708,25 @@ function zr(e, t, n, r, i) {
|
|
|
4708
4708
|
}
|
|
4709
4709
|
return a;
|
|
4710
4710
|
}
|
|
4711
|
-
function
|
|
4711
|
+
function Vr(e, t = null) {
|
|
4712
4712
|
let n = e.domSelectionRange(), r = e.state.doc;
|
|
4713
4713
|
if (!n.focusNode) return null;
|
|
4714
4714
|
let i = e.docView.nearestDesc(n.focusNode), a = i && i.size == 0, o = e.docView.posFromDOM(n.focusNode, n.focusOffset, 1);
|
|
4715
4715
|
if (o < 0) return null;
|
|
4716
4716
|
let s, c, l = r.resolve(o);
|
|
4717
|
-
if (
|
|
4717
|
+
if (Mn(n)) {
|
|
4718
4718
|
for (s = o; i && !i.node;) i = i.parent;
|
|
4719
4719
|
let e = i.node;
|
|
4720
|
-
if (i && e.isAtom &&
|
|
4721
|
-
for (let r = t == 0, i = t ==
|
|
4720
|
+
if (i && e.isAtom && M.isSelectable(e) && i.parent && (!e.isInline || !function(e, t, n) {
|
|
4721
|
+
for (let r = t == 0, i = t == An(e); r || i;) {
|
|
4722
4722
|
if (e == n) return !0;
|
|
4723
|
-
let t =
|
|
4723
|
+
let t = N(e);
|
|
4724
4724
|
if (!(e = e.parentNode)) return !1;
|
|
4725
|
-
r &&= t == 0, i &&= t ==
|
|
4725
|
+
r &&= t == 0, i &&= t == An(e);
|
|
4726
4726
|
}
|
|
4727
4727
|
}(n.focusNode, n.focusOffset, i.dom))) {
|
|
4728
4728
|
let e = i.posBefore;
|
|
4729
|
-
c = new
|
|
4729
|
+
c = new M(o == e ? l : r.resolve(e));
|
|
4730
4730
|
}
|
|
4731
4731
|
} else {
|
|
4732
4732
|
if (n instanceof e.dom.ownerDocument.defaultView.Selection && n.rangeCount > 1) {
|
|
@@ -4741,33 +4741,33 @@ function Br(e, t = null) {
|
|
|
4741
4741
|
if (s < 0) return null;
|
|
4742
4742
|
}
|
|
4743
4743
|
let u = r.resolve(s);
|
|
4744
|
-
return c ||=
|
|
4744
|
+
return c ||= Xr(e, u, l, t == "pointer" || e.state.selection.head < l.pos && !a ? 1 : -1), c;
|
|
4745
4745
|
}
|
|
4746
|
-
function
|
|
4747
|
-
return e.editable ? e.hasFocus() :
|
|
4746
|
+
function Hr(e) {
|
|
4747
|
+
return e.editable ? e.hasFocus() : Qr(e) && document.activeElement && document.activeElement.contains(e.dom);
|
|
4748
4748
|
}
|
|
4749
|
-
function
|
|
4749
|
+
function Ur(e, t = !1) {
|
|
4750
4750
|
let n = e.state.selection;
|
|
4751
|
-
if (
|
|
4752
|
-
if (!t && e.input.mouseDown && e.input.mouseDown.allowDefault &&
|
|
4751
|
+
if (Jr(e, n), Hr(e)) {
|
|
4752
|
+
if (!t && e.input.mouseDown && e.input.mouseDown.allowDefault && P) {
|
|
4753
4753
|
let t = e.domSelectionRange(), n = e.domObserver.currentSelection;
|
|
4754
|
-
if (t.anchorNode && n.anchorNode &&
|
|
4754
|
+
if (t.anchorNode && n.anchorNode && Dn(t.anchorNode, t.anchorOffset, n.anchorNode, n.anchorOffset)) return e.input.mouseDown.delayedSelectionSync = !0, void e.domObserver.setCurSelection();
|
|
4755
4755
|
}
|
|
4756
4756
|
if (e.domObserver.disconnectSelection(), e.cursorWrapper) (function(e) {
|
|
4757
4757
|
let t = e.domSelection();
|
|
4758
4758
|
if (!t) return;
|
|
4759
4759
|
let n = e.cursorWrapper.dom, r = n.nodeName == "IMG";
|
|
4760
|
-
r ? t.collapse(n.parentNode,
|
|
4760
|
+
r ? t.collapse(n.parentNode, N(n) + 1) : t.collapse(n, 0), !r && !e.state.selection.visible && Bn && Vn <= 11 && (n.disabled = !0, n.disabled = !1);
|
|
4761
4761
|
})(e);
|
|
4762
4762
|
else {
|
|
4763
4763
|
let r, i, { anchor: a, head: o } = n;
|
|
4764
|
-
!
|
|
4764
|
+
!Wr || n instanceof j || (n.$from.parent.inlineContent || (r = Gr(e, n.from)), n.empty || n.$from.parent.inlineContent || (i = Gr(e, n.to))), e.docView.setSelection(a, o, e, t), Wr && (r && qr(r), i && qr(i)), n.visible ? e.dom.classList.remove("ProseMirror-hideselection") : (e.dom.classList.add("ProseMirror-hideselection"), "onselectionchange" in document && function(e) {
|
|
4765
4765
|
let t = e.dom.ownerDocument;
|
|
4766
4766
|
t.removeEventListener("selectionchange", e.input.hideSelectionGuard);
|
|
4767
4767
|
let n = e.domSelectionRange(), r = n.anchorNode, i = n.anchorOffset;
|
|
4768
4768
|
t.addEventListener("selectionchange", e.input.hideSelectionGuard = () => {
|
|
4769
4769
|
n.anchorNode == r && n.anchorOffset == i || (t.removeEventListener("selectionchange", e.input.hideSelectionGuard), setTimeout((() => {
|
|
4770
|
-
|
|
4770
|
+
Hr(e) && !e.state.selection.visible || e.dom.classList.remove("ProseMirror-hideselection");
|
|
4771
4771
|
}), 20));
|
|
4772
4772
|
});
|
|
4773
4773
|
}(e));
|
|
@@ -4775,37 +4775,37 @@ function Hr(e, t = !1) {
|
|
|
4775
4775
|
e.domObserver.setCurSelection(), e.domObserver.connectSelection();
|
|
4776
4776
|
}
|
|
4777
4777
|
}
|
|
4778
|
-
var
|
|
4779
|
-
function
|
|
4778
|
+
var Wr = F || P && Wn < 63;
|
|
4779
|
+
function Gr(e, t) {
|
|
4780
4780
|
let { node: n, offset: r } = e.docView.domFromPos(t, 0), i = r < n.childNodes.length ? n.childNodes[r] : null, a = r ? n.childNodes[r - 1] : null;
|
|
4781
|
-
if (
|
|
4781
|
+
if (F && i && i.contentEditable == "false") return Kr(i);
|
|
4782
4782
|
if (!(i && i.contentEditable != "false" || a && a.contentEditable != "false")) {
|
|
4783
|
-
if (i) return
|
|
4784
|
-
if (a) return
|
|
4783
|
+
if (i) return Kr(i);
|
|
4784
|
+
if (a) return Kr(a);
|
|
4785
4785
|
}
|
|
4786
4786
|
}
|
|
4787
|
-
function Gr(e) {
|
|
4788
|
-
return e.contentEditable = "true", I && e.draggable && (e.draggable = !1, e.wasDraggable = !0), e;
|
|
4789
|
-
}
|
|
4790
4787
|
function Kr(e) {
|
|
4788
|
+
return e.contentEditable = "true", F && e.draggable && (e.draggable = !1, e.wasDraggable = !0), e;
|
|
4789
|
+
}
|
|
4790
|
+
function qr(e) {
|
|
4791
4791
|
e.contentEditable = "false", e.wasDraggable &&= (e.draggable = !0, null);
|
|
4792
4792
|
}
|
|
4793
|
-
function
|
|
4794
|
-
if (t instanceof
|
|
4793
|
+
function Jr(e, t) {
|
|
4794
|
+
if (t instanceof M) {
|
|
4795
4795
|
let n = e.docView.descAt(t.from);
|
|
4796
|
-
n != e.lastSelectedViewDesc && (
|
|
4797
|
-
} else
|
|
4796
|
+
n != e.lastSelectedViewDesc && (Yr(e), n && n.selectNode(), e.lastSelectedViewDesc = n);
|
|
4797
|
+
} else Yr(e);
|
|
4798
4798
|
}
|
|
4799
|
-
function
|
|
4799
|
+
function Yr(e) {
|
|
4800
4800
|
e.lastSelectedViewDesc &&= (e.lastSelectedViewDesc.parent && e.lastSelectedViewDesc.deselectNode(), void 0);
|
|
4801
4801
|
}
|
|
4802
|
-
function
|
|
4803
|
-
return e.someProp("createSelectionBetween", ((r) => r(e, t, n))) ||
|
|
4804
|
-
}
|
|
4805
|
-
function Xr(e) {
|
|
4806
|
-
return !(e.editable && !e.hasFocus()) && Zr(e);
|
|
4802
|
+
function Xr(e, t, n, r) {
|
|
4803
|
+
return e.someProp("createSelectionBetween", ((r) => r(e, t, n))) || j.between(t, n, r);
|
|
4807
4804
|
}
|
|
4808
4805
|
function Zr(e) {
|
|
4806
|
+
return !(e.editable && !e.hasFocus()) && Qr(e);
|
|
4807
|
+
}
|
|
4808
|
+
function Qr(e) {
|
|
4809
4809
|
let t = e.domSelectionRange();
|
|
4810
4810
|
if (!t.anchorNode) return !1;
|
|
4811
4811
|
try {
|
|
@@ -4814,106 +4814,106 @@ function Zr(e) {
|
|
|
4814
4814
|
return !1;
|
|
4815
4815
|
}
|
|
4816
4816
|
}
|
|
4817
|
-
function
|
|
4817
|
+
function $r(e, t) {
|
|
4818
4818
|
let { $anchor: n, $head: r } = e.selection, i = t > 0 ? n.max(r) : n.min(r), a = i.parent.inlineContent ? i.depth ? e.doc.resolve(t > 0 ? i.after() : i.before()) : null : i;
|
|
4819
|
-
return a &&
|
|
4819
|
+
return a && A.findFrom(a, t);
|
|
4820
4820
|
}
|
|
4821
|
-
function
|
|
4821
|
+
function ei(e, t) {
|
|
4822
4822
|
return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()), !0;
|
|
4823
4823
|
}
|
|
4824
|
-
function
|
|
4824
|
+
function ti(e, t, n) {
|
|
4825
4825
|
let r = e.state.selection;
|
|
4826
|
-
if (!(r instanceof
|
|
4827
|
-
if (r instanceof
|
|
4826
|
+
if (!(r instanceof j)) {
|
|
4827
|
+
if (r instanceof M && r.node.isInline) return ei(e, new j(t > 0 ? r.$to : r.$from));
|
|
4828
4828
|
{
|
|
4829
|
-
let n =
|
|
4830
|
-
return !!n &&
|
|
4829
|
+
let n = $r(e.state, t);
|
|
4830
|
+
return !!n && ei(e, n);
|
|
4831
4831
|
}
|
|
4832
4832
|
}
|
|
4833
4833
|
if (n.indexOf("s") > -1) {
|
|
4834
4834
|
let { $head: n } = r, i = n.textOffset ? null : t < 0 ? n.nodeBefore : n.nodeAfter;
|
|
4835
4835
|
if (!i || i.isText || !i.isLeaf) return !1;
|
|
4836
4836
|
let a = e.state.doc.resolve(n.pos + i.nodeSize * (t < 0 ? -1 : 1));
|
|
4837
|
-
return
|
|
4837
|
+
return ei(e, new j(r.$anchor, a));
|
|
4838
4838
|
}
|
|
4839
4839
|
if (!r.empty) return !1;
|
|
4840
4840
|
if (e.endOfTextblock(t > 0 ? "forward" : "backward")) {
|
|
4841
|
-
let n =
|
|
4842
|
-
return !!(n && n instanceof
|
|
4841
|
+
let n = $r(e.state, t);
|
|
4842
|
+
return !!(n && n instanceof M) && ei(e, n);
|
|
4843
4843
|
}
|
|
4844
|
-
if (!(
|
|
4844
|
+
if (!(Kn && n.indexOf("m") > -1)) {
|
|
4845
4845
|
let n, i = r.$head, a = i.textOffset ? null : t < 0 ? i.nodeBefore : i.nodeAfter;
|
|
4846
4846
|
if (!a || a.isText) return !1;
|
|
4847
4847
|
let o = t < 0 ? i.pos - a.nodeSize : i.pos;
|
|
4848
|
-
return !!(a.isAtom || (n = e.docView.descAt(o)) && !n.contentDOM) && (
|
|
4848
|
+
return !!(a.isAtom || (n = e.docView.descAt(o)) && !n.contentDOM) && (M.isSelectable(a) ? ei(e, new M(t < 0 ? e.state.doc.resolve(i.pos - a.nodeSize) : i)) : !!Yn && ei(e, new j(e.state.doc.resolve(t < 0 ? o : o + a.nodeSize))));
|
|
4849
4849
|
}
|
|
4850
4850
|
}
|
|
4851
|
-
function
|
|
4851
|
+
function ni(e) {
|
|
4852
4852
|
return e.nodeType == 3 ? e.nodeValue.length : e.childNodes.length;
|
|
4853
4853
|
}
|
|
4854
|
-
function
|
|
4854
|
+
function ri(e, t) {
|
|
4855
4855
|
let n = e.pmViewDesc;
|
|
4856
4856
|
return n && n.size == 0 && (t < 0 || e.nextSibling || e.nodeName != "BR");
|
|
4857
4857
|
}
|
|
4858
|
-
function
|
|
4858
|
+
function ii(e, t) {
|
|
4859
4859
|
return t < 0 ? function(e) {
|
|
4860
4860
|
let t = e.domSelectionRange(), n = t.focusNode, r = t.focusOffset;
|
|
4861
4861
|
if (!n) return;
|
|
4862
4862
|
let i, a, o = !1;
|
|
4863
|
-
for (
|
|
4863
|
+
for (Hn && n.nodeType == 1 && r < ni(n) && ri(n.childNodes[r], -1) && (o = !0);;) if (r > 0) {
|
|
4864
4864
|
if (n.nodeType != 1) break;
|
|
4865
4865
|
{
|
|
4866
4866
|
let e = n.childNodes[r - 1];
|
|
4867
|
-
if (
|
|
4867
|
+
if (ri(e, -1)) i = n, a = --r;
|
|
4868
4868
|
else {
|
|
4869
4869
|
if (e.nodeType != 3) break;
|
|
4870
4870
|
n = e, r = n.nodeValue.length;
|
|
4871
4871
|
}
|
|
4872
4872
|
}
|
|
4873
4873
|
} else {
|
|
4874
|
-
if (
|
|
4874
|
+
if (ai(n)) break;
|
|
4875
4875
|
{
|
|
4876
4876
|
let t = n.previousSibling;
|
|
4877
|
-
for (; t &&
|
|
4878
|
-
if (t) n = t, r =
|
|
4877
|
+
for (; t && ri(t, -1);) i = n.parentNode, a = N(t), t = t.previousSibling;
|
|
4878
|
+
if (t) n = t, r = ni(n);
|
|
4879
4879
|
else {
|
|
4880
4880
|
if (n = n.parentNode, n == e.dom) break;
|
|
4881
4881
|
r = 0;
|
|
4882
4882
|
}
|
|
4883
4883
|
}
|
|
4884
4884
|
}
|
|
4885
|
-
o ?
|
|
4885
|
+
o ? oi(e, n, r) : i && oi(e, i, a);
|
|
4886
4886
|
}(e) : function(e) {
|
|
4887
4887
|
let t = e.domSelectionRange(), n = t.focusNode, r = t.focusOffset;
|
|
4888
4888
|
if (!n) return;
|
|
4889
|
-
let i, a, o =
|
|
4889
|
+
let i, a, o = ni(n);
|
|
4890
4890
|
for (;;) if (r < o) {
|
|
4891
|
-
if (n.nodeType != 1 || !
|
|
4891
|
+
if (n.nodeType != 1 || !ri(n.childNodes[r], 1)) break;
|
|
4892
4892
|
i = n, a = ++r;
|
|
4893
4893
|
} else {
|
|
4894
|
-
if (
|
|
4894
|
+
if (ai(n)) break;
|
|
4895
4895
|
{
|
|
4896
4896
|
let t = n.nextSibling;
|
|
4897
|
-
for (; t &&
|
|
4898
|
-
if (t) n = t, r = 0, o =
|
|
4897
|
+
for (; t && ri(t, 1);) i = t.parentNode, a = N(t) + 1, t = t.nextSibling;
|
|
4898
|
+
if (t) n = t, r = 0, o = ni(n);
|
|
4899
4899
|
else {
|
|
4900
4900
|
if (n = n.parentNode, n == e.dom) break;
|
|
4901
4901
|
r = o = 0;
|
|
4902
4902
|
}
|
|
4903
4903
|
}
|
|
4904
4904
|
}
|
|
4905
|
-
i &&
|
|
4905
|
+
i && oi(e, i, a);
|
|
4906
4906
|
}(e);
|
|
4907
4907
|
}
|
|
4908
|
-
function
|
|
4908
|
+
function ai(e) {
|
|
4909
4909
|
let t = e.pmViewDesc;
|
|
4910
4910
|
return t && t.node && t.node.isBlock;
|
|
4911
4911
|
}
|
|
4912
|
-
function
|
|
4912
|
+
function oi(e, t, n) {
|
|
4913
4913
|
if (t.nodeType != 3) {
|
|
4914
4914
|
let e, r;
|
|
4915
4915
|
(r = function(e, t) {
|
|
4916
|
-
for (; e && t == e.childNodes.length && !
|
|
4916
|
+
for (; e && t == e.childNodes.length && !jn(e);) t = N(e) + 1, e = e.parentNode;
|
|
4917
4917
|
for (; e && t < e.childNodes.length;) {
|
|
4918
4918
|
let n = e.childNodes[t];
|
|
4919
4919
|
if (n.nodeType == 3) return n;
|
|
@@ -4921,7 +4921,7 @@ function ai(e, t, n) {
|
|
|
4921
4921
|
e = n, t = 0;
|
|
4922
4922
|
}
|
|
4923
4923
|
}(t, n)) ? (t = r, n = 0) : (e = function(e, t) {
|
|
4924
|
-
for (; e && !t && !
|
|
4924
|
+
for (; e && !t && !jn(e);) t = N(e), e = e.parentNode;
|
|
4925
4925
|
for (; e && t;) {
|
|
4926
4926
|
let n = e.childNodes[t - 1];
|
|
4927
4927
|
if (n.nodeType == 3) return n;
|
|
@@ -4932,19 +4932,19 @@ function ai(e, t, n) {
|
|
|
4932
4932
|
}
|
|
4933
4933
|
let r = e.domSelection();
|
|
4934
4934
|
if (!r) return;
|
|
4935
|
-
if (
|
|
4935
|
+
if (Mn(r)) {
|
|
4936
4936
|
let e = document.createRange();
|
|
4937
4937
|
e.setEnd(t, n), e.setStart(t, n), r.removeAllRanges(), r.addRange(e);
|
|
4938
4938
|
} else r.extend && r.extend(t, n);
|
|
4939
4939
|
e.domObserver.setCurSelection();
|
|
4940
4940
|
let { state: i } = e;
|
|
4941
4941
|
setTimeout((() => {
|
|
4942
|
-
e.state == i &&
|
|
4942
|
+
e.state == i && Ur(e);
|
|
4943
4943
|
}), 50);
|
|
4944
4944
|
}
|
|
4945
|
-
function
|
|
4945
|
+
function si(e, t) {
|
|
4946
4946
|
let n = e.state.doc.resolve(t);
|
|
4947
|
-
if (!
|
|
4947
|
+
if (!P && !qn && n.parent.inlineContent) {
|
|
4948
4948
|
let r = e.coordsAtPos(t);
|
|
4949
4949
|
if (t > n.start()) {
|
|
4950
4950
|
let n = e.coordsAtPos(t - 1), i = (n.top + n.bottom) / 2;
|
|
@@ -4957,22 +4957,22 @@ function oi(e, t) {
|
|
|
4957
4957
|
}
|
|
4958
4958
|
return getComputedStyle(e.dom).direction == "rtl" ? "rtl" : "ltr";
|
|
4959
4959
|
}
|
|
4960
|
-
function
|
|
4960
|
+
function ci(e, t, n) {
|
|
4961
4961
|
let r = e.state.selection;
|
|
4962
|
-
if (r instanceof
|
|
4962
|
+
if (r instanceof j && !r.empty || n.indexOf("s") > -1 || Kn && n.indexOf("m") > -1) return !1;
|
|
4963
4963
|
let { $from: i, $to: a } = r;
|
|
4964
4964
|
if (!i.parent.inlineContent || e.endOfTextblock(t < 0 ? "up" : "down")) {
|
|
4965
|
-
let n =
|
|
4966
|
-
if (n && n instanceof
|
|
4965
|
+
let n = $r(e.state, t);
|
|
4966
|
+
if (n && n instanceof M) return ei(e, n);
|
|
4967
4967
|
}
|
|
4968
4968
|
if (!i.parent.inlineContent) {
|
|
4969
|
-
let n = t < 0 ? i : a, o = r instanceof
|
|
4970
|
-
return !!o &&
|
|
4969
|
+
let n = t < 0 ? i : a, o = r instanceof ln ? A.near(n, t) : A.findFrom(n, t);
|
|
4970
|
+
return !!o && ei(e, o);
|
|
4971
4971
|
}
|
|
4972
4972
|
return !1;
|
|
4973
4973
|
}
|
|
4974
|
-
function
|
|
4975
|
-
if (!(e.state.selection instanceof
|
|
4974
|
+
function li(e, t) {
|
|
4975
|
+
if (!(e.state.selection instanceof j)) return !0;
|
|
4976
4976
|
let { $head: n, $anchor: r, empty: i } = e.state.selection;
|
|
4977
4977
|
if (!n.sameParent(r)) return !0;
|
|
4978
4978
|
if (!i) return !1;
|
|
@@ -4984,36 +4984,36 @@ function ci(e, t) {
|
|
|
4984
4984
|
}
|
|
4985
4985
|
return !1;
|
|
4986
4986
|
}
|
|
4987
|
-
function
|
|
4987
|
+
function ui(e, t, n) {
|
|
4988
4988
|
e.domObserver.stop(), t.contentEditable = n, e.domObserver.start();
|
|
4989
4989
|
}
|
|
4990
|
-
function
|
|
4990
|
+
function di(e, t) {
|
|
4991
4991
|
let n = t.keyCode, r = function(e) {
|
|
4992
4992
|
let t = "";
|
|
4993
4993
|
return e.ctrlKey && (t += "c"), e.metaKey && (t += "m"), e.altKey && (t += "a"), e.shiftKey && (t += "s"), t;
|
|
4994
4994
|
}(t);
|
|
4995
|
-
if (n == 8 ||
|
|
4996
|
-
if (n == 46 && !t.shiftKey ||
|
|
4995
|
+
if (n == 8 || Kn && n == 72 && r == "c") return li(e, -1) || ii(e, -1);
|
|
4996
|
+
if (n == 46 && !t.shiftKey || Kn && n == 68 && r == "c") return li(e, 1) || ii(e, 1);
|
|
4997
4997
|
if (n == 13 || n == 27) return !0;
|
|
4998
|
-
if (n == 37 ||
|
|
4999
|
-
let t = n == 37 ?
|
|
5000
|
-
return
|
|
4998
|
+
if (n == 37 || Kn && n == 66 && r == "c") {
|
|
4999
|
+
let t = n == 37 ? si(e, e.state.selection.from) == "ltr" ? -1 : 1 : -1;
|
|
5000
|
+
return ti(e, t, r) || ii(e, t);
|
|
5001
5001
|
}
|
|
5002
|
-
if (n == 39 ||
|
|
5003
|
-
let t = n == 39 ?
|
|
5004
|
-
return
|
|
5002
|
+
if (n == 39 || Kn && n == 70 && r == "c") {
|
|
5003
|
+
let t = n == 39 ? si(e, e.state.selection.from) == "ltr" ? 1 : -1 : 1;
|
|
5004
|
+
return ti(e, t, r) || ii(e, t);
|
|
5005
5005
|
}
|
|
5006
|
-
return n == 38 ||
|
|
5007
|
-
if (!
|
|
5006
|
+
return n == 38 || Kn && n == 80 && r == "c" ? ci(e, -1, r) || ii(e, -1) : n == 40 || Kn && n == 78 && r == "c" ? function(e) {
|
|
5007
|
+
if (!F || e.state.selection.$head.parentOffset > 0) return !1;
|
|
5008
5008
|
let { focusNode: t, focusOffset: n } = e.domSelectionRange();
|
|
5009
5009
|
if (t && t.nodeType == 1 && n == 0 && t.firstChild && t.firstChild.contentEditable == "false") {
|
|
5010
5010
|
let n = t.firstChild;
|
|
5011
|
-
|
|
5011
|
+
ui(e, n, "true"), setTimeout((() => ui(e, n, "false")), 20);
|
|
5012
5012
|
}
|
|
5013
5013
|
return !1;
|
|
5014
|
-
}(e) ||
|
|
5014
|
+
}(e) || ci(e, 1, r) || ii(e, 1) : r == (Kn ? "m" : "c") && (n == 66 || n == 73 || n == 89 || n == 90);
|
|
5015
5015
|
}
|
|
5016
|
-
function
|
|
5016
|
+
function fi(e, t) {
|
|
5017
5017
|
e.someProp("transformCopied", ((n) => {
|
|
5018
5018
|
t = n(t, e);
|
|
5019
5019
|
}));
|
|
@@ -5023,10 +5023,10 @@ function di(e, t) {
|
|
|
5023
5023
|
let e = r.firstChild;
|
|
5024
5024
|
n.push(e.type.name, e.attrs == e.type.defaultAttrs ? null : e.attrs), r = e.content;
|
|
5025
5025
|
}
|
|
5026
|
-
let o = e.someProp("clipboardSerializer") || dt.fromSchema(e.state.schema), s =
|
|
5026
|
+
let o = e.someProp("clipboardSerializer") || dt.fromSchema(e.state.schema), s = Si(), c = s.createElement("div");
|
|
5027
5027
|
c.appendChild(o.serializeFragment(r, { document: s }));
|
|
5028
5028
|
let l, u = c.firstChild, d = 0;
|
|
5029
|
-
for (; u && u.nodeType == 1 && (l =
|
|
5029
|
+
for (; u && u.nodeType == 1 && (l = bi[u.nodeName.toLowerCase()]);) {
|
|
5030
5030
|
for (let e = l.length - 1; e >= 0; e--) {
|
|
5031
5031
|
let t = s.createElement(l[e]);
|
|
5032
5032
|
for (; c.firstChild;) t.appendChild(c.firstChild);
|
|
@@ -5040,7 +5040,7 @@ function di(e, t) {
|
|
|
5040
5040
|
slice: t
|
|
5041
5041
|
};
|
|
5042
5042
|
}
|
|
5043
|
-
function
|
|
5043
|
+
function pi(e, t, n, r, i) {
|
|
5044
5044
|
let a, o, s = i.parent.type.spec.code;
|
|
5045
5045
|
if (!n && !t) return null;
|
|
5046
5046
|
let c = !!t && (r || s || !n);
|
|
@@ -5064,14 +5064,14 @@ function fi(e, t, n, r, i) {
|
|
|
5064
5064
|
})), a = function(e) {
|
|
5065
5065
|
let t = /^(\s*<meta [^>]*>)*/.exec(e);
|
|
5066
5066
|
t && (e = e.slice(t[0].length));
|
|
5067
|
-
let n, r =
|
|
5068
|
-
if ((n = i &&
|
|
5067
|
+
let n, r = Si().createElement("div"), i = /<([a-z][^>\s]+)/i.exec(e);
|
|
5068
|
+
if ((n = i && bi[i[1].toLowerCase()]) && (e = n.map(((e) => "<" + e + ">")).join("") + e + n.map(((e) => "</" + e + ">")).reverse().join("")), r.innerHTML = function(e) {
|
|
5069
5069
|
let t = window.trustedTypes;
|
|
5070
|
-
return t ? (
|
|
5070
|
+
return t ? (Ci ||= t.defaultPolicy || t.createPolicy("ProseMirrorClipboard", { createHTML: (e) => e }), Ci.createHTML(e)) : e;
|
|
5071
5071
|
}(e), n) for (let e = 0; e < n.length; e++) r = r.querySelector(n[e]) || r;
|
|
5072
5072
|
return r;
|
|
5073
|
-
}(n),
|
|
5074
|
-
let t = e.querySelectorAll(
|
|
5073
|
+
}(n), Yn && function(e) {
|
|
5074
|
+
let t = e.querySelectorAll(P ? "span:not([class]):not([style])" : "span.Apple-converted-space");
|
|
5075
5075
|
for (let n = 0; n < t.length; n++) {
|
|
5076
5076
|
let r = t[n];
|
|
5077
5077
|
r.childNodes.length == 1 && r.textContent == "\xA0" && r.parentNode && r.parentNode.replaceChild(e.ownerDocument.createTextNode(" "), r);
|
|
@@ -5087,7 +5087,7 @@ function fi(e, t, n, r, i) {
|
|
|
5087
5087
|
if (o ||= (e.someProp("clipboardParser") || e.someProp("domParser") || tt.fromSchema(e.state.schema)).parseSlice(a, {
|
|
5088
5088
|
preserveWhitespace: !(!c && !u),
|
|
5089
5089
|
context: i,
|
|
5090
|
-
ruleFromNode: (e) => e.nodeName != "BR" || e.nextSibling || !e.parentNode ||
|
|
5090
|
+
ruleFromNode: (e) => e.nodeName != "BR" || e.nextSibling || !e.parentNode || mi.test(e.parentNode.nodeName) ? null : { ignore: !0 }
|
|
5091
5091
|
}), u) o = function(e, t) {
|
|
5092
5092
|
if (!e.size) return e;
|
|
5093
5093
|
let n, r = e.content.firstChild.type.schema;
|
|
@@ -5103,7 +5103,7 @@ function fi(e, t, n, r, i) {
|
|
|
5103
5103
|
i = E.from(t.create(n[e + 1], i)), a++, o++;
|
|
5104
5104
|
}
|
|
5105
5105
|
return new O(i, a, o);
|
|
5106
|
-
}(
|
|
5106
|
+
}(yi(o, +u[1], +u[2]), u[4]);
|
|
5107
5107
|
else if (o = O.maxOpen(function(e, t) {
|
|
5108
5108
|
if (e.childCount < 2) return e;
|
|
5109
5109
|
for (let n = t.depth; n >= 0; n--) {
|
|
@@ -5112,10 +5112,10 @@ function fi(e, t, n, r, i) {
|
|
|
5112
5112
|
if (!a) return;
|
|
5113
5113
|
let t, n = i.findWrapping(e.type);
|
|
5114
5114
|
if (!n) return a = null;
|
|
5115
|
-
if (t = a.length && r.length &&
|
|
5115
|
+
if (t = a.length && r.length && gi(n, r, e, a[a.length - 1], 0)) a[a.length - 1] = t;
|
|
5116
5116
|
else {
|
|
5117
|
-
a.length && (a[a.length - 1] =
|
|
5118
|
-
let t =
|
|
5117
|
+
a.length && (a[a.length - 1] = _i(a[a.length - 1], r.length));
|
|
5118
|
+
let t = hi(e, n);
|
|
5119
5119
|
a.push(t), i = i.matchType(t.type), r = n;
|
|
5120
5120
|
}
|
|
5121
5121
|
})), a) return E.from(a);
|
|
@@ -5125,37 +5125,37 @@ function fi(e, t, n, r, i) {
|
|
|
5125
5125
|
let e = 0, t = 0;
|
|
5126
5126
|
for (let t = o.content.firstChild; e < o.openStart && !t.type.spec.isolating; e++, t = t.firstChild);
|
|
5127
5127
|
for (let e = o.content.lastChild; t < o.openEnd && !e.type.spec.isolating; t++, e = e.lastChild);
|
|
5128
|
-
o =
|
|
5128
|
+
o = yi(o, e, t);
|
|
5129
5129
|
}
|
|
5130
5130
|
return e.someProp("transformPasted", ((t) => {
|
|
5131
5131
|
o = t(o, e, c);
|
|
5132
5132
|
})), o;
|
|
5133
5133
|
}
|
|
5134
|
-
var
|
|
5135
|
-
function
|
|
5134
|
+
var mi = /^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;
|
|
5135
|
+
function hi(e, t, n = 0) {
|
|
5136
5136
|
for (let r = t.length - 1; r >= n; r--) e = t[r].create(null, E.from(e));
|
|
5137
5137
|
return e;
|
|
5138
5138
|
}
|
|
5139
|
-
function
|
|
5139
|
+
function gi(e, t, n, r, i) {
|
|
5140
5140
|
if (i < e.length && i < t.length && e[i] == t[i]) {
|
|
5141
|
-
let a =
|
|
5141
|
+
let a = gi(e, t, n, r.lastChild, i + 1);
|
|
5142
5142
|
if (a) return r.copy(r.content.replaceChild(r.childCount - 1, a));
|
|
5143
|
-
if (r.contentMatchAt(r.childCount).matchType(i == e.length - 1 ? n.type : e[i + 1])) return r.copy(r.content.append(E.from(
|
|
5143
|
+
if (r.contentMatchAt(r.childCount).matchType(i == e.length - 1 ? n.type : e[i + 1])) return r.copy(r.content.append(E.from(hi(n, e, i + 1))));
|
|
5144
5144
|
}
|
|
5145
5145
|
}
|
|
5146
|
-
function
|
|
5146
|
+
function _i(e, t) {
|
|
5147
5147
|
if (t == 0) return e;
|
|
5148
|
-
let n = e.content.replaceChild(e.childCount - 1,
|
|
5148
|
+
let n = e.content.replaceChild(e.childCount - 1, _i(e.lastChild, t - 1)), r = e.contentMatchAt(e.childCount).fillBefore(E.empty, !0);
|
|
5149
5149
|
return e.copy(n.append(r));
|
|
5150
5150
|
}
|
|
5151
|
-
function
|
|
5151
|
+
function vi(e, t, n, r, i, a) {
|
|
5152
5152
|
let o = t < 0 ? e.firstChild : e.lastChild, s = o.content;
|
|
5153
|
-
return e.childCount > 1 && (a = 0), i < r - 1 && (s =
|
|
5153
|
+
return e.childCount > 1 && (a = 0), i < r - 1 && (s = vi(s, t, n, r, i + 1, a)), i >= n && (s = t < 0 ? o.contentMatchAt(0).fillBefore(s, a <= i).append(s) : s.append(o.contentMatchAt(o.childCount).fillBefore(E.empty, !0))), e.replaceChild(t < 0 ? 0 : e.childCount - 1, o.copy(s));
|
|
5154
5154
|
}
|
|
5155
|
-
function
|
|
5156
|
-
return t < e.openStart && (e = new O(
|
|
5155
|
+
function yi(e, t, n) {
|
|
5156
|
+
return t < e.openStart && (e = new O(vi(e.content, -1, t, e.openStart, 0, e.openEnd), t, e.openEnd)), n < e.openEnd && (e = new O(vi(e.content, 1, n, e.openEnd, 0, 0), e.openStart, n)), e;
|
|
5157
5157
|
}
|
|
5158
|
-
var
|
|
5158
|
+
var bi = {
|
|
5159
5159
|
thead: ["table"],
|
|
5160
5160
|
tbody: ["table"],
|
|
5161
5161
|
tfoot: ["table"],
|
|
@@ -5173,11 +5173,11 @@ var yi = {
|
|
|
5173
5173
|
"tbody",
|
|
5174
5174
|
"tr"
|
|
5175
5175
|
]
|
|
5176
|
-
},
|
|
5177
|
-
function
|
|
5178
|
-
return
|
|
5176
|
+
}, xi = null;
|
|
5177
|
+
function Si() {
|
|
5178
|
+
return xi ||= document.implementation.createHTMLDocument("title");
|
|
5179
5179
|
}
|
|
5180
|
-
var
|
|
5180
|
+
var Ci = null, I = {}, wi = {}, Ti = {
|
|
5181
5181
|
touchstart: !0,
|
|
5182
5182
|
touchmove: !0
|
|
5183
5183
|
};
|
|
@@ -5222,20 +5222,20 @@ function Ni(e, t, n, r, i) {
|
|
|
5222
5222
|
return ji(e, "handleClickOn", t, n, r) || e.someProp("handleClick", ((n) => n(e, t, r))) || (i ? function(e, t) {
|
|
5223
5223
|
if (t == -1) return !1;
|
|
5224
5224
|
let n, r, i = e.state.selection;
|
|
5225
|
-
i instanceof
|
|
5225
|
+
i instanceof M && (n = i.node);
|
|
5226
5226
|
let a = e.state.doc.resolve(t);
|
|
5227
5227
|
for (let e = a.depth + 1; e > 0; e--) {
|
|
5228
5228
|
let t = e > a.depth ? a.nodeAfter : a.node(e);
|
|
5229
|
-
if (
|
|
5229
|
+
if (M.isSelectable(t)) {
|
|
5230
5230
|
r = n && i.$from.depth > 0 && e >= i.$from.depth && a.before(i.$from.depth + 1) == i.$from.pos ? a.before(i.$from.depth) : a.before(e);
|
|
5231
5231
|
break;
|
|
5232
5232
|
}
|
|
5233
5233
|
}
|
|
5234
|
-
return r != null && (Mi(e,
|
|
5234
|
+
return r != null && (Mi(e, M.create(e.state.doc, r), "pointer"), !0);
|
|
5235
5235
|
}(e, n) : function(e, t) {
|
|
5236
5236
|
if (t == -1) return !1;
|
|
5237
5237
|
let n = e.state.doc.resolve(t), r = n.nodeAfter;
|
|
5238
|
-
return !!(r && r.isAtom &&
|
|
5238
|
+
return !!(r && r.isAtom && M.isSelectable(r)) && (Mi(e, new M(n), "pointer"), !0);
|
|
5239
5239
|
}(e, n));
|
|
5240
5240
|
}
|
|
5241
5241
|
function Pi(e, t, n, r) {
|
|
@@ -5245,14 +5245,14 @@ function Fi(e, t, n, r) {
|
|
|
5245
5245
|
return ji(e, "handleTripleClickOn", t, n, r) || e.someProp("handleTripleClick", ((n) => n(e, t, r))) || function(e, t, n) {
|
|
5246
5246
|
if (n.button != 0) return !1;
|
|
5247
5247
|
let r = e.state.doc;
|
|
5248
|
-
if (t == -1) return !!r.inlineContent && (Mi(e,
|
|
5248
|
+
if (t == -1) return !!r.inlineContent && (Mi(e, j.create(r, 0, r.content.size), "pointer"), !0);
|
|
5249
5249
|
let i = r.resolve(t);
|
|
5250
5250
|
for (let t = i.depth + 1; t > 0; t--) {
|
|
5251
5251
|
let n = t > i.depth ? i.nodeAfter : i.node(t), a = i.before(t);
|
|
5252
|
-
if (n.inlineContent) Mi(e,
|
|
5252
|
+
if (n.inlineContent) Mi(e, j.create(r, a + 1, a + 1 + n.content.size), "pointer");
|
|
5253
5253
|
else {
|
|
5254
|
-
if (!
|
|
5255
|
-
Mi(e,
|
|
5254
|
+
if (!M.isSelectable(n)) continue;
|
|
5255
|
+
Mi(e, M.create(r, a), "pointer");
|
|
5256
5256
|
}
|
|
5257
5257
|
return !0;
|
|
5258
5258
|
}
|
|
@@ -5263,27 +5263,27 @@ function Ii(e) {
|
|
|
5263
5263
|
}
|
|
5264
5264
|
wi.keydown = (e, t) => {
|
|
5265
5265
|
let n = t;
|
|
5266
|
-
if (e.input.shiftKey = n.keyCode == 16 || n.shiftKey, !zi(e, n) && (e.input.lastKeyCode = n.keyCode, e.input.lastKeyCodeTime = Date.now(), !
|
|
5266
|
+
if (e.input.shiftKey = n.keyCode == 16 || n.shiftKey, !zi(e, n) && (e.input.lastKeyCode = n.keyCode, e.input.lastKeyCodeTime = Date.now(), !Jn || !P || n.keyCode != 13)) if (n.keyCode != 229 && e.domObserver.forceFlush(), !Gn || n.keyCode != 13 || n.ctrlKey || n.altKey || n.metaKey) e.someProp("handleKeyDown", ((t) => t(e, n))) || di(e, n) ? n.preventDefault() : Ei(e, "key");
|
|
5267
5267
|
else {
|
|
5268
5268
|
let t = Date.now();
|
|
5269
5269
|
e.input.lastIOSEnter = t, e.input.lastIOSEnterFallbackTimeout = setTimeout((() => {
|
|
5270
|
-
e.input.lastIOSEnter == t && (e.someProp("handleKeyDown", ((t) => t(e,
|
|
5270
|
+
e.input.lastIOSEnter == t && (e.someProp("handleKeyDown", ((t) => t(e, Nn(13, "Enter")))), e.input.lastIOSEnter = 0);
|
|
5271
5271
|
}), 200);
|
|
5272
5272
|
}
|
|
5273
5273
|
}, wi.keyup = (e, t) => {
|
|
5274
5274
|
t.keyCode == 16 && (e.input.shiftKey = !1);
|
|
5275
5275
|
}, wi.keypress = (e, t) => {
|
|
5276
5276
|
let n = t;
|
|
5277
|
-
if (zi(e, n) || !n.charCode || n.ctrlKey && !n.altKey ||
|
|
5277
|
+
if (zi(e, n) || !n.charCode || n.ctrlKey && !n.altKey || Kn && n.metaKey) return;
|
|
5278
5278
|
if (e.someProp("handleKeyPress", ((t) => t(e, n)))) return void n.preventDefault();
|
|
5279
5279
|
let r = e.state.selection;
|
|
5280
|
-
if (!(r instanceof
|
|
5280
|
+
if (!(r instanceof j && r.$from.sameParent(r.$to))) {
|
|
5281
5281
|
let t = String.fromCharCode(n.charCode), i = () => e.state.tr.insertText(t).scrollIntoView();
|
|
5282
5282
|
/[\r\n]/.test(t) || e.someProp("handleTextInput", ((n) => n(e, r.$from.pos, r.$to.pos, t, i))) || e.dispatch(i()), n.preventDefault();
|
|
5283
5283
|
}
|
|
5284
5284
|
};
|
|
5285
|
-
var Li =
|
|
5286
|
-
|
|
5285
|
+
var Li = Kn ? "metaKey" : "ctrlKey";
|
|
5286
|
+
I.mousedown = (e, t) => {
|
|
5287
5287
|
let n = t;
|
|
5288
5288
|
e.input.shiftKey = n.shiftKey;
|
|
5289
5289
|
let r = Ii(e), i = Date.now(), a = "singleClick";
|
|
@@ -5311,22 +5311,22 @@ var Ri = class {
|
|
|
5311
5311
|
let o = r ? null : n.target, s = o ? e.docView.nearestDesc(o, !0) : null;
|
|
5312
5312
|
this.target = s && s.nodeDOM.nodeType == 1 ? s.nodeDOM : null;
|
|
5313
5313
|
let { selection: c } = e.state;
|
|
5314
|
-
n.button == 0 && (i.type.spec.draggable && !1 !== i.type.spec.selectable || c instanceof
|
|
5314
|
+
n.button == 0 && (i.type.spec.draggable && !1 !== i.type.spec.selectable || c instanceof M && c.from <= a && c.to > a) && (this.mightDrag = {
|
|
5315
5315
|
node: i,
|
|
5316
5316
|
pos: a,
|
|
5317
5317
|
addAttr: !(!this.target || this.target.draggable),
|
|
5318
|
-
setUneditable: !(!this.target || !
|
|
5318
|
+
setUneditable: !(!this.target || !Hn || this.target.hasAttribute("contentEditable"))
|
|
5319
5319
|
}), 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((() => {
|
|
5320
5320
|
this.view.input.mouseDown == this && this.target.setAttribute("contentEditable", "false");
|
|
5321
5321
|
}), 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)), Ei(e, "pointer");
|
|
5322
5322
|
}
|
|
5323
5323
|
done() {
|
|
5324
|
-
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((() =>
|
|
5324
|
+
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((() => Ur(this.view))), this.view.input.mouseDown = null;
|
|
5325
5325
|
}
|
|
5326
5326
|
up(e) {
|
|
5327
5327
|
if (this.done(), !this.view.dom.contains(e.target)) return;
|
|
5328
5328
|
let t = this.pos;
|
|
5329
|
-
this.view.state.doc != this.startDoc && (t = this.view.posAtCoords(Ai(e))), this.updateAllowDefault(e), this.allowDefault || !t ? Ei(this.view, "pointer") : Ni(this.view, t.pos, t.inside, e, this.selectNode) ? e.preventDefault() : e.button == 0 && (this.flushed ||
|
|
5329
|
+
this.view.state.doc != this.startDoc && (t = this.view.posAtCoords(Ai(e))), this.updateAllowDefault(e), this.allowDefault || !t ? Ei(this.view, "pointer") : Ni(this.view, t.pos, t.inside, e, this.selectNode) ? e.preventDefault() : e.button == 0 && (this.flushed || F && this.mightDrag && !this.mightDrag.node.isAtom || P && !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) ? (Mi(this.view, A.near(this.view.state.doc.resolve(t.pos)), "pointer"), e.preventDefault()) : Ei(this.view, "pointer");
|
|
5330
5330
|
}
|
|
5331
5331
|
move(e) {
|
|
5332
5332
|
this.updateAllowDefault(e), Ei(this.view, "pointer"), e.buttons == 0 && this.done();
|
|
@@ -5336,14 +5336,14 @@ var Ri = class {
|
|
|
5336
5336
|
}
|
|
5337
5337
|
};
|
|
5338
5338
|
function zi(e, t) {
|
|
5339
|
-
return !!e.composing || !!(
|
|
5339
|
+
return !!e.composing || !!(F && Math.abs(t.timeStamp - e.input.compositionEndedAt) < 500) && (e.input.compositionEndedAt = -2e8, !0);
|
|
5340
5340
|
}
|
|
5341
|
-
|
|
5341
|
+
I.touchstart = (e) => {
|
|
5342
5342
|
e.input.lastTouch = Date.now(), Ii(e), Ei(e, "pointer");
|
|
5343
|
-
},
|
|
5343
|
+
}, I.touchmove = (e) => {
|
|
5344
5344
|
e.input.lastTouch = Date.now(), Ei(e, "pointer");
|
|
5345
|
-
},
|
|
5346
|
-
var Bi =
|
|
5345
|
+
}, I.contextmenu = (e) => Ii(e);
|
|
5346
|
+
var Bi = Jn ? 5e3 : -1;
|
|
5347
5347
|
function Vi(e, t) {
|
|
5348
5348
|
clearTimeout(e.input.composingTimeout), t > -1 && (e.input.composingTimeout = setTimeout((() => Wi(e)), t));
|
|
5349
5349
|
}
|
|
@@ -5361,10 +5361,10 @@ function Ui(e) {
|
|
|
5361
5361
|
if (e.nodeType == 3 && t) return e;
|
|
5362
5362
|
if (e.nodeType == 1 && t > 0) {
|
|
5363
5363
|
if (e.contentEditable == "false") return null;
|
|
5364
|
-
t =
|
|
5364
|
+
t = An(e = e.childNodes[t - 1]);
|
|
5365
5365
|
} else {
|
|
5366
|
-
if (!e.parentNode ||
|
|
5367
|
-
t =
|
|
5366
|
+
if (!e.parentNode || jn(e)) return null;
|
|
5367
|
+
t = N(e), e = e.parentNode;
|
|
5368
5368
|
}
|
|
5369
5369
|
}
|
|
5370
5370
|
}(t.focusNode, t.focusOffset), r = function(e, t) {
|
|
@@ -5374,8 +5374,8 @@ function Ui(e) {
|
|
|
5374
5374
|
if (e.contentEditable == "false") return null;
|
|
5375
5375
|
e = e.childNodes[t], t = 0;
|
|
5376
5376
|
} else {
|
|
5377
|
-
if (!e.parentNode ||
|
|
5378
|
-
t =
|
|
5377
|
+
if (!e.parentNode || jn(e)) return null;
|
|
5378
|
+
t = N(e) + 1, e = e.parentNode;
|
|
5379
5379
|
}
|
|
5380
5380
|
}
|
|
5381
5381
|
}(t.focusNode, t.focusOffset);
|
|
@@ -5391,9 +5391,9 @@ function Ui(e) {
|
|
|
5391
5391
|
return n || r;
|
|
5392
5392
|
}
|
|
5393
5393
|
function Wi(e, t = !1) {
|
|
5394
|
-
if (!(
|
|
5394
|
+
if (!(Jn && e.domObserver.flushingSoon >= 0)) {
|
|
5395
5395
|
if (e.domObserver.forceFlush(), Hi(e), t || e.docView && e.docView.dirty) {
|
|
5396
|
-
let n =
|
|
5396
|
+
let n = Vr(e), r = e.state.selection;
|
|
5397
5397
|
return n && !n.eq(r) ? e.dispatch(e.state.tr.setSelection(n)) : !e.markCursor && !t || r.$from.node(r.$from.sharedDepth(r.to)).inlineContent ? e.updateState(e.state) : e.dispatch(e.state.tr.deleteSelection()), !0;
|
|
5398
5398
|
}
|
|
5399
5399
|
return !1;
|
|
@@ -5403,13 +5403,13 @@ wi.compositionstart = wi.compositionupdate = (e) => {
|
|
|
5403
5403
|
if (!e.composing) {
|
|
5404
5404
|
e.domObserver.flush();
|
|
5405
5405
|
let { state: t } = e, n = t.selection.$to;
|
|
5406
|
-
if (t.selection instanceof
|
|
5406
|
+
if (t.selection instanceof j && (t.storedMarks || !n.textOffset && n.parentOffset && n.nodeBefore.marks.some(((e) => !1 === e.type.spec.inclusive)) || P && qn && function(e) {
|
|
5407
5407
|
let { focusNode: t, focusOffset: n } = e.domSelectionRange();
|
|
5408
5408
|
if (!t || t.nodeType != 1 || n >= t.childNodes.length) return !1;
|
|
5409
5409
|
let r = t.childNodes[n];
|
|
5410
5410
|
return r.nodeType == 1 && r.contentEditable == "false";
|
|
5411
5411
|
}(e))) e.markCursor = e.state.storedMarks || n.marks(), Wi(e, !0), e.markCursor = null;
|
|
5412
|
-
else if (Wi(e, !t.selection.empty),
|
|
5412
|
+
else if (Wi(e, !t.selection.empty), Hn && t.selection.empty && n.parentOffset && !n.textOffset && n.nodeBefore.marks.length) {
|
|
5413
5413
|
let t = e.domSelectionRange();
|
|
5414
5414
|
for (let n = t.focusNode, r = t.focusOffset; n && n.nodeType == 1 && r != 0;) {
|
|
5415
5415
|
let t = r < 0 ? n.lastChild : n.childNodes[r - 1];
|
|
@@ -5428,9 +5428,9 @@ wi.compositionstart = wi.compositionupdate = (e) => {
|
|
|
5428
5428
|
}, wi.compositionend = (e, t) => {
|
|
5429
5429
|
e.composing && (e.input.composing = !1, e.input.compositionEndedAt = t.timeStamp, e.input.compositionPendingChanges = e.domObserver.pendingRecords().length ? e.input.compositionID : 0, e.input.compositionNode = null, e.input.badSafariComposition ? e.domObserver.forceFlush() : e.input.compositionPendingChanges && Promise.resolve().then((() => e.domObserver.flush())), e.input.compositionID++, Vi(e, 20));
|
|
5430
5430
|
};
|
|
5431
|
-
var Gi =
|
|
5431
|
+
var Gi = Bn && Vn < 15 || Gn && Xn < 604;
|
|
5432
5432
|
function Ki(e, t, n, r, i) {
|
|
5433
|
-
let a =
|
|
5433
|
+
let a = pi(e, t, n, r, e.state.selection.$from);
|
|
5434
5434
|
if (e.someProp("handlePaste", ((t) => t(e, i, a || O.empty)))) return !0;
|
|
5435
5435
|
if (!a) return !1;
|
|
5436
5436
|
let o = function(e) {
|
|
@@ -5444,10 +5444,10 @@ function qi(e) {
|
|
|
5444
5444
|
let n = e.getData("text/uri-list");
|
|
5445
5445
|
return n ? n.replace(/\r?\n/g, " ") : "";
|
|
5446
5446
|
}
|
|
5447
|
-
|
|
5447
|
+
I.copy = wi.cut = (e, t) => {
|
|
5448
5448
|
let n = t, r = e.state.selection, i = n.type == "cut";
|
|
5449
5449
|
if (r.empty) return;
|
|
5450
|
-
let a = Gi ? null : n.clipboardData, { dom: o, text: s } =
|
|
5450
|
+
let a = Gi ? null : n.clipboardData, { dom: o, text: s } = fi(e, r.content());
|
|
5451
5451
|
a ? (n.preventDefault(), a.clearData(), a.setData("text/html", o.innerHTML), a.setData("text/plain", s)) : function(e, t) {
|
|
5452
5452
|
if (!e.dom.parentNode) return;
|
|
5453
5453
|
let n = e.dom.parentNode.appendChild(document.createElement("div"));
|
|
@@ -5459,7 +5459,7 @@ Ci.copy = wi.cut = (e, t) => {
|
|
|
5459
5459
|
}(e, o), i && e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent", "cut"));
|
|
5460
5460
|
}, wi.paste = (e, t) => {
|
|
5461
5461
|
let n = t;
|
|
5462
|
-
if (e.composing && !
|
|
5462
|
+
if (e.composing && !Jn) return;
|
|
5463
5463
|
let r = Gi ? null : n.clipboardData, i = e.input.shiftKey && e.input.lastKeyCode != 45;
|
|
5464
5464
|
r && Ki(e, qi(r), r.getData("text/html"), i, n) ? n.preventDefault() : function(e, t) {
|
|
5465
5465
|
if (!e.dom.parentNode) return;
|
|
@@ -5475,27 +5475,27 @@ var Ji = class {
|
|
|
5475
5475
|
constructor(e, t, n) {
|
|
5476
5476
|
this.slice = e, this.move = t, this.node = n;
|
|
5477
5477
|
}
|
|
5478
|
-
}, Yi =
|
|
5478
|
+
}, Yi = Kn ? "altKey" : "ctrlKey";
|
|
5479
5479
|
function Xi(e, t) {
|
|
5480
5480
|
let n;
|
|
5481
5481
|
return e.someProp("dragCopies", ((e) => {
|
|
5482
5482
|
n ||= e(t);
|
|
5483
5483
|
})), n == null ? !t[Yi] : !n;
|
|
5484
5484
|
}
|
|
5485
|
-
|
|
5485
|
+
I.dragstart = (e, t) => {
|
|
5486
5486
|
let n = t, r = e.input.mouseDown;
|
|
5487
5487
|
if (r && r.done(), !n.dataTransfer) return;
|
|
5488
5488
|
let i, a = e.state.selection, o = a.empty ? null : e.posAtCoords(Ai(n));
|
|
5489
|
-
if (!(o && o.pos >= a.from && o.pos <= (a instanceof
|
|
5490
|
-
if (r && r.mightDrag) i =
|
|
5489
|
+
if (!(o && o.pos >= a.from && o.pos <= (a instanceof M ? a.to - 1 : a.to))) {
|
|
5490
|
+
if (r && r.mightDrag) i = M.create(e.state.doc, r.mightDrag.pos);
|
|
5491
5491
|
else if (n.target && n.target.nodeType == 1) {
|
|
5492
5492
|
let t = e.docView.nearestDesc(n.target, !0);
|
|
5493
|
-
t && t.node.type.spec.draggable && t != e.docView && (i =
|
|
5493
|
+
t && t.node.type.spec.draggable && t != e.docView && (i = M.create(e.state.doc, t.posBefore));
|
|
5494
5494
|
}
|
|
5495
5495
|
}
|
|
5496
|
-
let { dom: s, text: c, slice: l } =
|
|
5497
|
-
(!n.dataTransfer.files.length || !
|
|
5498
|
-
},
|
|
5496
|
+
let { dom: s, text: c, slice: l } = fi(e, (i || e.state.selection).content());
|
|
5497
|
+
(!n.dataTransfer.files.length || !P || Wn > 120) && n.dataTransfer.clearData(), n.dataTransfer.setData(Gi ? "Text" : "text/html", s.innerHTML), n.dataTransfer.effectAllowed = "copyMove", Gi || n.dataTransfer.setData("text/plain", c), e.dragging = new Ji(l, Xi(e, n), i);
|
|
5498
|
+
}, I.dragend = (e) => {
|
|
5499
5499
|
let t = e.dragging;
|
|
5500
5500
|
window.setTimeout((() => {
|
|
5501
5501
|
e.dragging == t && (e.dragging = null);
|
|
@@ -5509,7 +5509,7 @@ Ci.dragstart = (e, t) => {
|
|
|
5509
5509
|
let i = e.state.doc.resolve(r.pos), a = n && n.slice;
|
|
5510
5510
|
a ? e.someProp("transformPasted", ((t) => {
|
|
5511
5511
|
a = t(a, e, !1);
|
|
5512
|
-
})) : a =
|
|
5512
|
+
})) : a = pi(e, qi(t.dataTransfer), Gi ? null : t.dataTransfer.getData("text/html"), !1, i);
|
|
5513
5513
|
let o = !(!n || !Xi(e, t));
|
|
5514
5514
|
if (e.someProp("handleDrop", ((n) => n(e, t, a || O.empty, o)))) return void t.preventDefault();
|
|
5515
5515
|
if (!a) return;
|
|
@@ -5539,35 +5539,35 @@ Ci.dragstart = (e, t) => {
|
|
|
5539
5539
|
let l = c.mapping.map(s), u = a.openStart == 0 && a.openEnd == 0 && a.content.childCount == 1, d = c.doc;
|
|
5540
5540
|
if (u ? c.replaceRangeWith(l, l, a.content.firstChild) : c.replaceRange(l, l, a), c.doc.eq(d)) return;
|
|
5541
5541
|
let f = c.doc.resolve(l);
|
|
5542
|
-
if (u &&
|
|
5542
|
+
if (u && M.isSelectable(a.content.firstChild) && f.nodeAfter && f.nodeAfter.sameMarkup(a.content.firstChild)) c.setSelection(new M(f));
|
|
5543
5543
|
else {
|
|
5544
5544
|
let t = c.mapping.map(s);
|
|
5545
|
-
c.mapping.maps[c.mapping.maps.length - 1].forEach(((e, n, r, i) => t = i)), c.setSelection(
|
|
5545
|
+
c.mapping.maps[c.mapping.maps.length - 1].forEach(((e, n, r, i) => t = i)), c.setSelection(Xr(e, f, c.doc.resolve(t)));
|
|
5546
5546
|
}
|
|
5547
5547
|
e.focus(), e.dispatch(c.setMeta("uiEvent", "drop"));
|
|
5548
5548
|
})(e, t, e.dragging);
|
|
5549
5549
|
} finally {
|
|
5550
5550
|
e.dragging = null;
|
|
5551
5551
|
}
|
|
5552
|
-
},
|
|
5552
|
+
}, I.focus = (e) => {
|
|
5553
5553
|
e.input.lastFocus = Date.now(), e.focused || (e.domObserver.stop(), e.dom.classList.add("ProseMirror-focused"), e.domObserver.start(), e.focused = !0, setTimeout((() => {
|
|
5554
|
-
e.docView && e.hasFocus() && !e.domObserver.currentSelection.eq(e.domSelectionRange()) &&
|
|
5554
|
+
e.docView && e.hasFocus() && !e.domObserver.currentSelection.eq(e.domSelectionRange()) && Ur(e);
|
|
5555
5555
|
}), 20));
|
|
5556
|
-
},
|
|
5556
|
+
}, I.blur = (e, t) => {
|
|
5557
5557
|
let n = t;
|
|
5558
5558
|
e.focused &&= (e.domObserver.stop(), e.dom.classList.remove("ProseMirror-focused"), e.domObserver.start(), n.relatedTarget && e.dom.contains(n.relatedTarget) && e.domObserver.currentSelection.clear(), !1);
|
|
5559
|
-
},
|
|
5560
|
-
if (
|
|
5559
|
+
}, I.beforeinput = (e, t) => {
|
|
5560
|
+
if (P && Jn && t.inputType == "deleteContentBackward") {
|
|
5561
5561
|
e.domObserver.flushSoon();
|
|
5562
5562
|
let { domChangeCount: t } = e.input;
|
|
5563
5563
|
setTimeout((() => {
|
|
5564
|
-
if (e.input.domChangeCount != t || (e.dom.blur(), e.focus(), e.someProp("handleKeyDown", ((t) => t(e,
|
|
5564
|
+
if (e.input.domChangeCount != t || (e.dom.blur(), e.focus(), e.someProp("handleKeyDown", ((t) => t(e, Nn(8, "Backspace")))))) return;
|
|
5565
5565
|
let { $cursor: n } = e.state.selection;
|
|
5566
5566
|
n && n.pos > 0 && e.dispatch(e.state.tr.delete(n.pos - 1, n.pos).scrollIntoView());
|
|
5567
5567
|
}), 50);
|
|
5568
5568
|
}
|
|
5569
5569
|
};
|
|
5570
|
-
for (let e in wi)
|
|
5570
|
+
for (let e in wi) I[e] = wi[e];
|
|
5571
5571
|
function Zi(e, t) {
|
|
5572
5572
|
if (e == t) return !0;
|
|
5573
5573
|
for (let n in e) if (e[n] !== t[n]) return !1;
|
|
@@ -5936,10 +5936,10 @@ var ha = {
|
|
|
5936
5936
|
attributes: !0,
|
|
5937
5937
|
attributeOldValue: !0,
|
|
5938
5938
|
subtree: !0
|
|
5939
|
-
}, ga =
|
|
5939
|
+
}, ga = Bn && Vn <= 11, _a = /* @__PURE__ */ new WeakMap(), va = !1;
|
|
5940
5940
|
function ya(e, t) {
|
|
5941
5941
|
let n = t.startContainer, r = t.startOffset, i = t.endContainer, a = t.endOffset, o = e.domAtPos(e.state.selection.anchor);
|
|
5942
|
-
return
|
|
5942
|
+
return Dn(o.node, o.offset, i, a) && ([n, r, i, a] = [
|
|
5943
5943
|
i,
|
|
5944
5944
|
a,
|
|
5945
5945
|
n,
|
|
@@ -5962,11 +5962,11 @@ function xa(e) {
|
|
|
5962
5962
|
let t = e.pmViewDesc;
|
|
5963
5963
|
if (t) return t.parseRule();
|
|
5964
5964
|
if (e.nodeName == "BR" && e.parentNode) {
|
|
5965
|
-
if (
|
|
5965
|
+
if (F && /^(ul|ol)$/i.test(e.parentNode.nodeName)) {
|
|
5966
5966
|
let e = document.createElement("div");
|
|
5967
5967
|
return e.appendChild(document.createElement("li")), { skip: e };
|
|
5968
5968
|
}
|
|
5969
|
-
if (e.parentNode.lastChild == e ||
|
|
5969
|
+
if (e.parentNode.lastChild == e || F && /^(tr|table)$/i.test(e.parentNode.nodeName)) return { ignore: !0 };
|
|
5970
5970
|
} else if (e.nodeName == "IMG" && e.getAttribute("mark-placeholder")) return { ignore: !0 };
|
|
5971
5971
|
return null;
|
|
5972
5972
|
}
|
|
@@ -5974,9 +5974,9 @@ var Sa = /^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|
|
|
|
5974
5974
|
function Ca(e, t, n, r, i) {
|
|
5975
5975
|
let a = e.input.compositionPendingChanges || (e.composing ? e.input.compositionID : 0);
|
|
5976
5976
|
if (e.input.compositionPendingChanges = 0, t < 0) {
|
|
5977
|
-
let t = e.input.lastSelectionTime > Date.now() - 50 ? e.input.lastSelectionOrigin : null, n =
|
|
5977
|
+
let t = e.input.lastSelectionTime > Date.now() - 50 ? e.input.lastSelectionOrigin : null, n = Vr(e, t);
|
|
5978
5978
|
if (n && !e.state.selection.eq(n)) {
|
|
5979
|
-
if (
|
|
5979
|
+
if (P && Jn && e.input.lastKeyCode === 13 && Date.now() - 100 < e.input.lastKeyCodeTime && e.someProp("handleKeyDown", ((t) => t(e, Nn(13, "Enter"))))) return;
|
|
5980
5980
|
let r = e.state.tr.setSelection(n);
|
|
5981
5981
|
t == "pointer" ? r.setMeta("pointer", !0) : t == "key" && r.scrollIntoView(), a && r.setMeta("composition", a), e.dispatch(r);
|
|
5982
5982
|
}
|
|
@@ -5989,10 +5989,10 @@ function Ca(e, t, n, r, i) {
|
|
|
5989
5989
|
if (u && e.dom.contains(u.nodeType == 1 ? u : u.parentNode) && (r = [{
|
|
5990
5990
|
node: u,
|
|
5991
5991
|
offset: l.anchorOffset
|
|
5992
|
-
}],
|
|
5992
|
+
}], Mn(l) || r.push({
|
|
5993
5993
|
node: l.focusNode,
|
|
5994
5994
|
offset: l.focusOffset
|
|
5995
|
-
})),
|
|
5995
|
+
})), P && e.input.lastKeyCode === 8) for (let e = o; e > a; e--) {
|
|
5996
5996
|
let t = i.childNodes[e - 1], n = t.pmViewDesc;
|
|
5997
5997
|
if (t.nodeName == "BR" && !n) {
|
|
5998
5998
|
o = e;
|
|
@@ -6043,9 +6043,9 @@ function Ca(e, t, n, r, i) {
|
|
|
6043
6043
|
endB: s
|
|
6044
6044
|
};
|
|
6045
6045
|
}(p.content, d.doc.content, d.from, c, l);
|
|
6046
|
-
if (m && e.input.domChangeCount++, (
|
|
6046
|
+
if (m && e.input.domChangeCount++, (Gn && e.input.lastIOSEnter > Date.now() - 225 || Jn) && i.some(((e) => e.nodeType == 1 && !Sa.test(e.nodeName))) && (!m || m.endA >= m.endB) && e.someProp("handleKeyDown", ((t) => t(e, Nn(13, "Enter"))))) return void (e.input.lastIOSEnter = 0);
|
|
6047
6047
|
if (!m) {
|
|
6048
|
-
if (!(r && u instanceof
|
|
6048
|
+
if (!(r && u instanceof j && !u.empty && u.$head.sameParent(u.$anchor)) || e.composing || d.sel && d.sel.anchor != d.sel.head) {
|
|
6049
6049
|
if (d.sel) {
|
|
6050
6050
|
let t = wa(e, e.state.doc, d.sel);
|
|
6051
6051
|
if (t && !t.eq(e.state.selection)) {
|
|
@@ -6061,9 +6061,9 @@ function Ca(e, t, n, r, i) {
|
|
|
6061
6061
|
endB: u.to
|
|
6062
6062
|
};
|
|
6063
6063
|
}
|
|
6064
|
-
e.state.selection.from < e.state.selection.to && m.start == m.endB && e.state.selection instanceof
|
|
6064
|
+
e.state.selection.from < e.state.selection.to && m.start == m.endB && e.state.selection instanceof j && (m.start > e.state.selection.from && m.start <= e.state.selection.from + 2 && e.state.selection.from >= d.from ? m.start = e.state.selection.from : m.endA < e.state.selection.to && m.endA >= e.state.selection.to - 2 && e.state.selection.to <= d.to && (m.endB += e.state.selection.to - m.endA, m.endA = e.state.selection.to)), Bn && Vn <= 11 && m.endB == m.start + 1 && m.endA == m.start && m.start > d.from && d.doc.textBetween(m.start - d.from - 1, m.start - d.from + 1) == " \xA0" && (m.start--, m.endA--, m.endB--);
|
|
6065
6065
|
let h = d.doc.resolveNoCache(m.start - d.from), g = d.doc.resolveNoCache(m.endB - d.from), _ = f.resolve(m.start), ee = h.sameParent(g) && h.parent.inlineContent && _.end() >= m.endA;
|
|
6066
|
-
if ((
|
|
6066
|
+
if ((Gn && e.input.lastIOSEnter > Date.now() - 225 && (!ee || i.some(((e) => e.nodeName == "DIV" || e.nodeName == "P"))) || !ee && h.pos < d.doc.content.size && (!h.sameParent(g) || !h.parent.inlineContent) && h.pos < g.pos && !/\S/.test(d.doc.textBetween(h.pos, g.pos, "", ""))) && e.someProp("handleKeyDown", ((t) => t(e, Nn(13, "Enter"))))) return void (e.input.lastIOSEnter = 0);
|
|
6067
6067
|
if (e.state.selection.anchor > m.start && function(e, t, n, r, i) {
|
|
6068
6068
|
if (n - t <= i.pos - r.pos || Ta(r, !0, !1) < i.pos) return !1;
|
|
6069
6069
|
let a = e.resolve(t);
|
|
@@ -6074,22 +6074,22 @@ function Ca(e, t, n, r, i) {
|
|
|
6074
6074
|
if (a.parentOffset < a.parent.content.size || !a.parent.isTextblock) return !1;
|
|
6075
6075
|
let o = e.resolve(Ta(a, !0, !0));
|
|
6076
6076
|
return !(!o.parent.isTextblock || o.pos > n || Ta(o, !0, !1) < n) && r.parent.content.cut(r.parentOffset).eq(o.parent.content);
|
|
6077
|
-
}(f, m.start, m.endA, h, g) && e.someProp("handleKeyDown", ((t) => t(e,
|
|
6078
|
-
|
|
6077
|
+
}(f, m.start, m.endA, h, g) && e.someProp("handleKeyDown", ((t) => t(e, Nn(8, "Backspace"))))) return void (Jn && P && e.domObserver.suppressSelectionUpdates());
|
|
6078
|
+
P && m.endB == m.start && (e.input.lastChromeDelete = Date.now()), Jn && !ee && h.start() != g.start() && g.parentOffset == 0 && h.depth == g.depth && d.sel && d.sel.anchor == d.sel.head && d.sel.head == m.endA && (m.endB -= 2, g = d.doc.resolveNoCache(m.endB - d.from), setTimeout((() => {
|
|
6079
6079
|
e.someProp("handleKeyDown", (function(t) {
|
|
6080
|
-
return t(e,
|
|
6080
|
+
return t(e, Nn(13, "Enter"));
|
|
6081
6081
|
}));
|
|
6082
6082
|
}), 20));
|
|
6083
6083
|
let v, y = m.start, b = m.endA, x = (t) => {
|
|
6084
6084
|
let n = t || e.state.tr.replace(y, b, d.doc.slice(m.start - d.from, m.endB - d.from));
|
|
6085
6085
|
if (d.sel) {
|
|
6086
6086
|
let t = wa(e, n.doc, d.sel);
|
|
6087
|
-
t && !(
|
|
6087
|
+
t && !(P && e.composing && t.empty && (m.start != m.endB || e.input.lastChromeDelete < Date.now() - 100) && (t.head == y || t.head == n.mapping.map(b) - 1) || Bn && t.empty && t.head == y) && n.setSelection(t);
|
|
6088
6088
|
}
|
|
6089
6089
|
return a && n.setMeta("composition", a), n.scrollIntoView();
|
|
6090
6090
|
};
|
|
6091
6091
|
if (ee) if (h.pos == g.pos) {
|
|
6092
|
-
|
|
6092
|
+
Bn && Vn <= 11 && h.parentOffset == 0 && (e.domObserver.suppressSelectionUpdates(), setTimeout((() => Ur(e)), 20));
|
|
6093
6093
|
let t = x(e.state.tr.delete(y, b)), n = f.resolve(m.start).marksAcross(f.resolve(m.endA));
|
|
6094
6094
|
n && t.ensureMarks(n), e.dispatch(t);
|
|
6095
6095
|
} else if (m.endA == m.endB && (v = function(e, t) {
|
|
@@ -6117,7 +6117,7 @@ function Ca(e, t, n, r, i) {
|
|
|
6117
6117
|
else e.dispatch(x());
|
|
6118
6118
|
}
|
|
6119
6119
|
function wa(e, t, n) {
|
|
6120
|
-
return Math.max(n.anchor, n.head) > t.content.size ? null :
|
|
6120
|
+
return Math.max(n.anchor, n.head) > t.content.size ? null : Xr(e, t.resolve(n.anchor), t.resolve(n.head));
|
|
6121
6121
|
}
|
|
6122
6122
|
function Ta(e, t, n) {
|
|
6123
6123
|
let r = e.depth, i = t ? e.end() : e.pos;
|
|
@@ -6145,7 +6145,7 @@ var Da = class {
|
|
|
6145
6145
|
button: 0
|
|
6146
6146
|
}, 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.badSafariComposition = !1, this.compositionPendingChanges = 0, this.domChangeCount = 0, this.eventHandlers = Object.create(null), this.hideSelectionGuard = null;
|
|
6147
6147
|
}
|
|
6148
|
-
}(), this.prevDirectPlugins = [], this.pluginViews = [], this.requiresGeckoHackNode = !1, this.dragging = null, this._props = t, this.state = t.state, this.directPlugins = t.plugins || [], this.directPlugins.forEach(Ma), this.dispatch = this.dispatch.bind(this), this.dom = e && e.mount || document.createElement("div"), e && (e.appendChild ? e.appendChild(this.dom) : typeof e == "function" ? e(this.dom) : e.mount && (this.mounted = !0)), this.editable = Aa(this), ka(this), this.nodeViews = ja(this), this.docView =
|
|
6148
|
+
}(), this.prevDirectPlugins = [], this.pluginViews = [], this.requiresGeckoHackNode = !1, this.dragging = null, this._props = t, this.state = t.state, this.directPlugins = t.plugins || [], this.directPlugins.forEach(Ma), this.dispatch = this.dispatch.bind(this), this.dom = e && e.mount || document.createElement("div"), e && (e.appendChild ? e.appendChild(this.dom) : typeof e == "function" ? e(this.dom) : e.mount && (this.mounted = !0)), this.editable = Aa(this), ka(this), this.nodeViews = ja(this), this.docView = Tr(this.state.doc, Oa(this), ma(this), this.dom, this), this.domObserver = new class {
|
|
6149
6149
|
constructor(e, t) {
|
|
6150
6150
|
this.view = e, this.handleDOMChange = t, this.queue = [], this.flushingSoon = -1, this.observer = null, this.currentSelection = new class {
|
|
6151
6151
|
constructor() {
|
|
@@ -6162,7 +6162,7 @@ var Da = class {
|
|
|
6162
6162
|
}
|
|
6163
6163
|
}(), this.onCharData = null, this.suppressingSelectionUpdates = !1, this.lastChangedTextNode = null, this.observer = window.MutationObserver && new window.MutationObserver(((t) => {
|
|
6164
6164
|
for (let e = 0; e < t.length; e++) this.queue.push(t[e]);
|
|
6165
|
-
|
|
6165
|
+
Bn && Vn <= 11 && t.some(((e) => e.type == "childList" && e.removedNodes.length || e.type == "characterData" && e.oldValue.length > e.target.nodeValue.length)) ? this.flushSoon() : F && e.composing && t.some(((e) => e.type == "childList" && e.target.nodeName == "TR")) ? (e.input.badSafariComposition = !0, this.flushSoon()) : this.flush();
|
|
6166
6166
|
})), ga && (this.onCharData = (e) => {
|
|
6167
6167
|
this.queue.push({
|
|
6168
6168
|
target: e.target,
|
|
@@ -6203,11 +6203,11 @@ var Da = class {
|
|
|
6203
6203
|
this.suppressingSelectionUpdates = !0, setTimeout((() => this.suppressingSelectionUpdates = !1), 50);
|
|
6204
6204
|
}
|
|
6205
6205
|
onSelectionChange() {
|
|
6206
|
-
if (
|
|
6207
|
-
if (this.suppressingSelectionUpdates) return
|
|
6208
|
-
if (
|
|
6206
|
+
if (Zr(this.view)) {
|
|
6207
|
+
if (this.suppressingSelectionUpdates) return Ur(this.view);
|
|
6208
|
+
if (Bn && Vn <= 11 && !this.view.state.selection.empty) {
|
|
6209
6209
|
let e = this.view.domSelectionRange();
|
|
6210
|
-
if (e.focusNode &&
|
|
6210
|
+
if (e.focusNode && Dn(e.focusNode, e.focusOffset, e.anchorNode, e.anchorOffset)) return this.flushSoon();
|
|
6211
6211
|
}
|
|
6212
6212
|
this.flush();
|
|
6213
6213
|
}
|
|
@@ -6218,8 +6218,8 @@ var Da = class {
|
|
|
6218
6218
|
ignoreSelectionChange(e) {
|
|
6219
6219
|
if (!e.focusNode) return !0;
|
|
6220
6220
|
let t, n = /* @__PURE__ */ new Set();
|
|
6221
|
-
for (let t = e.focusNode; t; t =
|
|
6222
|
-
for (let r = e.anchorNode; r; r =
|
|
6221
|
+
for (let t = e.focusNode; t; t = wn(t)) n.add(t);
|
|
6222
|
+
for (let r = e.anchorNode; r; r = wn(r)) if (n.has(r)) {
|
|
6223
6223
|
t = r;
|
|
6224
6224
|
break;
|
|
6225
6225
|
}
|
|
@@ -6238,13 +6238,13 @@ var Da = class {
|
|
|
6238
6238
|
if (!e.docView || this.flushingSoon > -1) return;
|
|
6239
6239
|
let t = this.pendingRecords();
|
|
6240
6240
|
t.length && (this.queue = []);
|
|
6241
|
-
let n = e.domSelectionRange(), r = !this.suppressingSelectionUpdates && !this.currentSelection.eq(n) &&
|
|
6241
|
+
let n = e.domSelectionRange(), r = !this.suppressingSelectionUpdates && !this.currentSelection.eq(n) && Zr(e) && !this.ignoreSelectionChange(n), i = -1, a = -1, o = !1, s = [];
|
|
6242
6242
|
if (e.editable) for (let e = 0; e < t.length; e++) {
|
|
6243
6243
|
let n = this.registerMutation(t[e], s);
|
|
6244
6244
|
n && (i = i < 0 ? n.from : Math.min(n.from, i), a = a < 0 ? n.to : Math.max(n.to, a), n.typeOver && (o = !0));
|
|
6245
6245
|
}
|
|
6246
6246
|
if (!s.some(((e) => e.nodeName == "BR")) || e.input.lastKeyCode != 8 && e.input.lastKeyCode != 46) {
|
|
6247
|
-
if (
|
|
6247
|
+
if (Hn && s.length) {
|
|
6248
6248
|
let t = s.filter(((e) => e.nodeName == "BR"));
|
|
6249
6249
|
if (t.length == 2) {
|
|
6250
6250
|
let [e, n] = t;
|
|
@@ -6268,13 +6268,13 @@ var Da = class {
|
|
|
6268
6268
|
}
|
|
6269
6269
|
}
|
|
6270
6270
|
let c = null;
|
|
6271
|
-
i < 0 && r && e.input.lastFocus > Date.now() - 200 && Math.max(e.input.lastTouch, e.input.lastClick.time) < Date.now() - 300 &&
|
|
6271
|
+
i < 0 && r && e.input.lastFocus > Date.now() - 200 && Math.max(e.input.lastTouch, e.input.lastClick.time) < Date.now() - 300 && Mn(n) && (c = Vr(e)) && c.eq(A.near(e.state.doc.resolve(0), 1)) ? (e.input.lastFocus = 0, Ur(e), this.currentSelection.set(n), e.scrollToSelection()) : (i > -1 || r) && (i > -1 && (e.docView.markDirty(i, a), function(e) {
|
|
6272
6272
|
if (!_a.has(e) && (_a.set(e, null), [
|
|
6273
6273
|
"normal",
|
|
6274
6274
|
"nowrap",
|
|
6275
6275
|
"pre-line"
|
|
6276
6276
|
].indexOf(getComputedStyle(e.dom).whiteSpace) !== -1)) {
|
|
6277
|
-
if (e.requiresGeckoHackNode =
|
|
6277
|
+
if (e.requiresGeckoHackNode = Hn, va) return;
|
|
6278
6278
|
console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."), va = !0;
|
|
6279
6279
|
}
|
|
6280
6280
|
}(e)), e.input.badSafariComposition && (e.input.badSafariComposition = !1, function(e, t) {
|
|
@@ -6292,7 +6292,7 @@ var Da = class {
|
|
|
6292
6292
|
a.insertBefore(i, a.firstChild), n == i && e.domSelection().collapse(i, r);
|
|
6293
6293
|
} else i.parentNode.removeChild(i);
|
|
6294
6294
|
}
|
|
6295
|
-
}(e, s)), this.handleDOMChange(i, a, o, s), e.docView && e.docView.dirty ? e.updateState(e.state) : this.currentSelection.eq(n) ||
|
|
6295
|
+
}(e, s)), this.handleDOMChange(i, a, o, s), e.docView && e.docView.dirty ? e.updateState(e.state) : this.currentSelection.eq(n) || Ur(e), this.currentSelection.set(n));
|
|
6296
6296
|
}
|
|
6297
6297
|
registerMutation(e, t) {
|
|
6298
6298
|
if (t.indexOf(e.target) > -1) return null;
|
|
@@ -6308,11 +6308,11 @@ var Da = class {
|
|
|
6308
6308
|
to: n.posAfter
|
|
6309
6309
|
};
|
|
6310
6310
|
let r = e.previousSibling, i = e.nextSibling;
|
|
6311
|
-
if (
|
|
6311
|
+
if (Bn && Vn <= 11 && e.addedNodes.length) for (let t = 0; t < e.addedNodes.length; t++) {
|
|
6312
6312
|
let { previousSibling: n, nextSibling: a } = e.addedNodes[t];
|
|
6313
6313
|
(!n || Array.prototype.indexOf.call(e.addedNodes, n) < 0) && (r = n), (!a || Array.prototype.indexOf.call(e.addedNodes, a) < 0) && (i = a);
|
|
6314
6314
|
}
|
|
6315
|
-
let a = r && r.parentNode == e.target ?
|
|
6315
|
+
let a = r && r.parentNode == e.target ? N(r) + 1 : 0, o = n.localPosFromDOM(e.target, a, -1), s = i && i.parentNode == e.target ? N(i) : e.target.childNodes.length;
|
|
6316
6316
|
return {
|
|
6317
6317
|
from: o,
|
|
6318
6318
|
to: n.localPosFromDOM(e.target, s, 1)
|
|
@@ -6328,13 +6328,13 @@ var Da = class {
|
|
|
6328
6328
|
});
|
|
6329
6329
|
}
|
|
6330
6330
|
}(this, ((e, t, n, r) => Ca(this, e, t, n, r))), this.domObserver.start(), function(e) {
|
|
6331
|
-
for (let t in
|
|
6332
|
-
let n =
|
|
6331
|
+
for (let t in I) {
|
|
6332
|
+
let n = I[t];
|
|
6333
6333
|
e.dom.addEventListener(t, e.input.eventHandlers[t] = (t) => {
|
|
6334
6334
|
!ki(e, t) || Oi(e, t) || !e.editable && t.type in wi || n(e, t);
|
|
6335
6335
|
}, Ti[t] ? { passive: !0 } : void 0);
|
|
6336
6336
|
}
|
|
6337
|
-
|
|
6337
|
+
F && e.dom.addEventListener("input", (() => null)), Di(e);
|
|
6338
6338
|
}(this), this.updatePluginViews();
|
|
6339
6339
|
}
|
|
6340
6340
|
get composing() {
|
|
@@ -6397,35 +6397,35 @@ var Da = class {
|
|
|
6397
6397
|
return {
|
|
6398
6398
|
refDOM: t,
|
|
6399
6399
|
refTop: n,
|
|
6400
|
-
stack:
|
|
6400
|
+
stack: tr(e.dom)
|
|
6401
6401
|
};
|
|
6402
6402
|
}(this);
|
|
6403
6403
|
if (i) {
|
|
6404
6404
|
this.domObserver.stop();
|
|
6405
|
-
let t = l && (
|
|
6405
|
+
let t = l && (Bn || P) && !this.composing && !n.selection.empty && !e.selection.empty && function(e, t) {
|
|
6406
6406
|
let n = Math.min(e.$anchor.sharedDepth(e.head), t.$anchor.sharedDepth(t.head));
|
|
6407
6407
|
return e.$anchor.start(n) != t.$anchor.start(n);
|
|
6408
6408
|
}(n.selection, e.selection);
|
|
6409
6409
|
if (l) {
|
|
6410
|
-
let n =
|
|
6411
|
-
this.composing && (this.input.compositionNode = Ui(this)), !r && this.docView.update(e.doc, s, o, this) || (this.docView.updateOuterDeco(s), this.docView.destroy(), this.docView =
|
|
6410
|
+
let n = P ? this.trackWrites = this.domSelectionRange().focusNode : null;
|
|
6411
|
+
this.composing && (this.input.compositionNode = Ui(this)), !r && this.docView.update(e.doc, s, o, this) || (this.docView.updateOuterDeco(s), this.docView.destroy(), this.docView = Tr(e.doc, s, o, this.dom, this)), !n || this.trackWrites && this.dom.contains(this.trackWrites) || (t = !0);
|
|
6412
6412
|
}
|
|
6413
6413
|
t || !(this.input.mouseDown && this.domObserver.currentSelection.eq(this.domSelectionRange()) && function(e) {
|
|
6414
6414
|
let t = e.docView.domFromPos(e.state.selection.anchor, 0), n = e.domSelectionRange();
|
|
6415
|
-
return
|
|
6416
|
-
}(this)) ?
|
|
6415
|
+
return Dn(t.node, t.offset, n.anchorNode, n.anchorOffset);
|
|
6416
|
+
}(this)) ? Ur(this, t) : (Jr(this, e.selection), this.domObserver.setCurSelection()), this.domObserver.start();
|
|
6417
6417
|
}
|
|
6418
6418
|
this.updatePluginViews(n), this.dragging?.node && !n.doc.eq(e.doc) && this.updateDraggedNode(this.dragging, n), c == "reset" ? this.dom.scrollTop = 0 : c == "to selection" ? this.scrollToSelection() : u && function({ refDOM: e, refTop: t, stack: n }) {
|
|
6419
6419
|
let r = e ? e.getBoundingClientRect().top : 0;
|
|
6420
|
-
|
|
6420
|
+
nr(n, r == 0 ? 0 : r - t);
|
|
6421
6421
|
}(u);
|
|
6422
6422
|
}
|
|
6423
6423
|
scrollToSelection() {
|
|
6424
6424
|
let e = this.domSelectionRange().focusNode;
|
|
6425
|
-
if (e && this.dom.contains(e.nodeType == 1 ? e : e.parentNode) && !this.someProp("handleScrollToSelection", ((e) => e(this)))) if (this.state.selection instanceof
|
|
6425
|
+
if (e && this.dom.contains(e.nodeType == 1 ? e : e.parentNode) && !this.someProp("handleScrollToSelection", ((e) => e(this)))) if (this.state.selection instanceof M) {
|
|
6426
6426
|
let t = this.docView.domAfterPos(this.state.selection.from);
|
|
6427
|
-
t.nodeType == 1 &&
|
|
6428
|
-
} else
|
|
6427
|
+
t.nodeType == 1 && er(this, t.getBoundingClientRect(), e);
|
|
6428
|
+
} else er(this, this.coordsAtPos(this.state.selection.head, 1), e);
|
|
6429
6429
|
}
|
|
6430
6430
|
destroyPluginViews() {
|
|
6431
6431
|
let e;
|
|
@@ -6455,7 +6455,7 @@ var Da = class {
|
|
|
6455
6455
|
let e = n.from + (this.state.doc.content.size - t.doc.content.size);
|
|
6456
6456
|
(e > 0 && e < this.state.doc.content.size && this.state.doc.nodeAt(e)) == n.node && (r = e);
|
|
6457
6457
|
}
|
|
6458
|
-
this.dragging = new Ji(e.slice, e.move, r < 0 ? void 0 :
|
|
6458
|
+
this.dragging = new Ji(e.slice, e.move, r < 0 ? void 0 : M.create(this.state.doc, r));
|
|
6459
6459
|
}
|
|
6460
6460
|
someProp(e, t) {
|
|
6461
6461
|
let n, r = this._props && this._props[e];
|
|
@@ -6471,7 +6471,7 @@ var Da = class {
|
|
|
6471
6471
|
}
|
|
6472
6472
|
}
|
|
6473
6473
|
hasFocus() {
|
|
6474
|
-
if (
|
|
6474
|
+
if (Bn) {
|
|
6475
6475
|
let e = this.root.activeElement;
|
|
6476
6476
|
if (e == this.dom) return !0;
|
|
6477
6477
|
if (!e || !this.dom.contains(e)) return !1;
|
|
@@ -6486,12 +6486,12 @@ var Da = class {
|
|
|
6486
6486
|
focus() {
|
|
6487
6487
|
this.domObserver.stop(), this.editable && function(e) {
|
|
6488
6488
|
if (e.setActive) return e.setActive();
|
|
6489
|
-
if (
|
|
6490
|
-
let t =
|
|
6491
|
-
e.focus(
|
|
6492
|
-
return
|
|
6493
|
-
} } : void 0),
|
|
6494
|
-
}(this.dom),
|
|
6489
|
+
if (rr) return e.focus(rr);
|
|
6490
|
+
let t = tr(e);
|
|
6491
|
+
e.focus(rr == null ? { get preventScroll() {
|
|
6492
|
+
return rr = { preventScroll: !0 }, !0;
|
|
6493
|
+
} } : void 0), rr || (rr = !1, nr(t, 0));
|
|
6494
|
+
}(this.dom), Ur(this), this.domObserver.start();
|
|
6495
6495
|
}
|
|
6496
6496
|
get root() {
|
|
6497
6497
|
let e = this._root;
|
|
@@ -6504,10 +6504,10 @@ var Da = class {
|
|
|
6504
6504
|
this._root = null;
|
|
6505
6505
|
}
|
|
6506
6506
|
posAtCoords(e) {
|
|
6507
|
-
return
|
|
6507
|
+
return sr(this, e);
|
|
6508
6508
|
}
|
|
6509
6509
|
coordsAtPos(e, t = 1) {
|
|
6510
|
-
return
|
|
6510
|
+
return dr(this, e, t);
|
|
6511
6511
|
}
|
|
6512
6512
|
domAtPos(e, t = 0) {
|
|
6513
6513
|
return this.docView.domFromPos(e, t);
|
|
@@ -6522,7 +6522,7 @@ var Da = class {
|
|
|
6522
6522
|
return r;
|
|
6523
6523
|
}
|
|
6524
6524
|
endOfTextblock(e, t) {
|
|
6525
|
-
return
|
|
6525
|
+
return yr(this, t || this.state, e);
|
|
6526
6526
|
}
|
|
6527
6527
|
pasteHTML(e, t) {
|
|
6528
6528
|
return Ki(this, "", e, !1, t || new ClipboardEvent("paste"));
|
|
@@ -6531,26 +6531,26 @@ var Da = class {
|
|
|
6531
6531
|
return Ki(this, e, null, !0, t || new ClipboardEvent("paste"));
|
|
6532
6532
|
}
|
|
6533
6533
|
serializeForClipboard(e) {
|
|
6534
|
-
return
|
|
6534
|
+
return fi(this, e);
|
|
6535
6535
|
}
|
|
6536
6536
|
destroy() {
|
|
6537
6537
|
this.docView && (function(e) {
|
|
6538
6538
|
e.domObserver.stop();
|
|
6539
6539
|
for (let t in e.input.eventHandlers) e.dom.removeEventListener(t, e.input.eventHandlers[t]);
|
|
6540
6540
|
clearTimeout(e.input.composingTimeout), clearTimeout(e.input.lastIOSEnterFallbackTimeout);
|
|
6541
|
-
}(this), this.destroyPluginViews(), this.mounted ? (this.docView.update(this.state.doc, [], ma(this), this), this.dom.textContent = "") : this.dom.parentNode && this.dom.parentNode.removeChild(this.dom), this.docView.destroy(), this.docView = null,
|
|
6541
|
+
}(this), this.destroyPluginViews(), this.mounted ? (this.docView.update(this.state.doc, [], ma(this), this), this.dom.textContent = "") : this.dom.parentNode && this.dom.parentNode.removeChild(this.dom), this.docView.destroy(), this.docView = null, Tn = null);
|
|
6542
6542
|
}
|
|
6543
6543
|
get isDestroyed() {
|
|
6544
6544
|
return this.docView == null;
|
|
6545
6545
|
}
|
|
6546
6546
|
dispatchEvent(e) {
|
|
6547
6547
|
return function(e, t) {
|
|
6548
|
-
Oi(e, t) || !
|
|
6548
|
+
Oi(e, t) || !I[t.type] || !e.editable && t.type in wi || I[t.type](e, t);
|
|
6549
6549
|
}(this, e);
|
|
6550
6550
|
}
|
|
6551
6551
|
domSelectionRange() {
|
|
6552
6552
|
let e = this.domSelection();
|
|
6553
|
-
return e ?
|
|
6553
|
+
return e ? F && this.root.nodeType === 11 && function(e) {
|
|
6554
6554
|
let t = e.activeElement;
|
|
6555
6555
|
for (; t && t.shadowRoot;) t = t.shadowRoot.activeElement;
|
|
6556
6556
|
return t;
|
|
@@ -6747,17 +6747,17 @@ var Ga = (e, t, n) => {
|
|
|
6747
6747
|
if (!r) return !1;
|
|
6748
6748
|
let i = Ya(r);
|
|
6749
6749
|
if (!i) {
|
|
6750
|
-
let n = r.blockRange(), i = n &&
|
|
6750
|
+
let n = r.blockRange(), i = n && Nt(n);
|
|
6751
6751
|
return i != null && (t && t(e.tr.lift(n, i).scrollIntoView()), !0);
|
|
6752
6752
|
}
|
|
6753
6753
|
let a = i.nodeBefore;
|
|
6754
6754
|
if (so(e, i, t, -1)) return !0;
|
|
6755
|
-
if (r.parent.content.size == 0 && (qa(a, "end") ||
|
|
6756
|
-
let o =
|
|
6755
|
+
if (r.parent.content.size == 0 && (qa(a, "end") || M.isSelectable(a))) for (let n = r.depth;; n--) {
|
|
6756
|
+
let o = Ht(e.doc, r.before(n), r.after(n), O.empty);
|
|
6757
6757
|
if (o && o.slice.size < o.to - o.from) {
|
|
6758
6758
|
if (t) {
|
|
6759
6759
|
let n = e.tr.step(o);
|
|
6760
|
-
n.setSelection(qa(a, "end") ?
|
|
6760
|
+
n.setSelection(qa(a, "end") ? A.findFrom(n.doc.resolve(n.mapping.map(i.pos, -1)), -1) : M.create(n.doc, i.pos - a.nodeSize)), t(n.scrollIntoView());
|
|
6761
6761
|
}
|
|
6762
6762
|
return !0;
|
|
6763
6763
|
}
|
|
@@ -6780,11 +6780,11 @@ function Ka(e, t, n) {
|
|
|
6780
6780
|
if (!e) return !1;
|
|
6781
6781
|
a = e;
|
|
6782
6782
|
}
|
|
6783
|
-
let s =
|
|
6784
|
-
if (!s || s.from != i || s instanceof
|
|
6783
|
+
let s = Ht(e.doc, i, o, O.empty);
|
|
6784
|
+
if (!s || s.from != i || s instanceof Ot && s.slice.size >= o - i) return !1;
|
|
6785
6785
|
if (n) {
|
|
6786
6786
|
let t = e.tr.step(s);
|
|
6787
|
-
t.setSelection(
|
|
6787
|
+
t.setSelection(j.create(t.doc, i)), n(t.scrollIntoView());
|
|
6788
6788
|
}
|
|
6789
6789
|
return !0;
|
|
6790
6790
|
}
|
|
@@ -6803,7 +6803,7 @@ var Ja = (e, t, n) => {
|
|
|
6803
6803
|
a = Ya(r);
|
|
6804
6804
|
}
|
|
6805
6805
|
let o = a && a.nodeBefore;
|
|
6806
|
-
return !(!o || !
|
|
6806
|
+
return !(!o || !M.isSelectable(o)) && (t && t(e.tr.setSelection(M.create(e.doc, a.pos - o.nodeSize)).scrollIntoView()), !0);
|
|
6807
6807
|
};
|
|
6808
6808
|
function Ya(e) {
|
|
6809
6809
|
if (!e.parent.type.spec.isolating) for (let t = e.depth - 1; t >= 0; t--) {
|
|
@@ -6823,12 +6823,12 @@ var Za = (e, t, n) => {
|
|
|
6823
6823
|
if (!i) return !1;
|
|
6824
6824
|
let a = i.nodeAfter;
|
|
6825
6825
|
if (so(e, i, t, 1)) return !0;
|
|
6826
|
-
if (r.parent.content.size == 0 && (qa(a, "start") ||
|
|
6827
|
-
let n =
|
|
6826
|
+
if (r.parent.content.size == 0 && (qa(a, "start") || M.isSelectable(a))) {
|
|
6827
|
+
let n = Ht(e.doc, r.before(), r.after(), O.empty);
|
|
6828
6828
|
if (n && n.slice.size < n.to - n.from) {
|
|
6829
6829
|
if (t) {
|
|
6830
6830
|
let r = e.tr.step(n);
|
|
6831
|
-
r.setSelection(qa(a, "start") ?
|
|
6831
|
+
r.setSelection(qa(a, "start") ? A.findFrom(r.doc.resolve(r.mapping.map(i.pos)), 1) : M.create(r.doc, r.mapping.map(i.pos))), t(r.scrollIntoView());
|
|
6832
6832
|
}
|
|
6833
6833
|
return !0;
|
|
6834
6834
|
}
|
|
@@ -6842,7 +6842,7 @@ var Za = (e, t, n) => {
|
|
|
6842
6842
|
a = $a(r);
|
|
6843
6843
|
}
|
|
6844
6844
|
let o = a && a.nodeAfter;
|
|
6845
|
-
return !(!o || !
|
|
6845
|
+
return !(!o || !M.isSelectable(o)) && (t && t(e.tr.setSelection(M.create(e.doc, a.pos)).scrollIntoView()), !0);
|
|
6846
6846
|
};
|
|
6847
6847
|
function $a(e) {
|
|
6848
6848
|
if (!e.parent.type.spec.isolating) for (let t = e.depth - 1; t >= 0; t--) {
|
|
@@ -6870,17 +6870,17 @@ var no = (e, t) => {
|
|
|
6870
6870
|
if (!o || !i.canReplaceWith(a, a, o)) return !1;
|
|
6871
6871
|
if (t) {
|
|
6872
6872
|
let r = n.after(), i = e.tr.replaceWith(r, r, o.createAndFill());
|
|
6873
|
-
i.setSelection(
|
|
6873
|
+
i.setSelection(A.near(i.doc.resolve(r), 1)), t(i.scrollIntoView());
|
|
6874
6874
|
}
|
|
6875
6875
|
return !0;
|
|
6876
6876
|
}, ro = (e, t) => {
|
|
6877
6877
|
let n = e.selection, { $from: r, $to: i } = n;
|
|
6878
|
-
if (n instanceof
|
|
6878
|
+
if (n instanceof ln || r.parent.inlineContent || i.parent.inlineContent) return !1;
|
|
6879
6879
|
let a = to(i.parent.contentMatchAt(i.indexAfter()));
|
|
6880
6880
|
if (!a || !a.isTextblock) return !1;
|
|
6881
6881
|
if (t) {
|
|
6882
6882
|
let n = (!r.parentOffset && i.index() < i.parent.childCount ? r : i).pos, o = e.tr.insert(n, a.createAndFill());
|
|
6883
|
-
o.setSelection(
|
|
6883
|
+
o.setSelection(j.create(o.doc, n + 1)), t(o.scrollIntoView());
|
|
6884
6884
|
}
|
|
6885
6885
|
return !0;
|
|
6886
6886
|
}, io = (e, t) => {
|
|
@@ -6888,13 +6888,13 @@ var no = (e, t) => {
|
|
|
6888
6888
|
if (!n || n.parent.content.size) return !1;
|
|
6889
6889
|
if (n.depth > 1 && n.after() != n.end(-1)) {
|
|
6890
6890
|
let r = n.before();
|
|
6891
|
-
if (
|
|
6891
|
+
if (Rt(e.doc, r)) return t && t(e.tr.split(r).scrollIntoView()), !0;
|
|
6892
6892
|
}
|
|
6893
|
-
let r = n.blockRange(), i = r &&
|
|
6893
|
+
let r = n.blockRange(), i = r && Nt(r);
|
|
6894
6894
|
return i != null && (t && t(e.tr.lift(r, i).scrollIntoView()), !0);
|
|
6895
6895
|
}, ao, oo = (e, t) => {
|
|
6896
6896
|
let { $from: n, $to: r } = e.selection;
|
|
6897
|
-
if (e.selection instanceof
|
|
6897
|
+
if (e.selection instanceof M && e.selection.node.isBlock) return !(!n.parentOffset || !Rt(e.doc, n.pos) || (t && t(e.tr.split(n.pos).scrollIntoView()), 0));
|
|
6898
6898
|
if (!n.depth) return !1;
|
|
6899
6899
|
let i, a, o = [], s = !1, c = !1;
|
|
6900
6900
|
for (let e = n.depth;; e--) {
|
|
@@ -6908,9 +6908,9 @@ var no = (e, t) => {
|
|
|
6908
6908
|
o.unshift(null);
|
|
6909
6909
|
}
|
|
6910
6910
|
let l = e.tr;
|
|
6911
|
-
(e.selection instanceof
|
|
6912
|
-
let u = l.mapping.map(n.pos), d =
|
|
6913
|
-
if (d ||= (o[0] = a ? { type: a } : null,
|
|
6911
|
+
(e.selection instanceof j || e.selection instanceof ln) && l.deleteSelection();
|
|
6912
|
+
let u = l.mapping.map(n.pos), d = Rt(l.doc, u, o.length, o);
|
|
6913
|
+
if (d ||= (o[0] = a ? { type: a } : null, Rt(l.doc, u, o.length, o)), !d) return !1;
|
|
6914
6914
|
if (l.split(u, o.length, o), !s && c && n.node(i).type != a) {
|
|
6915
6915
|
let e = l.mapping.map(n.before(i)), t = l.doc.resolve(e);
|
|
6916
6916
|
a && n.node(i - 1).canReplaceWith(t.index(), t.index() + 1, a) && l.setNodeMarkup(l.mapping.map(n.before(i)), a);
|
|
@@ -6921,7 +6921,7 @@ function so(e, t, n, r) {
|
|
|
6921
6921
|
let i, a, o = t.nodeBefore, s = t.nodeAfter, c = o.type.spec.isolating || s.type.spec.isolating;
|
|
6922
6922
|
if (!c && function(e, t, n) {
|
|
6923
6923
|
let r = t.nodeBefore, i = t.nodeAfter, a = t.index();
|
|
6924
|
-
return !(!(r && i && r.type.compatibleContent(i.type)) || (!r.content.size && t.parent.canReplace(a - 1, a) ? (n && n(e.tr.delete(t.pos - r.nodeSize, t.pos).scrollIntoView()), 0) : !t.parent.canReplace(a, a + 1) || !i.isTextblock && !
|
|
6924
|
+
return !(!(r && i && r.type.compatibleContent(i.type)) || (!r.content.size && t.parent.canReplace(a - 1, a) ? (n && n(e.tr.delete(t.pos - r.nodeSize, t.pos).scrollIntoView()), 0) : !t.parent.canReplace(a, a + 1) || !i.isTextblock && !zt(e.doc, t.pos) || (n && n(e.tr.join(t.pos).scrollIntoView()), 0)));
|
|
6925
6925
|
}(e, t, n)) return !0;
|
|
6926
6926
|
let l = !c && t.parent.canReplace(t.index(), t.index() + 1);
|
|
6927
6927
|
if (l && (i = (a = o.contentMatchAt(o.childCount)).findWrapping(s.type)) && a.matchType(i[0] || s.type).validEnd) {
|
|
@@ -6929,12 +6929,12 @@ function so(e, t, n, r) {
|
|
|
6929
6929
|
let r = t.pos + s.nodeSize, a = E.empty;
|
|
6930
6930
|
for (let e = i.length - 1; e >= 0; e--) a = E.from(i[e].create(null, a));
|
|
6931
6931
|
a = E.from(o.copy(a));
|
|
6932
|
-
let c = e.tr.step(new
|
|
6933
|
-
l.nodeAfter && l.nodeAfter.type == o.type &&
|
|
6932
|
+
let c = e.tr.step(new kt(t.pos - 1, r, t.pos, r, new O(a, 1, 0), i.length, !0)), l = c.doc.resolve(r + 2 * i.length);
|
|
6933
|
+
l.nodeAfter && l.nodeAfter.type == o.type && zt(c.doc, l.pos) && c.join(l.pos), n(c.scrollIntoView());
|
|
6934
6934
|
}
|
|
6935
6935
|
return !0;
|
|
6936
6936
|
}
|
|
6937
|
-
let u = s.type.spec.isolating || r > 0 && c ? null :
|
|
6937
|
+
let u = s.type.spec.isolating || r > 0 && c ? null : A.findFrom(t, 1), d = u && u.$from.blockRange(u.$to), f = d && Nt(d);
|
|
6938
6938
|
if (f != null && f >= t.depth) return n && n(e.tr.lift(d, f).scrollIntoView()), !0;
|
|
6939
6939
|
if (l && qa(s, "start", !0) && qa(o, "end")) {
|
|
6940
6940
|
let r = o, i = [];
|
|
@@ -6945,7 +6945,7 @@ function so(e, t, n, r) {
|
|
|
6945
6945
|
if (n) {
|
|
6946
6946
|
let r = E.empty;
|
|
6947
6947
|
for (let e = i.length - 1; e >= 0; e--) r = E.from(i[e].copy(r));
|
|
6948
|
-
n(e.tr.step(new
|
|
6948
|
+
n(e.tr.step(new kt(t.pos - i.length, t.pos + s.nodeSize, t.pos + c, t.pos + s.nodeSize - c, new O(r, i.length, 0), 0, !0)).scrollIntoView());
|
|
6949
6949
|
}
|
|
6950
6950
|
return !0;
|
|
6951
6951
|
}
|
|
@@ -6959,7 +6959,7 @@ function co(e) {
|
|
|
6959
6959
|
if (!a) return !1;
|
|
6960
6960
|
a--;
|
|
6961
6961
|
}
|
|
6962
|
-
return !!i.node(a).isTextblock && (n && n(t.tr.setSelection(
|
|
6962
|
+
return !!i.node(a).isTextblock && (n && n(t.tr.setSelection(j.create(t.doc, e < 0 ? i.start(a) : i.end(a)))), !0);
|
|
6963
6963
|
};
|
|
6964
6964
|
}
|
|
6965
6965
|
var lo = co(-1), uo = co(1);
|
|
@@ -7003,7 +7003,7 @@ var mo = po(Ua, Ga, Ja), ho = po(Ua, Za, Qa), go = {
|
|
|
7003
7003
|
"Shift-Backspace": mo,
|
|
7004
7004
|
Delete: ho,
|
|
7005
7005
|
"Mod-Delete": ho,
|
|
7006
|
-
"Mod-a": (e, t) => (t && t(e.tr.setSelection(new
|
|
7006
|
+
"Mod-a": (e, t) => (t && t(e.tr.setSelection(new ln(e.doc))), !0)
|
|
7007
7007
|
}, _o = {
|
|
7008
7008
|
"Ctrl-h": go.Backspace,
|
|
7009
7009
|
"Alt-Backspace": go["Mod-Backspace"],
|
|
@@ -7028,15 +7028,15 @@ function vo(e, t = null) {
|
|
|
7028
7028
|
let e = o.resolve(t.start - 2);
|
|
7029
7029
|
a = new je(e, e, t.depth), t.endIndex < t.parent.childCount && (t = new je(t.$from, o.resolve(t.$to.end(t.depth)), t.depth)), i = !0;
|
|
7030
7030
|
}
|
|
7031
|
-
let s =
|
|
7031
|
+
let s = Pt(a, n, r, t);
|
|
7032
7032
|
return s ? (e && function(e, t, n, r, i) {
|
|
7033
7033
|
let a = E.empty;
|
|
7034
7034
|
for (let e = n.length - 1; e >= 0; e--) a = E.from(n[e].type.create(n[e].attrs, a));
|
|
7035
|
-
e.step(new
|
|
7035
|
+
e.step(new kt(t.start - (r ? 2 : 0), t.end, t.start, t.end, new O(a, 0, 0), n.length, !0));
|
|
7036
7036
|
let o = 0;
|
|
7037
7037
|
for (let e = 0; e < n.length; e++) n[e].type == i && (o = e + 1);
|
|
7038
7038
|
let s = n.length - o, c = t.start + n.length - (r ? 2 : 0), l = t.parent;
|
|
7039
|
-
for (let n = t.startIndex, r = t.endIndex, i = !0; n < r; n++, i = !1) !i &&
|
|
7039
|
+
for (let n = t.startIndex, r = t.endIndex, i = !0; n < r; n++, i = !1) !i && Rt(e.doc, c, s) && (e.split(c, s), c += 2 * s), c += l.child(n).nodeSize;
|
|
7040
7040
|
}(e, t, s, i, n), !0) : !1;
|
|
7041
7041
|
}(s, o, e, t) && (r && r(s.scrollIntoView()), !0);
|
|
7042
7042
|
};
|
|
@@ -7046,12 +7046,12 @@ function yo(e) {
|
|
|
7046
7046
|
let { $from: r, $to: i } = t.selection, a = r.blockRange(i, ((t) => t.childCount > 0 && t.firstChild.type == e));
|
|
7047
7047
|
return !!a && (!n || (r.node(a.depth - 1).type == e ? function(e, t, n, r) {
|
|
7048
7048
|
let i = e.tr, a = r.end, o = r.$to.end(r.depth);
|
|
7049
|
-
a < o && (i.step(new
|
|
7050
|
-
let s =
|
|
7049
|
+
a < o && (i.step(new kt(a - 1, o, a, o, new O(E.from(n.create(null, r.parent.copy())), 1, 0), 1, !0)), r = new je(i.doc.resolve(r.$from.pos), i.doc.resolve(o), r.depth));
|
|
7050
|
+
let s = Nt(r);
|
|
7051
7051
|
if (s == null) return !1;
|
|
7052
7052
|
i.lift(r, s);
|
|
7053
7053
|
let c = i.doc.resolve(i.mapping.map(a, -1) - 1);
|
|
7054
|
-
return
|
|
7054
|
+
return zt(i.doc, c.pos) && c.nodeBefore.type == c.nodeAfter.type && i.join(c.pos), t(i.scrollIntoView()), !0;
|
|
7055
7055
|
}(t, n, e, a) : function(e, t, n) {
|
|
7056
7056
|
let r = e.tr, i = n.parent;
|
|
7057
7057
|
for (let e = n.end, t = n.endIndex - 1, a = n.startIndex; t > a; t--) e -= i.child(t).nodeSize, r.delete(e - 1, e + 1);
|
|
@@ -7060,7 +7060,7 @@ function yo(e) {
|
|
|
7060
7060
|
let s = n.startIndex == 0, c = n.endIndex == i.childCount, l = a.node(-1), u = a.index(-1);
|
|
7061
7061
|
if (!l.canReplace(u + +!s, u + 1, o.content.append(c ? E.empty : E.from(i)))) return !1;
|
|
7062
7062
|
let d = a.pos, f = d + o.nodeSize;
|
|
7063
|
-
return r.step(new
|
|
7063
|
+
return r.step(new kt(d - +!!s, f + +!!c, d + 1, f - 1, new O((s ? E.empty : E.from(i.copy(E.empty))).append(c ? E.empty : E.from(i.copy(E.empty))), +!s, +!c), +!s)), t(r.scrollIntoView()), !0;
|
|
7064
7064
|
}(t, n, a)));
|
|
7065
7065
|
};
|
|
7066
7066
|
}
|
|
@@ -7375,7 +7375,7 @@ function Lo(e) {
|
|
|
7375
7375
|
})), l;
|
|
7376
7376
|
}
|
|
7377
7377
|
function Ro(e) {
|
|
7378
|
-
let { editor: t, rules: n } = e, r = new
|
|
7378
|
+
let { editor: t, rules: n } = e, r = new bn({
|
|
7379
7379
|
state: {
|
|
7380
7380
|
init: () => null,
|
|
7381
7381
|
apply(e, i, a) {
|
|
@@ -7548,7 +7548,7 @@ function Wo(e) {
|
|
|
7548
7548
|
return s = typeof ClipboardEvent < "u" ? new ClipboardEvent("paste") : null, c;
|
|
7549
7549
|
}
|
|
7550
7550
|
};
|
|
7551
|
-
return n.map(((e) => new
|
|
7551
|
+
return n.map(((e) => new bn({
|
|
7552
7552
|
view(e) {
|
|
7553
7553
|
let n = (n) => {
|
|
7554
7554
|
i = e.dom.parentElement?.contains(n.target) ? e.dom.parentElement : null, i && (Uo = t);
|
|
@@ -7739,7 +7739,7 @@ var Go = class e {
|
|
|
7739
7739
|
...e
|
|
7740
7740
|
};
|
|
7741
7741
|
}
|
|
7742
|
-
let c = new
|
|
7742
|
+
let c = new bn({ props: { handleKeyDown: Ha(s) } });
|
|
7743
7743
|
a.push(c);
|
|
7744
7744
|
let l = z(e, "addInputRules", n);
|
|
7745
7745
|
jo(e, t.options.enableInputRules) && l && r.push(...l());
|
|
@@ -7864,8 +7864,8 @@ var Yo = Ko.create({
|
|
|
7864
7864
|
name: "clipboardTextSerializer",
|
|
7865
7865
|
addOptions: () => ({ blockSeparator: void 0 }),
|
|
7866
7866
|
addProseMirrorPlugins() {
|
|
7867
|
-
return [new
|
|
7868
|
-
key: new
|
|
7867
|
+
return [new bn({
|
|
7868
|
+
key: new Cn("clipboardTextSerializer"),
|
|
7869
7869
|
props: { clipboardTextSerializer: () => {
|
|
7870
7870
|
let { editor: e } = this, { state: t, schema: n } = e, { doc: r, selection: i } = t, { ranges: a } = i, o = Math.min(...a.map(((e) => e.$from.pos))), s = Math.max(...a.map(((e) => e.$to.pos))), c = Jo(n);
|
|
7871
7871
|
return qo(r, {
|
|
@@ -7909,18 +7909,18 @@ function es(e, t) {
|
|
|
7909
7909
|
return e;
|
|
7910
7910
|
}
|
|
7911
7911
|
function ts(e) {
|
|
7912
|
-
return e instanceof
|
|
7912
|
+
return e instanceof j;
|
|
7913
7913
|
}
|
|
7914
7914
|
function ns(e = 0, t = 0, n = 0) {
|
|
7915
7915
|
return Math.min(Math.max(e, t), n);
|
|
7916
7916
|
}
|
|
7917
7917
|
function rs(e, t = null) {
|
|
7918
7918
|
if (!t) return null;
|
|
7919
|
-
let n =
|
|
7919
|
+
let n = A.atStart(e), r = A.atEnd(e);
|
|
7920
7920
|
if (t === "start" || !0 === t) return n;
|
|
7921
7921
|
if (t === "end") return r;
|
|
7922
7922
|
let i = n.from, a = r.to;
|
|
7923
|
-
return t === "all" ?
|
|
7923
|
+
return t === "all" ? j.create(e, ns(0, i, a), ns(e.content.size, i, a)) : j.create(e, ns(t, i, a), ns(t, i, a));
|
|
7924
7924
|
}
|
|
7925
7925
|
function is() {
|
|
7926
7926
|
return [
|
|
@@ -8137,14 +8137,14 @@ var ws = (e, t) => {
|
|
|
8137
8137
|
let r = e.doc.resolve(Math.max(0, n.pos - 1)).before(n.depth);
|
|
8138
8138
|
if (r === void 0) return !0;
|
|
8139
8139
|
let i = e.doc.nodeAt(r);
|
|
8140
|
-
return n.node.type !== i?.type || !
|
|
8140
|
+
return n.node.type !== i?.type || !zt(e.doc, n.pos) || (e.join(n.pos), !0);
|
|
8141
8141
|
}, Ts = (e, t) => {
|
|
8142
8142
|
let n = hs(((e) => e.type === t))(e.selection);
|
|
8143
8143
|
if (!n) return !0;
|
|
8144
8144
|
let r = e.doc.resolve(n.start).after(n.depth);
|
|
8145
8145
|
if (r === void 0) return !0;
|
|
8146
8146
|
let i = e.doc.nodeAt(r);
|
|
8147
|
-
return n.node.type !== i?.type || !
|
|
8147
|
+
return n.node.type !== i?.type || !zt(e.doc, r) || (e.join(r), !0);
|
|
8148
8148
|
}, Es = Object.freeze({
|
|
8149
8149
|
__proto__: null,
|
|
8150
8150
|
blur: () => ({ editor: e, view: t }) => (requestAnimationFrame((() => {
|
|
@@ -8159,7 +8159,7 @@ var ws = (e, t) => {
|
|
|
8159
8159
|
if (e.type.isText) return;
|
|
8160
8160
|
let { doc: r, mapping: i } = t, a = r.resolve(i.map(n)), o = r.resolve(i.map(n + e.nodeSize)), s = a.blockRange(o);
|
|
8161
8161
|
if (!s) return;
|
|
8162
|
-
let c =
|
|
8162
|
+
let c = Nt(s);
|
|
8163
8163
|
if (e.type.isTextblock) {
|
|
8164
8164
|
let { defaultType: e } = a.parent.contentMatchAt(a.index());
|
|
8165
8165
|
t.setNodeMarkup(s.start, e);
|
|
@@ -8174,7 +8174,7 @@ var ws = (e, t) => {
|
|
|
8174
8174
|
let { state: i } = n, a = i.doc.slice(e.from, e.to);
|
|
8175
8175
|
r.deleteRange(e.from, e.to);
|
|
8176
8176
|
let o = r.mapping.map(t);
|
|
8177
|
-
return r.insert(o, a.content), r.setSelection(new
|
|
8177
|
+
return r.insert(o, a.content), r.setSelection(new j(r.doc.resolve(o - 1))), !0;
|
|
8178
8178
|
},
|
|
8179
8179
|
deleteCurrentNode: () => ({ tr: e, dispatch: t }) => {
|
|
8180
8180
|
let { selection: n } = e, r = n.$anchor.node();
|
|
@@ -8212,7 +8212,7 @@ var ws = (e, t) => {
|
|
|
8212
8212
|
if (i) {
|
|
8213
8213
|
let e = $o(c, a, t);
|
|
8214
8214
|
if (e && e.from <= l && e.to >= u) {
|
|
8215
|
-
let t =
|
|
8215
|
+
let t = j.create(o, e.from, e.to);
|
|
8216
8216
|
n.setSelection(t);
|
|
8217
8217
|
}
|
|
8218
8218
|
}
|
|
@@ -8301,11 +8301,11 @@ var ws = (e, t) => {
|
|
|
8301
8301
|
let r = e.steps.length - 1;
|
|
8302
8302
|
if (r < t) return;
|
|
8303
8303
|
let i = e.steps[r];
|
|
8304
|
-
if (!(i instanceof
|
|
8304
|
+
if (!(i instanceof Ot || i instanceof kt)) return;
|
|
8305
8305
|
let a = e.mapping.maps[r], o = 0;
|
|
8306
8306
|
a.forEach(((e, t, n, r) => {
|
|
8307
8307
|
o === 0 && (o = r);
|
|
8308
|
-
})), e.setSelection(
|
|
8308
|
+
})), e.setSelection(A.near(e.doc.resolve(o), n));
|
|
8309
8309
|
}(r, r.steps.length - 1, -1), n.applyInputRules && r.setMeta("applyInputRules", {
|
|
8310
8310
|
from: c,
|
|
8311
8311
|
text: s
|
|
@@ -8319,16 +8319,16 @@ var ws = (e, t) => {
|
|
|
8319
8319
|
joinBackward: () => ({ state: e, dispatch: t }) => Ga(e, t),
|
|
8320
8320
|
joinDown: () => ({ state: e, dispatch: t }) => ((e, t) => {
|
|
8321
8321
|
let n, r = e.selection;
|
|
8322
|
-
if (r instanceof
|
|
8323
|
-
if (r.node.isTextblock || !
|
|
8322
|
+
if (r instanceof M) {
|
|
8323
|
+
if (r.node.isTextblock || !zt(e.doc, r.to)) return !1;
|
|
8324
8324
|
n = r.to;
|
|
8325
|
-
} else if (n =
|
|
8325
|
+
} else if (n = Vt(e.doc, r.to, 1), n == null) return !1;
|
|
8326
8326
|
return t && t(e.tr.join(n).scrollIntoView()), !0;
|
|
8327
8327
|
})(e, t),
|
|
8328
8328
|
joinForward: () => ({ state: e, dispatch: t }) => Za(e, t),
|
|
8329
8329
|
joinItemBackward: () => ({ state: e, dispatch: t, tr: n }) => {
|
|
8330
8330
|
try {
|
|
8331
|
-
let r =
|
|
8331
|
+
let r = Vt(e.doc, e.selection.$from.pos, -1);
|
|
8332
8332
|
return r != null && (n.join(r, 2), t && t(n), !0);
|
|
8333
8333
|
} catch {
|
|
8334
8334
|
return !1;
|
|
@@ -8336,7 +8336,7 @@ var ws = (e, t) => {
|
|
|
8336
8336
|
},
|
|
8337
8337
|
joinItemForward: () => ({ state: e, dispatch: t, tr: n }) => {
|
|
8338
8338
|
try {
|
|
8339
|
-
let r =
|
|
8339
|
+
let r = Vt(e.doc, e.selection.$from.pos, 1);
|
|
8340
8340
|
return r != null && (n.join(r, 2), t && t(n), !0);
|
|
8341
8341
|
} catch {
|
|
8342
8342
|
return !1;
|
|
@@ -8355,14 +8355,14 @@ var ws = (e, t) => {
|
|
|
8355
8355
|
return !!i && Ka(e, i, t);
|
|
8356
8356
|
})(e, t),
|
|
8357
8357
|
joinUp: () => ({ state: e, dispatch: t }) => ((e, t) => {
|
|
8358
|
-
let n, r = e.selection, i = r instanceof
|
|
8358
|
+
let n, r = e.selection, i = r instanceof M;
|
|
8359
8359
|
if (i) {
|
|
8360
|
-
if (r.node.isTextblock || !
|
|
8360
|
+
if (r.node.isTextblock || !zt(e.doc, r.from)) return !1;
|
|
8361
8361
|
n = r.from;
|
|
8362
|
-
} else if (n =
|
|
8362
|
+
} else if (n = Vt(e.doc, r.from, -1), n == null) return !1;
|
|
8363
8363
|
if (t) {
|
|
8364
8364
|
let r = e.tr.join(n);
|
|
8365
|
-
i && r.setSelection(
|
|
8365
|
+
i && r.setSelection(M.create(r.doc, n - e.doc.resolve(n).nodeBefore.nodeSize)), t(r.scrollIntoView());
|
|
8366
8366
|
}
|
|
8367
8367
|
return !0;
|
|
8368
8368
|
})(e, t),
|
|
@@ -8404,7 +8404,7 @@ var ws = (e, t) => {
|
|
|
8404
8404
|
})), !0;
|
|
8405
8405
|
},
|
|
8406
8406
|
lift: (e, t = {}) => ({ state: n, dispatch: r }) => !!us(n, B(e, n.schema), t) && ((e, t) => {
|
|
8407
|
-
let { $from: n, $to: r } = e.selection, i = n.blockRange(r), a = i &&
|
|
8407
|
+
let { $from: n, $to: r } = e.selection, i = n.blockRange(r), a = i && Nt(i);
|
|
8408
8408
|
return a != null && (t && t(e.tr.lift(i, a).scrollIntoView()), !0);
|
|
8409
8409
|
})(n, r),
|
|
8410
8410
|
liftEmptyBlock: () => ({ state: e, dispatch: t }) => io(e, t),
|
|
@@ -8423,7 +8423,7 @@ var ws = (e, t) => {
|
|
|
8423
8423
|
scrollIntoView: () => ({ tr: e, dispatch: t }) => (t && e.scrollIntoView(), !0),
|
|
8424
8424
|
selectAll: () => ({ tr: e, dispatch: t }) => {
|
|
8425
8425
|
if (t) {
|
|
8426
|
-
let t = new
|
|
8426
|
+
let t = new ln(e.doc);
|
|
8427
8427
|
e.setSelection(t);
|
|
8428
8428
|
}
|
|
8429
8429
|
return !0;
|
|
@@ -8432,7 +8432,7 @@ var ws = (e, t) => {
|
|
|
8432
8432
|
selectNodeForward: () => ({ state: e, dispatch: t }) => Qa(e, t),
|
|
8433
8433
|
selectParentNode: () => ({ state: e, dispatch: t }) => ((e, t) => {
|
|
8434
8434
|
let n, { $from: r, to: i } = e.selection, a = r.sharedDepth(i);
|
|
8435
|
-
return a != 0 && (n = r.before(a), t && t(e.tr.setSelection(
|
|
8435
|
+
return a != 0 && (n = r.before(a), t && t(e.tr.setSelection(M.create(e.doc, n))), !0);
|
|
8436
8436
|
})(e, t),
|
|
8437
8437
|
selectTextblockEnd: () => ({ state: e, dispatch: t }) => uo(e, t),
|
|
8438
8438
|
selectTextblockStart: () => ({ state: e, dispatch: t }) => lo(e, t),
|
|
@@ -8503,7 +8503,7 @@ var ws = (e, t) => {
|
|
|
8503
8503
|
},
|
|
8504
8504
|
setNodeSelection: (e) => ({ tr: t, dispatch: n }) => {
|
|
8505
8505
|
if (n) {
|
|
8506
|
-
let { doc: n } = t, r = ns(e, 0, n.content.size), i =
|
|
8506
|
+
let { doc: n } = t, r = ns(e, 0, n.content.size), i = M.create(n, r);
|
|
8507
8507
|
t.setSelection(i);
|
|
8508
8508
|
}
|
|
8509
8509
|
return !0;
|
|
@@ -8513,7 +8513,7 @@ var ws = (e, t) => {
|
|
|
8513
8513
|
let { doc: n } = t, { from: r, to: i } = typeof e == "number" ? {
|
|
8514
8514
|
from: e,
|
|
8515
8515
|
to: e
|
|
8516
|
-
} : e, a =
|
|
8516
|
+
} : e, a = j.atStart(n).from, o = j.atEnd(n).to, s = ns(r, a, o), c = ns(i, a, o), l = j.create(n, s, c);
|
|
8517
8517
|
t.setSelection(l);
|
|
8518
8518
|
}
|
|
8519
8519
|
return !0;
|
|
@@ -8528,7 +8528,7 @@ var ws = (e, t) => {
|
|
|
8528
8528
|
if (c.type != r) return !1;
|
|
8529
8529
|
if (t) {
|
|
8530
8530
|
let n = c.lastChild && c.lastChild.type == s.type, i = E.from(n ? r.create() : null), o = new O(E.from(r.create(null, E.from(s.type.create(null, i)))), n ? 3 : 1, 0), l = a.start, u = a.end;
|
|
8531
|
-
t(e.tr.step(new
|
|
8531
|
+
t(e.tr.step(new kt(l - (n ? 3 : 1), u, l, u, o, 1, !0)).scrollIntoView());
|
|
8532
8532
|
}
|
|
8533
8533
|
return !0;
|
|
8534
8534
|
})(t, n);
|
|
@@ -8536,7 +8536,7 @@ var ws = (e, t) => {
|
|
|
8536
8536
|
},
|
|
8537
8537
|
splitBlock: ({ keepMarks: e = !0 } = {}) => ({ tr: t, state: n, dispatch: r, editor: i }) => {
|
|
8538
8538
|
let { selection: a, doc: o } = t, { $from: s, $to: c } = a, l = ys(i.extensionManager.attributes, s.node().type.name, s.node().attrs);
|
|
8539
|
-
if (a instanceof
|
|
8539
|
+
if (a instanceof M && a.node.isBlock) return !(!s.parentOffset || !Rt(o, s.pos)) && (r && (e && Cs(n, i.extensionManager.splittableMarks), t.split(s.pos).scrollIntoView()), !0);
|
|
8540
8540
|
if (!s.parent.isBlock) return !1;
|
|
8541
8541
|
let u = c.parentOffset === c.parent.content.size, d = s.depth === 0 ? void 0 : function(e) {
|
|
8542
8542
|
for (let t = 0; t < e.edgeCount; t += 1) {
|
|
@@ -8547,12 +8547,12 @@ var ws = (e, t) => {
|
|
|
8547
8547
|
}(s.node(-1).contentMatchAt(s.indexAfter(-1))), f = u && d ? [{
|
|
8548
8548
|
type: d,
|
|
8549
8549
|
attrs: l
|
|
8550
|
-
}] : void 0, p =
|
|
8551
|
-
if (f || p || !
|
|
8550
|
+
}] : void 0, p = Rt(t.doc, t.mapping.map(s.pos), 1, f);
|
|
8551
|
+
if (f || p || !Rt(t.doc, t.mapping.map(s.pos), 1, d ? [{ type: d }] : void 0) || (p = !0, f = d ? [{
|
|
8552
8552
|
type: d,
|
|
8553
8553
|
attrs: l
|
|
8554
8554
|
}] : void 0), r) {
|
|
8555
|
-
if (p && (a instanceof
|
|
8555
|
+
if (p && (a instanceof j && t.deleteSelection(), t.split(t.mapping.map(s.pos), 1, f), d && !u && !s.parentOffset && s.parent.type !== d)) {
|
|
8556
8556
|
let e = t.mapping.map(s.before()), n = t.doc.resolve(e);
|
|
8557
8557
|
s.node(-1).canReplaceWith(n.index(), n.index() + 1, d) && t.setNodeMarkup(t.mapping.map(s.before()), d);
|
|
8558
8558
|
}
|
|
@@ -8582,7 +8582,7 @@ var ws = (e, t) => {
|
|
|
8582
8582
|
n.doc.nodesBetween(l, n.doc.content.size, ((e, t) => {
|
|
8583
8583
|
if (u > -1) return !1;
|
|
8584
8584
|
e.isTextblock && e.content.size === 0 && (u = t + 1);
|
|
8585
|
-
})), u > -1 && n.setSelection(
|
|
8585
|
+
})), u > -1 && n.setSelection(j.near(n.doc.resolve(u))), n.scrollIntoView();
|
|
8586
8586
|
}
|
|
8587
8587
|
return !0;
|
|
8588
8588
|
}
|
|
@@ -8604,7 +8604,7 @@ var ws = (e, t) => {
|
|
|
8604
8604
|
type: o,
|
|
8605
8605
|
attrs: p
|
|
8606
8606
|
}];
|
|
8607
|
-
if (!
|
|
8607
|
+
if (!Rt(n.doc, s.pos, 2)) return !1;
|
|
8608
8608
|
if (i) {
|
|
8609
8609
|
let { selection: e, storedMarks: t } = r, { splittableMarks: o } = a.extensionManager, c = t || e.$to.parentOffset && e.$from.marks();
|
|
8610
8610
|
if (n.split(s.pos, 2, h).scrollIntoView(), !c || !i) return !0;
|
|
@@ -8708,7 +8708,7 @@ var ws = (e, t) => {
|
|
|
8708
8708
|
},
|
|
8709
8709
|
wrapIn: (e, t = {}) => ({ state: n, dispatch: r }) => function(e, t = null) {
|
|
8710
8710
|
return function(n, r) {
|
|
8711
|
-
let { $from: i, $to: a } = n.selection, o = i.blockRange(a), s = o &&
|
|
8711
|
+
let { $from: i, $to: a } = n.selection, o = i.blockRange(a), s = o && Pt(o, e, t);
|
|
8712
8712
|
return !!s && (r && r(n.tr.wrap(o, s).scrollIntoView()), !0);
|
|
8713
8713
|
};
|
|
8714
8714
|
}(B(e, n.schema), t)(n, r),
|
|
@@ -8719,8 +8719,8 @@ var ws = (e, t) => {
|
|
|
8719
8719
|
}), Os = Ko.create({
|
|
8720
8720
|
name: "drop",
|
|
8721
8721
|
addProseMirrorPlugins() {
|
|
8722
|
-
return [new
|
|
8723
|
-
key: new
|
|
8722
|
+
return [new bn({
|
|
8723
|
+
key: new Cn("tiptapDrop"),
|
|
8724
8724
|
props: { handleDrop: (e, t, n, r) => {
|
|
8725
8725
|
this.editor.emit("drop", {
|
|
8726
8726
|
editor: this.editor,
|
|
@@ -8734,16 +8734,16 @@ var ws = (e, t) => {
|
|
|
8734
8734
|
}), ks = Ko.create({
|
|
8735
8735
|
name: "editable",
|
|
8736
8736
|
addProseMirrorPlugins() {
|
|
8737
|
-
return [new
|
|
8738
|
-
key: new
|
|
8737
|
+
return [new bn({
|
|
8738
|
+
key: new Cn("editable"),
|
|
8739
8739
|
props: { editable: () => this.editor.options.editable }
|
|
8740
8740
|
})];
|
|
8741
8741
|
}
|
|
8742
|
-
}), As = new
|
|
8742
|
+
}), As = new Cn("focusEvents"), js = Ko.create({
|
|
8743
8743
|
name: "focusEvents",
|
|
8744
8744
|
addProseMirrorPlugins() {
|
|
8745
8745
|
let { editor: e } = this;
|
|
8746
|
-
return [new
|
|
8746
|
+
return [new bn({
|
|
8747
8747
|
key: As,
|
|
8748
8748
|
props: { handleDOMEvents: {
|
|
8749
8749
|
focus: (t, n) => {
|
|
@@ -8765,7 +8765,7 @@ var ws = (e, t) => {
|
|
|
8765
8765
|
let e = () => this.editor.commands.first((({ commands: e }) => [
|
|
8766
8766
|
() => e.undoInputRule(),
|
|
8767
8767
|
() => e.command((({ tr: t }) => {
|
|
8768
|
-
let { selection: n, doc: r } = t, { empty: i, $anchor: a } = n, { pos: o, parent: s } = a, c = a.parent.isTextblock && o > 0 ? t.doc.resolve(o - 1) : a, l = c.parent.type.spec.isolating, u = a.pos - a.parentOffset, d = l && c.parent.childCount === 1 ? u === a.pos :
|
|
8768
|
+
let { selection: n, doc: r } = t, { empty: i, $anchor: a } = n, { pos: o, parent: s } = a, c = a.parent.isTextblock && o > 0 ? t.doc.resolve(o - 1) : a, l = c.parent.type.spec.isolating, u = a.pos - a.parentOffset, d = l && c.parent.childCount === 1 ? u === a.pos : A.atStart(r).from === o;
|
|
8769
8769
|
return !(!i || !s.type.isTextblock || s.textContent.length || !d || d && a.parent.type.name === "paragraph") && e.clearNodes();
|
|
8770
8770
|
})),
|
|
8771
8771
|
() => e.deleteSelection(),
|
|
@@ -8804,13 +8804,13 @@ var ws = (e, t) => {
|
|
|
8804
8804
|
return is() || ls() ? i : r;
|
|
8805
8805
|
},
|
|
8806
8806
|
addProseMirrorPlugins() {
|
|
8807
|
-
return [new
|
|
8808
|
-
key: new
|
|
8807
|
+
return [new bn({
|
|
8808
|
+
key: new Cn("clearDocument"),
|
|
8809
8809
|
appendTransaction: (e, t, n) => {
|
|
8810
8810
|
if (e.some(((e) => e.getMeta("composition")))) return;
|
|
8811
8811
|
let r = e.some(((e) => e.docChanged)) && !t.doc.eq(n.doc), i = e.some(((e) => e.getMeta("preventClearDocument")));
|
|
8812
8812
|
if (!r || i) return;
|
|
8813
|
-
let { empty: a, from: o, to: s } = t.selection, c =
|
|
8813
|
+
let { empty: a, from: o, to: s } = t.selection, c = A.atStart(t.doc).from, l = A.atEnd(t.doc).to;
|
|
8814
8814
|
if (a || o !== c || s !== l || !Ss(n.doc)) return;
|
|
8815
8815
|
let u = n.tr, d = bo({
|
|
8816
8816
|
state: n,
|
|
@@ -8826,8 +8826,8 @@ var ws = (e, t) => {
|
|
|
8826
8826
|
}), Ns = Ko.create({
|
|
8827
8827
|
name: "paste",
|
|
8828
8828
|
addProseMirrorPlugins() {
|
|
8829
|
-
return [new
|
|
8830
|
-
key: new
|
|
8829
|
+
return [new bn({
|
|
8830
|
+
key: new Cn("tiptapPaste"),
|
|
8831
8831
|
props: { handlePaste: (e, t, n) => {
|
|
8832
8832
|
this.editor.emit("paste", {
|
|
8833
8833
|
editor: this.editor,
|
|
@@ -8840,8 +8840,8 @@ var ws = (e, t) => {
|
|
|
8840
8840
|
}), Ps = Ko.create({
|
|
8841
8841
|
name: "tabindex",
|
|
8842
8842
|
addProseMirrorPlugins() {
|
|
8843
|
-
return [new
|
|
8844
|
-
key: new
|
|
8843
|
+
return [new bn({
|
|
8844
|
+
key: new Cn("tabindex"),
|
|
8845
8845
|
props: { attributes: () => this.editor.isEditable ? { tabindex: "0" } : {} }
|
|
8846
8846
|
})];
|
|
8847
8847
|
}
|
|
@@ -8976,7 +8976,7 @@ var ws = (e, t) => {
|
|
|
8976
8976
|
...this.options.editorProps?.attributes
|
|
8977
8977
|
},
|
|
8978
8978
|
dispatchTransaction: this.dispatchTransaction.bind(this),
|
|
8979
|
-
state:
|
|
8979
|
+
state: vn.create({
|
|
8980
8980
|
doc: e,
|
|
8981
8981
|
selection: t || void 0
|
|
8982
8982
|
})
|
|
@@ -9221,7 +9221,7 @@ function Ls(e) {
|
|
|
9221
9221
|
return new Fo({
|
|
9222
9222
|
find: e.find,
|
|
9223
9223
|
handler: ({ state: t, range: n, match: r, chain: i }) => {
|
|
9224
|
-
let a = V(e.getAttributes, void 0, r) || {}, o = t.tr.delete(n.from, n.to), s = o.doc.resolve(n.from).blockRange(), c = s &&
|
|
9224
|
+
let a = V(e.getAttributes, void 0, r) || {}, o = t.tr.delete(n.from, n.to), s = o.doc.resolve(n.from).blockRange(), c = s && Pt(s, e.type, a);
|
|
9225
9225
|
if (!c) return null;
|
|
9226
9226
|
if (o.wrap(s, c), e.keepMarks && e.editor) {
|
|
9227
9227
|
let { selection: n, storedMarks: r } = t, { splittableMarks: i } = e.editor.extensionManager, a = r || n.$to.parentOffset && n.$from.marks();
|
|
@@ -9235,7 +9235,7 @@ function Ls(e) {
|
|
|
9235
9235
|
i().updateAttributes(t, a).run();
|
|
9236
9236
|
}
|
|
9237
9237
|
let l = o.doc.resolve(n.from - 1).nodeBefore;
|
|
9238
|
-
l && l.type === e.type &&
|
|
9238
|
+
l && l.type === e.type && zt(o.doc, n.from - 1) && (!e.joinPredicate || e.joinPredicate(r, l)) && o.join(n.from - 1);
|
|
9239
9239
|
}
|
|
9240
9240
|
});
|
|
9241
9241
|
}
|
|
@@ -11824,8 +11824,8 @@ function rf(e, t = null, n = null) {
|
|
|
11824
11824
|
return a;
|
|
11825
11825
|
}
|
|
11826
11826
|
function af(e) {
|
|
11827
|
-
return new
|
|
11828
|
-
key: new
|
|
11827
|
+
return new bn({
|
|
11828
|
+
key: new Cn("autolink"),
|
|
11829
11829
|
appendTransaction: (t, n, r) => {
|
|
11830
11830
|
let i = t.some(((e) => e.docChanged)) && !n.doc.eq(r.doc), a = t.some(((e) => e.getMeta("preventAutolink")));
|
|
11831
11831
|
if (!i || a) return;
|
|
@@ -11863,7 +11863,7 @@ function af(e) {
|
|
|
11863
11863
|
}));
|
|
11864
11864
|
})), _s(r);
|
|
11865
11865
|
}(function(e, t) {
|
|
11866
|
-
let n = new
|
|
11866
|
+
let n = new tn(e);
|
|
11867
11867
|
return t.forEach(((e) => {
|
|
11868
11868
|
e.steps.forEach(((e) => {
|
|
11869
11869
|
n.step(e);
|
|
@@ -12047,8 +12047,8 @@ var cf = Vo.create({
|
|
|
12047
12047
|
defaultProtocol: n
|
|
12048
12048
|
}),
|
|
12049
12049
|
shouldAutoLink: this.options.shouldAutoLink
|
|
12050
|
-
})), !0 === this.options.openOnClick && e.push((r = { type: this.type }, new
|
|
12051
|
-
key: new
|
|
12050
|
+
})), !0 === this.options.openOnClick && e.push((r = { type: this.type }, new bn({
|
|
12051
|
+
key: new Cn("handleClickLink"),
|
|
12052
12052
|
props: { handleClick: (e, t, n) => {
|
|
12053
12053
|
if (n.button !== 0 || !e.editable) return !1;
|
|
12054
12054
|
let i = n.target, a = [];
|
|
@@ -12058,8 +12058,8 @@ var cf = Vo.create({
|
|
|
12058
12058
|
return !(!s || !c || (window.open(c, l), 0));
|
|
12059
12059
|
} }
|
|
12060
12060
|
}))), this.options.linkOnPaste && e.push(function(e) {
|
|
12061
|
-
return new
|
|
12062
|
-
key: new
|
|
12061
|
+
return new bn({
|
|
12062
|
+
key: new Cn("handlePasteLink"),
|
|
12063
12063
|
props: { handlePaste: (t, n, r) => {
|
|
12064
12064
|
let { state: i } = t, { selection: a } = i, { empty: o } = a;
|
|
12065
12065
|
if (o) return !1;
|
|
@@ -12343,8 +12343,8 @@ var cf = Vo.create({
|
|
|
12343
12343
|
includeChildren: !1
|
|
12344
12344
|
}),
|
|
12345
12345
|
addProseMirrorPlugins() {
|
|
12346
|
-
return [new
|
|
12347
|
-
key: new
|
|
12346
|
+
return [new bn({
|
|
12347
|
+
key: new Cn("placeholder"),
|
|
12348
12348
|
props: { decorations: ({ doc: e, selection: t }) => {
|
|
12349
12349
|
let n = this.editor.isEditable || !this.options.showOnlyWhenEditable, { anchor: r } = t, i = [];
|
|
12350
12350
|
if (!n) return null;
|
|
@@ -27377,9 +27377,9 @@ var S_ = ({ dataTest: e, attachmentsMenu: t, id: n, inputRef: r, className: i, e
|
|
|
27377
27377
|
}), [w.content?.length, D]);
|
|
27378
27378
|
let [ge, _e] = _(ie), [ve, ye] = _(!1);
|
|
27379
27379
|
p(r, (() => D));
|
|
27380
|
-
let [be, xe] = _(!1), [Se, Ce] = _(!1), we =
|
|
27380
|
+
let [be, xe] = _(!1), [Se, Ce] = _(!1), we = !s && c;
|
|
27381
27381
|
if (!D) return null;
|
|
27382
|
-
let
|
|
27382
|
+
let Te = !ge || pe;
|
|
27383
27383
|
return ce(re, {
|
|
27384
27384
|
className: i,
|
|
27385
27385
|
children: [
|
|
@@ -27389,7 +27389,7 @@ var S_ = ({ dataTest: e, attachmentsMenu: t, id: n, inputRef: r, className: i, e
|
|
|
27389
27389
|
}),
|
|
27390
27390
|
ce("div", {
|
|
27391
27391
|
ref: ue,
|
|
27392
|
-
className: le(!oe && "rte-wrapper", s === "outlined" && "readonly-outlined", s === "plain" && "readonly-plain", !s &&
|
|
27392
|
+
className: le(!oe && "rte-wrapper", s === "outlined" && "readonly-outlined", s === "plain" && "readonly-plain", !s && we && (be ? "error-focused-state" : "error-state"), !s && !we && be && "focused-state"),
|
|
27393
27393
|
children: [
|
|
27394
27394
|
se,
|
|
27395
27395
|
C("div", {
|
|
@@ -27411,7 +27411,7 @@ var S_ = ({ dataTest: e, attachmentsMenu: t, id: n, inputRef: r, className: i, e
|
|
|
27411
27411
|
})
|
|
27412
27412
|
}), !ae && !o && !s && ce("div", {
|
|
27413
27413
|
className: le("flex shrink-0 items-center justify-end", pe ? "flex-col w-10" : "w-20"),
|
|
27414
|
-
children: [t,
|
|
27414
|
+
children: [t, Te && C(x, {
|
|
27415
27415
|
dataTest: "richeditor-format-button",
|
|
27416
27416
|
className: le(pe ? "order-last" : "order-first"),
|
|
27417
27417
|
size: "large",
|
|
@@ -27440,8 +27440,8 @@ var S_ = ({ dataTest: e, attachmentsMenu: t, id: n, inputRef: r, className: i, e
|
|
|
27440
27440
|
]
|
|
27441
27441
|
}),
|
|
27442
27442
|
v && ce("div", {
|
|
27443
|
-
className: le("text-sm mt-1",
|
|
27444
|
-
children: [
|
|
27443
|
+
className: le("text-sm mt-1", we ? "flex items-center gap-1 text-red-600" : "mx-[14px] text-gray-500"),
|
|
27444
|
+
children: [we && C(y, {
|
|
27445
27445
|
width: 20,
|
|
27446
27446
|
height: 20,
|
|
27447
27447
|
className: "min-w-5"
|