@jinntec/jinntap 1.9.2 → 1.9.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/editor-styles.css +3 -1
- package/dist/jinn-tap.es.js +424 -419
- package/dist/jinn-tap.umd.js +16 -16
- package/package.json +1 -1
package/dist/jinn-tap.es.js
CHANGED
|
@@ -428,7 +428,7 @@ function Wt(r, e) {
|
|
|
428
428
|
}
|
|
429
429
|
return !0;
|
|
430
430
|
}
|
|
431
|
-
let
|
|
431
|
+
let D = class zn {
|
|
432
432
|
/**
|
|
433
433
|
@internal
|
|
434
434
|
*/
|
|
@@ -533,8 +533,8 @@ let v = class zn {
|
|
|
533
533
|
return t.sort((n, i) => n.type.rank - i.type.rank), t;
|
|
534
534
|
}
|
|
535
535
|
};
|
|
536
|
-
|
|
537
|
-
class
|
|
536
|
+
D.none = [];
|
|
537
|
+
class qt extends Error {
|
|
538
538
|
}
|
|
539
539
|
class k {
|
|
540
540
|
/**
|
|
@@ -637,9 +637,9 @@ function Hi(r, e, t, n) {
|
|
|
637
637
|
}
|
|
638
638
|
function vo(r, e, t) {
|
|
639
639
|
if (t.openStart > r.depth)
|
|
640
|
-
throw new
|
|
640
|
+
throw new qt("Inserted content deeper than insertion position");
|
|
641
641
|
if (r.depth - t.openStart != e.depth - t.openEnd)
|
|
642
|
-
throw new
|
|
642
|
+
throw new qt("Inconsistent open depths");
|
|
643
643
|
return Wi(r, e, t, 0);
|
|
644
644
|
}
|
|
645
645
|
function Wi(r, e, t, n) {
|
|
@@ -653,17 +653,17 @@ function Wi(r, e, t, n) {
|
|
|
653
653
|
return Fe(o, l.cut(0, r.parentOffset).append(t.content).append(l.cut(e.parentOffset)));
|
|
654
654
|
} else {
|
|
655
655
|
let { start: o, end: l } = Do(t, r);
|
|
656
|
-
return Fe(s,
|
|
656
|
+
return Fe(s, Ji(r, o, l, e, n));
|
|
657
657
|
}
|
|
658
|
-
else return Fe(s,
|
|
658
|
+
else return Fe(s, Jt(r, e, n));
|
|
659
659
|
}
|
|
660
|
-
function
|
|
660
|
+
function qi(r, e) {
|
|
661
661
|
if (!e.type.compatibleContent(r.type))
|
|
662
|
-
throw new
|
|
662
|
+
throw new qt("Cannot join " + e.type.name + " onto " + r.type.name);
|
|
663
663
|
}
|
|
664
664
|
function Fn(r, e, t) {
|
|
665
665
|
let n = r.node(t);
|
|
666
|
-
return
|
|
666
|
+
return qi(n, e.node(t)), n;
|
|
667
667
|
}
|
|
668
668
|
function ze(r, e) {
|
|
669
669
|
let t = e.length - 1;
|
|
@@ -679,15 +679,15 @@ function dt(r, e, t, n) {
|
|
|
679
679
|
function Fe(r, e) {
|
|
680
680
|
return r.type.checkContent(e), r.copy(e);
|
|
681
681
|
}
|
|
682
|
-
function
|
|
682
|
+
function Ji(r, e, t, n, i) {
|
|
683
683
|
let s = r.depth > i && Fn(r, e, i + 1), o = n.depth > i && Fn(t, n, i + 1), l = [];
|
|
684
|
-
return dt(null, r, i, l), s && o && e.index(i) == t.index(i) ? (
|
|
684
|
+
return dt(null, r, i, l), s && o && e.index(i) == t.index(i) ? (qi(s, o), ze(Fe(s, Ji(r, e, t, n, i + 1)), l)) : (s && ze(Fe(s, Jt(r, e, i + 1)), l), dt(e, t, i, l), o && ze(Fe(o, Jt(t, n, i + 1)), l)), dt(n, null, i, l), new b(l);
|
|
685
685
|
}
|
|
686
|
-
function
|
|
686
|
+
function Jt(r, e, t) {
|
|
687
687
|
let n = [];
|
|
688
688
|
if (dt(null, r, t, n), r.depth > t) {
|
|
689
689
|
let i = Fn(r, e, t + 1);
|
|
690
|
-
ze(Fe(i,
|
|
690
|
+
ze(Fe(i, Jt(r, e, t + 1)), n);
|
|
691
691
|
}
|
|
692
692
|
return dt(e, null, t, n), new b(n);
|
|
693
693
|
}
|
|
@@ -831,7 +831,7 @@ class gt {
|
|
|
831
831
|
marks() {
|
|
832
832
|
let e = this.parent, t = this.index();
|
|
833
833
|
if (e.content.size == 0)
|
|
834
|
-
return
|
|
834
|
+
return D.none;
|
|
835
835
|
if (this.textOffset)
|
|
836
836
|
return e.child(t).marks;
|
|
837
837
|
let n = e.maybeChild(t - 1), i = e.maybeChild(t);
|
|
@@ -998,7 +998,7 @@ let ue = class Ln {
|
|
|
998
998
|
/**
|
|
999
999
|
@internal
|
|
1000
1000
|
*/
|
|
1001
|
-
constructor(e, t, n, i =
|
|
1001
|
+
constructor(e, t, n, i = D.none) {
|
|
1002
1002
|
this.type = e, this.attrs = t, this.marks = i, this.content = n || b.empty;
|
|
1003
1003
|
}
|
|
1004
1004
|
/**
|
|
@@ -1112,7 +1112,7 @@ let ue = class Ln {
|
|
|
1112
1112
|
attributes, and marks.
|
|
1113
1113
|
*/
|
|
1114
1114
|
hasMarkup(e, t, n) {
|
|
1115
|
-
return this.type == e && Wt(this.attrs, t || e.defaultAttrs || Ro) &&
|
|
1115
|
+
return this.type == e && Wt(this.attrs, t || e.defaultAttrs || Ro) && D.sameSet(this.marks, n || D.none);
|
|
1116
1116
|
}
|
|
1117
1117
|
/**
|
|
1118
1118
|
Create a new node with the same markup as this node, containing
|
|
@@ -1322,12 +1322,12 @@ let ue = class Ln {
|
|
|
1322
1322
|
*/
|
|
1323
1323
|
check() {
|
|
1324
1324
|
this.type.checkContent(this.content), this.type.checkAttrs(this.attrs);
|
|
1325
|
-
let e =
|
|
1325
|
+
let e = D.none;
|
|
1326
1326
|
for (let t = 0; t < this.marks.length; t++) {
|
|
1327
1327
|
let n = this.marks[t];
|
|
1328
1328
|
n.type.checkAttrs(n.attrs), e = n.addToSet(e);
|
|
1329
1329
|
}
|
|
1330
|
-
if (!
|
|
1330
|
+
if (!D.sameSet(e, this.marks))
|
|
1331
1331
|
throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map((t) => t.type.name)}`);
|
|
1332
1332
|
this.content.forEach((t) => t.check());
|
|
1333
1333
|
}
|
|
@@ -1788,7 +1788,7 @@ function Zi(r, e) {
|
|
|
1788
1788
|
let t = /* @__PURE__ */ Object.create(null);
|
|
1789
1789
|
if (e)
|
|
1790
1790
|
for (let n in e)
|
|
1791
|
-
t[n] = new
|
|
1791
|
+
t[n] = new Jo(r, n, e[n]);
|
|
1792
1792
|
return t;
|
|
1793
1793
|
}
|
|
1794
1794
|
let Dr = class Qi {
|
|
@@ -1870,7 +1870,7 @@ let Dr = class Qi {
|
|
|
1870
1870
|
create(e = null, t, n) {
|
|
1871
1871
|
if (this.isText)
|
|
1872
1872
|
throw new Error("NodeType.create can't construct text nodes");
|
|
1873
|
-
return new ue(this, this.computeAttrs(e), b.from(t),
|
|
1873
|
+
return new ue(this, this.computeAttrs(e), b.from(t), D.setFrom(n));
|
|
1874
1874
|
}
|
|
1875
1875
|
/**
|
|
1876
1876
|
Like [`create`](https://prosemirror.net/docs/ref/#model.NodeType.create), but check the given content
|
|
@@ -1878,7 +1878,7 @@ let Dr = class Qi {
|
|
|
1878
1878
|
if it doesn't match.
|
|
1879
1879
|
*/
|
|
1880
1880
|
createChecked(e = null, t, n) {
|
|
1881
|
-
return t = b.from(t), this.checkContent(t), new ue(this, this.computeAttrs(e), t,
|
|
1881
|
+
return t = b.from(t), this.checkContent(t), new ue(this, this.computeAttrs(e), t, D.setFrom(n));
|
|
1882
1882
|
}
|
|
1883
1883
|
/**
|
|
1884
1884
|
Like [`create`](https://prosemirror.net/docs/ref/#model.NodeType.create), but see if it is
|
|
@@ -1896,7 +1896,7 @@ let Dr = class Qi {
|
|
|
1896
1896
|
t = o.append(t);
|
|
1897
1897
|
}
|
|
1898
1898
|
let i = this.contentMatch.matchFragment(t), s = i && i.fillBefore(b.empty, !0);
|
|
1899
|
-
return s ? new ue(this, e, t.append(s),
|
|
1899
|
+
return s ? new ue(this, e, t.append(s), D.setFrom(n)) : null;
|
|
1900
1900
|
}
|
|
1901
1901
|
/**
|
|
1902
1902
|
Returns true if the given fragment is valid content for this node
|
|
@@ -1952,7 +1952,7 @@ let Dr = class Qi {
|
|
|
1952
1952
|
let t;
|
|
1953
1953
|
for (let n = 0; n < e.length; n++)
|
|
1954
1954
|
this.allowsMarkType(e[n].type) ? t && t.push(e[n]) : t || (t = e.slice(0, n));
|
|
1955
|
-
return t ? t.length ? t :
|
|
1955
|
+
return t ? t.length ? t : D.none : e;
|
|
1956
1956
|
}
|
|
1957
1957
|
/**
|
|
1958
1958
|
@internal
|
|
@@ -1970,7 +1970,7 @@ let Dr = class Qi {
|
|
|
1970
1970
|
return n;
|
|
1971
1971
|
}
|
|
1972
1972
|
};
|
|
1973
|
-
function
|
|
1973
|
+
function qo(r, e, t) {
|
|
1974
1974
|
let n = t.split("|");
|
|
1975
1975
|
return (i) => {
|
|
1976
1976
|
let s = i === null ? "null" : typeof i;
|
|
@@ -1978,9 +1978,9 @@ function Jo(r, e, t) {
|
|
|
1978
1978
|
throw new RangeError(`Expected value of type ${n} for attribute ${e} on type ${r}, got ${s}`);
|
|
1979
1979
|
};
|
|
1980
1980
|
}
|
|
1981
|
-
class
|
|
1981
|
+
class Jo {
|
|
1982
1982
|
constructor(e, t, n) {
|
|
1983
|
-
this.hasDefault = Object.prototype.hasOwnProperty.call(n, "default"), this.default = n.default, this.validate = typeof n.validate == "string" ?
|
|
1983
|
+
this.hasDefault = Object.prototype.hasOwnProperty.call(n, "default"), this.default = n.default, this.validate = typeof n.validate == "string" ? qo(e, t, n.validate) : n.validate;
|
|
1984
1984
|
}
|
|
1985
1985
|
get isRequired() {
|
|
1986
1986
|
return !this.hasDefault;
|
|
@@ -1993,7 +1993,7 @@ class nn {
|
|
|
1993
1993
|
constructor(e, t, n, i) {
|
|
1994
1994
|
this.name = e, this.rank = t, this.schema = n, this.spec = i, this.attrs = Zi(e, i.attrs), this.excluded = null;
|
|
1995
1995
|
let s = _i(this.attrs);
|
|
1996
|
-
this.instance = s ? new
|
|
1996
|
+
this.instance = s ? new D(this, s) : null;
|
|
1997
1997
|
}
|
|
1998
1998
|
/**
|
|
1999
1999
|
Create a mark of this type. `attrs` may be `null` or an object
|
|
@@ -2001,7 +2001,7 @@ class nn {
|
|
|
2001
2001
|
they have defaults, will be added.
|
|
2002
2002
|
*/
|
|
2003
2003
|
create(e = null) {
|
|
2004
|
-
return !e && this.instance ? this.instance : new
|
|
2004
|
+
return !e && this.instance ? this.instance : new D(this, Yi(this.attrs, e));
|
|
2005
2005
|
}
|
|
2006
2006
|
/**
|
|
2007
2007
|
@internal
|
|
@@ -2092,7 +2092,7 @@ class es {
|
|
|
2092
2092
|
*/
|
|
2093
2093
|
text(e, t) {
|
|
2094
2094
|
let n = this.nodes.text;
|
|
2095
|
-
return new Ut(n, n.defaultAttrs, e,
|
|
2095
|
+
return new Ut(n, n.defaultAttrs, e, D.setFrom(t));
|
|
2096
2096
|
}
|
|
2097
2097
|
/**
|
|
2098
2098
|
Create a mark with the given type and attributes.
|
|
@@ -2112,7 +2112,7 @@ class es {
|
|
|
2112
2112
|
bound.
|
|
2113
2113
|
*/
|
|
2114
2114
|
markFromJSON(e) {
|
|
2115
|
-
return
|
|
2115
|
+
return D.fromJSON(this, e);
|
|
2116
2116
|
}
|
|
2117
2117
|
/**
|
|
2118
2118
|
@internal
|
|
@@ -2173,7 +2173,7 @@ let ht = class $n {
|
|
|
2173
2173
|
*/
|
|
2174
2174
|
parse(e, t = {}) {
|
|
2175
2175
|
let n = new Rr(this, t, !1);
|
|
2176
|
-
return n.addAll(e,
|
|
2176
|
+
return n.addAll(e, D.none, t.from, t.to), n.finish();
|
|
2177
2177
|
}
|
|
2178
2178
|
/**
|
|
2179
2179
|
Parses the content of the given DOM node, like
|
|
@@ -2185,7 +2185,7 @@ let ht = class $n {
|
|
|
2185
2185
|
*/
|
|
2186
2186
|
parseSlice(e, t = {}) {
|
|
2187
2187
|
let n = new Rr(this, t, !0);
|
|
2188
|
-
return n.addAll(e,
|
|
2188
|
+
return n.addAll(e, D.none, t.from, t.to), k.maxOpen(n.finish());
|
|
2189
2189
|
}
|
|
2190
2190
|
/**
|
|
2191
2191
|
@internal
|
|
@@ -2307,7 +2307,7 @@ function Pr(r, e, t) {
|
|
|
2307
2307
|
}
|
|
2308
2308
|
class Pt {
|
|
2309
2309
|
constructor(e, t, n, i, s, o) {
|
|
2310
|
-
this.type = e, this.attrs = t, this.marks = n, this.solid = i, this.options = o, this.content = [], this.activeMarks =
|
|
2310
|
+
this.type = e, this.attrs = t, this.marks = n, this.solid = i, this.options = o, this.content = [], this.activeMarks = D.none, this.match = s || (o & Lt ? null : e.contentMatch);
|
|
2311
2311
|
}
|
|
2312
2312
|
findWrapping(e) {
|
|
2313
2313
|
if (!this.match) {
|
|
@@ -2342,7 +2342,7 @@ class Rr {
|
|
|
2342
2342
|
constructor(e, t, n) {
|
|
2343
2343
|
this.parser = e, this.options = t, this.isOpen = n, this.open = 0, this.localPreserveWS = !1;
|
|
2344
2344
|
let i = t.topNode, s, o = Pr(null, t.preserveWhitespace, 0) | (n ? Lt : 0);
|
|
2345
|
-
i ? s = new Pt(i.type, i.attrs,
|
|
2345
|
+
i ? s = new Pt(i.type, i.attrs, D.none, !0, t.topMatch || i.type.contentMatch, o) : n ? s = new Pt(null, null, D.none, !0, null, o) : s = new Pt(e.schema.topNodeType, null, D.none, !0, null, o), this.nodes = [s], this.find = t.findPositions, this.needsBlock = !1;
|
|
2346
2346
|
}
|
|
2347
2347
|
get top() {
|
|
2348
2348
|
return this.nodes[this.open];
|
|
@@ -2363,7 +2363,7 @@ class Rr {
|
|
|
2363
2363
|
let o = i.content[i.content.length - 1], l = e.previousSibling;
|
|
2364
2364
|
(!o || l && l.nodeName == "BR" || o.isText && /[ \t\r\n\u000c]$/.test(o.text)) && (n = n.slice(1));
|
|
2365
2365
|
}
|
|
2366
|
-
n && this.insertNode(this.parser.schema.text(n), t), this.findInText(e);
|
|
2366
|
+
n && this.insertNode(this.parser.schema.text(n), t, !/\S/.test(n)), this.findInText(e);
|
|
2367
2367
|
} else
|
|
2368
2368
|
this.findInside(e);
|
|
2369
2369
|
}
|
|
@@ -2401,7 +2401,7 @@ class Rr {
|
|
|
2401
2401
|
}
|
|
2402
2402
|
// Called for ignored nodes
|
|
2403
2403
|
ignoreFallback(e, t) {
|
|
2404
|
-
e.nodeName == "BR" && (!this.top.type || !this.top.type.inlineContent) && this.findPlace(this.parser.schema.text("-"), t);
|
|
2404
|
+
e.nodeName == "BR" && (!this.top.type || !this.top.type.inlineContent) && this.findPlace(this.parser.schema.text("-"), t, !0);
|
|
2405
2405
|
}
|
|
2406
2406
|
// Run any style parser associated with the node's styles. Either
|
|
2407
2407
|
// return an updated array of marks, or null to indicate some of the
|
|
@@ -2433,7 +2433,7 @@ class Rr {
|
|
|
2433
2433
|
let s, o;
|
|
2434
2434
|
if (t.node)
|
|
2435
2435
|
if (o = this.parser.schema.nodes[t.node], o.isLeaf)
|
|
2436
|
-
this.insertNode(o.create(t.attrs), n) || this.leafFallback(e, n);
|
|
2436
|
+
this.insertNode(o.create(t.attrs), n, e.nodeName == "BR") || this.leafFallback(e, n);
|
|
2437
2437
|
else {
|
|
2438
2438
|
let a = this.enter(o, t.attrs || null, n, t.preserveWhitespace);
|
|
2439
2439
|
a && (s = !0, n = a);
|
|
@@ -2448,7 +2448,7 @@ class Rr {
|
|
|
2448
2448
|
else if (i)
|
|
2449
2449
|
this.addElement(e, n, i);
|
|
2450
2450
|
else if (t.getContent)
|
|
2451
|
-
this.findInside(e), t.getContent(e, this.parser.schema).forEach((a) => this.insertNode(a, n));
|
|
2451
|
+
this.findInside(e), t.getContent(e, this.parser.schema).forEach((a) => this.insertNode(a, n, !1));
|
|
2452
2452
|
else {
|
|
2453
2453
|
let a = e;
|
|
2454
2454
|
typeof t.contentElement == "string" ? a = e.querySelector(t.contentElement) : typeof t.contentElement == "function" ? a = t.contentElement(e) : t.contentElement && (a = t.contentElement), this.findAround(e, a, !0), this.addAll(a, n), this.findAround(e, a, !1);
|
|
@@ -2467,42 +2467,47 @@ class Rr {
|
|
|
2467
2467
|
// Try to find a way to fit the given node type into the current
|
|
2468
2468
|
// context. May add intermediate wrappers and/or leave non-solid
|
|
2469
2469
|
// nodes that we're in.
|
|
2470
|
-
findPlace(e, t) {
|
|
2471
|
-
let
|
|
2472
|
-
for (let
|
|
2473
|
-
let
|
|
2474
|
-
if (
|
|
2470
|
+
findPlace(e, t, n) {
|
|
2471
|
+
let i, s;
|
|
2472
|
+
for (let o = this.open, l = 0; o >= 0; o--) {
|
|
2473
|
+
let a = this.nodes[o], c = a.findWrapping(e);
|
|
2474
|
+
if (c && (!i || i.length > c.length + l) && (i = c, s = a, !c.length))
|
|
2475
2475
|
break;
|
|
2476
|
+
if (a.solid) {
|
|
2477
|
+
if (n)
|
|
2478
|
+
break;
|
|
2479
|
+
l += 2;
|
|
2480
|
+
}
|
|
2476
2481
|
}
|
|
2477
|
-
if (!
|
|
2482
|
+
if (!i)
|
|
2478
2483
|
return null;
|
|
2479
|
-
this.sync(
|
|
2480
|
-
for (let
|
|
2481
|
-
t = this.enterInner(
|
|
2484
|
+
this.sync(s);
|
|
2485
|
+
for (let o = 0; o < i.length; o++)
|
|
2486
|
+
t = this.enterInner(i[o], null, t, !1);
|
|
2482
2487
|
return t;
|
|
2483
2488
|
}
|
|
2484
2489
|
// Try to insert the given node, adjusting the context when needed.
|
|
2485
|
-
insertNode(e, t) {
|
|
2490
|
+
insertNode(e, t, n) {
|
|
2486
2491
|
if (e.isInline && this.needsBlock && !this.top.type) {
|
|
2487
|
-
let
|
|
2488
|
-
|
|
2492
|
+
let s = this.textblockFromContext();
|
|
2493
|
+
s && (t = this.enterInner(s, null, t));
|
|
2489
2494
|
}
|
|
2490
|
-
let
|
|
2491
|
-
if (
|
|
2495
|
+
let i = this.findPlace(e, t, n);
|
|
2496
|
+
if (i) {
|
|
2492
2497
|
this.closeExtra();
|
|
2493
|
-
let
|
|
2494
|
-
|
|
2495
|
-
let
|
|
2496
|
-
for (let
|
|
2497
|
-
(
|
|
2498
|
-
return
|
|
2498
|
+
let s = this.top;
|
|
2499
|
+
s.match && (s.match = s.match.matchType(e.type));
|
|
2500
|
+
let o = D.none;
|
|
2501
|
+
for (let l of i.concat(e.marks))
|
|
2502
|
+
(s.type ? s.type.allowsMarkType(l.type) : zr(l.type, e.type)) && (o = l.addToSet(o));
|
|
2503
|
+
return s.content.push(e.mark(o)), !0;
|
|
2499
2504
|
}
|
|
2500
2505
|
return !1;
|
|
2501
2506
|
}
|
|
2502
2507
|
// Try to start a node of the given type, adjusting the context when
|
|
2503
2508
|
// necessary.
|
|
2504
2509
|
enter(e, t, n, i) {
|
|
2505
|
-
let s = this.findPlace(e.create(t), n);
|
|
2510
|
+
let s = this.findPlace(e.create(t), n, !1);
|
|
2506
2511
|
return s && (s = this.enterInner(e, t, n, !0, i)), s;
|
|
2507
2512
|
}
|
|
2508
2513
|
// Open a node of the given type
|
|
@@ -2512,7 +2517,7 @@ class Rr {
|
|
|
2512
2517
|
o.match = o.match && o.match.matchType(e);
|
|
2513
2518
|
let l = Pr(e, s, o.options);
|
|
2514
2519
|
o.options & Lt && o.content.length == 0 && (l |= Lt);
|
|
2515
|
-
let a =
|
|
2520
|
+
let a = D.none;
|
|
2516
2521
|
return n = n.filter((c) => (o.type ? o.type.allowsMarkType(c.type) : zr(c.type, e)) ? (a = c.addToSet(a), !1) : !0), this.nodes.push(new Pt(e, t, a, i, null, l)), this.open++, n;
|
|
2517
2522
|
}
|
|
2518
2523
|
// Make sure all nodes above this.open are finished and added to
|
|
@@ -3137,7 +3142,7 @@ class R {
|
|
|
3137
3142
|
try {
|
|
3138
3143
|
return R.ok(e.replace(t, n, i));
|
|
3139
3144
|
} catch (s) {
|
|
3140
|
-
if (s instanceof
|
|
3145
|
+
if (s instanceof qt)
|
|
3141
3146
|
return R.fail(s.message);
|
|
3142
3147
|
throw s;
|
|
3143
3148
|
}
|
|
@@ -3151,7 +3156,7 @@ function sr(r, e, t) {
|
|
|
3151
3156
|
}
|
|
3152
3157
|
return b.fromArray(n);
|
|
3153
3158
|
}
|
|
3154
|
-
class
|
|
3159
|
+
class we extends K {
|
|
3155
3160
|
/**
|
|
3156
3161
|
Create a mark step.
|
|
3157
3162
|
*/
|
|
@@ -3167,10 +3172,10 @@ class Ce extends K {
|
|
|
3167
3172
|
}
|
|
3168
3173
|
map(e) {
|
|
3169
3174
|
let t = e.mapResult(this.from, 1), n = e.mapResult(this.to, -1);
|
|
3170
|
-
return t.deleted && n.deleted || t.pos >= n.pos ? null : new
|
|
3175
|
+
return t.deleted && n.deleted || t.pos >= n.pos ? null : new we(t.pos, n.pos, this.mark);
|
|
3171
3176
|
}
|
|
3172
3177
|
merge(e) {
|
|
3173
|
-
return e instanceof
|
|
3178
|
+
return e instanceof we && e.mark.eq(this.mark) && this.from <= e.to && this.to >= e.from ? new we(Math.min(this.from, e.from), Math.max(this.to, e.to), this.mark) : null;
|
|
3174
3179
|
}
|
|
3175
3180
|
toJSON() {
|
|
3176
3181
|
return {
|
|
@@ -3186,10 +3191,10 @@ class Ce extends K {
|
|
|
3186
3191
|
static fromJSON(e, t) {
|
|
3187
3192
|
if (typeof t.from != "number" || typeof t.to != "number")
|
|
3188
3193
|
throw new RangeError("Invalid input for AddMarkStep.fromJSON");
|
|
3189
|
-
return new
|
|
3194
|
+
return new we(t.from, t.to, e.markFromJSON(t.mark));
|
|
3190
3195
|
}
|
|
3191
3196
|
}
|
|
3192
|
-
K.jsonID("addMark",
|
|
3197
|
+
K.jsonID("addMark", we);
|
|
3193
3198
|
class ce extends K {
|
|
3194
3199
|
/**
|
|
3195
3200
|
Create a mark-removing step.
|
|
@@ -3202,7 +3207,7 @@ class ce extends K {
|
|
|
3202
3207
|
return R.fromReplace(e, this.from, this.to, n);
|
|
3203
3208
|
}
|
|
3204
3209
|
invert() {
|
|
3205
|
-
return new
|
|
3210
|
+
return new we(this.from, this.to, this.mark);
|
|
3206
3211
|
}
|
|
3207
3212
|
map(e) {
|
|
3208
3213
|
let t = e.mapResult(this.from, 1), n = e.mapResult(this.to, -1);
|
|
@@ -3229,7 +3234,7 @@ class ce extends K {
|
|
|
3229
3234
|
}
|
|
3230
3235
|
}
|
|
3231
3236
|
K.jsonID("removeMark", ce);
|
|
3232
|
-
class
|
|
3237
|
+
class Ce extends K {
|
|
3233
3238
|
/**
|
|
3234
3239
|
Create a node mark step.
|
|
3235
3240
|
*/
|
|
@@ -3250,15 +3255,15 @@ class we extends K {
|
|
|
3250
3255
|
if (n.length == t.marks.length) {
|
|
3251
3256
|
for (let i = 0; i < t.marks.length; i++)
|
|
3252
3257
|
if (!t.marks[i].isInSet(n))
|
|
3253
|
-
return new
|
|
3254
|
-
return new
|
|
3258
|
+
return new Ce(this.pos, t.marks[i]);
|
|
3259
|
+
return new Ce(this.pos, this.mark);
|
|
3255
3260
|
}
|
|
3256
3261
|
}
|
|
3257
|
-
return new
|
|
3262
|
+
return new He(this.pos, this.mark);
|
|
3258
3263
|
}
|
|
3259
3264
|
map(e) {
|
|
3260
3265
|
let t = e.mapResult(this.pos, 1);
|
|
3261
|
-
return t.deletedAfter ? null : new
|
|
3266
|
+
return t.deletedAfter ? null : new Ce(t.pos, this.mark);
|
|
3262
3267
|
}
|
|
3263
3268
|
toJSON() {
|
|
3264
3269
|
return { stepType: "addNodeMark", pos: this.pos, mark: this.mark.toJSON() };
|
|
@@ -3269,11 +3274,11 @@ class we extends K {
|
|
|
3269
3274
|
static fromJSON(e, t) {
|
|
3270
3275
|
if (typeof t.pos != "number")
|
|
3271
3276
|
throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");
|
|
3272
|
-
return new
|
|
3277
|
+
return new Ce(t.pos, e.markFromJSON(t.mark));
|
|
3273
3278
|
}
|
|
3274
3279
|
}
|
|
3275
|
-
K.jsonID("addNodeMark",
|
|
3276
|
-
class
|
|
3280
|
+
K.jsonID("addNodeMark", Ce);
|
|
3281
|
+
class He extends K {
|
|
3277
3282
|
/**
|
|
3278
3283
|
Create a mark-removing step.
|
|
3279
3284
|
*/
|
|
@@ -3289,11 +3294,11 @@ class et extends K {
|
|
|
3289
3294
|
}
|
|
3290
3295
|
invert(e) {
|
|
3291
3296
|
let t = e.nodeAt(this.pos);
|
|
3292
|
-
return !t || !this.mark.isInSet(t.marks) ? this : new
|
|
3297
|
+
return !t || !this.mark.isInSet(t.marks) ? this : new Ce(this.pos, this.mark);
|
|
3293
3298
|
}
|
|
3294
3299
|
map(e) {
|
|
3295
3300
|
let t = e.mapResult(this.pos, 1);
|
|
3296
|
-
return t.deletedAfter ? null : new
|
|
3301
|
+
return t.deletedAfter ? null : new He(t.pos, this.mark);
|
|
3297
3302
|
}
|
|
3298
3303
|
toJSON() {
|
|
3299
3304
|
return { stepType: "removeNodeMark", pos: this.pos, mark: this.mark.toJSON() };
|
|
@@ -3304,10 +3309,10 @@ class et extends K {
|
|
|
3304
3309
|
static fromJSON(e, t) {
|
|
3305
3310
|
if (typeof t.pos != "number")
|
|
3306
3311
|
throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");
|
|
3307
|
-
return new
|
|
3312
|
+
return new He(t.pos, e.markFromJSON(t.mark));
|
|
3308
3313
|
}
|
|
3309
3314
|
}
|
|
3310
|
-
K.jsonID("removeNodeMark",
|
|
3315
|
+
K.jsonID("removeNodeMark", He);
|
|
3311
3316
|
class P extends K {
|
|
3312
3317
|
/**
|
|
3313
3318
|
The given `slice` should fit the 'gap' between `from` and
|
|
@@ -3332,7 +3337,7 @@ class P extends K {
|
|
|
3332
3337
|
}
|
|
3333
3338
|
map(e) {
|
|
3334
3339
|
let t = e.mapResult(this.from, 1), n = e.mapResult(this.to, -1);
|
|
3335
|
-
return t.deletedAcross && n.deletedAcross ? null : new P(t.pos, Math.max(t.pos, n.pos), this.slice);
|
|
3340
|
+
return t.deletedAcross && n.deletedAcross ? null : new P(t.pos, Math.max(t.pos, n.pos), this.slice, this.structure);
|
|
3336
3341
|
}
|
|
3337
3342
|
merge(e) {
|
|
3338
3343
|
if (!(e instanceof P) || e.structure || this.structure)
|
|
@@ -3442,7 +3447,7 @@ function tl(r, e, t, n) {
|
|
|
3442
3447
|
let h = Math.max(c, e), f = Math.min(c + a.nodeSize, t), p = n.addToSet(d);
|
|
3443
3448
|
for (let m = 0; m < d.length; m++)
|
|
3444
3449
|
d[m].isInSet(p) || (o && o.to == h && o.mark.eq(d[m]) ? o.to = f : i.push(o = new ce(h, f, d[m])));
|
|
3445
|
-
l && l.to == h ? l.to = f : s.push(l = new
|
|
3450
|
+
l && l.to == h ? l.to = f : s.push(l = new we(h, f, n));
|
|
3446
3451
|
}
|
|
3447
3452
|
}), i.forEach((a) => r.step(a)), s.forEach((a) => r.step(a));
|
|
3448
3453
|
}
|
|
@@ -3635,7 +3640,7 @@ function dl(r, e, t = 1, n) {
|
|
|
3635
3640
|
}
|
|
3636
3641
|
r.step(new P(e, e, new k(s.append(o), t, t), !0));
|
|
3637
3642
|
}
|
|
3638
|
-
function
|
|
3643
|
+
function Ke(r, e) {
|
|
3639
3644
|
let t = r.resolve(e), n = t.index();
|
|
3640
3645
|
return hs(t.nodeBefore, t.nodeAfter) && t.parent.canReplace(n, n + 1);
|
|
3641
3646
|
}
|
|
@@ -3950,8 +3955,8 @@ function kl(r, e, t, n) {
|
|
|
3950
3955
|
for (let m = 0; m < o.length; m++) {
|
|
3951
3956
|
let g = o[(m + a) % o.length], y = !0;
|
|
3952
3957
|
g < 0 && (y = !1, g = -g);
|
|
3953
|
-
let S = i.node(g - 1),
|
|
3954
|
-
if (S.canReplaceWith(
|
|
3958
|
+
let S = i.node(g - 1), C = i.index(g - 1);
|
|
3959
|
+
if (S.canReplaceWith(C, C, p.type, p.marks))
|
|
3955
3960
|
return r.replace(i.before(g), y ? s.after(g) : t, new k(ms(n.content, 0, n.openStart, f), f, n.openEnd));
|
|
3956
3961
|
}
|
|
3957
3962
|
}
|
|
@@ -4003,7 +4008,7 @@ function gs(r, e) {
|
|
|
4003
4008
|
}
|
|
4004
4009
|
return t;
|
|
4005
4010
|
}
|
|
4006
|
-
class
|
|
4011
|
+
class Qe extends K {
|
|
4007
4012
|
/**
|
|
4008
4013
|
Construct an attribute step.
|
|
4009
4014
|
*/
|
|
@@ -4025,11 +4030,11 @@ class Ze extends K {
|
|
|
4025
4030
|
return X.empty;
|
|
4026
4031
|
}
|
|
4027
4032
|
invert(e) {
|
|
4028
|
-
return new
|
|
4033
|
+
return new Qe(this.pos, this.attr, e.nodeAt(this.pos).attrs[this.attr]);
|
|
4029
4034
|
}
|
|
4030
4035
|
map(e) {
|
|
4031
4036
|
let t = e.mapResult(this.pos, 1);
|
|
4032
|
-
return t.deletedAfter ? null : new
|
|
4037
|
+
return t.deletedAfter ? null : new Qe(t.pos, this.attr, this.value);
|
|
4033
4038
|
}
|
|
4034
4039
|
toJSON() {
|
|
4035
4040
|
return { stepType: "attr", pos: this.pos, attr: this.attr, value: this.value };
|
|
@@ -4037,10 +4042,10 @@ class Ze extends K {
|
|
|
4037
4042
|
static fromJSON(e, t) {
|
|
4038
4043
|
if (typeof t.pos != "number" || typeof t.attr != "string")
|
|
4039
4044
|
throw new RangeError("Invalid input for AttrStep.fromJSON");
|
|
4040
|
-
return new
|
|
4045
|
+
return new Qe(t.pos, t.attr, t.value);
|
|
4041
4046
|
}
|
|
4042
4047
|
}
|
|
4043
|
-
K.jsonID("attr",
|
|
4048
|
+
K.jsonID("attr", Qe);
|
|
4044
4049
|
class kt extends K {
|
|
4045
4050
|
/**
|
|
4046
4051
|
Construct an attribute step.
|
|
@@ -4084,7 +4089,7 @@ tt = function r(e) {
|
|
|
4084
4089
|
tt.prototype = Object.create(Error.prototype);
|
|
4085
4090
|
tt.prototype.constructor = tt;
|
|
4086
4091
|
tt.prototype.name = "TransformError";
|
|
4087
|
-
class
|
|
4092
|
+
class wl {
|
|
4088
4093
|
/**
|
|
4089
4094
|
Create a transform that starts with the given document.
|
|
4090
4095
|
*/
|
|
@@ -4241,7 +4246,7 @@ class Cl {
|
|
|
4241
4246
|
to set attributes on the document itself.
|
|
4242
4247
|
*/
|
|
4243
4248
|
setNodeAttribute(e, t, n) {
|
|
4244
|
-
return this.step(new
|
|
4249
|
+
return this.step(new Qe(e, t, n)), this;
|
|
4245
4250
|
}
|
|
4246
4251
|
/**
|
|
4247
4252
|
Set a single attribute on the document to a new value.
|
|
@@ -4253,21 +4258,26 @@ class Cl {
|
|
|
4253
4258
|
Add a mark to the node at position `pos`.
|
|
4254
4259
|
*/
|
|
4255
4260
|
addNodeMark(e, t) {
|
|
4256
|
-
return this.step(new
|
|
4261
|
+
return this.step(new Ce(e, t)), this;
|
|
4257
4262
|
}
|
|
4258
4263
|
/**
|
|
4259
|
-
Remove a mark (or
|
|
4264
|
+
Remove a mark (or all marks of the given type) from the node at
|
|
4260
4265
|
position `pos`.
|
|
4261
4266
|
*/
|
|
4262
4267
|
removeNodeMark(e, t) {
|
|
4263
|
-
|
|
4264
|
-
|
|
4265
|
-
|
|
4266
|
-
|
|
4267
|
-
|
|
4268
|
-
|
|
4268
|
+
let n = this.doc.nodeAt(e);
|
|
4269
|
+
if (!n)
|
|
4270
|
+
throw new RangeError("No node at position " + e);
|
|
4271
|
+
if (t instanceof D)
|
|
4272
|
+
t.isInSet(n.marks) && this.step(new He(e, t));
|
|
4273
|
+
else {
|
|
4274
|
+
let i = n.marks, s, o = [];
|
|
4275
|
+
for (; s = t.isInSet(i); )
|
|
4276
|
+
o.push(new He(e, s)), i = s.removeFromSet(i);
|
|
4277
|
+
for (let l = o.length - 1; l >= 0; l--)
|
|
4278
|
+
this.step(o[l]);
|
|
4269
4279
|
}
|
|
4270
|
-
return this
|
|
4280
|
+
return this;
|
|
4271
4281
|
}
|
|
4272
4282
|
/**
|
|
4273
4283
|
Split the node at the given position, and optionally, if `depth` is
|
|
@@ -4312,7 +4322,7 @@ class O {
|
|
|
4312
4322
|
`$head`.
|
|
4313
4323
|
*/
|
|
4314
4324
|
constructor(e, t, n) {
|
|
4315
|
-
this.$anchor = e, this.$head = t, this.ranges = n || [new
|
|
4325
|
+
this.$anchor = e, this.$head = t, this.ranges = n || [new Cl(e.min(t), e.max(t))];
|
|
4316
4326
|
}
|
|
4317
4327
|
/**
|
|
4318
4328
|
The selection's anchor, as an unresolved position.
|
|
@@ -4399,11 +4409,11 @@ class O {
|
|
|
4399
4409
|
found.
|
|
4400
4410
|
*/
|
|
4401
4411
|
static findFrom(e, t, n = !1) {
|
|
4402
|
-
let i = e.parent.inlineContent ? new T(e) :
|
|
4412
|
+
let i = e.parent.inlineContent ? new T(e) : _e(e.node(0), e.parent, e.pos, e.index(), t, n);
|
|
4403
4413
|
if (i)
|
|
4404
4414
|
return i;
|
|
4405
4415
|
for (let s = e.depth - 1; s >= 0; s--) {
|
|
4406
|
-
let o = t < 0 ?
|
|
4416
|
+
let o = t < 0 ? _e(e.node(0), e.node(s), e.before(s + 1), e.index(s), t, n) : _e(e.node(0), e.node(s), e.after(s + 1), e.index(s) + 1, t, n);
|
|
4407
4417
|
if (o)
|
|
4408
4418
|
return o;
|
|
4409
4419
|
}
|
|
@@ -4424,14 +4434,14 @@ class O {
|
|
|
4424
4434
|
exists.
|
|
4425
4435
|
*/
|
|
4426
4436
|
static atStart(e) {
|
|
4427
|
-
return
|
|
4437
|
+
return _e(e, e, 0, 0, 1) || new Z(e);
|
|
4428
4438
|
}
|
|
4429
4439
|
/**
|
|
4430
4440
|
Find the cursor or leaf node selection closest to the end of the
|
|
4431
4441
|
given document.
|
|
4432
4442
|
*/
|
|
4433
4443
|
static atEnd(e) {
|
|
4434
|
-
return
|
|
4444
|
+
return _e(e, e, e.content.size, e.childCount, -1) || new Z(e);
|
|
4435
4445
|
}
|
|
4436
4446
|
/**
|
|
4437
4447
|
Deserialize the JSON representation of a selection. Must be
|
|
@@ -4470,7 +4480,7 @@ class O {
|
|
|
4470
4480
|
}
|
|
4471
4481
|
}
|
|
4472
4482
|
O.prototype.visible = !0;
|
|
4473
|
-
class
|
|
4483
|
+
class Cl {
|
|
4474
4484
|
/**
|
|
4475
4485
|
Create a range.
|
|
4476
4486
|
*/
|
|
@@ -4565,7 +4575,7 @@ class on {
|
|
|
4565
4575
|
return T.between(e.resolve(this.anchor), e.resolve(this.head));
|
|
4566
4576
|
}
|
|
4567
4577
|
}
|
|
4568
|
-
class
|
|
4578
|
+
class w extends O {
|
|
4569
4579
|
/**
|
|
4570
4580
|
Create a node selection. Does not verify the validity of its
|
|
4571
4581
|
argument.
|
|
@@ -4576,13 +4586,13 @@ class C extends O {
|
|
|
4576
4586
|
}
|
|
4577
4587
|
map(e, t) {
|
|
4578
4588
|
let { deleted: n, pos: i } = t.mapResult(this.anchor), s = e.resolve(i);
|
|
4579
|
-
return n ? O.near(s) : new
|
|
4589
|
+
return n ? O.near(s) : new w(s);
|
|
4580
4590
|
}
|
|
4581
4591
|
content() {
|
|
4582
4592
|
return new k(b.from(this.node), 0, 0);
|
|
4583
4593
|
}
|
|
4584
4594
|
eq(e) {
|
|
4585
|
-
return e instanceof
|
|
4595
|
+
return e instanceof w && e.anchor == this.anchor;
|
|
4586
4596
|
}
|
|
4587
4597
|
toJSON() {
|
|
4588
4598
|
return { type: "node", anchor: this.anchor };
|
|
@@ -4596,13 +4606,13 @@ class C extends O {
|
|
|
4596
4606
|
static fromJSON(e, t) {
|
|
4597
4607
|
if (typeof t.anchor != "number")
|
|
4598
4608
|
throw new RangeError("Invalid input for NodeSelection.fromJSON");
|
|
4599
|
-
return new
|
|
4609
|
+
return new w(e.resolve(t.anchor));
|
|
4600
4610
|
}
|
|
4601
4611
|
/**
|
|
4602
4612
|
Create a node selection from non-resolved positions.
|
|
4603
4613
|
*/
|
|
4604
4614
|
static create(e, t) {
|
|
4605
|
-
return new
|
|
4615
|
+
return new w(e.resolve(t));
|
|
4606
4616
|
}
|
|
4607
4617
|
/**
|
|
4608
4618
|
Determines whether the given node may be selected as a node
|
|
@@ -4612,8 +4622,8 @@ class C extends O {
|
|
|
4612
4622
|
return !e.isText && e.type.spec.selectable !== !1;
|
|
4613
4623
|
}
|
|
4614
4624
|
}
|
|
4615
|
-
|
|
4616
|
-
O.jsonID("node",
|
|
4625
|
+
w.prototype.visible = !1;
|
|
4626
|
+
O.jsonID("node", w);
|
|
4617
4627
|
class lr {
|
|
4618
4628
|
constructor(e) {
|
|
4619
4629
|
this.anchor = e;
|
|
@@ -4624,7 +4634,7 @@ class lr {
|
|
|
4624
4634
|
}
|
|
4625
4635
|
resolve(e) {
|
|
4626
4636
|
let t = e.resolve(this.anchor), n = t.nodeAfter;
|
|
4627
|
-
return n &&
|
|
4637
|
+
return n && w.isSelectable(n) ? new w(t) : O.near(t);
|
|
4628
4638
|
}
|
|
4629
4639
|
}
|
|
4630
4640
|
class Z extends O {
|
|
@@ -4670,16 +4680,16 @@ const Ml = {
|
|
|
4670
4680
|
return new Z(r);
|
|
4671
4681
|
}
|
|
4672
4682
|
};
|
|
4673
|
-
function
|
|
4683
|
+
function _e(r, e, t, n, i, s = !1) {
|
|
4674
4684
|
if (e.inlineContent)
|
|
4675
4685
|
return T.create(r, t);
|
|
4676
4686
|
for (let o = n - (i > 0 ? 0 : 1); i > 0 ? o < e.childCount : o >= 0; o += i) {
|
|
4677
4687
|
let l = e.child(o);
|
|
4678
4688
|
if (l.isAtom) {
|
|
4679
|
-
if (!s &&
|
|
4680
|
-
return
|
|
4689
|
+
if (!s && w.isSelectable(l))
|
|
4690
|
+
return w.create(r, t - (i < 0 ? l.nodeSize : 0));
|
|
4681
4691
|
} else {
|
|
4682
|
-
let a =
|
|
4692
|
+
let a = _e(r, l, t + i, i < 0 ? l.childCount : 0, i, s);
|
|
4683
4693
|
if (a)
|
|
4684
4694
|
return a;
|
|
4685
4695
|
}
|
|
@@ -4699,8 +4709,8 @@ function Wr(r, e, t) {
|
|
|
4699
4709
|
o == null && (o = u);
|
|
4700
4710
|
}), r.setSelection(O.near(r.doc.resolve(o), t));
|
|
4701
4711
|
}
|
|
4702
|
-
const
|
|
4703
|
-
class El extends
|
|
4712
|
+
const qr = 1, Jr = 2, Kr = 4;
|
|
4713
|
+
class El extends wl {
|
|
4704
4714
|
/**
|
|
4705
4715
|
@internal
|
|
4706
4716
|
*/
|
|
@@ -4723,19 +4733,19 @@ class El extends Cl {
|
|
|
4723
4733
|
setSelection(e) {
|
|
4724
4734
|
if (e.$from.doc != this.doc)
|
|
4725
4735
|
throw new RangeError("Selection passed to setSelection must point at the current document");
|
|
4726
|
-
return this.curSelection = e, this.curSelectionFor = this.steps.length, this.updated = (this.updated |
|
|
4736
|
+
return this.curSelection = e, this.curSelectionFor = this.steps.length, this.updated = (this.updated | qr) & -3, this.storedMarks = null, this;
|
|
4727
4737
|
}
|
|
4728
4738
|
/**
|
|
4729
4739
|
Whether the selection was explicitly updated by this transaction.
|
|
4730
4740
|
*/
|
|
4731
4741
|
get selectionSet() {
|
|
4732
|
-
return (this.updated &
|
|
4742
|
+
return (this.updated & qr) > 0;
|
|
4733
4743
|
}
|
|
4734
4744
|
/**
|
|
4735
4745
|
Set the current stored marks.
|
|
4736
4746
|
*/
|
|
4737
4747
|
setStoredMarks(e) {
|
|
4738
|
-
return this.storedMarks = e, this.updated |=
|
|
4748
|
+
return this.storedMarks = e, this.updated |= Jr, this;
|
|
4739
4749
|
}
|
|
4740
4750
|
/**
|
|
4741
4751
|
Make sure the current stored marks or, if that is null, the marks
|
|
@@ -4743,7 +4753,7 @@ class El extends Cl {
|
|
|
4743
4753
|
this is already the case.
|
|
4744
4754
|
*/
|
|
4745
4755
|
ensureMarks(e) {
|
|
4746
|
-
return
|
|
4756
|
+
return D.sameSet(this.storedMarks || this.selection.$from.marks(), e) || this.setStoredMarks(e), this;
|
|
4747
4757
|
}
|
|
4748
4758
|
/**
|
|
4749
4759
|
Add a mark to the set of stored marks.
|
|
@@ -4761,7 +4771,7 @@ class El extends Cl {
|
|
|
4761
4771
|
Whether the stored marks were explicitly set for this transaction.
|
|
4762
4772
|
*/
|
|
4763
4773
|
get storedMarksSet() {
|
|
4764
|
-
return (this.updated &
|
|
4774
|
+
return (this.updated & Jr) > 0;
|
|
4765
4775
|
}
|
|
4766
4776
|
/**
|
|
4767
4777
|
@internal
|
|
@@ -4788,7 +4798,7 @@ class El extends Cl {
|
|
|
4788
4798
|
*/
|
|
4789
4799
|
replaceSelectionWith(e, t = !0) {
|
|
4790
4800
|
let n = this.selection;
|
|
4791
|
-
return t && (e = e.mark(this.storedMarks || (n.empty ? n.$from.marks() : n.$from.marksAcross(n.$to) ||
|
|
4801
|
+
return t && (e = e.mark(this.storedMarks || (n.empty ? n.$from.marks() : n.$from.marksAcross(n.$to) || D.none))), n.replaceWith(this, e), this;
|
|
4792
4802
|
}
|
|
4793
4803
|
/**
|
|
4794
4804
|
Delete the selection.
|
|
@@ -4893,7 +4903,7 @@ const Tl = [
|
|
|
4893
4903
|
}
|
|
4894
4904
|
})
|
|
4895
4905
|
];
|
|
4896
|
-
class
|
|
4906
|
+
class wn {
|
|
4897
4907
|
constructor(e, t) {
|
|
4898
4908
|
this.schema = e, this.plugins = [], this.pluginsByKey = /* @__PURE__ */ Object.create(null), this.fields = Tl.slice(), t && t.forEach((n) => {
|
|
4899
4909
|
if (this.pluginsByKey[n.key])
|
|
@@ -4902,7 +4912,7 @@ class Cn {
|
|
|
4902
4912
|
});
|
|
4903
4913
|
}
|
|
4904
4914
|
}
|
|
4905
|
-
class
|
|
4915
|
+
class Xe {
|
|
4906
4916
|
/**
|
|
4907
4917
|
@internal
|
|
4908
4918
|
*/
|
|
@@ -4977,7 +4987,7 @@ class Ye {
|
|
|
4977
4987
|
applyInner(e) {
|
|
4978
4988
|
if (!e.before.eq(this.doc))
|
|
4979
4989
|
throw new RangeError("Applying a mismatched transaction");
|
|
4980
|
-
let t = new
|
|
4990
|
+
let t = new Xe(this.config), n = this.config.fields;
|
|
4981
4991
|
for (let i = 0; i < n.length; i++) {
|
|
4982
4992
|
let s = n[i];
|
|
4983
4993
|
t[s.name] = s.apply(e, this[s.name], this, t);
|
|
@@ -4994,7 +5004,7 @@ class Ye {
|
|
|
4994
5004
|
Create a new state.
|
|
4995
5005
|
*/
|
|
4996
5006
|
static create(e) {
|
|
4997
|
-
let t = new
|
|
5007
|
+
let t = new wn(e.doc ? e.doc.type.schema : e.schema, e.plugins), n = new Xe(t);
|
|
4998
5008
|
for (let i = 0; i < t.fields.length; i++)
|
|
4999
5009
|
n[t.fields[i].name] = t.fields[i].init(e, n);
|
|
5000
5010
|
return n;
|
|
@@ -5008,7 +5018,7 @@ class Ye {
|
|
|
5008
5018
|
configuration object..
|
|
5009
5019
|
*/
|
|
5010
5020
|
reconfigure(e) {
|
|
5011
|
-
let t = new
|
|
5021
|
+
let t = new wn(this.schema, e.plugins), n = t.fields, i = new Xe(t);
|
|
5012
5022
|
for (let s = 0; s < n.length; s++) {
|
|
5013
5023
|
let o = n[s].name;
|
|
5014
5024
|
i[o] = this.hasOwnProperty(o) ? this[o] : n[s].init(e, i);
|
|
@@ -5045,7 +5055,7 @@ class Ye {
|
|
|
5045
5055
|
throw new RangeError("Invalid input for EditorState.fromJSON");
|
|
5046
5056
|
if (!e.schema)
|
|
5047
5057
|
throw new RangeError("Required config field 'schema' missing");
|
|
5048
|
-
let i = new
|
|
5058
|
+
let i = new wn(e.schema, e.plugins), s = new Xe(i);
|
|
5049
5059
|
return i.fields.forEach((o) => {
|
|
5050
5060
|
if (o.name == "doc")
|
|
5051
5061
|
s.doc = ue.fromJSON(e.schema, t.doc);
|
|
@@ -5088,9 +5098,9 @@ class Q {
|
|
|
5088
5098
|
return e[this.key];
|
|
5089
5099
|
}
|
|
5090
5100
|
}
|
|
5091
|
-
const
|
|
5101
|
+
const Cn = /* @__PURE__ */ Object.create(null);
|
|
5092
5102
|
function bs(r) {
|
|
5093
|
-
return r in
|
|
5103
|
+
return r in Cn ? r + "$" + ++Cn[r] : (Cn[r] = 0, r + "$");
|
|
5094
5104
|
}
|
|
5095
5105
|
class le {
|
|
5096
5106
|
/**
|
|
@@ -5127,7 +5137,7 @@ const pe = function(r, e, t) {
|
|
|
5127
5137
|
return n.setEnd(r, t ?? r.nodeValue.length), n.setStart(r, e || 0), n;
|
|
5128
5138
|
}, Ol = function() {
|
|
5129
5139
|
Wn = null;
|
|
5130
|
-
},
|
|
5140
|
+
}, We = function(r, e, t, n) {
|
|
5131
5141
|
return t && (Gr(r, e, t, n, -1) || Gr(r, e, t, n, 1));
|
|
5132
5142
|
}, Nl = /^(img|br|input|textarea|hr)$/i;
|
|
5133
5143
|
function Gr(r, e, t, n, i) {
|
|
@@ -5195,7 +5205,7 @@ function Ot(r) {
|
|
|
5195
5205
|
return e && e.node && e.node.isBlock && (e.dom == r || e.contentDOM == r);
|
|
5196
5206
|
}
|
|
5197
5207
|
const ln = function(r) {
|
|
5198
|
-
return r.focusNode &&
|
|
5208
|
+
return r.focusNode && We(r.focusNode, r.focusOffset, r.anchorNode, r.anchorOffset);
|
|
5199
5209
|
};
|
|
5200
5210
|
function De(r, e) {
|
|
5201
5211
|
let t = document.createEvent("Event");
|
|
@@ -5221,9 +5231,9 @@ function Pl(r, e, t) {
|
|
|
5221
5231
|
return { node: n.startContainer, offset: Math.min(ne(n.startContainer), n.startOffset) };
|
|
5222
5232
|
}
|
|
5223
5233
|
}
|
|
5224
|
-
const de = typeof navigator < "u" ? navigator : null, _r = typeof document < "u" ? document : null, Ae = de && de.userAgent || "",
|
|
5234
|
+
const de = typeof navigator < "u" ? navigator : null, _r = typeof document < "u" ? document : null, Ae = de && de.userAgent || "", qn = /Edge\/(\d+)/.exec(Ae), ks = /MSIE \d/.exec(Ae), Jn = /Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Ae), Y = !!(ks || Jn || qn), Ee = ks ? document.documentMode : Jn ? +Jn[1] : qn ? +qn[1] : 0, oe = !Y && /gecko\/(\d+)/i.test(Ae);
|
|
5225
5235
|
oe && +(/Firefox\/(\d+)/.exec(Ae) || [0, 0])[1];
|
|
5226
|
-
const Kn = !Y && /Chrome\/(\d+)/.exec(Ae),
|
|
5236
|
+
const Kn = !Y && /Chrome\/(\d+)/.exec(Ae), q = !!Kn, xs = Kn ? +Kn[1] : 0, U = !Y && !!de && /Apple Computer/.test(de.vendor), rt = U && (/Mobile\/\w+/.test(Ae) || !!de && de.maxTouchPoints > 2), te = rt || (de ? /Mac/.test(de.platform) : !1), Rl = de ? /Win/.test(de.platform) : !1, me = /Android \d/.test(Ae), Nt = !!_r && "webkitFontSmoothing" in _r.documentElement.style, Bl = Nt ? +(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent) || [0, 0])[1] : 0;
|
|
5227
5237
|
function zl(r) {
|
|
5228
5238
|
let e = r.defaultView && r.defaultView.visualViewport;
|
|
5229
5239
|
return e ? {
|
|
@@ -5295,28 +5305,28 @@ function Ss(r) {
|
|
|
5295
5305
|
}
|
|
5296
5306
|
function $l({ refDOM: r, refTop: e, stack: t }) {
|
|
5297
5307
|
let n = r ? r.getBoundingClientRect().top : 0;
|
|
5298
|
-
|
|
5308
|
+
ws(t, n == 0 ? 0 : n - e);
|
|
5299
5309
|
}
|
|
5300
|
-
function
|
|
5310
|
+
function ws(r, e) {
|
|
5301
5311
|
for (let t = 0; t < r.length; t++) {
|
|
5302
5312
|
let { dom: n, top: i, left: s } = r[t];
|
|
5303
5313
|
n.scrollTop != i + e && (n.scrollTop = i + e), n.scrollLeft != s && (n.scrollLeft = s);
|
|
5304
5314
|
}
|
|
5305
5315
|
}
|
|
5306
|
-
let
|
|
5316
|
+
let Ue = null;
|
|
5307
5317
|
function Vl(r) {
|
|
5308
5318
|
if (r.setActive)
|
|
5309
5319
|
return r.setActive();
|
|
5310
|
-
if (
|
|
5311
|
-
return r.focus(
|
|
5320
|
+
if (Ue)
|
|
5321
|
+
return r.focus(Ue);
|
|
5312
5322
|
let e = Ss(r);
|
|
5313
|
-
r.focus(
|
|
5323
|
+
r.focus(Ue == null ? {
|
|
5314
5324
|
get preventScroll() {
|
|
5315
|
-
return
|
|
5325
|
+
return Ue = { preventScroll: !0 }, !0;
|
|
5316
5326
|
}
|
|
5317
|
-
} : void 0),
|
|
5327
|
+
} : void 0), Ue || (Ue = !1, ws(e, 0));
|
|
5318
5328
|
}
|
|
5319
|
-
function
|
|
5329
|
+
function Cs(r, e) {
|
|
5320
5330
|
let t, n = 2e8, i, s = 0, o = e.top, l = e.top, a, c;
|
|
5321
5331
|
for (let u = r.firstChild, d = 0; u; u = u.nextSibling, d++) {
|
|
5322
5332
|
let h;
|
|
@@ -5342,7 +5352,7 @@ function ws(r, e) {
|
|
|
5342
5352
|
!t && (e.left >= p.right && e.top >= p.top || e.left >= p.left && e.top >= p.bottom) && (s = d + 1);
|
|
5343
5353
|
}
|
|
5344
5354
|
}
|
|
5345
|
-
return !t && a && (t = a, i = c, n = 0), t && t.nodeType == 3 ? jl(t, i) : !t || n && t.nodeType == 1 ? { node: r, offset: s } :
|
|
5355
|
+
return !t && a && (t = a, i = c, n = 0), t && t.nodeType == 3 ? jl(t, i) : !t || n && t.nodeType == 1 ? { node: r, offset: s } : Cs(t, i);
|
|
5346
5356
|
}
|
|
5347
5357
|
function jl(r, e) {
|
|
5348
5358
|
let t = r.nodeValue.length, n = document.createRange();
|
|
@@ -5362,14 +5372,14 @@ function Hl(r, e) {
|
|
|
5362
5372
|
return t && /^li$/i.test(t.nodeName) && e.left < r.getBoundingClientRect().left ? t : r;
|
|
5363
5373
|
}
|
|
5364
5374
|
function Wl(r, e, t) {
|
|
5365
|
-
let { node: n, offset: i } =
|
|
5375
|
+
let { node: n, offset: i } = Cs(e, t), s = -1;
|
|
5366
5376
|
if (n.nodeType == 1 && !n.firstChild) {
|
|
5367
5377
|
let o = n.getBoundingClientRect();
|
|
5368
5378
|
s = o.left != o.right && t.left > (o.left + o.right) / 2 ? 1 : -1;
|
|
5369
5379
|
}
|
|
5370
5380
|
return r.docView.posFromDOM(n, i, s);
|
|
5371
5381
|
}
|
|
5372
|
-
function
|
|
5382
|
+
function ql(r, e, t, n) {
|
|
5373
5383
|
let i = -1;
|
|
5374
5384
|
for (let s = e, o = !1; s != r.dom; ) {
|
|
5375
5385
|
let l = r.docView.nearestDesc(s, !0), a;
|
|
@@ -5400,7 +5410,7 @@ function Ms(r, e, t) {
|
|
|
5400
5410
|
}
|
|
5401
5411
|
return r;
|
|
5402
5412
|
}
|
|
5403
|
-
function
|
|
5413
|
+
function Jl(r, e) {
|
|
5404
5414
|
let t = r.dom.ownerDocument, n, i = 0, s = Pl(t, e.left, e.top);
|
|
5405
5415
|
s && ({ node: n, offset: i } = s);
|
|
5406
5416
|
let o = (r.root.elementFromPoint ? r.root : t).elementFromPoint(e.left, e.top), l;
|
|
@@ -5418,7 +5428,7 @@ function ql(r, e) {
|
|
|
5418
5428
|
u.nodeName == "IMG" && (d = u.getBoundingClientRect()).right <= e.left && d.bottom > e.top && i++;
|
|
5419
5429
|
}
|
|
5420
5430
|
let c;
|
|
5421
|
-
Nt && i && n.nodeType == 1 && (c = n.childNodes[i - 1]).nodeType == 1 && c.contentEditable == "false" && c.getBoundingClientRect().top >= e.top && i--, n == r.dom && i == n.childNodes.length - 1 && n.lastChild.nodeType == 1 && e.top > n.lastChild.getBoundingClientRect().bottom ? l = r.state.doc.content.size : (i == 0 || n.nodeType != 1 || n.childNodes[i - 1].nodeName != "BR") && (l =
|
|
5431
|
+
Nt && i && n.nodeType == 1 && (c = n.childNodes[i - 1]).nodeType == 1 && c.contentEditable == "false" && c.getBoundingClientRect().top >= e.top && i--, n == r.dom && i == n.childNodes.length - 1 && n.lastChild.nodeType == 1 && e.top > n.lastChild.getBoundingClientRect().bottom ? l = r.state.doc.content.size : (i == 0 || n.nodeType != 1 || n.childNodes[i - 1].nodeName != "BR") && (l = ql(r, n, i, e));
|
|
5422
5432
|
}
|
|
5423
5433
|
l == null && (l = Wl(r, o, e));
|
|
5424
5434
|
let a = r.docView.nearestDesc(o, !0);
|
|
@@ -5840,7 +5850,7 @@ class At {
|
|
|
5840
5850
|
let f = u.focusNode.childNodes[u.focusOffset];
|
|
5841
5851
|
f && f.contentEditable == "false" && (i = !0);
|
|
5842
5852
|
}
|
|
5843
|
-
if (!(i || d && U) &&
|
|
5853
|
+
if (!(i || d && U) && We(l.node, l.offset, u.anchorNode, u.anchorOffset) && We(a.node, a.offset, u.focusNode, u.focusOffset))
|
|
5844
5854
|
return;
|
|
5845
5855
|
let h = !1;
|
|
5846
5856
|
if ((c.extend || e == t) && !d) {
|
|
@@ -5956,13 +5966,13 @@ class Xl extends At {
|
|
|
5956
5966
|
return e.type === "characterData" && e.target.nodeValue == e.oldValue;
|
|
5957
5967
|
}
|
|
5958
5968
|
}
|
|
5959
|
-
class
|
|
5969
|
+
class qe extends At {
|
|
5960
5970
|
constructor(e, t, n, i, s) {
|
|
5961
5971
|
super(e, [], n, i), this.mark = t, this.spec = s;
|
|
5962
5972
|
}
|
|
5963
5973
|
static create(e, t, n, i) {
|
|
5964
5974
|
let s = i.nodeViews[t.type.name], o = s && s(t, i, n);
|
|
5965
|
-
return (!o || !o.dom) && (o = Je.renderSpec(document, t.type.spec.toDOM(t, n), null, t.attrs)), new
|
|
5975
|
+
return (!o || !o.dom) && (o = Je.renderSpec(document, t.type.spec.toDOM(t, n), null, t.attrs)), new qe(e, t, o.dom, o.contentDOM || o.dom, o);
|
|
5966
5976
|
}
|
|
5967
5977
|
parseRule() {
|
|
5968
5978
|
return this.dirty & he || this.mark.type.spec.reparseInView ? null : { mark: this.mark.type.name, attrs: this.mark.attrs, contentElement: this.contentDOM };
|
|
@@ -5979,7 +5989,7 @@ class We extends At {
|
|
|
5979
5989
|
}
|
|
5980
5990
|
}
|
|
5981
5991
|
slice(e, t, n) {
|
|
5982
|
-
let i =
|
|
5992
|
+
let i = qe.create(this.parent, this.mark, !0, n), s = this.children, o = this.size;
|
|
5983
5993
|
t < o && (s = Gn(s, t, o, n)), e > 0 && (s = Gn(s, 0, e, n));
|
|
5984
5994
|
for (let l = 0; l < s.length; l++)
|
|
5985
5995
|
s[l].parent = i;
|
|
@@ -6058,7 +6068,7 @@ class Te extends At {
|
|
|
6058
6068
|
updateChildren(e, t) {
|
|
6059
6069
|
let n = this.node.inlineContent, i = t, s = e.composing ? this.localCompositionInfo(e, t) : null, o = s && s.pos > -1 ? s : null, l = s && s.pos < 0, a = new ea(this, o && o.node, e);
|
|
6060
6070
|
ra(this.node, this.innerDeco, (c, u, d) => {
|
|
6061
|
-
c.spec.marks ? a.syncToMarks(c.spec.marks, n, e) : c.type.side >= 0 && !d && a.syncToMarks(u == this.node.childCount ?
|
|
6071
|
+
c.spec.marks ? a.syncToMarks(c.spec.marks, n, e) : c.type.side >= 0 && !d && a.syncToMarks(u == this.node.childCount ? D.none : this.node.child(u).marks, n, e), a.placeWidget(c, e, i);
|
|
6062
6072
|
}, (c, u, d, h) => {
|
|
6063
6073
|
a.syncToMarks(c.marks, n, e);
|
|
6064
6074
|
let f;
|
|
@@ -6224,7 +6234,7 @@ function As(r, e, t) {
|
|
|
6224
6234
|
n = n.nextSibling;
|
|
6225
6235
|
} else
|
|
6226
6236
|
i = !0, r.insertBefore(l, n);
|
|
6227
|
-
if (o instanceof
|
|
6237
|
+
if (o instanceof qe) {
|
|
6228
6238
|
let a = n ? n.previousSibling : r.lastChild;
|
|
6229
6239
|
As(o.contentDOM, o.children, t), n = a ? a.nextSibling : r.firstChild;
|
|
6230
6240
|
}
|
|
@@ -6343,7 +6353,7 @@ class ea {
|
|
|
6343
6353
|
if (l > -1)
|
|
6344
6354
|
l > this.index && (this.changed = !0, this.destroyBetween(this.index, l)), this.top = this.top.children[this.index];
|
|
6345
6355
|
else {
|
|
6346
|
-
let a =
|
|
6356
|
+
let a = qe.create(this.top, e[s], t, n);
|
|
6347
6357
|
this.top.children.splice(this.index, 0, a), this.top = a, this.changed = !0;
|
|
6348
6358
|
}
|
|
6349
6359
|
this.index = 0, s++;
|
|
@@ -6436,10 +6446,10 @@ class ea {
|
|
|
6436
6446
|
// contentEditable.
|
|
6437
6447
|
addTextblockHacks() {
|
|
6438
6448
|
let e = this.top.children[this.index - 1], t = this.top;
|
|
6439
|
-
for (; e instanceof
|
|
6449
|
+
for (; e instanceof qe; )
|
|
6440
6450
|
t = e, e = t.children[t.children.length - 1];
|
|
6441
6451
|
(!e || // Empty textblock
|
|
6442
|
-
!(e instanceof an) || /\n$/.test(e.node.text) || this.view.requiresGeckoHackNode && /\s$/.test(e.node.text)) && ((U ||
|
|
6452
|
+
!(e instanceof an) || /\n$/.test(e.node.text) || this.view.requiresGeckoHackNode && /\s$/.test(e.node.text)) && ((U || q) && e && e.dom.contentEditable == "false" && this.addHackNode("IMG", t), this.addHackNode("BR", this.top));
|
|
6443
6453
|
}
|
|
6444
6454
|
addHackNode(e, t) {
|
|
6445
6455
|
if (t == this.top && this.index < t.children.length && t.children[this.index].matchesHack(e))
|
|
@@ -6462,7 +6472,7 @@ function ta(r, e) {
|
|
|
6462
6472
|
for (; ; )
|
|
6463
6473
|
if (n) {
|
|
6464
6474
|
let c = t.children[n - 1];
|
|
6465
|
-
if (c instanceof
|
|
6475
|
+
if (c instanceof qe)
|
|
6466
6476
|
t = c, n = c.children.length;
|
|
6467
6477
|
else {
|
|
6468
6478
|
l = c, n--;
|
|
@@ -6583,9 +6593,9 @@ function cr(r, e = null) {
|
|
|
6583
6593
|
for (a = o; i && !i.node; )
|
|
6584
6594
|
i = i.parent;
|
|
6585
6595
|
let d = i.node;
|
|
6586
|
-
if (i && d.isAtom &&
|
|
6596
|
+
if (i && d.isAtom && w.isSelectable(d) && i.parent && !(d.isInline && Dl(t.focusNode, t.focusOffset, i.dom))) {
|
|
6587
6597
|
let h = i.posBefore;
|
|
6588
|
-
c = new
|
|
6598
|
+
c = new w(o == h ? l : n.resolve(h));
|
|
6589
6599
|
}
|
|
6590
6600
|
} else {
|
|
6591
6601
|
if (t instanceof r.dom.ownerDocument.defaultView.Selection && t.rangeCount > 1) {
|
|
@@ -6615,9 +6625,9 @@ function Is(r) {
|
|
|
6615
6625
|
function ye(r, e = !1) {
|
|
6616
6626
|
let t = r.state.selection;
|
|
6617
6627
|
if (Ps(r, t), !!Is(r)) {
|
|
6618
|
-
if (!e && r.input.mouseDown && r.input.mouseDown.allowDefault &&
|
|
6628
|
+
if (!e && r.input.mouseDown && r.input.mouseDown.allowDefault && q) {
|
|
6619
6629
|
let n = r.domSelectionRange(), i = r.domObserver.currentSelection;
|
|
6620
|
-
if (n.anchorNode && i.anchorNode &&
|
|
6630
|
+
if (n.anchorNode && i.anchorNode && We(n.anchorNode, n.anchorOffset, i.anchorNode, i.anchorOffset)) {
|
|
6621
6631
|
r.input.mouseDown.delayedSelectionSync = !0, r.domObserver.setCurSelection();
|
|
6622
6632
|
return;
|
|
6623
6633
|
}
|
|
@@ -6631,7 +6641,7 @@ function ye(r, e = !1) {
|
|
|
6631
6641
|
r.domObserver.setCurSelection(), r.domObserver.connectSelection();
|
|
6632
6642
|
}
|
|
6633
6643
|
}
|
|
6634
|
-
const ii = U ||
|
|
6644
|
+
const ii = U || q && xs < 63;
|
|
6635
6645
|
function si(r, e) {
|
|
6636
6646
|
let { node: t, offset: n } = r.docView.domFromPos(e, 0), i = n < t.childNodes.length ? t.childNodes[n] : null, s = n ? t.childNodes[n - 1] : null;
|
|
6637
6647
|
if (U && i && i.contentEditable == "false")
|
|
@@ -6667,7 +6677,7 @@ function la(r) {
|
|
|
6667
6677
|
i ? t.setStart(n.parentNode, V(n) + 1) : t.setStart(n, 0), t.collapse(!0), e.removeAllRanges(), e.addRange(t), !i && !r.state.selection.visible && Y && Ee <= 11 && (n.disabled = !0, n.disabled = !1);
|
|
6668
6678
|
}
|
|
6669
6679
|
function Ps(r, e) {
|
|
6670
|
-
if (e instanceof
|
|
6680
|
+
if (e instanceof w) {
|
|
6671
6681
|
let t = r.docView.descAt(e.from);
|
|
6672
6682
|
t != r.lastSelectedViewDesc && (li(r), t && t.selectNode(), r.lastSelectedViewDesc = t);
|
|
6673
6683
|
} else
|
|
@@ -6694,7 +6704,7 @@ function Rs(r) {
|
|
|
6694
6704
|
}
|
|
6695
6705
|
function aa(r) {
|
|
6696
6706
|
let e = r.docView.domFromPos(r.state.selection.anchor, 0), t = r.domSelectionRange();
|
|
6697
|
-
return
|
|
6707
|
+
return We(e.node, e.offset, t.anchorNode, t.anchorOffset);
|
|
6698
6708
|
}
|
|
6699
6709
|
function _n(r, e) {
|
|
6700
6710
|
let { $anchor: t, $head: n } = r.selection, i = e > 0 ? t.max(n) : t.min(n), s = i.parent.inlineContent ? i.depth ? r.doc.resolve(e > 0 ? i.after() : i.before()) : null : i;
|
|
@@ -6715,17 +6725,17 @@ function ci(r, e, t) {
|
|
|
6715
6725
|
} else if (n.empty) {
|
|
6716
6726
|
if (r.endOfTextblock(e > 0 ? "forward" : "backward")) {
|
|
6717
6727
|
let i = _n(r.state, e);
|
|
6718
|
-
return i && i instanceof
|
|
6728
|
+
return i && i instanceof w ? ke(r, i) : !1;
|
|
6719
6729
|
} else if (!(te && t.indexOf("m") > -1)) {
|
|
6720
6730
|
let i = n.$head, s = i.textOffset ? null : e < 0 ? i.nodeBefore : i.nodeAfter, o;
|
|
6721
6731
|
if (!s || s.isText)
|
|
6722
6732
|
return !1;
|
|
6723
6733
|
let l = e < 0 ? i.pos - s.nodeSize : i.pos;
|
|
6724
|
-
return s.isAtom || (o = r.docView.descAt(l)) && !o.contentDOM ?
|
|
6734
|
+
return s.isAtom || (o = r.docView.descAt(l)) && !o.contentDOM ? w.isSelectable(s) ? ke(r, new w(e < 0 ? r.state.doc.resolve(i.pos - s.nodeSize) : i)) : Nt ? ke(r, new T(r.state.doc.resolve(e < 0 ? l : l + s.nodeSize))) : !1 : !1;
|
|
6725
6735
|
}
|
|
6726
6736
|
} else return !1;
|
|
6727
6737
|
else {
|
|
6728
|
-
if (n instanceof
|
|
6738
|
+
if (n instanceof w && n.node.isInline)
|
|
6729
6739
|
return ke(r, new T(e > 0 ? n.$to : n.$from));
|
|
6730
6740
|
{
|
|
6731
6741
|
let i = _n(r.state, e);
|
|
@@ -6740,7 +6750,7 @@ function pt(r, e) {
|
|
|
6740
6750
|
let t = r.pmViewDesc;
|
|
6741
6751
|
return t && t.size == 0 && (e < 0 || r.nextSibling || r.nodeName != "BR");
|
|
6742
6752
|
}
|
|
6743
|
-
function
|
|
6753
|
+
function Ge(r, e) {
|
|
6744
6754
|
return e < 0 ? ca(r) : ua(r);
|
|
6745
6755
|
}
|
|
6746
6756
|
function ca(r) {
|
|
@@ -6859,7 +6869,7 @@ function Yn(r, e, t) {
|
|
|
6859
6869
|
}
|
|
6860
6870
|
function ui(r, e) {
|
|
6861
6871
|
let t = r.state.doc.resolve(e);
|
|
6862
|
-
if (!(
|
|
6872
|
+
if (!(q || Rl) && t.parent.inlineContent) {
|
|
6863
6873
|
let i = r.coordsAtPos(e);
|
|
6864
6874
|
if (e > t.start()) {
|
|
6865
6875
|
let s = r.coordsAtPos(e - 1), o = (s.top + s.bottom) / 2;
|
|
@@ -6881,7 +6891,7 @@ function di(r, e, t) {
|
|
|
6881
6891
|
let { $from: i, $to: s } = n;
|
|
6882
6892
|
if (!i.parent.inlineContent || r.endOfTextblock(e < 0 ? "up" : "down")) {
|
|
6883
6893
|
let o = _n(r.state, e);
|
|
6884
|
-
if (o && o instanceof
|
|
6894
|
+
if (o && o instanceof w)
|
|
6885
6895
|
return ke(r, o);
|
|
6886
6896
|
}
|
|
6887
6897
|
if (!i.parent.inlineContent) {
|
|
@@ -6927,22 +6937,22 @@ function pa(r) {
|
|
|
6927
6937
|
function ma(r, e) {
|
|
6928
6938
|
let t = e.keyCode, n = pa(e);
|
|
6929
6939
|
if (t == 8 || te && t == 72 && n == "c")
|
|
6930
|
-
return hi(r, -1) ||
|
|
6940
|
+
return hi(r, -1) || Ge(r, -1);
|
|
6931
6941
|
if (t == 46 && !e.shiftKey || te && t == 68 && n == "c")
|
|
6932
|
-
return hi(r, 1) ||
|
|
6942
|
+
return hi(r, 1) || Ge(r, 1);
|
|
6933
6943
|
if (t == 13 || t == 27)
|
|
6934
6944
|
return !0;
|
|
6935
6945
|
if (t == 37 || te && t == 66 && n == "c") {
|
|
6936
6946
|
let i = t == 37 ? ui(r, r.state.selection.from) == "ltr" ? -1 : 1 : -1;
|
|
6937
|
-
return ci(r, i, n) ||
|
|
6947
|
+
return ci(r, i, n) || Ge(r, i);
|
|
6938
6948
|
} else if (t == 39 || te && t == 70 && n == "c") {
|
|
6939
6949
|
let i = t == 39 ? ui(r, r.state.selection.from) == "ltr" ? 1 : -1 : 1;
|
|
6940
|
-
return ci(r, i, n) ||
|
|
6950
|
+
return ci(r, i, n) || Ge(r, i);
|
|
6941
6951
|
} else {
|
|
6942
6952
|
if (t == 38 || te && t == 80 && n == "c")
|
|
6943
|
-
return di(r, -1, n) ||
|
|
6953
|
+
return di(r, -1, n) || Ge(r, -1);
|
|
6944
6954
|
if (t == 40 || te && t == 78 && n == "c")
|
|
6945
|
-
return fa(r) || di(r, 1, n) ||
|
|
6955
|
+
return fa(r) || di(r, 1, n) || Ge(r, 1);
|
|
6946
6956
|
if (n == (te ? "m" : "c") && (t == 66 || t == 73 || t == 89 || t == 90))
|
|
6947
6957
|
return !0;
|
|
6948
6958
|
}
|
|
@@ -7100,7 +7110,7 @@ function js() {
|
|
|
7100
7110
|
let Tn = null;
|
|
7101
7111
|
function ba(r) {
|
|
7102
7112
|
let e = window.trustedTypes;
|
|
7103
|
-
return e ? (Tn || (Tn = e.createPolicy("ProseMirrorClipboard", { createHTML: (t) => t })), Tn.createHTML(r)) : r;
|
|
7113
|
+
return e ? (Tn || (Tn = e.defaultPolicy || e.createPolicy("ProseMirrorClipboard", { createHTML: (t) => t })), Tn.createHTML(r)) : r;
|
|
7104
7114
|
}
|
|
7105
7115
|
function ka(r) {
|
|
7106
7116
|
let e = /^(\s*<meta [^>]*>)*/.exec(r);
|
|
@@ -7112,7 +7122,7 @@ function ka(r) {
|
|
|
7112
7122
|
return t;
|
|
7113
7123
|
}
|
|
7114
7124
|
function xa(r) {
|
|
7115
|
-
let e = r.querySelectorAll(
|
|
7125
|
+
let e = r.querySelectorAll(q ? "span:not([class]):not([style])" : "span.Apple-converted-space");
|
|
7116
7126
|
for (let t = 0; t < e.length; t++) {
|
|
7117
7127
|
let n = e[t];
|
|
7118
7128
|
n.childNodes.length == 1 && n.textContent == " " && n.parentNode && n.parentNode.replaceChild(r.ownerDocument.createTextNode(" "), n);
|
|
@@ -7136,8 +7146,8 @@ function Sa(r, e) {
|
|
|
7136
7146
|
}
|
|
7137
7147
|
return new k(i, s, o);
|
|
7138
7148
|
}
|
|
7139
|
-
const G = {}, _ = {},
|
|
7140
|
-
class
|
|
7149
|
+
const G = {}, _ = {}, wa = { touchstart: !0, touchmove: !0 };
|
|
7150
|
+
class Ca {
|
|
7141
7151
|
constructor() {
|
|
7142
7152
|
this.shiftKey = !1, this.mouseDown = null, this.lastKeyCode = null, this.lastKeyCodeTime = 0, this.lastClick = { time: 0, x: 0, y: 0, type: "" }, this.lastSelectionOrigin = null, this.lastSelectionTime = 0, this.lastIOSEnter = 0, this.lastIOSEnterFallbackTimeout = -1, this.lastFocus = 0, this.lastTouch = 0, this.lastChromeDelete = 0, this.composing = !1, this.compositionNode = null, this.composingTimeout = -1, this.compositionNodes = [], this.compositionEndedAt = -2e8, this.compositionID = 1, this.compositionPendingChanges = 0, this.domChangeCount = 0, this.eventHandlers = /* @__PURE__ */ Object.create(null), this.hideSelectionGuard = null;
|
|
7143
7153
|
}
|
|
@@ -7147,7 +7157,7 @@ function Ma(r) {
|
|
|
7147
7157
|
let t = G[e];
|
|
7148
7158
|
r.dom.addEventListener(e, r.input.eventHandlers[e] = (n) => {
|
|
7149
7159
|
Ta(r, n) && !hr(r, n) && (r.editable || !(n.type in _)) && t(r, n);
|
|
7150
|
-
},
|
|
7160
|
+
}, wa[e] ? { passive: !0 } : void 0);
|
|
7151
7161
|
}
|
|
7152
7162
|
U && r.dom.addEventListener("input", () => null), Zn(r);
|
|
7153
7163
|
}
|
|
@@ -7187,7 +7197,7 @@ function Oa(r, e) {
|
|
|
7187
7197
|
}
|
|
7188
7198
|
_.keydown = (r, e) => {
|
|
7189
7199
|
let t = e;
|
|
7190
|
-
if (r.input.shiftKey = t.keyCode == 16 || t.shiftKey, !Ws(r, t) && (r.input.lastKeyCode = t.keyCode, r.input.lastKeyCodeTime = Date.now(), !(me &&
|
|
7200
|
+
if (r.input.shiftKey = t.keyCode == 16 || t.shiftKey, !Ws(r, t) && (r.input.lastKeyCode = t.keyCode, r.input.lastKeyCodeTime = Date.now(), !(me && q && t.keyCode == 13)))
|
|
7191
7201
|
if (t.keyCode != 229 && r.domObserver.forceFlush(), rt && t.keyCode == 13 && !t.ctrlKey && !t.altKey && !t.metaKey) {
|
|
7192
7202
|
let n = Date.now();
|
|
7193
7203
|
r.input.lastIOSEnter = n, r.input.lastIOSEnterFallbackTimeout = setTimeout(() => {
|
|
@@ -7228,7 +7238,7 @@ function fr(r, e, t, n, i) {
|
|
|
7228
7238
|
return !0;
|
|
7229
7239
|
return !1;
|
|
7230
7240
|
}
|
|
7231
|
-
function
|
|
7241
|
+
function et(r, e, t) {
|
|
7232
7242
|
if (r.focused || r.focus(), r.state.selection.eq(e))
|
|
7233
7243
|
return;
|
|
7234
7244
|
let n = r.state.tr.setSelection(e);
|
|
@@ -7238,22 +7248,22 @@ function Aa(r, e) {
|
|
|
7238
7248
|
if (e == -1)
|
|
7239
7249
|
return !1;
|
|
7240
7250
|
let t = r.state.doc.resolve(e), n = t.nodeAfter;
|
|
7241
|
-
return n && n.isAtom &&
|
|
7251
|
+
return n && n.isAtom && w.isSelectable(n) ? (et(r, new w(t)), !0) : !1;
|
|
7242
7252
|
}
|
|
7243
7253
|
function va(r, e) {
|
|
7244
7254
|
if (e == -1)
|
|
7245
7255
|
return !1;
|
|
7246
7256
|
let t = r.state.selection, n, i;
|
|
7247
|
-
t instanceof
|
|
7257
|
+
t instanceof w && (n = t.node);
|
|
7248
7258
|
let s = r.state.doc.resolve(e);
|
|
7249
7259
|
for (let o = s.depth + 1; o > 0; o--) {
|
|
7250
7260
|
let l = o > s.depth ? s.nodeAfter : s.node(o);
|
|
7251
|
-
if (
|
|
7261
|
+
if (w.isSelectable(l)) {
|
|
7252
7262
|
n && t.$from.depth > 0 && o >= t.$from.depth && s.before(t.$from.depth + 1) == t.$from.pos ? i = s.before(t.$from.depth) : i = s.before(o);
|
|
7253
7263
|
break;
|
|
7254
7264
|
}
|
|
7255
7265
|
}
|
|
7256
|
-
return i != null ? (
|
|
7266
|
+
return i != null ? (et(r, w.create(r.state.doc, i)), !0) : !1;
|
|
7257
7267
|
}
|
|
7258
7268
|
function Da(r, e, t, n, i) {
|
|
7259
7269
|
return fr(r, "handleClickOn", e, t, n) || r.someProp("handleClick", (s) => s(r, e, n)) || (i ? va(r, t) : Aa(r, t));
|
|
@@ -7269,14 +7279,14 @@ function Ra(r, e, t) {
|
|
|
7269
7279
|
return !1;
|
|
7270
7280
|
let n = r.state.doc;
|
|
7271
7281
|
if (e == -1)
|
|
7272
|
-
return n.inlineContent ? (
|
|
7282
|
+
return n.inlineContent ? (et(r, T.create(n, 0, n.content.size)), !0) : !1;
|
|
7273
7283
|
let i = n.resolve(e);
|
|
7274
7284
|
for (let s = i.depth + 1; s > 0; s--) {
|
|
7275
7285
|
let o = s > i.depth ? i.nodeAfter : i.node(s), l = i.before(s);
|
|
7276
7286
|
if (o.inlineContent)
|
|
7277
|
-
|
|
7278
|
-
else if (
|
|
7279
|
-
|
|
7287
|
+
et(r, T.create(n, l + 1, l + 1 + o.content.size));
|
|
7288
|
+
else if (w.isSelectable(o))
|
|
7289
|
+
et(r, w.create(n, l));
|
|
7280
7290
|
else
|
|
7281
7291
|
continue;
|
|
7282
7292
|
return !0;
|
|
@@ -7307,7 +7317,7 @@ class Ba {
|
|
|
7307
7317
|
const l = i ? null : n.target, a = l ? e.docView.nearestDesc(l, !0) : null;
|
|
7308
7318
|
this.target = a && a.dom.nodeType == 1 ? a.dom : null;
|
|
7309
7319
|
let { selection: c } = e.state;
|
|
7310
|
-
(n.button == 0 && s.type.spec.draggable && s.type.spec.selectable !== !1 || c instanceof
|
|
7320
|
+
(n.button == 0 && s.type.spec.draggable && s.type.spec.selectable !== !1 || c instanceof w && c.from <= o && c.to > o) && (this.mightDrag = {
|
|
7311
7321
|
node: s,
|
|
7312
7322
|
pos: o,
|
|
7313
7323
|
addAttr: !!(this.target && !this.target.draggable),
|
|
@@ -7331,7 +7341,7 @@ class Ba {
|
|
|
7331
7341
|
// (hidden) cursor is doesn't change the selection, and
|
|
7332
7342
|
// thus doesn't get a reaction from ProseMirror. This
|
|
7333
7343
|
// works around that.
|
|
7334
|
-
|
|
7344
|
+
q && !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) ? (et(this.view, O.near(this.view.state.doc.resolve(t.pos))), e.preventDefault()) : Me(this.view, "pointer");
|
|
7335
7345
|
}
|
|
7336
7346
|
move(e) {
|
|
7337
7347
|
this.updateAllowDefault(e), Me(this.view, "pointer"), e.buttons == 0 && this.done();
|
|
@@ -7373,15 +7383,15 @@ _.compositionstart = _.compositionupdate = (r) => {
|
|
|
7373
7383
|
}
|
|
7374
7384
|
r.input.composing = !0;
|
|
7375
7385
|
}
|
|
7376
|
-
|
|
7386
|
+
qs(r, za);
|
|
7377
7387
|
};
|
|
7378
7388
|
_.compositionend = (r, e) => {
|
|
7379
|
-
r.composing && (r.input.composing = !1, r.input.compositionEndedAt = e.timeStamp, r.input.compositionPendingChanges = r.domObserver.pendingRecords().length ? r.input.compositionID : 0, r.input.compositionNode = null, r.input.compositionPendingChanges && Promise.resolve().then(() => r.domObserver.flush()), r.input.compositionID++,
|
|
7389
|
+
r.composing && (r.input.composing = !1, r.input.compositionEndedAt = e.timeStamp, r.input.compositionPendingChanges = r.domObserver.pendingRecords().length ? r.input.compositionID : 0, r.input.compositionNode = null, r.input.compositionPendingChanges && Promise.resolve().then(() => r.domObserver.flush()), r.input.compositionID++, qs(r, 20));
|
|
7380
7390
|
};
|
|
7381
|
-
function
|
|
7391
|
+
function qs(r, e) {
|
|
7382
7392
|
clearTimeout(r.input.composingTimeout), e > -1 && (r.input.composingTimeout = setTimeout(() => Yt(r), e));
|
|
7383
7393
|
}
|
|
7384
|
-
function
|
|
7394
|
+
function Js(r) {
|
|
7385
7395
|
for (r.composing && (r.input.composing = !1, r.input.compositionEndedAt = La()); r.input.compositionNodes.length > 0; )
|
|
7386
7396
|
r.input.compositionNodes.pop().markParentsDirty();
|
|
7387
7397
|
}
|
|
@@ -7410,7 +7420,7 @@ function La() {
|
|
|
7410
7420
|
}
|
|
7411
7421
|
function Yt(r, e = !1) {
|
|
7412
7422
|
if (!(me && r.domObserver.flushingSoon >= 0)) {
|
|
7413
|
-
if (r.domObserver.forceFlush(),
|
|
7423
|
+
if (r.domObserver.forceFlush(), Js(r), e || r.docView && r.docView.dirty) {
|
|
7414
7424
|
let t = cr(r);
|
|
7415
7425
|
return t && !t.eq(r.state.selection) ? r.dispatch(r.state.tr.setSelection(t)) : (r.markCursor || e) && !r.state.selection.empty ? r.dispatch(r.state.tr.deleteSelection()) : r.updateState(r.state), !0;
|
|
7416
7426
|
}
|
|
@@ -7486,16 +7496,16 @@ G.dragstart = (r, e) => {
|
|
|
7486
7496
|
if (n && n.done(), !t.dataTransfer)
|
|
7487
7497
|
return;
|
|
7488
7498
|
let i = r.state.selection, s = i.empty ? null : r.posAtCoords(cn(t)), o;
|
|
7489
|
-
if (!(s && s.pos >= i.from && s.pos <= (i instanceof
|
|
7499
|
+
if (!(s && s.pos >= i.from && s.pos <= (i instanceof w ? i.to - 1 : i.to))) {
|
|
7490
7500
|
if (n && n.mightDrag)
|
|
7491
|
-
o =
|
|
7501
|
+
o = w.create(r.state.doc, n.mightDrag.pos);
|
|
7492
7502
|
else if (t.target && t.target.nodeType == 1) {
|
|
7493
7503
|
let d = r.docView.nearestDesc(t.target, !0);
|
|
7494
|
-
d && d.node.type.spec.draggable && d != r.docView && (o =
|
|
7504
|
+
d && d.node.type.spec.draggable && d != r.docView && (o = w.create(r.state.doc, d.posBefore));
|
|
7495
7505
|
}
|
|
7496
7506
|
}
|
|
7497
7507
|
let l = (o || r.state.selection).content(), { dom: a, text: c, slice: u } = dr(r, l);
|
|
7498
|
-
(!t.dataTransfer.files.length || !
|
|
7508
|
+
(!t.dataTransfer.files.length || !q || xs > 120) && t.dataTransfer.clearData(), t.dataTransfer.setData(xt ? "Text" : "text/html", a.innerHTML), t.dataTransfer.effectAllowed = "copyMove", xt || t.dataTransfer.setData("text/plain", c), r.dragging = new Us(u, Gs(r, t), o);
|
|
7499
7509
|
};
|
|
7500
7510
|
G.dragend = (r) => {
|
|
7501
7511
|
let e = r.dragging;
|
|
@@ -7534,8 +7544,8 @@ _.drop = (r, e) => {
|
|
|
7534
7544
|
if (d ? c.replaceRangeWith(u, u, o.content.firstChild) : c.replaceRange(u, u, o), c.doc.eq(h))
|
|
7535
7545
|
return;
|
|
7536
7546
|
let f = c.doc.resolve(u);
|
|
7537
|
-
if (d &&
|
|
7538
|
-
c.setSelection(new
|
|
7547
|
+
if (d && w.isSelectable(o.content.firstChild) && f.nodeAfter && f.nodeAfter.sameMarkup(o.content.firstChild))
|
|
7548
|
+
c.setSelection(new w(f));
|
|
7539
7549
|
else {
|
|
7540
7550
|
let p = c.mapping.map(a);
|
|
7541
7551
|
c.mapping.maps[c.mapping.maps.length - 1].forEach((m, g, y, S) => p = S), c.setSelection(ur(r, f, c.doc.resolve(p)));
|
|
@@ -7552,7 +7562,7 @@ G.blur = (r, e) => {
|
|
|
7552
7562
|
r.focused && (r.domObserver.stop(), r.dom.classList.remove("ProseMirror-focused"), r.domObserver.start(), t.relatedTarget && r.dom.contains(t.relatedTarget) && r.domObserver.currentSelection.clear(), r.focused = !1);
|
|
7553
7563
|
};
|
|
7554
7564
|
G.beforeinput = (r, e) => {
|
|
7555
|
-
if (
|
|
7565
|
+
if (q && me && e.inputType == "deleteContentBackward") {
|
|
7556
7566
|
r.domObserver.flushSoon();
|
|
7557
7567
|
let { domChangeCount: n } = r.input;
|
|
7558
7568
|
setTimeout(() => {
|
|
@@ -7565,7 +7575,7 @@ G.beforeinput = (r, e) => {
|
|
|
7565
7575
|
};
|
|
7566
7576
|
for (let r in _)
|
|
7567
7577
|
G[r] = _[r];
|
|
7568
|
-
function
|
|
7578
|
+
function wt(r, e) {
|
|
7569
7579
|
if (r == e)
|
|
7570
7580
|
return !0;
|
|
7571
7581
|
for (let t in r)
|
|
@@ -7588,7 +7598,7 @@ class Xt {
|
|
|
7588
7598
|
return !0;
|
|
7589
7599
|
}
|
|
7590
7600
|
eq(e) {
|
|
7591
|
-
return this == e || e instanceof Xt && (this.spec.key && this.spec.key == e.spec.key || this.toDOM == e.toDOM &&
|
|
7601
|
+
return this == e || e instanceof Xt && (this.spec.key && this.spec.key == e.spec.key || this.toDOM == e.toDOM && wt(this.spec, e.spec));
|
|
7592
7602
|
}
|
|
7593
7603
|
destroy(e) {
|
|
7594
7604
|
this.spec.destroy && this.spec.destroy(e);
|
|
@@ -7606,7 +7616,7 @@ class Oe {
|
|
|
7606
7616
|
return t.from < t.to;
|
|
7607
7617
|
}
|
|
7608
7618
|
eq(e) {
|
|
7609
|
-
return this == e || e instanceof Oe &&
|
|
7619
|
+
return this == e || e instanceof Oe && wt(this.attrs, e.attrs) && wt(this.spec, e.spec);
|
|
7610
7620
|
}
|
|
7611
7621
|
static is(e) {
|
|
7612
7622
|
return e.type instanceof Oe;
|
|
@@ -7630,7 +7640,7 @@ class mr {
|
|
|
7630
7640
|
return i == t.from && !(s = e.child(n)).isText && i + s.nodeSize == t.to;
|
|
7631
7641
|
}
|
|
7632
7642
|
eq(e) {
|
|
7633
|
-
return this == e || e instanceof mr &&
|
|
7643
|
+
return this == e || e instanceof mr && wt(this.attrs, e.attrs) && wt(this.spec, e.spec);
|
|
7634
7644
|
}
|
|
7635
7645
|
destroy() {
|
|
7636
7646
|
}
|
|
@@ -7706,13 +7716,13 @@ class re {
|
|
|
7706
7716
|
return this.type instanceof Xt;
|
|
7707
7717
|
}
|
|
7708
7718
|
}
|
|
7709
|
-
const
|
|
7719
|
+
const Ye = [], Le = {};
|
|
7710
7720
|
class B {
|
|
7711
7721
|
/**
|
|
7712
7722
|
@internal
|
|
7713
7723
|
*/
|
|
7714
7724
|
constructor(e, t) {
|
|
7715
|
-
this.local = e.length ? e :
|
|
7725
|
+
this.local = e.length ? e : Ye, this.children = t.length ? t : Ye;
|
|
7716
7726
|
}
|
|
7717
7727
|
/**
|
|
7718
7728
|
Create a set of decorations, using the structure of the given
|
|
@@ -7761,7 +7771,7 @@ class B {
|
|
|
7761
7771
|
let a = this.local[l].map(e, n, i);
|
|
7762
7772
|
a && a.type.valid(t, a) ? (o || (o = [])).push(a) : s.onRemove && s.onRemove(this.local[l].spec);
|
|
7763
7773
|
}
|
|
7764
|
-
return this.children.length ? Wa(this.children, o || [], e, t, n, i, s) : o ? new B(o.sort($e),
|
|
7774
|
+
return this.children.length ? Wa(this.children, o || [], e, t, n, i, s) : o ? new B(o.sort($e), Ye) : W;
|
|
7765
7775
|
}
|
|
7766
7776
|
/**
|
|
7767
7777
|
Add the given array of decorations to the ones in the set,
|
|
@@ -7834,7 +7844,7 @@ class B {
|
|
|
7834
7844
|
}
|
|
7835
7845
|
}
|
|
7836
7846
|
if (i) {
|
|
7837
|
-
let l = new B(i.sort($e),
|
|
7847
|
+
let l = new B(i.sort($e), Ye);
|
|
7838
7848
|
return n ? new Se([l, n]) : l;
|
|
7839
7849
|
}
|
|
7840
7850
|
return n || W;
|
|
@@ -7866,7 +7876,7 @@ class B {
|
|
|
7866
7876
|
*/
|
|
7867
7877
|
localsInner(e) {
|
|
7868
7878
|
if (this == W)
|
|
7869
|
-
return
|
|
7879
|
+
return Ye;
|
|
7870
7880
|
if (e.inlineContent || !this.local.some(Oe.is))
|
|
7871
7881
|
return this.local;
|
|
7872
7882
|
let t = [];
|
|
@@ -7920,7 +7930,7 @@ class Se {
|
|
|
7920
7930
|
t.push(s[o]);
|
|
7921
7931
|
}
|
|
7922
7932
|
}
|
|
7923
|
-
return t ? gr(n ? t : t.sort($e)) :
|
|
7933
|
+
return t ? gr(n ? t : t.sort($e)) : Ye;
|
|
7924
7934
|
}
|
|
7925
7935
|
// Create a group for the given array of decoration sets, or return
|
|
7926
7936
|
// a single set when possible.
|
|
@@ -7949,8 +7959,8 @@ function Wa(r, e, t, n, i, s, o) {
|
|
|
7949
7959
|
let S = l[y + 1];
|
|
7950
7960
|
if (S < 0 || h > S + u - d)
|
|
7951
7961
|
continue;
|
|
7952
|
-
let
|
|
7953
|
-
f >=
|
|
7962
|
+
let C = l[y] + u - d;
|
|
7963
|
+
f >= C ? l[y + 1] = h <= C ? -2 : -1 : h >= u && g && (l[y] += g, l[y + 1] += g);
|
|
7954
7964
|
}
|
|
7955
7965
|
d += g;
|
|
7956
7966
|
}), u = t.maps[c].map(u, -1);
|
|
@@ -7975,7 +7985,7 @@ function Wa(r, e, t, n, i, s, o) {
|
|
|
7975
7985
|
a = !0;
|
|
7976
7986
|
}
|
|
7977
7987
|
if (a) {
|
|
7978
|
-
let c =
|
|
7988
|
+
let c = qa(l, r, e, t, i, s, o), u = Zt(c, n, 0, o);
|
|
7979
7989
|
e = u.local;
|
|
7980
7990
|
for (let d = 0; d < l.length; d += 3)
|
|
7981
7991
|
l[d + 1] < 0 && (l.splice(d, 3), d -= 3);
|
|
@@ -7998,7 +8008,7 @@ function _s(r, e) {
|
|
|
7998
8008
|
}
|
|
7999
8009
|
return t;
|
|
8000
8010
|
}
|
|
8001
|
-
function
|
|
8011
|
+
function qa(r, e, t, n, i, s, o) {
|
|
8002
8012
|
function l(a, c) {
|
|
8003
8013
|
for (let u = 0; u < a.local.length; u++) {
|
|
8004
8014
|
let d = a.local[u].map(n, i, c);
|
|
@@ -8073,7 +8083,7 @@ function On(r) {
|
|
|
8073
8083
|
n && n != W && e.push(n);
|
|
8074
8084
|
}), r.cursorWrapper && e.push(B.create(r.state.doc, [r.cursorWrapper.deco])), Se.from(e);
|
|
8075
8085
|
}
|
|
8076
|
-
const
|
|
8086
|
+
const Ja = {
|
|
8077
8087
|
childList: !0,
|
|
8078
8088
|
characterData: !0,
|
|
8079
8089
|
characterDataOldValue: !0,
|
|
@@ -8114,7 +8124,7 @@ class Ga {
|
|
|
8114
8124
|
this.flushingSoon > -1 && (window.clearTimeout(this.flushingSoon), this.flushingSoon = -1, this.flush());
|
|
8115
8125
|
}
|
|
8116
8126
|
start() {
|
|
8117
|
-
this.observer && (this.observer.takeRecords(), this.observer.observe(this.view.dom,
|
|
8127
|
+
this.observer && (this.observer.takeRecords(), this.observer.observe(this.view.dom, Ja)), this.onCharData && this.view.dom.addEventListener("DOMCharacterDataModified", this.onCharData), this.connectSelection();
|
|
8118
8128
|
}
|
|
8119
8129
|
stop() {
|
|
8120
8130
|
if (this.observer) {
|
|
@@ -8143,7 +8153,7 @@ class Ga {
|
|
|
8143
8153
|
return ye(this.view);
|
|
8144
8154
|
if (Y && Ee <= 11 && !this.view.state.selection.empty) {
|
|
8145
8155
|
let e = this.view.domSelectionRange();
|
|
8146
|
-
if (e.focusNode &&
|
|
8156
|
+
if (e.focusNode && We(e.focusNode, e.focusOffset, e.anchorNode, e.anchorOffset))
|
|
8147
8157
|
return this.flushSoon();
|
|
8148
8158
|
}
|
|
8149
8159
|
this.flush();
|
|
@@ -8247,7 +8257,7 @@ function _a(r) {
|
|
|
8247
8257
|
}
|
|
8248
8258
|
function ki(r, e) {
|
|
8249
8259
|
let t = e.startContainer, n = e.startOffset, i = e.endContainer, s = e.endOffset, o = r.domAtPos(r.state.selection.anchor);
|
|
8250
|
-
return
|
|
8260
|
+
return We(o.node, o.offset, i, s) && ([t, n, i, s] = [i, s, t, n]), { anchorNode: t, anchorOffset: n, focusNode: i, focusOffset: s };
|
|
8251
8261
|
}
|
|
8252
8262
|
function Ya(r, e) {
|
|
8253
8263
|
if (e.getComposedRanges) {
|
|
@@ -8271,7 +8281,7 @@ function Xa(r, e) {
|
|
|
8271
8281
|
}
|
|
8272
8282
|
function Za(r, e, t) {
|
|
8273
8283
|
let { node: n, fromOffset: i, toOffset: s, from: o, to: l } = r.docView.parseRange(e, t), a = r.domSelectionRange(), c, u = a.anchorNode;
|
|
8274
|
-
if (u && r.dom.contains(u.nodeType == 1 ? u : u.parentNode) && (c = [{ node: u, offset: a.anchorOffset }], ln(a) || c.push({ node: a.focusNode, offset: a.focusOffset })),
|
|
8284
|
+
if (u && r.dom.contains(u.nodeType == 1 ? u : u.parentNode) && (c = [{ node: u, offset: a.anchorOffset }], ln(a) || c.push({ node: a.focusNode, offset: a.focusOffset })), q && r.input.lastKeyCode === 8)
|
|
8275
8285
|
for (let g = s; g > i; g--) {
|
|
8276
8286
|
let y = n.childNodes[g - 1], S = y.pmViewDesc;
|
|
8277
8287
|
if (y.nodeName == "BR" && !S) {
|
|
@@ -8318,7 +8328,7 @@ function tc(r, e, t, n, i) {
|
|
|
8318
8328
|
if (r.input.compositionPendingChanges = 0, e < 0) {
|
|
8319
8329
|
let E = r.input.lastSelectionTime > Date.now() - 50 ? r.input.lastSelectionOrigin : null, ee = cr(r, E);
|
|
8320
8330
|
if (ee && !r.state.selection.eq(ee)) {
|
|
8321
|
-
if (
|
|
8331
|
+
if (q && me && r.input.lastKeyCode === 13 && Date.now() - 100 < r.input.lastKeyCodeTime && r.someProp("handleKeyDown", (Ao) => Ao(r, De(13, "Enter"))))
|
|
8322
8332
|
return;
|
|
8323
8333
|
let Dt = r.state.tr.setSelection(ee);
|
|
8324
8334
|
E == "pointer" ? Dt.setMeta("pointer", !0) : E == "key" && Dt.scrollIntoView(), s && Dt.setMeta("composition", s), r.dispatch(Dt);
|
|
@@ -8348,39 +8358,39 @@ function tc(r, e, t, n, i) {
|
|
|
8348
8358
|
return;
|
|
8349
8359
|
}
|
|
8350
8360
|
r.state.selection.from < r.state.selection.to && p.start == p.endB && r.state.selection instanceof T && (p.start > r.state.selection.from && p.start <= r.state.selection.from + 2 && r.state.selection.from >= c.from ? p.start = r.state.selection.from : p.endA < r.state.selection.to && p.endA >= r.state.selection.to - 2 && r.state.selection.to <= c.to && (p.endB += r.state.selection.to - p.endA, p.endA = r.state.selection.to)), Y && Ee <= 11 && p.endB == p.start + 1 && p.endA == p.start && p.start > c.from && c.doc.textBetween(p.start - c.from - 1, p.start - c.from + 1) == " " && (p.start--, p.endA--, p.endB--);
|
|
8351
|
-
let m = c.doc.resolveNoCache(p.start - c.from), g = c.doc.resolveNoCache(p.endB - c.from), y = u.resolve(p.start), S = m.sameParent(g) && m.parent.inlineContent && y.end() >= p.endA,
|
|
8352
|
-
if ((rt && r.input.lastIOSEnter > Date.now() - 225 && (!S || i.some((E) => E.nodeName == "DIV" || E.nodeName == "P")) || !S && m.pos < c.doc.content.size && (!m.sameParent(g) || !m.parent.inlineContent) && (
|
|
8361
|
+
let m = c.doc.resolveNoCache(p.start - c.from), g = c.doc.resolveNoCache(p.endB - c.from), y = u.resolve(p.start), S = m.sameParent(g) && m.parent.inlineContent && y.end() >= p.endA, C;
|
|
8362
|
+
if ((rt && r.input.lastIOSEnter > Date.now() - 225 && (!S || i.some((E) => E.nodeName == "DIV" || E.nodeName == "P")) || !S && m.pos < c.doc.content.size && (!m.sameParent(g) || !m.parent.inlineContent) && !/\S/.test(c.doc.textBetween(m.pos, g.pos, "", "")) && (C = O.findFrom(c.doc.resolve(m.pos + 1), 1, !0)) && C.head > m.pos) && r.someProp("handleKeyDown", (E) => E(r, De(13, "Enter")))) {
|
|
8353
8363
|
r.input.lastIOSEnter = 0;
|
|
8354
8364
|
return;
|
|
8355
8365
|
}
|
|
8356
8366
|
if (r.state.selection.anchor > p.start && rc(u, p.start, p.endA, m, g) && r.someProp("handleKeyDown", (E) => E(r, De(8, "Backspace")))) {
|
|
8357
|
-
me &&
|
|
8367
|
+
me && q && r.domObserver.suppressSelectionUpdates();
|
|
8358
8368
|
return;
|
|
8359
8369
|
}
|
|
8360
|
-
|
|
8370
|
+
q && p.endB == p.start && (r.input.lastChromeDelete = Date.now()), me && !S && m.start() != g.start() && g.parentOffset == 0 && m.depth == g.depth && c.sel && c.sel.anchor == c.sel.head && c.sel.head == p.endA && (p.endB -= 2, g = c.doc.resolveNoCache(p.endB - c.from), setTimeout(() => {
|
|
8361
8371
|
r.someProp("handleKeyDown", function(E) {
|
|
8362
8372
|
return E(r, De(13, "Enter"));
|
|
8363
8373
|
});
|
|
8364
8374
|
}, 20));
|
|
8365
|
-
let
|
|
8375
|
+
let v = p.start, A = p.endA, M, I, H;
|
|
8366
8376
|
if (S) {
|
|
8367
8377
|
if (m.pos == g.pos)
|
|
8368
|
-
Y && Ee <= 11 && m.parentOffset == 0 && (r.domObserver.suppressSelectionUpdates(), setTimeout(() => ye(r), 20)), M = r.state.tr.delete(
|
|
8378
|
+
Y && Ee <= 11 && m.parentOffset == 0 && (r.domObserver.suppressSelectionUpdates(), setTimeout(() => ye(r), 20)), M = r.state.tr.delete(v, A), I = u.resolve(p.start).marksAcross(u.resolve(p.endA));
|
|
8369
8379
|
else if (
|
|
8370
8380
|
// Adding or removing a mark
|
|
8371
8381
|
p.endA == p.endB && (H = nc(m.parent.content.cut(m.parentOffset, g.parentOffset), y.parent.content.cut(y.parentOffset, p.endA - y.start())))
|
|
8372
8382
|
)
|
|
8373
|
-
M = r.state.tr, H.type == "add" ? M.addMark(
|
|
8383
|
+
M = r.state.tr, H.type == "add" ? M.addMark(v, A, H.mark) : M.removeMark(v, A, H.mark);
|
|
8374
8384
|
else if (m.parent.child(m.index()).isText && m.index() == g.index() - (g.textOffset ? 0 : 1)) {
|
|
8375
8385
|
let E = m.parent.textBetween(m.parentOffset, g.parentOffset);
|
|
8376
|
-
if (r.someProp("handleTextInput", (ee) => ee(r,
|
|
8386
|
+
if (r.someProp("handleTextInput", (ee) => ee(r, v, A, E)))
|
|
8377
8387
|
return;
|
|
8378
|
-
M = r.state.tr.insertText(E,
|
|
8388
|
+
M = r.state.tr.insertText(E, v, A);
|
|
8379
8389
|
}
|
|
8380
8390
|
}
|
|
8381
|
-
if (M || (M = r.state.tr.replace(
|
|
8391
|
+
if (M || (M = r.state.tr.replace(v, A, c.doc.slice(p.start - c.from, p.endB - c.from))), c.sel) {
|
|
8382
8392
|
let E = xi(r, M.doc, c.sel);
|
|
8383
|
-
E && !(
|
|
8393
|
+
E && !(q && r.composing && E.empty && (p.start != p.endB || r.input.lastChromeDelete < Date.now() - 100) && (E.head == v || E.head == M.mapping.map(A) - 1) || Y && E.empty && E.head == v) && M.setSelection(E);
|
|
8384
8394
|
}
|
|
8385
8395
|
I && M.ensureMarks(I), s && M.setMeta("composition", s), r.dispatch(M.scrollIntoView());
|
|
8386
8396
|
}
|
|
@@ -8466,7 +8476,7 @@ class sc {
|
|
|
8466
8476
|
added to the document.
|
|
8467
8477
|
*/
|
|
8468
8478
|
constructor(e, t) {
|
|
8469
|
-
this._root = null, this.focused = !1, this.trackWrites = null, this.mounted = !1, this.markCursor = null, this.cursorWrapper = null, this.lastSelectedViewDesc = void 0, this.input = new
|
|
8479
|
+
this._root = null, this.focused = !1, this.trackWrites = null, this.mounted = !1, this.markCursor = null, this.cursorWrapper = null, this.lastSelectedViewDesc = void 0, this.input = new Ca(), this.prevDirectPlugins = [], this.pluginViews = [], this.requiresGeckoHackNode = !1, this.dragging = null, this._props = t, this.state = t.state, this.directPlugins = t.plugins || [], this.directPlugins.forEach(Ti), 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 = Mi(this), Ci(this), this.nodeViews = Ei(this), this.docView = ni(this.state.doc, wi(this), On(this), this.dom, this), this.domObserver = new Ga(this, (n, i, s, o) => tc(this, n, i, s, o)), this.domObserver.start(), Ma(this), this.updatePluginViews();
|
|
8470
8480
|
}
|
|
8471
8481
|
/**
|
|
8472
8482
|
Holds `true` when a
|
|
@@ -8522,21 +8532,21 @@ class sc {
|
|
|
8522
8532
|
updateStateInner(e, t) {
|
|
8523
8533
|
var n;
|
|
8524
8534
|
let i = this.state, s = !1, o = !1;
|
|
8525
|
-
e.storedMarks && this.composing && (
|
|
8535
|
+
e.storedMarks && this.composing && (Js(this), o = !0), this.state = e;
|
|
8526
8536
|
let l = i.plugins != e.plugins || this._props.plugins != t.plugins;
|
|
8527
8537
|
if (l || this._props.plugins != t.plugins || this._props.nodeViews != t.nodeViews) {
|
|
8528
8538
|
let f = Ei(this);
|
|
8529
8539
|
lc(f, this.nodeViews) && (this.nodeViews = f, s = !0);
|
|
8530
8540
|
}
|
|
8531
|
-
(l || t.handleDOMEvents != this._props.handleDOMEvents) && Zn(this), this.editable = Mi(this),
|
|
8532
|
-
let a = On(this), c =
|
|
8541
|
+
(l || t.handleDOMEvents != this._props.handleDOMEvents) && Zn(this), this.editable = Mi(this), Ci(this);
|
|
8542
|
+
let a = On(this), c = wi(this), u = i.plugins != e.plugins && !i.doc.eq(e.doc) ? "reset" : e.scrollToSelection > i.scrollToSelection ? "to selection" : "preserve", d = s || !this.docView.matchesNode(e.doc, c, a);
|
|
8533
8543
|
(d || !e.selection.eq(i.selection)) && (o = !0);
|
|
8534
8544
|
let h = u == "preserve" && o && this.dom.style.overflowAnchor == null && Ll(this);
|
|
8535
8545
|
if (o) {
|
|
8536
8546
|
this.domObserver.stop();
|
|
8537
|
-
let f = d && (Y ||
|
|
8547
|
+
let f = d && (Y || q) && !this.composing && !i.selection.empty && !e.selection.empty && oc(i.selection, e.selection);
|
|
8538
8548
|
if (d) {
|
|
8539
|
-
let p =
|
|
8549
|
+
let p = q ? this.trackWrites = this.domSelectionRange().focusNode : null;
|
|
8540
8550
|
this.composing && (this.input.compositionNode = Fa(this)), (s || !this.docView.update(e.doc, c, a, this)) && (this.docView.updateOuterDeco(c), this.docView.destroy(), this.docView = ni(e.doc, c, a, this.dom, this)), p && !this.trackWrites && (f = !0);
|
|
8541
8551
|
}
|
|
8542
8552
|
f || !(this.input.mouseDown && this.domObserver.currentSelection.eq(this.domSelectionRange()) && aa(this)) ? ye(this, f) : (Ps(this, e.selection), this.domObserver.setCurSelection()), this.domObserver.start();
|
|
@@ -8549,7 +8559,7 @@ class sc {
|
|
|
8549
8559
|
scrollToSelection() {
|
|
8550
8560
|
let e = this.domSelectionRange().focusNode;
|
|
8551
8561
|
if (!(!e || !this.dom.contains(e.nodeType == 1 ? e : e.parentNode))) {
|
|
8552
|
-
if (!this.someProp("handleScrollToSelection", (t) => t(this))) if (this.state.selection instanceof
|
|
8562
|
+
if (!this.someProp("handleScrollToSelection", (t) => t(this))) if (this.state.selection instanceof w) {
|
|
8553
8563
|
let t = this.docView.domAfterPos(this.state.selection.from);
|
|
8554
8564
|
t.nodeType == 1 && Yr(this, t.getBoundingClientRect(), e);
|
|
8555
8565
|
} else
|
|
@@ -8586,7 +8596,7 @@ class sc {
|
|
|
8586
8596
|
let s = n.from + (this.state.doc.content.size - t.doc.content.size);
|
|
8587
8597
|
(s > 0 && this.state.doc.nodeAt(s)) == n.node && (i = s);
|
|
8588
8598
|
}
|
|
8589
|
-
this.dragging = new Us(e.slice, e.move, i < 0 ? void 0 :
|
|
8599
|
+
this.dragging = new Us(e.slice, e.move, i < 0 ? void 0 : w.create(this.state.doc, i));
|
|
8590
8600
|
}
|
|
8591
8601
|
someProp(e, t) {
|
|
8592
8602
|
let n = this._props && this._props[e], i;
|
|
@@ -8662,7 +8672,7 @@ class sc {
|
|
|
8662
8672
|
the top level, not in any node.
|
|
8663
8673
|
*/
|
|
8664
8674
|
posAtCoords(e) {
|
|
8665
|
-
return
|
|
8675
|
+
return Jl(this, e);
|
|
8666
8676
|
}
|
|
8667
8677
|
/**
|
|
8668
8678
|
Returns the viewport rectangle at a given document position.
|
|
@@ -8802,7 +8812,7 @@ class sc {
|
|
|
8802
8812
|
return this.root.getSelection();
|
|
8803
8813
|
}
|
|
8804
8814
|
}
|
|
8805
|
-
function
|
|
8815
|
+
function wi(r) {
|
|
8806
8816
|
let e = /* @__PURE__ */ Object.create(null);
|
|
8807
8817
|
return e.class = "ProseMirror", e.contenteditable = String(r.editable), r.someProp("attributes", (t) => {
|
|
8808
8818
|
if (typeof t == "function" && (t = t(r.state)), t)
|
|
@@ -8810,7 +8820,7 @@ function Ci(r) {
|
|
|
8810
8820
|
n == "class" ? e.class += " " + t[n] : n == "style" ? e.style = (e.style ? e.style + ";" : "") + t[n] : !e[n] && n != "contenteditable" && n != "nodeName" && (e[n] = String(t[n]));
|
|
8811
8821
|
}), e.translate || (e.translate = "no"), [re.node(0, r.state.doc.content.size, e)];
|
|
8812
8822
|
}
|
|
8813
|
-
function
|
|
8823
|
+
function Ci(r) {
|
|
8814
8824
|
if (r.markCursor) {
|
|
8815
8825
|
let e = document.createElement("img");
|
|
8816
8826
|
e.className = "ProseMirror-separator", e.setAttribute("mark-placeholder", "true"), e.setAttribute("alt", ""), r.cursorWrapper = { dom: e, deco: re.widget(r.state.selection.from, e, { raw: !0, marks: r.markCursor }) };
|
|
@@ -9007,13 +9017,13 @@ const Qs = (r, e, t) => {
|
|
|
9007
9017
|
let s = i.nodeBefore;
|
|
9008
9018
|
if (ao(r, i, e, -1))
|
|
9009
9019
|
return !0;
|
|
9010
|
-
if (n.parent.content.size == 0 && (it(s, "end") ||
|
|
9020
|
+
if (n.parent.content.size == 0 && (it(s, "end") || w.isSelectable(s)))
|
|
9011
9021
|
for (let o = n.depth; ; o--) {
|
|
9012
9022
|
let l = sn(r.doc, n.before(o), n.after(o), k.empty);
|
|
9013
9023
|
if (l && l.slice.size < l.to - l.from) {
|
|
9014
9024
|
if (e) {
|
|
9015
9025
|
let a = r.tr.step(l);
|
|
9016
|
-
a.setSelection(it(s, "end") ? O.findFrom(a.doc.resolve(a.mapping.map(i.pos, -1)), -1) :
|
|
9026
|
+
a.setSelection(it(s, "end") ? O.findFrom(a.doc.resolve(a.mapping.map(i.pos, -1)), -1) : w.create(a.doc, i.pos - s.nodeSize)), e(a.scrollIntoView());
|
|
9017
9027
|
}
|
|
9018
9028
|
return !0;
|
|
9019
9029
|
}
|
|
@@ -9081,7 +9091,7 @@ const to = (r, e, t) => {
|
|
|
9081
9091
|
s = br(n);
|
|
9082
9092
|
}
|
|
9083
9093
|
let o = s && s.nodeBefore;
|
|
9084
|
-
return !o || !
|
|
9094
|
+
return !o || !w.isSelectable(o) ? !1 : (e && e(r.tr.setSelection(w.create(r.doc, s.pos - o.nodeSize)).scrollIntoView()), !0);
|
|
9085
9095
|
};
|
|
9086
9096
|
function br(r) {
|
|
9087
9097
|
if (!r.parent.type.spec.isolating)
|
|
@@ -9107,12 +9117,12 @@ const ro = (r, e, t) => {
|
|
|
9107
9117
|
let s = i.nodeAfter;
|
|
9108
9118
|
if (ao(r, i, e, 1))
|
|
9109
9119
|
return !0;
|
|
9110
|
-
if (n.parent.content.size == 0 && (it(s, "start") ||
|
|
9120
|
+
if (n.parent.content.size == 0 && (it(s, "start") || w.isSelectable(s))) {
|
|
9111
9121
|
let o = sn(r.doc, n.before(), n.after(), k.empty);
|
|
9112
9122
|
if (o && o.slice.size < o.to - o.from) {
|
|
9113
9123
|
if (e) {
|
|
9114
9124
|
let l = r.tr.step(o);
|
|
9115
|
-
l.setSelection(it(s, "start") ? O.findFrom(l.doc.resolve(l.mapping.map(i.pos)), 1) :
|
|
9125
|
+
l.setSelection(it(s, "start") ? O.findFrom(l.doc.resolve(l.mapping.map(i.pos)), 1) : w.create(l.doc, l.mapping.map(i.pos))), e(l.scrollIntoView());
|
|
9116
9126
|
}
|
|
9117
9127
|
return !0;
|
|
9118
9128
|
}
|
|
@@ -9128,7 +9138,7 @@ const ro = (r, e, t) => {
|
|
|
9128
9138
|
s = kr(n);
|
|
9129
9139
|
}
|
|
9130
9140
|
let o = s && s.nodeAfter;
|
|
9131
|
-
return !o || !
|
|
9141
|
+
return !o || !w.isSelectable(o) ? !1 : (e && e(r.tr.setSelection(w.create(r.doc, s.pos)).scrollIntoView()), !0);
|
|
9132
9142
|
};
|
|
9133
9143
|
function kr(r) {
|
|
9134
9144
|
if (!r.parent.type.spec.isolating)
|
|
@@ -9142,22 +9152,22 @@ function kr(r) {
|
|
|
9142
9152
|
return null;
|
|
9143
9153
|
}
|
|
9144
9154
|
const bc = (r, e) => {
|
|
9145
|
-
let t = r.selection, n = t instanceof
|
|
9155
|
+
let t = r.selection, n = t instanceof w, i;
|
|
9146
9156
|
if (n) {
|
|
9147
|
-
if (t.node.isTextblock || !
|
|
9157
|
+
if (t.node.isTextblock || !Ke(r.doc, t.from))
|
|
9148
9158
|
return !1;
|
|
9149
9159
|
i = t.from;
|
|
9150
9160
|
} else if (i = rn(r.doc, t.from, -1), i == null)
|
|
9151
9161
|
return !1;
|
|
9152
9162
|
if (e) {
|
|
9153
9163
|
let s = r.tr.join(i);
|
|
9154
|
-
n && s.setSelection(
|
|
9164
|
+
n && s.setSelection(w.create(s.doc, i - r.doc.resolve(i).nodeBefore.nodeSize)), e(s.scrollIntoView());
|
|
9155
9165
|
}
|
|
9156
9166
|
return !0;
|
|
9157
9167
|
}, kc = (r, e) => {
|
|
9158
9168
|
let t = r.selection, n;
|
|
9159
|
-
if (t instanceof
|
|
9160
|
-
if (t.node.isTextblock || !
|
|
9169
|
+
if (t instanceof w) {
|
|
9170
|
+
if (t.node.isTextblock || !Ke(r.doc, t.to))
|
|
9161
9171
|
return !1;
|
|
9162
9172
|
n = t.to;
|
|
9163
9173
|
} else if (n = rn(r.doc, t.to, 1), n == null)
|
|
@@ -9215,10 +9225,10 @@ const Sc = (r, e) => {
|
|
|
9215
9225
|
let n = t.blockRange(), i = n && st(n);
|
|
9216
9226
|
return i == null ? !1 : (e && e(r.tr.lift(n, i).scrollIntoView()), !0);
|
|
9217
9227
|
};
|
|
9218
|
-
function
|
|
9228
|
+
function wc(r) {
|
|
9219
9229
|
return (e, t) => {
|
|
9220
9230
|
let { $from: n, $to: i } = e.selection;
|
|
9221
|
-
if (e.selection instanceof
|
|
9231
|
+
if (e.selection instanceof w && e.selection.node.isBlock)
|
|
9222
9232
|
return !n.parentOffset || !ge(e.doc, n.pos) ? !1 : (t && t(e.tr.split(n.pos).scrollIntoView()), !0);
|
|
9223
9233
|
if (!n.depth)
|
|
9224
9234
|
return !1;
|
|
@@ -9244,13 +9254,13 @@ function Cc(r) {
|
|
|
9244
9254
|
return t && t(u.scrollIntoView()), !0;
|
|
9245
9255
|
};
|
|
9246
9256
|
}
|
|
9247
|
-
const
|
|
9257
|
+
const Cc = wc(), Mc = (r, e) => {
|
|
9248
9258
|
let { $from: t, to: n } = r.selection, i, s = t.sharedDepth(n);
|
|
9249
|
-
return s == 0 ? !1 : (i = t.before(s), e && e(r.tr.setSelection(
|
|
9259
|
+
return s == 0 ? !1 : (i = t.before(s), e && e(r.tr.setSelection(w.create(r.doc, i))), !0);
|
|
9250
9260
|
};
|
|
9251
9261
|
function Ec(r, e, t) {
|
|
9252
9262
|
let n = e.nodeBefore, i = e.nodeAfter, s = e.index();
|
|
9253
|
-
return !n || !i || !n.type.compatibleContent(i.type) ? !1 : !n.content.size && e.parent.canReplace(s - 1, s) ? (t && t(r.tr.delete(e.pos - n.nodeSize, e.pos).scrollIntoView()), !0) : !e.parent.canReplace(s, s + 1) || !(i.isTextblock ||
|
|
9263
|
+
return !n || !i || !n.type.compatibleContent(i.type) ? !1 : !n.content.size && e.parent.canReplace(s - 1, s) ? (t && t(r.tr.delete(e.pos - n.nodeSize, e.pos).scrollIntoView()), !0) : !e.parent.canReplace(s, s + 1) || !(i.isTextblock || Ke(r.doc, e.pos)) ? !1 : (t && t(r.tr.join(e.pos).scrollIntoView()), !0);
|
|
9254
9264
|
}
|
|
9255
9265
|
function ao(r, e, t, n) {
|
|
9256
9266
|
let i = e.nodeBefore, s = e.nodeAfter, o, l, a = i.type.spec.isolating || s.type.spec.isolating;
|
|
@@ -9264,7 +9274,7 @@ function ao(r, e, t, n) {
|
|
|
9264
9274
|
p = b.from(o[y].create(null, p));
|
|
9265
9275
|
p = b.from(i.copy(p));
|
|
9266
9276
|
let m = r.tr.step(new z(e.pos - 1, f, e.pos, f, new k(p, 1, 0), o.length, !0)), g = m.doc.resolve(f + 2 * o.length);
|
|
9267
|
-
g.nodeAfter && g.nodeAfter.type == i.type &&
|
|
9277
|
+
g.nodeAfter && g.nodeAfter.type == i.type && Ke(m.doc, g.pos) && m.join(g.pos), t(m.scrollIntoView());
|
|
9268
9278
|
}
|
|
9269
9279
|
return !0;
|
|
9270
9280
|
}
|
|
@@ -9281,8 +9291,8 @@ function ao(r, e, t, n) {
|
|
|
9281
9291
|
if (f.canReplace(f.childCount, f.childCount, m.content)) {
|
|
9282
9292
|
if (t) {
|
|
9283
9293
|
let y = b.empty;
|
|
9284
|
-
for (let
|
|
9285
|
-
y = b.from(p[
|
|
9294
|
+
for (let C = p.length - 1; C >= 0; C--)
|
|
9295
|
+
y = b.from(p[C].copy(y));
|
|
9286
9296
|
let S = r.tr.step(new z(e.pos - p.length, e.pos + s.nodeSize, e.pos + g, e.pos + s.nodeSize - g, new k(y, p.length, 0), 0, !0));
|
|
9287
9297
|
t(S.scrollIntoView());
|
|
9288
9298
|
}
|
|
@@ -9349,7 +9359,7 @@ function Sr(...r) {
|
|
|
9349
9359
|
}
|
|
9350
9360
|
Sr(yr, Qs, to);
|
|
9351
9361
|
Sr(yr, ro, io);
|
|
9352
|
-
Sr(so, oo, lo,
|
|
9362
|
+
Sr(so, oo, lo, Cc);
|
|
9353
9363
|
typeof navigator < "u" ? /Mac|iP(hone|[oa]d)/.test(navigator.platform) : typeof os < "u" && os.platform && os.platform() == "darwin";
|
|
9354
9364
|
function Ac(r, e = null) {
|
|
9355
9365
|
return function(t, n) {
|
|
@@ -9398,7 +9408,7 @@ function Pc(r, e, t, n) {
|
|
|
9398
9408
|
return !1;
|
|
9399
9409
|
i.lift(n, l);
|
|
9400
9410
|
let a = i.doc.resolve(i.mapping.map(s, -1) - 1);
|
|
9401
|
-
return
|
|
9411
|
+
return Ke(i.doc, a.pos) && a.nodeBefore.type == a.nodeAfter.type && i.join(a.pos), e(i.scrollIntoView()), !0;
|
|
9402
9412
|
}
|
|
9403
9413
|
function Rc(r, e, t) {
|
|
9404
9414
|
let n = r.tr, i = t.parent;
|
|
@@ -9692,10 +9702,10 @@ function Vc(r, e) {
|
|
|
9692
9702
|
storage: c.storage,
|
|
9693
9703
|
editor: e
|
|
9694
9704
|
}, h = r.reduce((y, S) => {
|
|
9695
|
-
const
|
|
9705
|
+
const C = x(S, "extendNodeSchema", d);
|
|
9696
9706
|
return {
|
|
9697
9707
|
...y,
|
|
9698
|
-
...
|
|
9708
|
+
...C ? C(c) : {}
|
|
9699
9709
|
};
|
|
9700
9710
|
}, {}), f = Ai({
|
|
9701
9711
|
...h,
|
|
@@ -9767,7 +9777,7 @@ function Dn(r, e) {
|
|
|
9767
9777
|
function vi(r, e) {
|
|
9768
9778
|
return Array.isArray(e) ? e.some((t) => (typeof t == "string" ? t : t.name) === r.name) : e;
|
|
9769
9779
|
}
|
|
9770
|
-
function
|
|
9780
|
+
function wr(r, e) {
|
|
9771
9781
|
const t = Je.fromSchema(e).serializeFragment(r), i = document.implementation.createHTMLDocument().createElement("div");
|
|
9772
9782
|
return i.appendChild(t), i.innerHTML;
|
|
9773
9783
|
}
|
|
@@ -9785,7 +9795,7 @@ const jc = (r, e = 500) => {
|
|
|
9785
9795
|
t += i.isAtom && !i.isText ? u : u.slice(0, Math.max(0, n - s));
|
|
9786
9796
|
}), t;
|
|
9787
9797
|
};
|
|
9788
|
-
function
|
|
9798
|
+
function Cr(r) {
|
|
9789
9799
|
return Object.prototype.toString.call(r) === "[object RegExp]";
|
|
9790
9800
|
}
|
|
9791
9801
|
class Hc {
|
|
@@ -9794,7 +9804,7 @@ class Hc {
|
|
|
9794
9804
|
}
|
|
9795
9805
|
}
|
|
9796
9806
|
const Wc = (r, e) => {
|
|
9797
|
-
if (
|
|
9807
|
+
if (Cr(e))
|
|
9798
9808
|
return e.exec(r);
|
|
9799
9809
|
const t = e(r);
|
|
9800
9810
|
if (!t)
|
|
@@ -9827,7 +9837,7 @@ function Rt(r) {
|
|
|
9827
9837
|
}), g = {
|
|
9828
9838
|
from: n - (f[0].length - s.length),
|
|
9829
9839
|
to: i
|
|
9830
|
-
}, { commands: y, chain: S, can:
|
|
9840
|
+
}, { commands: y, chain: S, can: C } = new dn({
|
|
9831
9841
|
editor: t,
|
|
9832
9842
|
state: m
|
|
9833
9843
|
});
|
|
@@ -9837,7 +9847,7 @@ function Rt(r) {
|
|
|
9837
9847
|
match: f,
|
|
9838
9848
|
commands: y,
|
|
9839
9849
|
chain: S,
|
|
9840
|
-
can:
|
|
9850
|
+
can: C
|
|
9841
9851
|
}) === null || !p.steps.length || (p.setMeta(l, {
|
|
9842
9852
|
transform: p,
|
|
9843
9853
|
from: n,
|
|
@@ -9846,7 +9856,7 @@ function Rt(r) {
|
|
|
9846
9856
|
}), a.dispatch(p), u = !0);
|
|
9847
9857
|
}), u;
|
|
9848
9858
|
}
|
|
9849
|
-
function
|
|
9859
|
+
function qc(r) {
|
|
9850
9860
|
const { editor: e, rules: t } = r, n = new Q({
|
|
9851
9861
|
state: {
|
|
9852
9862
|
init() {
|
|
@@ -9859,7 +9869,7 @@ function Jc(r) {
|
|
|
9859
9869
|
const a = i.getMeta("applyInputRules");
|
|
9860
9870
|
return !!a && setTimeout(() => {
|
|
9861
9871
|
let { text: u } = a;
|
|
9862
|
-
typeof u == "string" ? u = u : u =
|
|
9872
|
+
typeof u == "string" ? u = u : u = wr(b.from(u), o.schema);
|
|
9863
9873
|
const { from: d } = a, h = d + u.length;
|
|
9864
9874
|
Rt({
|
|
9865
9875
|
editor: e,
|
|
@@ -9918,11 +9928,11 @@ function Jc(r) {
|
|
|
9918
9928
|
});
|
|
9919
9929
|
return n;
|
|
9920
9930
|
}
|
|
9921
|
-
function
|
|
9931
|
+
function Jc(r) {
|
|
9922
9932
|
return Object.prototype.toString.call(r).slice(8, -1);
|
|
9923
9933
|
}
|
|
9924
9934
|
function Bt(r) {
|
|
9925
|
-
return
|
|
9935
|
+
return Jc(r) !== "Object" ? !1 : r.constructor === Object && Object.getPrototypeOf(r) === Object.prototype;
|
|
9926
9936
|
}
|
|
9927
9937
|
function fn(r, e) {
|
|
9928
9938
|
const t = { ...r };
|
|
@@ -9930,7 +9940,7 @@ function fn(r, e) {
|
|
|
9930
9940
|
Bt(e[n]) && Bt(r[n]) ? t[n] = fn(r[n], e[n]) : t[n] = e[n];
|
|
9931
9941
|
}), t;
|
|
9932
9942
|
}
|
|
9933
|
-
class
|
|
9943
|
+
class Ct {
|
|
9934
9944
|
constructor(e = {}) {
|
|
9935
9945
|
this.type = "mark", this.name = "mark", this.parent = null, this.child = null, this.config = {
|
|
9936
9946
|
name: this.name,
|
|
@@ -9946,7 +9956,7 @@ class wt {
|
|
|
9946
9956
|
})) || {};
|
|
9947
9957
|
}
|
|
9948
9958
|
static create(e = {}) {
|
|
9949
|
-
return new
|
|
9959
|
+
return new Ct(e);
|
|
9950
9960
|
}
|
|
9951
9961
|
configure(e = {}) {
|
|
9952
9962
|
const t = this.extend({
|
|
@@ -9956,7 +9966,7 @@ class wt {
|
|
|
9956
9966
|
return t.name = this.name, t.parent = this.parent, t;
|
|
9957
9967
|
}
|
|
9958
9968
|
extend(e = {}) {
|
|
9959
|
-
const t = new
|
|
9969
|
+
const t = new Ct(e);
|
|
9960
9970
|
return t.parent = this, this.child = t, t.name = e.name ? e.name : t.parent.name, e.defaultOptions && Object.keys(e.defaultOptions).length > 0 && console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${t.name}".`), t.options = N(x(t, "addOptions", {
|
|
9961
9971
|
name: t.name
|
|
9962
9972
|
})), t.storage = N(x(t, "addStorage", {
|
|
@@ -9980,7 +9990,7 @@ function Kc(r) {
|
|
|
9980
9990
|
return typeof r == "number";
|
|
9981
9991
|
}
|
|
9982
9992
|
const Uc = (r, e, t) => {
|
|
9983
|
-
if (
|
|
9993
|
+
if (Cr(e))
|
|
9984
9994
|
return [...r.matchAll(e)];
|
|
9985
9995
|
const n = e(r, t);
|
|
9986
9996
|
return n ? n.map((i) => {
|
|
@@ -9997,16 +10007,16 @@ function Gc(r) {
|
|
|
9997
10007
|
if (!f.isTextblock || f.type.spec.code)
|
|
9998
10008
|
return;
|
|
9999
10009
|
const m = Math.max(n, p), g = Math.min(i, p + f.content.size), y = f.textBetween(m - p, g - p, void 0, "");
|
|
10000
|
-
Uc(y, s.find, o).forEach((
|
|
10001
|
-
if (
|
|
10010
|
+
Uc(y, s.find, o).forEach((C) => {
|
|
10011
|
+
if (C.index === void 0)
|
|
10002
10012
|
return;
|
|
10003
|
-
const
|
|
10004
|
-
from: t.tr.mapping.map(
|
|
10013
|
+
const v = m + C.index + 1, A = v + C[0].length, M = {
|
|
10014
|
+
from: t.tr.mapping.map(v),
|
|
10005
10015
|
to: t.tr.mapping.map(A)
|
|
10006
10016
|
}, I = s.handler({
|
|
10007
10017
|
state: t,
|
|
10008
10018
|
range: M,
|
|
10009
|
-
match:
|
|
10019
|
+
match: C,
|
|
10010
10020
|
commands: a,
|
|
10011
10021
|
chain: c,
|
|
10012
10022
|
can: u,
|
|
@@ -10095,7 +10105,7 @@ function Yc(r) {
|
|
|
10095
10105
|
return;
|
|
10096
10106
|
if (S) {
|
|
10097
10107
|
let { text: A } = y;
|
|
10098
|
-
typeof A == "string" ? A = A : A =
|
|
10108
|
+
typeof A == "string" ? A = A : A = wr(b.from(A), f.schema);
|
|
10099
10109
|
const { from: M } = y, I = M + A.length, H = _c(A);
|
|
10100
10110
|
return a({
|
|
10101
10111
|
rule: u,
|
|
@@ -10105,13 +10115,13 @@ function Yc(r) {
|
|
|
10105
10115
|
pasteEvt: H
|
|
10106
10116
|
});
|
|
10107
10117
|
}
|
|
10108
|
-
const
|
|
10109
|
-
if (!(!Kc(
|
|
10118
|
+
const C = h.doc.content.findDiffStart(f.doc.content), v = h.doc.content.findDiffEnd(f.doc.content);
|
|
10119
|
+
if (!(!Kc(C) || !v || C === v.b))
|
|
10110
10120
|
return a({
|
|
10111
10121
|
rule: u,
|
|
10112
10122
|
state: f,
|
|
10113
|
-
from:
|
|
10114
|
-
to:
|
|
10123
|
+
from: C,
|
|
10124
|
+
to: v,
|
|
10115
10125
|
pasteEvt: o
|
|
10116
10126
|
});
|
|
10117
10127
|
}
|
|
@@ -10121,9 +10131,9 @@ function Xc(r) {
|
|
|
10121
10131
|
const e = r.filter((t, n) => r.indexOf(t) !== n);
|
|
10122
10132
|
return Array.from(new Set(e));
|
|
10123
10133
|
}
|
|
10124
|
-
class
|
|
10134
|
+
class Ze {
|
|
10125
10135
|
constructor(e, t) {
|
|
10126
|
-
this.splittableMarks = [], this.editor = t, this.extensions =
|
|
10136
|
+
this.splittableMarks = [], this.editor = t, this.extensions = Ze.resolve(e), this.schema = Vc(this.extensions, t), this.setupExtensions();
|
|
10127
10137
|
}
|
|
10128
10138
|
/**
|
|
10129
10139
|
* Returns a flattened and sorted extension list while
|
|
@@ -10132,7 +10142,7 @@ class Xe {
|
|
|
10132
10142
|
* @returns An flattened and sorted array of Tiptap extensions
|
|
10133
10143
|
*/
|
|
10134
10144
|
static resolve(e) {
|
|
10135
|
-
const t =
|
|
10145
|
+
const t = Ze.sort(Ze.flatten(e)), n = Xc(t.map((i) => i.name));
|
|
10136
10146
|
return n.length && console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map((i) => `'${i}'`).join(", ")}]. This can lead to issues.`), t;
|
|
10137
10147
|
}
|
|
10138
10148
|
/**
|
|
@@ -10185,7 +10195,7 @@ class Xe {
|
|
|
10185
10195
|
* @returns An array of Prosemirror plugins
|
|
10186
10196
|
*/
|
|
10187
10197
|
get plugins() {
|
|
10188
|
-
const { editor: e } = this, t =
|
|
10198
|
+
const { editor: e } = this, t = Ze.sort([...this.extensions].reverse()), n = [], i = [], s = t.map((o) => {
|
|
10189
10199
|
const l = {
|
|
10190
10200
|
name: o.name,
|
|
10191
10201
|
options: o.options,
|
|
@@ -10194,7 +10204,7 @@ class Xe {
|
|
|
10194
10204
|
type: Dn(o.name, this.schema)
|
|
10195
10205
|
}, a = [], c = x(o, "addKeyboardShortcuts", l);
|
|
10196
10206
|
let u = {};
|
|
10197
|
-
if (o.type === "mark" && x(o, "exitable", l) && (u.ArrowRight = () =>
|
|
10207
|
+
if (o.type === "mark" && x(o, "exitable", l) && (u.ArrowRight = () => Ct.handleExit({ editor: e, mark: o })), c) {
|
|
10198
10208
|
const m = Object.fromEntries(Object.entries(c()).map(([g, y]) => [g, () => y({ editor: e })]));
|
|
10199
10209
|
u = { ...u, ...m };
|
|
10200
10210
|
}
|
|
@@ -10212,7 +10222,7 @@ class Xe {
|
|
|
10212
10222
|
return a;
|
|
10213
10223
|
}).flat();
|
|
10214
10224
|
return [
|
|
10215
|
-
|
|
10225
|
+
qc({
|
|
10216
10226
|
editor: e,
|
|
10217
10227
|
rules: n
|
|
10218
10228
|
}),
|
|
@@ -10285,7 +10295,7 @@ class Xe {
|
|
|
10285
10295
|
});
|
|
10286
10296
|
}
|
|
10287
10297
|
}
|
|
10288
|
-
class
|
|
10298
|
+
class J {
|
|
10289
10299
|
constructor(e = {}) {
|
|
10290
10300
|
this.type = "extension", this.name = "extension", this.parent = null, this.child = null, this.config = {
|
|
10291
10301
|
name: this.name,
|
|
@@ -10301,7 +10311,7 @@ class q {
|
|
|
10301
10311
|
})) || {};
|
|
10302
10312
|
}
|
|
10303
10313
|
static create(e = {}) {
|
|
10304
|
-
return new
|
|
10314
|
+
return new J(e);
|
|
10305
10315
|
}
|
|
10306
10316
|
configure(e = {}) {
|
|
10307
10317
|
const t = this.extend({
|
|
@@ -10311,7 +10321,7 @@ class q {
|
|
|
10311
10321
|
return t.name = this.name, t.parent = this.parent, t;
|
|
10312
10322
|
}
|
|
10313
10323
|
extend(e = {}) {
|
|
10314
|
-
const t = new
|
|
10324
|
+
const t = new J({ ...this.config, ...e });
|
|
10315
10325
|
return t.parent = this, this.child = t, t.name = e.name ? e.name : t.parent.name, e.defaultOptions && Object.keys(e.defaultOptions).length > 0 && console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${t.name}".`), t.options = N(x(t, "addOptions", {
|
|
10316
10326
|
name: t.name
|
|
10317
10327
|
})), t.storage = N(x(t, "addStorage", {
|
|
@@ -10343,7 +10353,7 @@ function fo(r, e, t) {
|
|
|
10343
10353
|
function po(r) {
|
|
10344
10354
|
return Object.fromEntries(Object.entries(r.nodes).filter(([, e]) => e.spec.toText).map(([e, t]) => [e, t.spec.toText]));
|
|
10345
10355
|
}
|
|
10346
|
-
const Zc =
|
|
10356
|
+
const Zc = J.create({
|
|
10347
10357
|
name: "clipboardTextSerializer",
|
|
10348
10358
|
addOptions() {
|
|
10349
10359
|
return {
|
|
@@ -10422,7 +10432,7 @@ const Zc = q.create({
|
|
|
10422
10432
|
}, au = () => ({ state: r, dispatch: e }) => yr(r, e), cu = () => ({ commands: r }) => r.keyboardShortcut("Enter"), uu = () => ({ state: r, dispatch: e }) => Sc(r, e);
|
|
10423
10433
|
function en(r, e, t = { strict: !0 }) {
|
|
10424
10434
|
const n = Object.keys(e);
|
|
10425
|
-
return n.length ? n.every((i) => t.strict ? e[i] === r[i] :
|
|
10435
|
+
return n.length ? n.every((i) => t.strict ? e[i] === r[i] : Cr(e[i]) ? e[i].test(r[i]) : e[i] === r[i]) : !0;
|
|
10426
10436
|
}
|
|
10427
10437
|
function mo(r, e, t = {}) {
|
|
10428
10438
|
return r.find((n) => n.type === e && en(
|
|
@@ -10647,7 +10657,7 @@ const bu = (r) => !("type" in r), ku = (r, e, t) => ({ tr: n, dispatch: i, edito
|
|
|
10647
10657
|
t.updateSelection && yu(n, n.steps.length - 1, -1), t.applyInputRules && n.setMeta("applyInputRules", { from: a, text: f }), t.applyPasteRules && n.setMeta("applyPasteRules", { from: a, text: f });
|
|
10648
10658
|
}
|
|
10649
10659
|
return !0;
|
|
10650
|
-
}, xu = () => ({ state: r, dispatch: e }) => bc(r, e), Su = () => ({ state: r, dispatch: e }) => kc(r, e),
|
|
10660
|
+
}, xu = () => ({ state: r, dispatch: e }) => bc(r, e), Su = () => ({ state: r, dispatch: e }) => kc(r, e), wu = () => ({ state: r, dispatch: e }) => Qs(r, e), Cu = () => ({ state: r, dispatch: e }) => ro(r, e), Mu = () => ({ state: r, dispatch: e, tr: t }) => {
|
|
10651
10661
|
try {
|
|
10652
10662
|
const n = rn(r.doc, r.selection.$from.pos, -1);
|
|
10653
10663
|
return n == null ? !1 : (t.join(n, 2), e && e(t), !0);
|
|
@@ -10802,14 +10812,14 @@ function mt(r, e) {
|
|
|
10802
10812
|
function Tr(r) {
|
|
10803
10813
|
return (e) => mt(e.$from, r);
|
|
10804
10814
|
}
|
|
10805
|
-
function
|
|
10815
|
+
function qu(r, e) {
|
|
10806
10816
|
const t = {
|
|
10807
10817
|
from: 0,
|
|
10808
10818
|
to: r.content.size
|
|
10809
10819
|
};
|
|
10810
10820
|
return fo(r, t, e);
|
|
10811
10821
|
}
|
|
10812
|
-
function
|
|
10822
|
+
function Ju(r, e) {
|
|
10813
10823
|
const t = L(e, r.schema), { from: n, to: i } = r.selection, s = [];
|
|
10814
10824
|
r.doc.nodesBetween(n, i, (l) => {
|
|
10815
10825
|
s.push(l);
|
|
@@ -10819,7 +10829,7 @@ function qu(r, e) {
|
|
|
10819
10829
|
}
|
|
10820
10830
|
function Ku(r, e) {
|
|
10821
10831
|
const t = pn(typeof e == "string" ? e : e.name, r.schema);
|
|
10822
|
-
return t === "node" ?
|
|
10832
|
+
return t === "node" ? Ju(r, e) : t === "mark" ? xo(r, e) : {};
|
|
10823
10833
|
}
|
|
10824
10834
|
function jt(r, e, t) {
|
|
10825
10835
|
return Object.fromEntries(Object.entries(t).filter(([n]) => {
|
|
@@ -10838,9 +10848,9 @@ function tr(r, e, t = {}) {
|
|
|
10838
10848
|
r.doc.nodesBetween(f, p, (m, g) => {
|
|
10839
10849
|
if (!m.isText && !m.marks.length)
|
|
10840
10850
|
return;
|
|
10841
|
-
const y = Math.max(f, g), S = Math.min(p, g + m.nodeSize),
|
|
10842
|
-
o +=
|
|
10843
|
-
mark:
|
|
10851
|
+
const y = Math.max(f, g), S = Math.min(p, g + m.nodeSize), C = S - y;
|
|
10852
|
+
o += C, l.push(...m.marks.map((v) => ({
|
|
10853
|
+
mark: v,
|
|
10844
10854
|
from: y,
|
|
10845
10855
|
to: S
|
|
10846
10856
|
})));
|
|
@@ -10940,7 +10950,7 @@ const _u = (r, e = {}) => ({ tr: t, state: n, dispatch: i }) => {
|
|
|
10940
10950
|
return t.selection.$anchor.sameParent(t.selection.$head) && (o = t.selection.$anchor.parent.attrs), s.isTextblock ? i().command(({ commands: l }) => Oi(s, { ...o, ...e })(t) ? !0 : l.clearNodes()).command(({ state: l }) => Oi(s, { ...o, ...e })(l, n)).run() : (console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'), !1);
|
|
10941
10951
|
}, Zu = (r) => ({ tr: e, dispatch: t }) => {
|
|
10942
10952
|
if (t) {
|
|
10943
|
-
const { doc: n } = e, i = Be(r, 0, n.content.size), s =
|
|
10953
|
+
const { doc: n } = e, i = Be(r, 0, n.content.size), s = w.create(n, i);
|
|
10944
10954
|
e.setSelection(s);
|
|
10945
10955
|
}
|
|
10946
10956
|
return !0;
|
|
@@ -10963,7 +10973,7 @@ function Ri(r, e) {
|
|
|
10963
10973
|
}
|
|
10964
10974
|
const td = ({ keepMarks: r = !0 } = {}) => ({ tr: e, state: t, dispatch: n, editor: i }) => {
|
|
10965
10975
|
const { selection: s, doc: o } = e, { $from: l, $to: a } = s, c = i.extensionManager.attributes, u = jt(c, l.node().type.name, l.node().attrs);
|
|
10966
|
-
if (s instanceof
|
|
10976
|
+
if (s instanceof w && s.node.isBlock)
|
|
10967
10977
|
return !l.parentOffset || !ge(o, l.pos) ? !1 : (n && (r && Ri(t, i.extensionManager.splittableMarks), e.split(l.pos).scrollIntoView()), !0);
|
|
10968
10978
|
if (!l.parent.isBlock)
|
|
10969
10979
|
return !1;
|
|
@@ -11004,13 +11014,13 @@ const td = ({ keepMarks: r = !0 } = {}) => ({ tr: e, state: t, dispatch: n, edit
|
|
|
11004
11014
|
const S = a.index(-1) ? 1 : a.index(-2) ? 2 : 3;
|
|
11005
11015
|
for (let H = a.depth - S; H >= a.depth - 3; H -= 1)
|
|
11006
11016
|
y = b.from(a.node(H).copy(y));
|
|
11007
|
-
const
|
|
11017
|
+
const C = a.indexAfter(-1) < a.node(-2).childCount ? 1 : a.indexAfter(-2) < a.node(-3).childCount ? 2 : 3, v = {
|
|
11008
11018
|
...jt(h, a.node().type.name, a.node().attrs),
|
|
11009
11019
|
...e
|
|
11010
|
-
}, A = ((o = l.contentMatch.defaultType) === null || o === void 0 ? void 0 : o.createAndFill(
|
|
11020
|
+
}, A = ((o = l.contentMatch.defaultType) === null || o === void 0 ? void 0 : o.createAndFill(v)) || void 0;
|
|
11011
11021
|
y = y.append(b.from(l.createAndFill(null, A) || void 0));
|
|
11012
11022
|
const M = a.before(a.depth - (S - 1));
|
|
11013
|
-
t.replace(M, a.after(-
|
|
11023
|
+
t.replace(M, a.after(-C), new k(y, 4 - S, 0));
|
|
11014
11024
|
let I = -1;
|
|
11015
11025
|
t.doc.nodesBetween(M, t.doc.content.size, (H, E) => {
|
|
11016
11026
|
if (I > -1)
|
|
@@ -11035,10 +11045,10 @@ const td = ({ keepMarks: r = !0 } = {}) => ({ tr: e, state: t, dispatch: n, edit
|
|
|
11035
11045
|
if (!ge(t.doc, a.pos, 2))
|
|
11036
11046
|
return !1;
|
|
11037
11047
|
if (i) {
|
|
11038
|
-
const { selection: y, storedMarks: S } = n, { splittableMarks:
|
|
11039
|
-
if (t.split(a.pos, 2, g).scrollIntoView(), !
|
|
11048
|
+
const { selection: y, storedMarks: S } = n, { splittableMarks: C } = s.extensionManager, v = S || y.$to.parentOffset && y.$from.marks();
|
|
11049
|
+
if (t.split(a.pos, 2, g).scrollIntoView(), !v || !i)
|
|
11040
11050
|
return !0;
|
|
11041
|
-
const A =
|
|
11051
|
+
const A = v.filter((M) => C.includes(M.type.name));
|
|
11042
11052
|
t.ensureMarks(A);
|
|
11043
11053
|
}
|
|
11044
11054
|
return !0;
|
|
@@ -11050,7 +11060,7 @@ const td = ({ keepMarks: r = !0 } = {}) => ({ tr: e, state: t, dispatch: n, edit
|
|
|
11050
11060
|
if (n === void 0)
|
|
11051
11061
|
return !0;
|
|
11052
11062
|
const i = r.doc.nodeAt(n);
|
|
11053
|
-
return t.node.type === (i == null ? void 0 : i.type) &&
|
|
11063
|
+
return t.node.type === (i == null ? void 0 : i.type) && Ke(r.doc, t.pos) && r.join(t.pos), !0;
|
|
11054
11064
|
}, Pn = (r, e) => {
|
|
11055
11065
|
const t = Tr((o) => o.type === e)(r.selection);
|
|
11056
11066
|
if (!t)
|
|
@@ -11059,20 +11069,20 @@ const td = ({ keepMarks: r = !0 } = {}) => ({ tr: e, state: t, dispatch: n, edit
|
|
|
11059
11069
|
if (n === void 0)
|
|
11060
11070
|
return !0;
|
|
11061
11071
|
const i = r.doc.nodeAt(n);
|
|
11062
|
-
return t.node.type === (i == null ? void 0 : i.type) &&
|
|
11072
|
+
return t.node.type === (i == null ? void 0 : i.type) && Ke(r.doc, n) && r.join(n), !0;
|
|
11063
11073
|
}, rd = (r, e, t, n = {}) => ({ editor: i, tr: s, state: o, dispatch: l, chain: a, commands: c, can: u }) => {
|
|
11064
|
-
const { extensions: d, splittableMarks: h } = i.extensionManager, f = L(r, o.schema), p = L(e, o.schema), { selection: m, storedMarks: g } = o, { $from: y, $to: S } = m,
|
|
11065
|
-
if (!
|
|
11074
|
+
const { extensions: d, splittableMarks: h } = i.extensionManager, f = L(r, o.schema), p = L(e, o.schema), { selection: m, storedMarks: g } = o, { $from: y, $to: S } = m, C = y.blockRange(S), v = g || m.$to.parentOffset && m.$from.marks();
|
|
11075
|
+
if (!C)
|
|
11066
11076
|
return !1;
|
|
11067
11077
|
const A = Tr((M) => Pi(M.type.name, d))(m);
|
|
11068
|
-
if (
|
|
11078
|
+
if (C.depth >= 1 && A && C.depth - A.depth <= 1) {
|
|
11069
11079
|
if (A.node.type === f)
|
|
11070
11080
|
return c.liftListItem(p);
|
|
11071
11081
|
if (Pi(A.node.type.name, d) && f.validContent(A.node.content) && l)
|
|
11072
11082
|
return a().command(() => (s.setNodeMarkup(A.pos, f), !0)).command(() => In(s, f)).command(() => Pn(s, f)).run();
|
|
11073
11083
|
}
|
|
11074
|
-
return !t || !
|
|
11075
|
-
const M = u().wrapInList(f, n), I =
|
|
11084
|
+
return !t || !v || !l ? a().command(() => u().wrapInList(f, n) ? !0 : c.clearNodes()).wrapInList(f, n).command(() => In(s, f)).command(() => Pn(s, f)).run() : a().command(() => {
|
|
11085
|
+
const M = u().wrapInList(f, n), I = v.filter((H) => h.includes(H.type.name));
|
|
11076
11086
|
return s.ensureMarks(I), M ? !0 : c.clearNodes();
|
|
11077
11087
|
}).wrapInList(f, n).command(() => In(s, f)).command(() => Pn(s, f)).run();
|
|
11078
11088
|
}, id = (r, e = {}, t = {}) => ({ state: n, commands: i }) => {
|
|
@@ -11138,8 +11148,8 @@ const td = ({ keepMarks: r = !0 } = {}) => ({ tr: e, state: t, dispatch: n, edit
|
|
|
11138
11148
|
...e
|
|
11139
11149
|
}), o && m.marks.length && m.marks.forEach((y) => {
|
|
11140
11150
|
if (o === y.type) {
|
|
11141
|
-
const S = Math.max(g, c),
|
|
11142
|
-
t.addMark(S,
|
|
11151
|
+
const S = Math.max(g, c), C = Math.min(g + m.nodeSize, u);
|
|
11152
|
+
t.addMark(S, C, o.create({
|
|
11143
11153
|
...y.attrs,
|
|
11144
11154
|
...e
|
|
11145
11155
|
}));
|
|
@@ -11182,9 +11192,9 @@ var fd = /* @__PURE__ */ Object.freeze({
|
|
|
11182
11192
|
forEach: mu,
|
|
11183
11193
|
insertContent: gu,
|
|
11184
11194
|
insertContentAt: ku,
|
|
11185
|
-
joinBackward:
|
|
11195
|
+
joinBackward: wu,
|
|
11186
11196
|
joinDown: Su,
|
|
11187
|
-
joinForward:
|
|
11197
|
+
joinForward: Cu,
|
|
11188
11198
|
joinItemBackward: Mu,
|
|
11189
11199
|
joinItemForward: Eu,
|
|
11190
11200
|
joinTextblockBackward: Tu,
|
|
@@ -11223,14 +11233,14 @@ var fd = /* @__PURE__ */ Object.freeze({
|
|
|
11223
11233
|
wrapIn: dd,
|
|
11224
11234
|
wrapInList: hd
|
|
11225
11235
|
});
|
|
11226
|
-
const pd =
|
|
11236
|
+
const pd = J.create({
|
|
11227
11237
|
name: "commands",
|
|
11228
11238
|
addCommands() {
|
|
11229
11239
|
return {
|
|
11230
11240
|
...fd
|
|
11231
11241
|
};
|
|
11232
11242
|
}
|
|
11233
|
-
}), md =
|
|
11243
|
+
}), md = J.create({
|
|
11234
11244
|
name: "drop",
|
|
11235
11245
|
addProseMirrorPlugins() {
|
|
11236
11246
|
return [
|
|
@@ -11249,7 +11259,7 @@ const pd = q.create({
|
|
|
11249
11259
|
})
|
|
11250
11260
|
];
|
|
11251
11261
|
}
|
|
11252
|
-
}), gd =
|
|
11262
|
+
}), gd = J.create({
|
|
11253
11263
|
name: "editable",
|
|
11254
11264
|
addProseMirrorPlugins() {
|
|
11255
11265
|
return [
|
|
@@ -11261,7 +11271,7 @@ const pd = q.create({
|
|
|
11261
11271
|
})
|
|
11262
11272
|
];
|
|
11263
11273
|
}
|
|
11264
|
-
}), yd = new le("focusEvents"), bd =
|
|
11274
|
+
}), yd = new le("focusEvents"), bd = J.create({
|
|
11265
11275
|
name: "focusEvents",
|
|
11266
11276
|
addProseMirrorPlugins() {
|
|
11267
11277
|
const { editor: r } = this;
|
|
@@ -11285,7 +11295,7 @@ const pd = q.create({
|
|
|
11285
11295
|
})
|
|
11286
11296
|
];
|
|
11287
11297
|
}
|
|
11288
|
-
}), kd =
|
|
11298
|
+
}), kd = J.create({
|
|
11289
11299
|
name: "keymap",
|
|
11290
11300
|
addKeyboardShortcuts() {
|
|
11291
11301
|
const r = () => this.editor.commands.first(({ commands: o }) => [
|
|
@@ -11363,7 +11373,7 @@ const pd = q.create({
|
|
|
11363
11373
|
})
|
|
11364
11374
|
];
|
|
11365
11375
|
}
|
|
11366
|
-
}), xd =
|
|
11376
|
+
}), xd = J.create({
|
|
11367
11377
|
name: "paste",
|
|
11368
11378
|
addProseMirrorPlugins() {
|
|
11369
11379
|
return [
|
|
@@ -11381,7 +11391,7 @@ const pd = q.create({
|
|
|
11381
11391
|
})
|
|
11382
11392
|
];
|
|
11383
11393
|
}
|
|
11384
|
-
}), Sd =
|
|
11394
|
+
}), Sd = J.create({
|
|
11385
11395
|
name: "tabindex",
|
|
11386
11396
|
addProseMirrorPlugins() {
|
|
11387
11397
|
return [
|
|
@@ -11517,7 +11527,7 @@ class Ie {
|
|
|
11517
11527
|
}), this.editor.view.dispatch(t);
|
|
11518
11528
|
}
|
|
11519
11529
|
}
|
|
11520
|
-
const
|
|
11530
|
+
const wd = `.ProseMirror {
|
|
11521
11531
|
position: relative;
|
|
11522
11532
|
}
|
|
11523
11533
|
|
|
@@ -11592,7 +11602,7 @@ img.ProseMirror-separator {
|
|
|
11592
11602
|
.tippy-box[data-animation=fade][data-state=hidden] {
|
|
11593
11603
|
opacity: 0
|
|
11594
11604
|
}`;
|
|
11595
|
-
function
|
|
11605
|
+
function Cd(r, e, t) {
|
|
11596
11606
|
const n = document.querySelector("style[data-tiptap-style]");
|
|
11597
11607
|
if (n !== null)
|
|
11598
11608
|
return n;
|
|
@@ -11661,7 +11671,7 @@ class Md extends zc {
|
|
|
11661
11671
|
* Inject CSS styles.
|
|
11662
11672
|
*/
|
|
11663
11673
|
injectCSS() {
|
|
11664
|
-
this.options.injectCSS && document && (this.css = wd
|
|
11674
|
+
this.options.injectCSS && document && (this.css = Cd(wd, this.options.injectNonce));
|
|
11665
11675
|
}
|
|
11666
11676
|
/**
|
|
11667
11677
|
* Update editor options.
|
|
@@ -11741,7 +11751,7 @@ class Md extends zc {
|
|
|
11741
11751
|
md,
|
|
11742
11752
|
xd
|
|
11743
11753
|
].filter((s) => typeof this.options.enableCoreExtensions == "object" ? this.options.enableCoreExtensions[s.name] !== !1 : !0) : [], ...this.options.extensions].filter((s) => ["extension", "node", "mark"].includes(s == null ? void 0 : s.type));
|
|
11744
|
-
this.extensionManager = new
|
|
11754
|
+
this.extensionManager = new Ze(i, this);
|
|
11745
11755
|
}
|
|
11746
11756
|
/**
|
|
11747
11757
|
* Creates an command manager.
|
|
@@ -11785,7 +11795,7 @@ class Md extends zc {
|
|
|
11785
11795
|
...(e = this.options.editorProps) === null || e === void 0 ? void 0 : e.attributes
|
|
11786
11796
|
},
|
|
11787
11797
|
dispatchTransaction: this.dispatchTransaction.bind(this),
|
|
11788
|
-
state:
|
|
11798
|
+
state: Xe.create({
|
|
11789
11799
|
doc: t,
|
|
11790
11800
|
selection: n || void 0
|
|
11791
11801
|
})
|
|
@@ -11881,7 +11891,7 @@ class Md extends zc {
|
|
|
11881
11891
|
* Get the document as HTML.
|
|
11882
11892
|
*/
|
|
11883
11893
|
getHTML() {
|
|
11884
|
-
return
|
|
11894
|
+
return wr(this.state.doc.content, this.schema);
|
|
11885
11895
|
}
|
|
11886
11896
|
/**
|
|
11887
11897
|
* Get the document as text.
|
|
@@ -11890,7 +11900,7 @@ class Md extends zc {
|
|
|
11890
11900
|
const { blockSeparator: t = `
|
|
11891
11901
|
|
|
11892
11902
|
`, textSerializers: n = {} } = e || {};
|
|
11893
|
-
return
|
|
11903
|
+
return qu(this.state.doc, {
|
|
11894
11904
|
blockSeparator: t,
|
|
11895
11905
|
textSerializers: {
|
|
11896
11906
|
...po(this.schema),
|
|
@@ -12025,9 +12035,9 @@ F.prototype.map = function(e, t, n) {
|
|
|
12025
12035
|
}, t, n), i;
|
|
12026
12036
|
};
|
|
12027
12037
|
F.from = function(e) {
|
|
12028
|
-
return e instanceof F ? e : e && e.length ? new
|
|
12038
|
+
return e instanceof F ? e : e && e.length ? new wo(e) : F.empty;
|
|
12029
12039
|
};
|
|
12030
|
-
var
|
|
12040
|
+
var wo = /* @__PURE__ */ function(r) {
|
|
12031
12041
|
function e(n) {
|
|
12032
12042
|
r.call(this), this.values = n;
|
|
12033
12043
|
}
|
|
@@ -12059,7 +12069,7 @@ var Co = /* @__PURE__ */ function(r) {
|
|
|
12059
12069
|
return 0;
|
|
12060
12070
|
}, Object.defineProperties(e.prototype, t), e;
|
|
12061
12071
|
}(F);
|
|
12062
|
-
F.empty = new
|
|
12072
|
+
F.empty = new wo([]);
|
|
12063
12073
|
var Ed = /* @__PURE__ */ function(r) {
|
|
12064
12074
|
function e(t, n) {
|
|
12065
12075
|
r.call(this), this.left = t, this.right = n, this.length = t.length + n.length, this.depth = Math.max(t.depth, n.depth) + 1;
|
|
@@ -12320,7 +12330,7 @@ function Pd(r = {}) {
|
|
|
12320
12330
|
}
|
|
12321
12331
|
});
|
|
12322
12332
|
}
|
|
12323
|
-
function
|
|
12333
|
+
function Co(r, e) {
|
|
12324
12334
|
return (t, n) => {
|
|
12325
12335
|
let i = Ve.getState(t);
|
|
12326
12336
|
if (!i || (r ? i.undone : i.done).eventCount == 0)
|
|
@@ -12332,7 +12342,7 @@ function wo(r, e) {
|
|
|
12332
12342
|
return !0;
|
|
12333
12343
|
};
|
|
12334
12344
|
}
|
|
12335
|
-
const Mo =
|
|
12345
|
+
const Mo = Co(!1, !0), Eo = Co(!0, !0), Rd = J.create({
|
|
12336
12346
|
name: "history",
|
|
12337
12347
|
addOptions() {
|
|
12338
12348
|
return {
|
|
@@ -12361,7 +12371,7 @@ const Mo = wo(!1, !0), Eo = wo(!0, !0), Rd = q.create({
|
|
|
12361
12371
|
"Shift-Mod-я": () => this.editor.commands.redo()
|
|
12362
12372
|
};
|
|
12363
12373
|
}
|
|
12364
|
-
}), Bd =
|
|
12374
|
+
}), Bd = J.create({
|
|
12365
12375
|
name: "placeholder",
|
|
12366
12376
|
addOptions() {
|
|
12367
12377
|
return {
|
|
@@ -12477,7 +12487,7 @@ const Fd = Or.create({
|
|
|
12477
12487
|
}), Ld = Or.create({
|
|
12478
12488
|
name: "text",
|
|
12479
12489
|
group: "inline"
|
|
12480
|
-
}), $d =
|
|
12490
|
+
}), $d = Ct.create({
|
|
12481
12491
|
name: "inline",
|
|
12482
12492
|
addOptions() {
|
|
12483
12493
|
return {
|
|
@@ -12693,7 +12703,7 @@ function Wd(r) {
|
|
|
12693
12703
|
function Tt(r) {
|
|
12694
12704
|
return rr.get(r) || -1;
|
|
12695
12705
|
}
|
|
12696
|
-
function
|
|
12706
|
+
function qd(r, e) {
|
|
12697
12707
|
return e.nodesBetween(0, e.content.size, (t, n) => {
|
|
12698
12708
|
if (t.type.name === "note") {
|
|
12699
12709
|
const i = t.attrs.target;
|
|
@@ -12708,7 +12718,7 @@ function Jd(r, e) {
|
|
|
12708
12718
|
}
|
|
12709
12719
|
}), r;
|
|
12710
12720
|
}
|
|
12711
|
-
function
|
|
12721
|
+
function Jd(r, e, t = null) {
|
|
12712
12722
|
let n = null;
|
|
12713
12723
|
if (e.descendants((c, u) => {
|
|
12714
12724
|
if (c.type.name === "noteGrp")
|
|
@@ -12841,7 +12851,7 @@ const Ud = To.extend({
|
|
|
12841
12851
|
};
|
|
12842
12852
|
};
|
|
12843
12853
|
}
|
|
12844
|
-
}), Gd =
|
|
12854
|
+
}), Gd = J.create({
|
|
12845
12855
|
name: "footnoteRules",
|
|
12846
12856
|
priority: 1e3,
|
|
12847
12857
|
addProseMirrorPlugins() {
|
|
@@ -12906,7 +12916,7 @@ const Ud = To.extend({
|
|
|
12906
12916
|
f + 1
|
|
12907
12917
|
)));
|
|
12908
12918
|
}
|
|
12909
|
-
return s && (Wd(n.doc), n = Kd(n, n.doc), n =
|
|
12919
|
+
return s && (Wd(n.doc), n = Kd(n, n.doc), n = qd(n, n.doc), n = Jd(n, n.doc, i)), n;
|
|
12910
12920
|
}
|
|
12911
12921
|
})
|
|
12912
12922
|
];
|
|
@@ -12995,7 +13005,7 @@ const Xd = Fd.extend({
|
|
|
12995
13005
|
}), Qd = So({
|
|
12996
13006
|
find: /--(?!-)/,
|
|
12997
13007
|
replace: "–"
|
|
12998
|
-
}), eh =
|
|
13008
|
+
}), eh = J.create({
|
|
12999
13009
|
name: "inputRules",
|
|
13000
13010
|
addInputRules() {
|
|
13001
13011
|
return [
|
|
@@ -13003,7 +13013,7 @@ const Xd = Fd.extend({
|
|
|
13003
13013
|
Qd
|
|
13004
13014
|
];
|
|
13005
13015
|
}
|
|
13006
|
-
}), th =
|
|
13016
|
+
}), th = J.create({
|
|
13007
13017
|
name: "jinnTapCommands",
|
|
13008
13018
|
addCommands() {
|
|
13009
13019
|
return {
|
|
@@ -13211,17 +13221,17 @@ class lh {
|
|
|
13211
13221
|
d.open = !e.attrs[a];
|
|
13212
13222
|
const h = document.createElement("summary");
|
|
13213
13223
|
h.textContent = "Lookup", d.appendChild(h);
|
|
13214
|
-
const f = document.createElement("pb-authority-lookup");
|
|
13215
|
-
f.setAttribute("type", c.connector.type), f.setAttribute("query", t), f.setAttribute("auto",
|
|
13216
|
-
const
|
|
13217
|
-
if (
|
|
13218
|
-
const
|
|
13219
|
-
u.value =
|
|
13224
|
+
const f = document.createElement("pb-authority-lookup"), p = e.attrs[a] || e.attrs[a] === "";
|
|
13225
|
+
f.setAttribute("type", c.connector.type), f.setAttribute("query", t), f.setAttribute("auto", p), f.setAttribute("no-occurrences", !0);
|
|
13226
|
+
const m = document.createElement("pb-authority");
|
|
13227
|
+
if (m.setAttribute("connector", c.connector.name), m.setAttribute("name", c.connector.type), c.connector.user && m.setAttribute("user", c.connector.user), f.appendChild(m), document.addEventListener("pb-authority-select", (g) => {
|
|
13228
|
+
const y = `${c.connector.prefix}-${g.detail.properties.ref}`;
|
|
13229
|
+
u.value = y, d.open = !1, this.handleAttributeUpdate(e, { [a]: y });
|
|
13220
13230
|
}), d.appendChild(f), o.appendChild(d), e.attrs[a]) {
|
|
13221
|
-
const
|
|
13222
|
-
f.lookup(c.connector.type,
|
|
13223
|
-
const
|
|
13224
|
-
|
|
13231
|
+
const g = e.attrs[a].substring(e.attrs[a].indexOf("-") + 1);
|
|
13232
|
+
f.lookup(c.connector.type, g, s).then((y) => {
|
|
13233
|
+
const S = y.strings;
|
|
13234
|
+
S.sort((C, v) => v.length - C.length), S.unshift(t), this.updateOccurrences(this.editor, e, S);
|
|
13225
13235
|
});
|
|
13226
13236
|
}
|
|
13227
13237
|
} else
|
|
@@ -13249,8 +13259,8 @@ class lh {
|
|
|
13249
13259
|
a !== "" ? t[l] = a : i.push(l);
|
|
13250
13260
|
console.log("<jinn-tap> pendingChanges: %o, cleared: %o", t, i);
|
|
13251
13261
|
const { from: s, to: o } = this.editor.state.selection;
|
|
13252
|
-
if (e instanceof
|
|
13253
|
-
if (e instanceof
|
|
13262
|
+
if (e instanceof D && this.editor.chain().focus().extendMarkRange(e.type).run(), Object.keys(t).length > 0)
|
|
13263
|
+
if (e instanceof D)
|
|
13254
13264
|
i.length > 0 && this.editor.commands.resetAttributes(e.type, i), this.editor.chain().focus().updateAttributes(e.type, t).setTextSelection({ from: s, to: o }).run();
|
|
13255
13265
|
else {
|
|
13256
13266
|
let l = null;
|
|
@@ -13292,8 +13302,8 @@ class lh {
|
|
|
13292
13302
|
to: d.pos + d.index + d.length,
|
|
13293
13303
|
hasMark: m
|
|
13294
13304
|
});
|
|
13295
|
-
const
|
|
13296
|
-
A.innerHTML =
|
|
13305
|
+
const C = e.state.doc.textBetween(d.pos, h.end()), v = oh(C, d.index, d.index + d.length), A = document.createElement("span");
|
|
13306
|
+
A.innerHTML = v, y.appendChild(A), g.appendChild(y), o.appendChild(g), y.addEventListener("mouseenter", (M) => {
|
|
13297
13307
|
M.preventDefault(), M.stopPropagation();
|
|
13298
13308
|
const I = e.view.nodeDOM(d.pos);
|
|
13299
13309
|
if (I) {
|
|
@@ -13417,9 +13427,9 @@ class ch {
|
|
|
13417
13427
|
h.isGlobal ? this.addOptionToSelect(u, h.name, h.def, h.name, h.def) : this.addOptionToSelect(u, h.name, h.def, h.label, h.toolbarDef);
|
|
13418
13428
|
});
|
|
13419
13429
|
} else {
|
|
13420
|
-
const c = this.createButton(a.name, a.label, a.toolbarDef || a.def);
|
|
13430
|
+
const c = this.createButton(a.name, a.isGlobal ? a.name : a.label, a.isGlobal ? a.def : a.toolbarDef || a.def);
|
|
13421
13431
|
c.addEventListener("click", (d) => {
|
|
13422
|
-
d.preventDefault(), this.
|
|
13432
|
+
d.preventDefault(), this.nodeAction(a.name, a.def, a.toolbarDef || a.def);
|
|
13423
13433
|
});
|
|
13424
13434
|
const u = document.createElement("li");
|
|
13425
13435
|
u.appendChild(c), this.toolbar.appendChild(u);
|
|
@@ -13432,7 +13442,7 @@ class ch {
|
|
|
13432
13442
|
c.hasAttribute("debug") ? c.removeAttribute("debug") : c.setAttribute("debug", "");
|
|
13433
13443
|
});
|
|
13434
13444
|
const l = document.createElement("li");
|
|
13435
|
-
l.appendChild(o), this.toolbar.appendChild(l);
|
|
13445
|
+
l.appendChild(o), this.toolbar.appendChild(l), this.editor.on("selectionUpdate", this.updateButtonStates.bind(this));
|
|
13436
13446
|
}
|
|
13437
13447
|
/**
|
|
13438
13448
|
* Perform action for a node in the toolbar.
|
|
@@ -13440,59 +13450,56 @@ class ch {
|
|
|
13440
13450
|
* @param {string} name - The name of the node.
|
|
13441
13451
|
* @param {Object} def - The definition of the node.
|
|
13442
13452
|
* @param {Object} toolbarDef - The definition of the toolbar item.
|
|
13453
|
+
* @param {boolean} checkOnly - Whether to only check if the action can be performed.
|
|
13443
13454
|
*/
|
|
13444
|
-
|
|
13455
|
+
nodeAction(e, t, n, i = !1) {
|
|
13445
13456
|
if (e === "head") {
|
|
13446
|
-
const { state:
|
|
13447
|
-
if (mt(
|
|
13457
|
+
const { state: o } = this.editor, { selection: l } = o, { $from: a } = l;
|
|
13458
|
+
if (mt(a, (u) => u.type.name === "item")) {
|
|
13459
|
+
if (i)
|
|
13460
|
+
return this.editor.can().transformToHead();
|
|
13448
13461
|
this.editor.chain().focus().transformToHead().run();
|
|
13449
13462
|
return;
|
|
13450
13463
|
}
|
|
13451
13464
|
}
|
|
13452
|
-
|
|
13453
|
-
if (n.command)
|
|
13454
|
-
n.args ?
|
|
13465
|
+
let s;
|
|
13466
|
+
if (i ? s = this.editor.can() : s = this.editor.chain().focus(), n.command)
|
|
13467
|
+
n.args ? s = s[n.command](...n.args) : s = s[n.command](e, n.attributes);
|
|
13455
13468
|
else if (t.type === "inline")
|
|
13456
|
-
|
|
13469
|
+
s = s.toggleMark(e, n.attributes);
|
|
13457
13470
|
else if (t.type === "list")
|
|
13458
|
-
|
|
13471
|
+
s = s.toggleList(n.attributes);
|
|
13459
13472
|
else if (t.type === "anchor")
|
|
13460
|
-
|
|
13473
|
+
s = s.addAnchor(n.attributes);
|
|
13461
13474
|
else if (t.type === "empty" || t.type === "graphic")
|
|
13462
|
-
|
|
13475
|
+
s = s.insertContent({
|
|
13463
13476
|
type: e,
|
|
13464
13477
|
attrs: n.attributes
|
|
13465
13478
|
});
|
|
13466
13479
|
else {
|
|
13467
|
-
const
|
|
13468
|
-
|
|
13480
|
+
const o = this.editor.schema.nodes[e];
|
|
13481
|
+
o && o.isTextblock ? s = s.setNode(e, n.attributes) : s = s.wrapIn(e, n.attributes);
|
|
13469
13482
|
}
|
|
13470
|
-
i
|
|
13483
|
+
if (i)
|
|
13484
|
+
return s;
|
|
13485
|
+
s.run();
|
|
13471
13486
|
}
|
|
13472
13487
|
createButton(e, t, n) {
|
|
13473
13488
|
const i = document.createElement("a");
|
|
13474
|
-
return i.href = "#", i.className = "outline toolbar-button", n.label && (i.innerHTML = n.label), i.dataset.tooltip = t, i.dataset.placement = "bottom", i.addEventListener("mousedown", (s) => {
|
|
13489
|
+
return i.href = "#", i.className = "outline toolbar-button", n.label && (i.innerHTML = n.label), i.dataset.tooltip = t, i.dataset.placement = "bottom", i.dataset.name = e, i.addEventListener("mousedown", (s) => {
|
|
13475
13490
|
s.preventDefault();
|
|
13476
|
-
}), this.editor.on("selectionUpdate", ({ editor: s }) => {
|
|
13477
|
-
this.updateButtonState(i, e, n, s);
|
|
13478
13491
|
}), i;
|
|
13479
13492
|
}
|
|
13480
13493
|
/**
|
|
13481
|
-
* Update the state of
|
|
13482
|
-
*
|
|
13483
|
-
* @param {Element} button - The button or linkelement.
|
|
13484
|
-
* @param {string} name - The name of the node.
|
|
13485
|
-
* @param {Object} def - The definition of the node.
|
|
13486
|
-
* @param {Object} editor - The editor instance.
|
|
13494
|
+
* Update the state of buttons based on the current selection.
|
|
13487
13495
|
*/
|
|
13488
|
-
|
|
13489
|
-
|
|
13490
|
-
|
|
13491
|
-
|
|
13492
|
-
|
|
13493
|
-
|
|
13494
|
-
|
|
13495
|
-
})), e.disabled = !o, o ? e.classList.remove("disabled") : e.classList.add("disabled"), e.classList.toggle("active", i.isActive(t));
|
|
13496
|
+
updateButtonStates() {
|
|
13497
|
+
this.toolbar.querySelectorAll("a[data-name]").forEach((t) => {
|
|
13498
|
+
const n = this.schemaDef.schema[t.dataset.name];
|
|
13499
|
+
if (!n) return;
|
|
13500
|
+
const i = this.nodeAction(t.dataset.name, n, n, !0);
|
|
13501
|
+
t.disabled = !i, i ? t.classList.remove("disabled") : t.classList.add("disabled"), t.classList.toggle("active", this.editor.isActive(t.dataset.name));
|
|
13502
|
+
});
|
|
13496
13503
|
}
|
|
13497
13504
|
createSelect(e) {
|
|
13498
13505
|
const t = document.createElement("details");
|
|
@@ -13504,10 +13511,8 @@ class ch {
|
|
|
13504
13511
|
}
|
|
13505
13512
|
addOptionToSelect(e, t, n, i, s) {
|
|
13506
13513
|
const o = document.createElement("li"), l = document.createElement("a");
|
|
13507
|
-
l.innerHTML = s.label, l.appendChild(document.createTextNode(" " + i)), l.href = "#", o.appendChild(l), l.addEventListener("click", (a) => {
|
|
13508
|
-
a.preventDefault(), e.open = !1, this.
|
|
13509
|
-
}), this.editor.on("selectionUpdate", ({ editor: a }) => {
|
|
13510
|
-
this.updateButtonState(l, t, n, a);
|
|
13514
|
+
l.innerHTML = s.label, l.dataset.name = t, l.appendChild(document.createTextNode(" " + i)), l.href = "#", o.appendChild(l), l.addEventListener("click", (a) => {
|
|
13515
|
+
a.preventDefault(), e.open = !1, this.nodeAction(t, n, s);
|
|
13511
13516
|
}), e.querySelector("ul").appendChild(o);
|
|
13512
13517
|
}
|
|
13513
13518
|
}
|
|
@@ -13517,16 +13522,16 @@ function uh(r) {
|
|
|
13517
13522
|
if (p === m)
|
|
13518
13523
|
g = y = 0;
|
|
13519
13524
|
else {
|
|
13520
|
-
let
|
|
13521
|
-
switch (y = S > 0.5 ?
|
|
13525
|
+
let C = p - m;
|
|
13526
|
+
switch (y = S > 0.5 ? C / (2 - p - m) : C / (p + m), p) {
|
|
13522
13527
|
case d:
|
|
13523
|
-
g = (h - f) /
|
|
13528
|
+
g = (h - f) / C + (h < f ? 6 : 0);
|
|
13524
13529
|
break;
|
|
13525
13530
|
case h:
|
|
13526
|
-
g = (f - d) /
|
|
13531
|
+
g = (f - d) / C + 2;
|
|
13527
13532
|
break;
|
|
13528
13533
|
case f:
|
|
13529
|
-
g = (d - h) /
|
|
13534
|
+
g = (d - h) / C + 4;
|
|
13530
13535
|
break;
|
|
13531
13536
|
}
|
|
13532
13537
|
g /= 6;
|