@jinntec/jinntap 1.4.0 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/jinn-tap.es.js +837 -777
- package/dist/jinn-tap.umd.js +19 -19
- package/package.json +1 -1
package/dist/jinn-tap.es.js
CHANGED
|
@@ -428,7 +428,7 @@ function jt(r, e) {
|
|
|
428
428
|
}
|
|
429
429
|
return !0;
|
|
430
430
|
}
|
|
431
|
-
let
|
|
431
|
+
let v = class zn {
|
|
432
432
|
/**
|
|
433
433
|
@internal
|
|
434
434
|
*/
|
|
@@ -533,7 +533,7 @@ let D = class zn {
|
|
|
533
533
|
return t.sort((n, i) => n.type.rank - i.type.rank), t;
|
|
534
534
|
}
|
|
535
535
|
};
|
|
536
|
-
|
|
536
|
+
v.none = [];
|
|
537
537
|
class Ht extends Error {
|
|
538
538
|
}
|
|
539
539
|
class k {
|
|
@@ -635,7 +635,7 @@ function Wi(r, e, t, n) {
|
|
|
635
635
|
let l = Wi(o.content, e - s - 1, t);
|
|
636
636
|
return l && r.replaceChild(i, o.copy(l));
|
|
637
637
|
}
|
|
638
|
-
function
|
|
638
|
+
function vo(r, e, t) {
|
|
639
639
|
if (t.openStart > r.depth)
|
|
640
640
|
throw new Ht("Inserted content deeper than insertion position");
|
|
641
641
|
if (r.depth - t.openStart != e.depth - t.openEnd)
|
|
@@ -652,7 +652,7 @@ function Ji(r, e, t, n) {
|
|
|
652
652
|
let o = r.parent, l = o.content;
|
|
653
653
|
return Fe(o, l.cut(0, r.parentOffset).append(t.content).append(l.cut(e.parentOffset)));
|
|
654
654
|
} else {
|
|
655
|
-
let { start: o, end: l } =
|
|
655
|
+
let { start: o, end: l } = Do(t, r);
|
|
656
656
|
return Fe(s, Ki(r, o, l, e, n));
|
|
657
657
|
}
|
|
658
658
|
else return Fe(s, Wt(r, e, n));
|
|
@@ -691,7 +691,7 @@ function Wt(r, e, t) {
|
|
|
691
691
|
}
|
|
692
692
|
return ut(e, null, t, n), new b(n);
|
|
693
693
|
}
|
|
694
|
-
function
|
|
694
|
+
function Do(r, e) {
|
|
695
695
|
let t = e.depth - r.openStart, i = e.node(t).copy(r.content);
|
|
696
696
|
for (let s = t - 1; s >= 0; s--)
|
|
697
697
|
i = e.node(s).copy(b.from(i));
|
|
@@ -831,7 +831,7 @@ class mt {
|
|
|
831
831
|
marks() {
|
|
832
832
|
let e = this.parent, t = this.index();
|
|
833
833
|
if (e.content.size == 0)
|
|
834
|
-
return
|
|
834
|
+
return v.none;
|
|
835
835
|
if (this.textOffset)
|
|
836
836
|
return e.child(t).marks;
|
|
837
837
|
let n = e.maybeChild(t - 1), i = e.maybeChild(t);
|
|
@@ -942,17 +942,17 @@ class mt {
|
|
|
942
942
|
return o;
|
|
943
943
|
}
|
|
944
944
|
else
|
|
945
|
-
Nr.set(e, n = new
|
|
945
|
+
Nr.set(e, n = new Io());
|
|
946
946
|
let i = n.elts[n.i] = mt.resolve(e, t);
|
|
947
|
-
return n.i = (n.i + 1) %
|
|
947
|
+
return n.i = (n.i + 1) % Po, i;
|
|
948
948
|
}
|
|
949
949
|
}
|
|
950
|
-
class
|
|
950
|
+
class Io {
|
|
951
951
|
constructor() {
|
|
952
952
|
this.elts = [], this.i = 0;
|
|
953
953
|
}
|
|
954
954
|
}
|
|
955
|
-
const
|
|
955
|
+
const Po = 12, Nr = /* @__PURE__ */ new WeakMap();
|
|
956
956
|
class Jt {
|
|
957
957
|
/**
|
|
958
958
|
Construct a node range. `$from` and `$to` should point into the
|
|
@@ -993,12 +993,12 @@ class Jt {
|
|
|
993
993
|
return this.$to.indexAfter(this.depth);
|
|
994
994
|
}
|
|
995
995
|
}
|
|
996
|
-
const
|
|
997
|
-
let
|
|
996
|
+
const Ro = /* @__PURE__ */ Object.create(null);
|
|
997
|
+
let ue = class Ln {
|
|
998
998
|
/**
|
|
999
999
|
@internal
|
|
1000
1000
|
*/
|
|
1001
|
-
constructor(e, t, n, i =
|
|
1001
|
+
constructor(e, t, n, i = v.none) {
|
|
1002
1002
|
this.type = e, this.attrs = t, this.marks = i, this.content = n || b.empty;
|
|
1003
1003
|
}
|
|
1004
1004
|
/**
|
|
@@ -1112,7 +1112,7 @@ let Me = class Ln {
|
|
|
1112
1112
|
attributes, and marks.
|
|
1113
1113
|
*/
|
|
1114
1114
|
hasMarkup(e, t, n) {
|
|
1115
|
-
return this.type == e && jt(this.attrs, t || e.defaultAttrs ||
|
|
1115
|
+
return this.type == e && jt(this.attrs, t || e.defaultAttrs || Ro) && v.sameSet(this.marks, n || v.none);
|
|
1116
1116
|
}
|
|
1117
1117
|
/**
|
|
1118
1118
|
Create a new node with the same markup as this node, containing
|
|
@@ -1155,7 +1155,7 @@ let Me = class Ln {
|
|
|
1155
1155
|
[`ReplaceError`](https://prosemirror.net/docs/ref/#model.ReplaceError) is thrown.
|
|
1156
1156
|
*/
|
|
1157
1157
|
replace(e, t, n) {
|
|
1158
|
-
return
|
|
1158
|
+
return vo(this.resolve(e), this.resolve(t), n);
|
|
1159
1159
|
}
|
|
1160
1160
|
/**
|
|
1161
1161
|
Find the node directly after the given position.
|
|
@@ -1322,12 +1322,12 @@ let Me = class Ln {
|
|
|
1322
1322
|
*/
|
|
1323
1323
|
check() {
|
|
1324
1324
|
this.type.checkContent(this.content), this.type.checkAttrs(this.attrs);
|
|
1325
|
-
let e =
|
|
1325
|
+
let e = v.none;
|
|
1326
1326
|
for (let t = 0; t < this.marks.length; t++) {
|
|
1327
1327
|
let n = this.marks[t];
|
|
1328
1328
|
n.type.checkAttrs(n.attrs), e = n.addToSet(e);
|
|
1329
1329
|
}
|
|
1330
|
-
if (!
|
|
1330
|
+
if (!v.sameSet(e, this.marks))
|
|
1331
1331
|
throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map((t) => t.type.name)}`);
|
|
1332
1332
|
this.content.forEach((t) => t.check());
|
|
1333
1333
|
}
|
|
@@ -1363,8 +1363,8 @@ let Me = class Ln {
|
|
|
1363
1363
|
return s.type.checkAttrs(s.attrs), s;
|
|
1364
1364
|
}
|
|
1365
1365
|
};
|
|
1366
|
-
|
|
1367
|
-
class qt extends
|
|
1366
|
+
ue.prototype.text = void 0;
|
|
1367
|
+
class qt extends ue {
|
|
1368
1368
|
/**
|
|
1369
1369
|
@internal
|
|
1370
1370
|
*/
|
|
@@ -1418,13 +1418,13 @@ class je {
|
|
|
1418
1418
|
@internal
|
|
1419
1419
|
*/
|
|
1420
1420
|
static parse(e, t) {
|
|
1421
|
-
let n = new
|
|
1421
|
+
let n = new Bo(e, t);
|
|
1422
1422
|
if (n.next == null)
|
|
1423
1423
|
return je.empty;
|
|
1424
1424
|
let i = _i(n);
|
|
1425
1425
|
n.next && n.err("Unexpected trailing text");
|
|
1426
|
-
let s = jo(
|
|
1427
|
-
return
|
|
1426
|
+
let s = Ho(jo(i));
|
|
1427
|
+
return Wo(s, n), s;
|
|
1428
1428
|
}
|
|
1429
1429
|
/**
|
|
1430
1430
|
Match a node type, returning a match after that node if
|
|
@@ -1570,7 +1570,7 @@ class je {
|
|
|
1570
1570
|
}
|
|
1571
1571
|
}
|
|
1572
1572
|
je.empty = new je(!0);
|
|
1573
|
-
class
|
|
1573
|
+
class Bo {
|
|
1574
1574
|
constructor(e, t) {
|
|
1575
1575
|
this.string = e, this.nodeTypes = t, this.inline = null, this.pos = 0, this.tokens = e.split(/\s*(?=\b|\W|$)/), this.tokens[this.tokens.length - 1] == "" && this.tokens.pop(), this.tokens[0] == "" && this.tokens.shift();
|
|
1576
1576
|
}
|
|
@@ -1587,19 +1587,19 @@ class Ro {
|
|
|
1587
1587
|
function _i(r) {
|
|
1588
1588
|
let e = [];
|
|
1589
1589
|
do
|
|
1590
|
-
e.push(
|
|
1590
|
+
e.push(zo(r));
|
|
1591
1591
|
while (r.eat("|"));
|
|
1592
1592
|
return e.length == 1 ? e[0] : { type: "choice", exprs: e };
|
|
1593
1593
|
}
|
|
1594
|
-
function
|
|
1594
|
+
function zo(r) {
|
|
1595
1595
|
let e = [];
|
|
1596
1596
|
do
|
|
1597
|
-
e.push(
|
|
1597
|
+
e.push(Fo(r));
|
|
1598
1598
|
while (r.next && r.next != ")" && r.next != "|");
|
|
1599
1599
|
return e.length == 1 ? e[0] : { type: "seq", exprs: e };
|
|
1600
1600
|
}
|
|
1601
|
-
function
|
|
1602
|
-
let e =
|
|
1601
|
+
function Fo(r) {
|
|
1602
|
+
let e = Vo(r);
|
|
1603
1603
|
for (; ; )
|
|
1604
1604
|
if (r.eat("+"))
|
|
1605
1605
|
e = { type: "plus", expr: e };
|
|
@@ -1608,7 +1608,7 @@ function zo(r) {
|
|
|
1608
1608
|
else if (r.eat("?"))
|
|
1609
1609
|
e = { type: "opt", expr: e };
|
|
1610
1610
|
else if (r.eat("{"))
|
|
1611
|
-
e =
|
|
1611
|
+
e = Lo(r, e);
|
|
1612
1612
|
else
|
|
1613
1613
|
break;
|
|
1614
1614
|
return e;
|
|
@@ -1618,11 +1618,11 @@ function Ar(r) {
|
|
|
1618
1618
|
let e = Number(r.next);
|
|
1619
1619
|
return r.pos++, e;
|
|
1620
1620
|
}
|
|
1621
|
-
function
|
|
1621
|
+
function Lo(r, e) {
|
|
1622
1622
|
let t = Ar(r), n = t;
|
|
1623
1623
|
return r.eat(",") && (r.next != "}" ? n = Ar(r) : n = -1), r.eat("}") || r.err("Unclosed braced range"), { type: "range", min: t, max: n, expr: e };
|
|
1624
1624
|
}
|
|
1625
|
-
function
|
|
1625
|
+
function $o(r, e) {
|
|
1626
1626
|
let t = r.nodeTypes, n = t[e];
|
|
1627
1627
|
if (n)
|
|
1628
1628
|
return [n];
|
|
@@ -1633,18 +1633,18 @@ function Lo(r, e) {
|
|
|
1633
1633
|
}
|
|
1634
1634
|
return i.length == 0 && r.err("No node type or group '" + e + "' found"), i;
|
|
1635
1635
|
}
|
|
1636
|
-
function
|
|
1636
|
+
function Vo(r) {
|
|
1637
1637
|
if (r.eat("(")) {
|
|
1638
1638
|
let e = _i(r);
|
|
1639
1639
|
return r.eat(")") || r.err("Missing closing paren"), e;
|
|
1640
1640
|
} else if (/\W/.test(r.next))
|
|
1641
1641
|
r.err("Unexpected token '" + r.next + "'");
|
|
1642
1642
|
else {
|
|
1643
|
-
let e =
|
|
1643
|
+
let e = $o(r, r.next).map((t) => (r.inline == null ? r.inline = t.isInline : r.inline != t.isInline && r.err("Mixing inline and block content"), { type: "name", value: t }));
|
|
1644
1644
|
return r.pos++, e.length == 1 ? e[0] : { type: "choice", exprs: e };
|
|
1645
1645
|
}
|
|
1646
1646
|
}
|
|
1647
|
-
function
|
|
1647
|
+
function jo(r) {
|
|
1648
1648
|
let e = [[]];
|
|
1649
1649
|
return i(s(r, 0), t()), e;
|
|
1650
1650
|
function t() {
|
|
@@ -1715,7 +1715,7 @@ function vr(r, e) {
|
|
|
1715
1715
|
}
|
|
1716
1716
|
}
|
|
1717
1717
|
}
|
|
1718
|
-
function
|
|
1718
|
+
function Ho(r) {
|
|
1719
1719
|
let e = /* @__PURE__ */ Object.create(null);
|
|
1720
1720
|
return t(vr(r, 0));
|
|
1721
1721
|
function t(n) {
|
|
@@ -1740,7 +1740,7 @@ function jo(r) {
|
|
|
1740
1740
|
return s;
|
|
1741
1741
|
}
|
|
1742
1742
|
}
|
|
1743
|
-
function
|
|
1743
|
+
function Wo(r, e) {
|
|
1744
1744
|
for (let t = 0, n = [r]; t < n.length; t++) {
|
|
1745
1745
|
let i = n[t], s = !i.validEnd, o = [];
|
|
1746
1746
|
for (let l = 0; l < i.next.length; l++) {
|
|
@@ -1788,7 +1788,7 @@ function Qi(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 qo(r, n, e[n]);
|
|
1792
1792
|
return t;
|
|
1793
1793
|
}
|
|
1794
1794
|
let Dr = class es {
|
|
@@ -1870,7 +1870,7 @@ let Dr = class es {
|
|
|
1870
1870
|
create(e = null, t, n) {
|
|
1871
1871
|
if (this.isText)
|
|
1872
1872
|
throw new Error("NodeType.create can't construct text nodes");
|
|
1873
|
-
return new
|
|
1873
|
+
return new ue(this, this.computeAttrs(e), b.from(t), v.setFrom(n));
|
|
1874
1874
|
}
|
|
1875
1875
|
/**
|
|
1876
1876
|
Like [`create`](https://prosemirror.net/docs/ref/#model.NodeType.create), but check the given content
|
|
@@ -1878,7 +1878,7 @@ let Dr = class es {
|
|
|
1878
1878
|
if it doesn't match.
|
|
1879
1879
|
*/
|
|
1880
1880
|
createChecked(e = null, t, n) {
|
|
1881
|
-
return t = b.from(t), this.checkContent(t), new
|
|
1881
|
+
return t = b.from(t), this.checkContent(t), new ue(this, this.computeAttrs(e), t, v.setFrom(n));
|
|
1882
1882
|
}
|
|
1883
1883
|
/**
|
|
1884
1884
|
Like [`create`](https://prosemirror.net/docs/ref/#model.NodeType.create), but see if it is
|
|
@@ -1896,7 +1896,7 @@ let Dr = class es {
|
|
|
1896
1896
|
t = o.append(t);
|
|
1897
1897
|
}
|
|
1898
1898
|
let i = this.contentMatch.matchFragment(t), s = i && i.fillBefore(b.empty, !0);
|
|
1899
|
-
return s ? new
|
|
1899
|
+
return s ? new ue(this, e, t.append(s), v.setFrom(n)) : null;
|
|
1900
1900
|
}
|
|
1901
1901
|
/**
|
|
1902
1902
|
Returns true if the given fragment is valid content for this node
|
|
@@ -1952,7 +1952,7 @@ let Dr = class es {
|
|
|
1952
1952
|
let t;
|
|
1953
1953
|
for (let n = 0; n < e.length; n++)
|
|
1954
1954
|
this.allowsMarkType(e[n].type) ? t && t.push(e[n]) : t || (t = e.slice(0, n));
|
|
1955
|
-
return t ? t.length ? t :
|
|
1955
|
+
return t ? t.length ? t : v.none : e;
|
|
1956
1956
|
}
|
|
1957
1957
|
/**
|
|
1958
1958
|
@internal
|
|
@@ -1970,7 +1970,7 @@ let Dr = class es {
|
|
|
1970
1970
|
return n;
|
|
1971
1971
|
}
|
|
1972
1972
|
};
|
|
1973
|
-
function
|
|
1973
|
+
function Jo(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 Wo(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 qo {
|
|
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" ? Jo(e, t, n.validate) : n.validate;
|
|
1984
1984
|
}
|
|
1985
1985
|
get isRequired() {
|
|
1986
1986
|
return !this.hasDefault;
|
|
@@ -1993,7 +1993,7 @@ class tn {
|
|
|
1993
1993
|
constructor(e, t, n, i) {
|
|
1994
1994
|
this.name = e, this.rank = t, this.schema = n, this.spec = i, this.attrs = Qi(e, i.attrs), this.excluded = null;
|
|
1995
1995
|
let s = Yi(this.attrs);
|
|
1996
|
-
this.instance = s ? new
|
|
1996
|
+
this.instance = s ? new v(this, s) : null;
|
|
1997
1997
|
}
|
|
1998
1998
|
/**
|
|
1999
1999
|
Create a mark of this type. `attrs` may be `null` or an object
|
|
@@ -2001,7 +2001,7 @@ class tn {
|
|
|
2001
2001
|
they have defaults, will be added.
|
|
2002
2002
|
*/
|
|
2003
2003
|
create(e = null) {
|
|
2004
|
-
return !e && this.instance ? this.instance : new
|
|
2004
|
+
return !e && this.instance ? this.instance : new v(this, Xi(this.attrs, e));
|
|
2005
2005
|
}
|
|
2006
2006
|
/**
|
|
2007
2007
|
@internal
|
|
@@ -2092,7 +2092,7 @@ class ts {
|
|
|
2092
2092
|
*/
|
|
2093
2093
|
text(e, t) {
|
|
2094
2094
|
let n = this.nodes.text;
|
|
2095
|
-
return new qt(n, n.defaultAttrs, e,
|
|
2095
|
+
return new qt(n, n.defaultAttrs, e, v.setFrom(t));
|
|
2096
2096
|
}
|
|
2097
2097
|
/**
|
|
2098
2098
|
Create a mark with the given type and attributes.
|
|
@@ -2105,14 +2105,14 @@ class ts {
|
|
|
2105
2105
|
bound.
|
|
2106
2106
|
*/
|
|
2107
2107
|
nodeFromJSON(e) {
|
|
2108
|
-
return
|
|
2108
|
+
return ue.fromJSON(this, e);
|
|
2109
2109
|
}
|
|
2110
2110
|
/**
|
|
2111
2111
|
Deserialize a mark from its JSON representation. This method is
|
|
2112
2112
|
bound.
|
|
2113
2113
|
*/
|
|
2114
2114
|
markFromJSON(e) {
|
|
2115
|
-
return
|
|
2115
|
+
return v.fromJSON(this, e);
|
|
2116
2116
|
}
|
|
2117
2117
|
/**
|
|
2118
2118
|
@internal
|
|
@@ -2140,10 +2140,10 @@ function Ir(r, e) {
|
|
|
2140
2140
|
}
|
|
2141
2141
|
return t;
|
|
2142
2142
|
}
|
|
2143
|
-
function
|
|
2143
|
+
function Ko(r) {
|
|
2144
2144
|
return r.tag != null;
|
|
2145
2145
|
}
|
|
2146
|
-
function
|
|
2146
|
+
function Uo(r) {
|
|
2147
2147
|
return r.style != null;
|
|
2148
2148
|
}
|
|
2149
2149
|
let dt = class $n {
|
|
@@ -2155,9 +2155,9 @@ let dt = class $n {
|
|
|
2155
2155
|
this.schema = e, this.rules = t, this.tags = [], this.styles = [];
|
|
2156
2156
|
let n = this.matchedStyles = [];
|
|
2157
2157
|
t.forEach((i) => {
|
|
2158
|
-
if (
|
|
2158
|
+
if (Ko(i))
|
|
2159
2159
|
this.tags.push(i);
|
|
2160
|
-
else if (
|
|
2160
|
+
else if (Uo(i)) {
|
|
2161
2161
|
let s = /[^=]*/.exec(i.style)[0];
|
|
2162
2162
|
n.indexOf(s) < 0 && n.push(s), this.styles.push(i);
|
|
2163
2163
|
}
|
|
@@ -2173,7 +2173,7 @@ let dt = class $n {
|
|
|
2173
2173
|
*/
|
|
2174
2174
|
parse(e, t = {}) {
|
|
2175
2175
|
let n = new Rr(this, t, !1);
|
|
2176
|
-
return n.addAll(e,
|
|
2176
|
+
return n.addAll(e, v.none, t.from, t.to), n.finish();
|
|
2177
2177
|
}
|
|
2178
2178
|
/**
|
|
2179
2179
|
Parses the content of the given DOM node, like
|
|
@@ -2185,7 +2185,7 @@ let dt = class $n {
|
|
|
2185
2185
|
*/
|
|
2186
2186
|
parseSlice(e, t = {}) {
|
|
2187
2187
|
let n = new Rr(this, t, !0);
|
|
2188
|
-
return n.addAll(e,
|
|
2188
|
+
return n.addAll(e, v.none, t.from, t.to), k.maxOpen(n.finish());
|
|
2189
2189
|
}
|
|
2190
2190
|
/**
|
|
2191
2191
|
@internal
|
|
@@ -2193,7 +2193,7 @@ let dt = class $n {
|
|
|
2193
2193
|
matchTag(e, t, n) {
|
|
2194
2194
|
for (let i = n ? this.tags.indexOf(n) + 1 : 0; i < this.tags.length; i++) {
|
|
2195
2195
|
let s = this.tags[i];
|
|
2196
|
-
if (
|
|
2196
|
+
if (Yo(e, s.tag) && (s.namespace === void 0 || e.namespaceURI == s.namespace) && (!s.context || t.matchesContext(s.context))) {
|
|
2197
2197
|
if (s.getAttrs) {
|
|
2198
2198
|
let o = s.getAttrs(e);
|
|
2199
2199
|
if (o === !1)
|
|
@@ -2294,7 +2294,7 @@ const ns = {
|
|
|
2294
2294
|
table: !0,
|
|
2295
2295
|
tfoot: !0,
|
|
2296
2296
|
ul: !0
|
|
2297
|
-
},
|
|
2297
|
+
}, _o = {
|
|
2298
2298
|
head: !0,
|
|
2299
2299
|
noscript: !0,
|
|
2300
2300
|
object: !0,
|
|
@@ -2307,7 +2307,7 @@ function Pr(r, e, t) {
|
|
|
2307
2307
|
}
|
|
2308
2308
|
class vt {
|
|
2309
2309
|
constructor(e, t, n, i, s, o) {
|
|
2310
|
-
this.type = e, this.attrs = t, this.marks = n, this.solid = i, this.options = o, this.content = [], this.activeMarks =
|
|
2310
|
+
this.type = e, this.attrs = t, this.marks = n, this.solid = i, this.options = o, this.content = [], this.activeMarks = v.none, this.match = s || (o & Bt ? null : e.contentMatch);
|
|
2311
2311
|
}
|
|
2312
2312
|
findWrapping(e) {
|
|
2313
2313
|
if (!this.match) {
|
|
@@ -2342,7 +2342,7 @@ class Rr {
|
|
|
2342
2342
|
constructor(e, t, n) {
|
|
2343
2343
|
this.parser = e, this.options = t, this.isOpen = n, this.open = 0, this.localPreserveWS = !1;
|
|
2344
2344
|
let i = t.topNode, s, o = Pr(null, t.preserveWhitespace, 0) | (n ? Bt : 0);
|
|
2345
|
-
i ? s = new vt(i.type, i.attrs,
|
|
2345
|
+
i ? s = new vt(i.type, i.attrs, v.none, !0, t.topMatch || i.type.contentMatch, o) : n ? s = new vt(null, null, v.none, !0, null, o) : s = new vt(e.schema.topNodeType, null, v.none, !0, null, o), this.nodes = [s], this.find = t.findPositions, this.needsBlock = !1;
|
|
2346
2346
|
}
|
|
2347
2347
|
get top() {
|
|
2348
2348
|
return this.nodes[this.open];
|
|
@@ -2373,9 +2373,9 @@ class Rr {
|
|
|
2373
2373
|
let i = this.localPreserveWS, s = this.top;
|
|
2374
2374
|
(e.tagName == "PRE" || /pre/.test(e.style && e.style.whiteSpace)) && (this.localPreserveWS = !0);
|
|
2375
2375
|
let o = e.nodeName.toLowerCase(), l;
|
|
2376
|
-
rs.hasOwnProperty(o) && this.parser.normalizeLists &&
|
|
2376
|
+
rs.hasOwnProperty(o) && this.parser.normalizeLists && Go(e);
|
|
2377
2377
|
let a = this.options.ruleFromNode && this.options.ruleFromNode(e) || (l = this.parser.matchTag(e, this, n));
|
|
2378
|
-
e: if (a ? a.ignore :
|
|
2378
|
+
e: if (a ? a.ignore : _o.hasOwnProperty(o))
|
|
2379
2379
|
this.findInside(e), this.ignoreFallback(e, t);
|
|
2380
2380
|
else if (!a || a.skip || a.closeParent) {
|
|
2381
2381
|
a && a.closeParent ? this.open = Math.max(0, this.open - 1) : a && a.skip.nodeType && (e = a.skip);
|
|
@@ -2492,7 +2492,7 @@ class Rr {
|
|
|
2492
2492
|
this.closeExtra();
|
|
2493
2493
|
let i = this.top;
|
|
2494
2494
|
i.match && (i.match = i.match.matchType(e.type));
|
|
2495
|
-
let s =
|
|
2495
|
+
let s = v.none;
|
|
2496
2496
|
for (let o of n.concat(e.marks))
|
|
2497
2497
|
(i.type ? i.type.allowsMarkType(o.type) : zr(o.type, e.type)) && (s = o.addToSet(s));
|
|
2498
2498
|
return i.content.push(e.mark(s)), !0;
|
|
@@ -2512,7 +2512,7 @@ class Rr {
|
|
|
2512
2512
|
o.match = o.match && o.match.matchType(e);
|
|
2513
2513
|
let l = Pr(e, s, o.options);
|
|
2514
2514
|
o.options & Bt && o.content.length == 0 && (l |= Bt);
|
|
2515
|
-
let a =
|
|
2515
|
+
let a = v.none;
|
|
2516
2516
|
return n = n.filter((c) => (o.type ? o.type.allowsMarkType(c.type) : zr(c.type, e)) ? (a = c.addToSet(a), !1) : !0), this.nodes.push(new vt(e, t, a, i, null, l)), this.open++, n;
|
|
2517
2517
|
}
|
|
2518
2518
|
// Make sure all nodes above this.open are finished and added to
|
|
@@ -2607,13 +2607,13 @@ class Rr {
|
|
|
2607
2607
|
}
|
|
2608
2608
|
}
|
|
2609
2609
|
}
|
|
2610
|
-
function
|
|
2610
|
+
function Go(r) {
|
|
2611
2611
|
for (let e = r.firstChild, t = null; e; e = e.nextSibling) {
|
|
2612
2612
|
let n = e.nodeType == 1 ? e.nodeName.toLowerCase() : null;
|
|
2613
2613
|
n && rs.hasOwnProperty(n) && t ? (t.appendChild(e), e = t) : n == "li" ? t = e : n && (t = null);
|
|
2614
2614
|
}
|
|
2615
2615
|
}
|
|
2616
|
-
function
|
|
2616
|
+
function Yo(r, e) {
|
|
2617
2617
|
return (r.matches || r.msMatchesSelector || r.webkitMatchesSelector || r.mozMatchesSelector).call(r, e);
|
|
2618
2618
|
}
|
|
2619
2619
|
function Br(r) {
|
|
@@ -2756,11 +2756,11 @@ function yn(r) {
|
|
|
2756
2756
|
return r.document || window.document;
|
|
2757
2757
|
}
|
|
2758
2758
|
const Lr = /* @__PURE__ */ new WeakMap();
|
|
2759
|
-
function
|
|
2759
|
+
function Xo(r) {
|
|
2760
2760
|
let e = Lr.get(r);
|
|
2761
|
-
return e === void 0 && Lr.set(r, e =
|
|
2761
|
+
return e === void 0 && Lr.set(r, e = Zo(r)), e;
|
|
2762
2762
|
}
|
|
2763
|
-
function
|
|
2763
|
+
function Zo(r) {
|
|
2764
2764
|
let e = null;
|
|
2765
2765
|
function t(n) {
|
|
2766
2766
|
if (n && typeof n == "object")
|
|
@@ -2786,7 +2786,7 @@ function zt(r, e, t, n) {
|
|
|
2786
2786
|
let i = e[0], s;
|
|
2787
2787
|
if (typeof i != "string")
|
|
2788
2788
|
throw new RangeError("Invalid array passed to renderSpec");
|
|
2789
|
-
if (n && (s =
|
|
2789
|
+
if (n && (s = Xo(n)) && s.indexOf(e) > -1)
|
|
2790
2790
|
throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");
|
|
2791
2791
|
let o = i.indexOf(" ");
|
|
2792
2792
|
o > 0 && (t = i.slice(0, o), i = i.slice(o + 1));
|
|
@@ -2817,13 +2817,13 @@ function zt(r, e, t, n) {
|
|
|
2817
2817
|
return { dom: a, contentDOM: l };
|
|
2818
2818
|
}
|
|
2819
2819
|
const is = 65535, ss = Math.pow(2, 16);
|
|
2820
|
-
function
|
|
2820
|
+
function Qo(r, e) {
|
|
2821
2821
|
return r + e * ss;
|
|
2822
2822
|
}
|
|
2823
2823
|
function $r(r) {
|
|
2824
2824
|
return r & is;
|
|
2825
2825
|
}
|
|
2826
|
-
function
|
|
2826
|
+
function el(r) {
|
|
2827
2827
|
return (r - (r & is)) / ss;
|
|
2828
2828
|
}
|
|
2829
2829
|
const ls = 1, as = 2, Ft = 4, cs = 8;
|
|
@@ -2881,7 +2881,7 @@ class X {
|
|
|
2881
2881
|
if (!this.inverted)
|
|
2882
2882
|
for (let i = 0; i < n; i++)
|
|
2883
2883
|
t += this.ranges[i * 3 + 2] - this.ranges[i * 3 + 1];
|
|
2884
|
-
return this.ranges[n * 3] + t +
|
|
2884
|
+
return this.ranges[n * 3] + t + el(e);
|
|
2885
2885
|
}
|
|
2886
2886
|
mapResult(e, t = 1) {
|
|
2887
2887
|
return this._map(e, t, !1);
|
|
@@ -2903,7 +2903,7 @@ class X {
|
|
|
2903
2903
|
let f = c ? e == a ? -1 : e == d ? 1 : t : t, h = a + i + (f < 0 ? 0 : u);
|
|
2904
2904
|
if (n)
|
|
2905
2905
|
return h;
|
|
2906
|
-
let p = e == (t < 0 ? a : d) ? null :
|
|
2906
|
+
let p = e == (t < 0 ? a : d) ? null : Qo(l / 3, e - a), m = e == a ? as : e == d ? ls : Ft;
|
|
2907
2907
|
return (t < 0 ? e != a : e != d) && (m |= cs), new jn(h, m, p);
|
|
2908
2908
|
}
|
|
2909
2909
|
i += u - c;
|
|
@@ -3068,7 +3068,7 @@ class yt {
|
|
|
3068
3068
|
}
|
|
3069
3069
|
}
|
|
3070
3070
|
const bn = /* @__PURE__ */ Object.create(null);
|
|
3071
|
-
class
|
|
3071
|
+
class K {
|
|
3072
3072
|
/**
|
|
3073
3073
|
Get the step map that represents the changes made by this step,
|
|
3074
3074
|
and which can be used to transform between positions in the old
|
|
@@ -3151,7 +3151,7 @@ function sr(r, e, t) {
|
|
|
3151
3151
|
}
|
|
3152
3152
|
return b.fromArray(n);
|
|
3153
3153
|
}
|
|
3154
|
-
class
|
|
3154
|
+
class Ce extends K {
|
|
3155
3155
|
/**
|
|
3156
3156
|
Create a mark step.
|
|
3157
3157
|
*/
|
|
@@ -3167,10 +3167,10 @@ class Se extends q {
|
|
|
3167
3167
|
}
|
|
3168
3168
|
map(e) {
|
|
3169
3169
|
let t = e.mapResult(this.from, 1), n = e.mapResult(this.to, -1);
|
|
3170
|
-
return t.deleted && n.deleted || t.pos >= n.pos ? null : new
|
|
3170
|
+
return t.deleted && n.deleted || t.pos >= n.pos ? null : new Ce(t.pos, n.pos, this.mark);
|
|
3171
3171
|
}
|
|
3172
3172
|
merge(e) {
|
|
3173
|
-
return e instanceof
|
|
3173
|
+
return e instanceof Ce && e.mark.eq(this.mark) && this.from <= e.to && this.to >= e.from ? new Ce(Math.min(this.from, e.from), Math.max(this.to, e.to), this.mark) : null;
|
|
3174
3174
|
}
|
|
3175
3175
|
toJSON() {
|
|
3176
3176
|
return {
|
|
@@ -3186,11 +3186,11 @@ class Se extends q {
|
|
|
3186
3186
|
static fromJSON(e, t) {
|
|
3187
3187
|
if (typeof t.from != "number" || typeof t.to != "number")
|
|
3188
3188
|
throw new RangeError("Invalid input for AddMarkStep.fromJSON");
|
|
3189
|
-
return new
|
|
3189
|
+
return new Ce(t.from, t.to, e.markFromJSON(t.mark));
|
|
3190
3190
|
}
|
|
3191
3191
|
}
|
|
3192
|
-
|
|
3193
|
-
class ce extends
|
|
3192
|
+
K.jsonID("addMark", Ce);
|
|
3193
|
+
class ce extends K {
|
|
3194
3194
|
/**
|
|
3195
3195
|
Create a mark-removing step.
|
|
3196
3196
|
*/
|
|
@@ -3202,7 +3202,7 @@ class ce extends q {
|
|
|
3202
3202
|
return R.fromReplace(e, this.from, this.to, n);
|
|
3203
3203
|
}
|
|
3204
3204
|
invert() {
|
|
3205
|
-
return new
|
|
3205
|
+
return new Ce(this.from, this.to, this.mark);
|
|
3206
3206
|
}
|
|
3207
3207
|
map(e) {
|
|
3208
3208
|
let t = e.mapResult(this.from, 1), n = e.mapResult(this.to, -1);
|
|
@@ -3228,8 +3228,8 @@ class ce extends q {
|
|
|
3228
3228
|
return new ce(t.from, t.to, e.markFromJSON(t.mark));
|
|
3229
3229
|
}
|
|
3230
3230
|
}
|
|
3231
|
-
|
|
3232
|
-
class
|
|
3231
|
+
K.jsonID("removeMark", ce);
|
|
3232
|
+
class we extends K {
|
|
3233
3233
|
/**
|
|
3234
3234
|
Create a node mark step.
|
|
3235
3235
|
*/
|
|
@@ -3250,15 +3250,15 @@ class Ce extends q {
|
|
|
3250
3250
|
if (n.length == t.marks.length) {
|
|
3251
3251
|
for (let i = 0; i < t.marks.length; i++)
|
|
3252
3252
|
if (!t.marks[i].isInSet(n))
|
|
3253
|
-
return new
|
|
3254
|
-
return new
|
|
3253
|
+
return new we(this.pos, t.marks[i]);
|
|
3254
|
+
return new we(this.pos, this.mark);
|
|
3255
3255
|
}
|
|
3256
3256
|
}
|
|
3257
3257
|
return new et(this.pos, this.mark);
|
|
3258
3258
|
}
|
|
3259
3259
|
map(e) {
|
|
3260
3260
|
let t = e.mapResult(this.pos, 1);
|
|
3261
|
-
return t.deletedAfter ? null : new
|
|
3261
|
+
return t.deletedAfter ? null : new we(t.pos, this.mark);
|
|
3262
3262
|
}
|
|
3263
3263
|
toJSON() {
|
|
3264
3264
|
return { stepType: "addNodeMark", pos: this.pos, mark: this.mark.toJSON() };
|
|
@@ -3269,11 +3269,11 @@ class Ce extends q {
|
|
|
3269
3269
|
static fromJSON(e, t) {
|
|
3270
3270
|
if (typeof t.pos != "number")
|
|
3271
3271
|
throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");
|
|
3272
|
-
return new
|
|
3272
|
+
return new we(t.pos, e.markFromJSON(t.mark));
|
|
3273
3273
|
}
|
|
3274
3274
|
}
|
|
3275
|
-
|
|
3276
|
-
class et extends
|
|
3275
|
+
K.jsonID("addNodeMark", we);
|
|
3276
|
+
class et extends K {
|
|
3277
3277
|
/**
|
|
3278
3278
|
Create a mark-removing step.
|
|
3279
3279
|
*/
|
|
@@ -3289,7 +3289,7 @@ class et extends q {
|
|
|
3289
3289
|
}
|
|
3290
3290
|
invert(e) {
|
|
3291
3291
|
let t = e.nodeAt(this.pos);
|
|
3292
|
-
return !t || !this.mark.isInSet(t.marks) ? this : new
|
|
3292
|
+
return !t || !this.mark.isInSet(t.marks) ? this : new we(this.pos, this.mark);
|
|
3293
3293
|
}
|
|
3294
3294
|
map(e) {
|
|
3295
3295
|
let t = e.mapResult(this.pos, 1);
|
|
@@ -3307,8 +3307,8 @@ class et extends q {
|
|
|
3307
3307
|
return new et(t.pos, e.markFromJSON(t.mark));
|
|
3308
3308
|
}
|
|
3309
3309
|
}
|
|
3310
|
-
|
|
3311
|
-
class P extends
|
|
3310
|
+
K.jsonID("removeNodeMark", et);
|
|
3311
|
+
class P extends K {
|
|
3312
3312
|
/**
|
|
3313
3313
|
The given `slice` should fit the 'gap' between `from` and
|
|
3314
3314
|
`to`—the depths must line up, and the surrounding nodes must be
|
|
@@ -3359,8 +3359,8 @@ class P extends q {
|
|
|
3359
3359
|
return new P(t.from, t.to, k.fromJSON(e, t.slice), !!t.structure);
|
|
3360
3360
|
}
|
|
3361
3361
|
}
|
|
3362
|
-
|
|
3363
|
-
class z extends
|
|
3362
|
+
K.jsonID("replace", P);
|
|
3363
|
+
class z extends K {
|
|
3364
3364
|
/**
|
|
3365
3365
|
Create a replace-around step with the given range and gap.
|
|
3366
3366
|
`insert` should be the point in the slice into which the content
|
|
@@ -3417,7 +3417,7 @@ class z extends q {
|
|
|
3417
3417
|
return new z(t.from, t.to, t.gapFrom, t.gapTo, k.fromJSON(e, t.slice), t.insert, !!t.structure);
|
|
3418
3418
|
}
|
|
3419
3419
|
}
|
|
3420
|
-
|
|
3420
|
+
K.jsonID("replaceAround", z);
|
|
3421
3421
|
function Hn(r, e, t) {
|
|
3422
3422
|
let n = r.resolve(e), i = t - e, s = n.depth;
|
|
3423
3423
|
for (; i > 0 && s > 0 && n.indexAfter(s) == n.node(s).childCount; )
|
|
@@ -3432,7 +3432,7 @@ function Hn(r, e, t) {
|
|
|
3432
3432
|
}
|
|
3433
3433
|
return !1;
|
|
3434
3434
|
}
|
|
3435
|
-
function
|
|
3435
|
+
function tl(r, e, t, n) {
|
|
3436
3436
|
let i = [], s = [], o, l;
|
|
3437
3437
|
r.doc.nodesBetween(e, t, (a, c, u) => {
|
|
3438
3438
|
if (!a.isInline)
|
|
@@ -3442,11 +3442,11 @@ function el(r, e, t, n) {
|
|
|
3442
3442
|
let f = Math.max(c, e), h = Math.min(c + a.nodeSize, t), p = n.addToSet(d);
|
|
3443
3443
|
for (let m = 0; m < d.length; m++)
|
|
3444
3444
|
d[m].isInSet(p) || (o && o.to == f && o.mark.eq(d[m]) ? o.to = h : i.push(o = new ce(f, h, d[m])));
|
|
3445
|
-
l && l.to == f ? l.to = h : s.push(l = new
|
|
3445
|
+
l && l.to == f ? l.to = h : s.push(l = new Ce(f, h, n));
|
|
3446
3446
|
}
|
|
3447
3447
|
}), i.forEach((a) => r.step(a)), s.forEach((a) => r.step(a));
|
|
3448
3448
|
}
|
|
3449
|
-
function
|
|
3449
|
+
function nl(r, e, t, n) {
|
|
3450
3450
|
let i = [], s = 0;
|
|
3451
3451
|
r.doc.nodesBetween(e, t, (o, l) => {
|
|
3452
3452
|
if (!o.isInline)
|
|
@@ -3496,7 +3496,7 @@ function or(r, e, t, n = t.contentMatch, i = !0) {
|
|
|
3496
3496
|
for (let a = o.length - 1; a >= 0; a--)
|
|
3497
3497
|
r.step(o[a]);
|
|
3498
3498
|
}
|
|
3499
|
-
function
|
|
3499
|
+
function rl(r, e, t) {
|
|
3500
3500
|
return (e == 0 || r.canReplace(e, r.childCount)) && (t == r.childCount || r.canReplace(0, t));
|
|
3501
3501
|
}
|
|
3502
3502
|
function st(r) {
|
|
@@ -3505,12 +3505,12 @@ function st(r) {
|
|
|
3505
3505
|
let i = r.$from.node(n), s = r.$from.index(n), o = r.$to.indexAfter(n);
|
|
3506
3506
|
if (n < r.depth && i.canReplace(s, o, t))
|
|
3507
3507
|
return n;
|
|
3508
|
-
if (n == 0 || i.type.spec.isolating || !
|
|
3508
|
+
if (n == 0 || i.type.spec.isolating || !rl(i, s, o))
|
|
3509
3509
|
break;
|
|
3510
3510
|
}
|
|
3511
3511
|
return null;
|
|
3512
3512
|
}
|
|
3513
|
-
function
|
|
3513
|
+
function il(r, e, t) {
|
|
3514
3514
|
let { $from: n, $to: i, depth: s } = e, o = n.before(s + 1), l = i.after(s + 1), a = o, c = l, u = b.empty, d = 0;
|
|
3515
3515
|
for (let p = s, m = !1; p > t; p--)
|
|
3516
3516
|
m || n.index(p) > 0 ? (m = !0, u = b.from(n.node(p).copy(u)), d++) : a--;
|
|
@@ -3520,20 +3520,20 @@ function rl(r, e, t) {
|
|
|
3520
3520
|
r.step(new z(a, c, o, l, new k(u.append(f), d, h), u.size - d, !0));
|
|
3521
3521
|
}
|
|
3522
3522
|
function us(r, e, t = null, n = r) {
|
|
3523
|
-
let i =
|
|
3523
|
+
let i = sl(r, e), s = i && ol(n, e);
|
|
3524
3524
|
return s ? i.map(Vr).concat({ type: e, attrs: t }).concat(s.map(Vr)) : null;
|
|
3525
3525
|
}
|
|
3526
3526
|
function Vr(r) {
|
|
3527
3527
|
return { type: r, attrs: null };
|
|
3528
3528
|
}
|
|
3529
|
-
function
|
|
3529
|
+
function sl(r, e) {
|
|
3530
3530
|
let { parent: t, startIndex: n, endIndex: i } = r, s = t.contentMatchAt(n).findWrapping(e);
|
|
3531
3531
|
if (!s)
|
|
3532
3532
|
return null;
|
|
3533
3533
|
let o = s.length ? s[0] : e;
|
|
3534
3534
|
return t.canReplaceWith(n, i, o) ? s : null;
|
|
3535
3535
|
}
|
|
3536
|
-
function
|
|
3536
|
+
function ol(r, e) {
|
|
3537
3537
|
let { parent: t, startIndex: n, endIndex: i } = r, s = t.child(n), o = e.contentMatch.findWrapping(s.type);
|
|
3538
3538
|
if (!o)
|
|
3539
3539
|
return null;
|
|
@@ -3542,7 +3542,7 @@ function sl(r, e) {
|
|
|
3542
3542
|
a = a.matchType(t.child(c).type);
|
|
3543
3543
|
return !a || !a.validEnd ? null : o;
|
|
3544
3544
|
}
|
|
3545
|
-
function
|
|
3545
|
+
function ll(r, e, t) {
|
|
3546
3546
|
let n = b.empty;
|
|
3547
3547
|
for (let o = t.length - 1; o >= 0; o--) {
|
|
3548
3548
|
if (n.size) {
|
|
@@ -3555,13 +3555,13 @@ function ol(r, e, t) {
|
|
|
3555
3555
|
let i = e.start, s = e.end;
|
|
3556
3556
|
r.step(new z(i, s, i, s, new k(n, 0, 0), t.length, !0));
|
|
3557
3557
|
}
|
|
3558
|
-
function
|
|
3558
|
+
function al(r, e, t, n, i) {
|
|
3559
3559
|
if (!n.isTextblock)
|
|
3560
3560
|
throw new RangeError("Type given to setBlockType should be a textblock");
|
|
3561
3561
|
let s = r.steps.length;
|
|
3562
3562
|
r.doc.nodesBetween(e, t, (o, l) => {
|
|
3563
3563
|
let a = typeof i == "function" ? i(o) : i;
|
|
3564
|
-
if (o.isTextblock && !o.hasMarkup(n, a) &&
|
|
3564
|
+
if (o.isTextblock && !o.hasMarkup(n, a) && cl(r.doc, r.mapping.slice(s).map(l), n)) {
|
|
3565
3565
|
let c = null;
|
|
3566
3566
|
if (n.schema.linebreakReplacement) {
|
|
3567
3567
|
let h = n.whitespace == "pre", p = !!n.contentMatch.matchType(n.schema.linebreakReplacement);
|
|
@@ -3593,11 +3593,11 @@ function fs(r, e, t, n) {
|
|
|
3593
3593
|
}
|
|
3594
3594
|
});
|
|
3595
3595
|
}
|
|
3596
|
-
function
|
|
3596
|
+
function cl(r, e, t) {
|
|
3597
3597
|
let n = r.resolve(e), i = n.index();
|
|
3598
3598
|
return n.parent.canReplaceWith(i, i + 1, t);
|
|
3599
3599
|
}
|
|
3600
|
-
function
|
|
3600
|
+
function ul(r, e, t, n, i) {
|
|
3601
3601
|
let s = r.doc.nodeAt(e);
|
|
3602
3602
|
if (!s)
|
|
3603
3603
|
throw new RangeError("No node at given position");
|
|
@@ -3609,7 +3609,7 @@ function cl(r, e, t, n, i) {
|
|
|
3609
3609
|
throw new RangeError("Invalid content for node type " + t.name);
|
|
3610
3610
|
r.step(new z(e, e + s.nodeSize, e + 1, e + s.nodeSize - 1, new k(b.from(o), 0, 0), 1, !0));
|
|
3611
3611
|
}
|
|
3612
|
-
function
|
|
3612
|
+
function ge(r, e, t = 1, n) {
|
|
3613
3613
|
let i = r.resolve(e), s = i.depth - t, o = n && n[n.length - 1] || i.parent;
|
|
3614
3614
|
if (s < 0 || i.parent.type.spec.isolating || !i.parent.canReplace(i.index(), i.parent.childCount) || !o.type.validContent(i.parent.content.cutByIndex(i.index(), i.parent.childCount)))
|
|
3615
3615
|
return !1;
|
|
@@ -3626,7 +3626,7 @@ function me(r, e, t = 1, n) {
|
|
|
3626
3626
|
let l = i.indexAfter(s), a = n && n[0];
|
|
3627
3627
|
return i.node(s).canReplaceWith(l, l, a ? a.type : i.node(s + 1).type);
|
|
3628
3628
|
}
|
|
3629
|
-
function
|
|
3629
|
+
function dl(r, e, t = 1, n) {
|
|
3630
3630
|
let i = r.doc.resolve(e), s = b.empty, o = b.empty;
|
|
3631
3631
|
for (let l = i.depth, a = i.depth - t, c = t - 1; l > a; l--, c--) {
|
|
3632
3632
|
s = b.from(i.node(l).copy(s));
|
|
@@ -3639,7 +3639,7 @@ function qe(r, e) {
|
|
|
3639
3639
|
let t = r.resolve(e), n = t.index();
|
|
3640
3640
|
return hs(t.nodeBefore, t.nodeAfter) && t.parent.canReplace(n, n + 1);
|
|
3641
3641
|
}
|
|
3642
|
-
function
|
|
3642
|
+
function fl(r, e) {
|
|
3643
3643
|
e.content.size || r.type.compatibleContent(e.type);
|
|
3644
3644
|
let t = r.contentMatchAt(r.childCount), { linebreakReplacement: n } = r.type.schema;
|
|
3645
3645
|
for (let i = 0; i < e.childCount; i++) {
|
|
@@ -3650,7 +3650,7 @@ function dl(r, e) {
|
|
|
3650
3650
|
return t.validEnd;
|
|
3651
3651
|
}
|
|
3652
3652
|
function hs(r, e) {
|
|
3653
|
-
return !!(r && e && !r.isLeaf &&
|
|
3653
|
+
return !!(r && e && !r.isLeaf && fl(r, e));
|
|
3654
3654
|
}
|
|
3655
3655
|
function nn(r, e, t = -1) {
|
|
3656
3656
|
let n = r.resolve(e);
|
|
@@ -3663,7 +3663,7 @@ function nn(r, e, t = -1) {
|
|
|
3663
3663
|
e = t < 0 ? n.before(i) : n.after(i);
|
|
3664
3664
|
}
|
|
3665
3665
|
}
|
|
3666
|
-
function
|
|
3666
|
+
function hl(r, e, t) {
|
|
3667
3667
|
let n = null, { linebreakReplacement: i } = r.doc.type.schema, s = r.doc.resolve(e - t), o = s.node().type;
|
|
3668
3668
|
if (i && o.inlineContent) {
|
|
3669
3669
|
let u = o.whitespace == "pre", d = !!o.contentMatch.matchType(i);
|
|
@@ -3682,7 +3682,7 @@ function fl(r, e, t) {
|
|
|
3682
3682
|
}
|
|
3683
3683
|
return r;
|
|
3684
3684
|
}
|
|
3685
|
-
function
|
|
3685
|
+
function pl(r, e, t) {
|
|
3686
3686
|
let n = r.resolve(e);
|
|
3687
3687
|
if (n.parent.canReplaceWith(n.index(), n.index(), t))
|
|
3688
3688
|
return e;
|
|
@@ -3704,7 +3704,7 @@ function hl(r, e, t) {
|
|
|
3704
3704
|
}
|
|
3705
3705
|
return null;
|
|
3706
3706
|
}
|
|
3707
|
-
function
|
|
3707
|
+
function ml(r, e, t) {
|
|
3708
3708
|
let n = r.resolve(e);
|
|
3709
3709
|
if (!t.content.size)
|
|
3710
3710
|
return e;
|
|
@@ -3729,12 +3729,12 @@ function rn(r, e, t = e, n = k.empty) {
|
|
|
3729
3729
|
if (e == t && !n.size)
|
|
3730
3730
|
return null;
|
|
3731
3731
|
let i = r.resolve(e), s = r.resolve(t);
|
|
3732
|
-
return ps(i, s, n) ? new P(e, t, n) : new
|
|
3732
|
+
return ps(i, s, n) ? new P(e, t, n) : new gl(i, s, n).fit();
|
|
3733
3733
|
}
|
|
3734
3734
|
function ps(r, e, t) {
|
|
3735
3735
|
return !t.openStart && !t.openEnd && r.start() == e.start() && r.parent.canReplace(r.index(), e.index(), t.content);
|
|
3736
3736
|
}
|
|
3737
|
-
class
|
|
3737
|
+
class gl {
|
|
3738
3738
|
constructor(e, t, n) {
|
|
3739
3739
|
this.$from = e, this.$to = t, this.unplaced = n, this.frontier = [], this.placed = b.empty;
|
|
3740
3740
|
for (let i = 0; i <= e.depth; i++) {
|
|
@@ -3903,18 +3903,18 @@ function xn(r, e, t, n, i) {
|
|
|
3903
3903
|
if (o == s.childCount && !t.compatibleContent(s.type))
|
|
3904
3904
|
return null;
|
|
3905
3905
|
let l = n.fillBefore(s.content, !0, o);
|
|
3906
|
-
return l && !
|
|
3906
|
+
return l && !yl(t, s.content, o) ? l : null;
|
|
3907
3907
|
}
|
|
3908
|
-
function
|
|
3908
|
+
function yl(r, e, t) {
|
|
3909
3909
|
for (let n = t; n < e.childCount; n++)
|
|
3910
3910
|
if (!r.allowsMarks(e.child(n).marks))
|
|
3911
3911
|
return !0;
|
|
3912
3912
|
return !1;
|
|
3913
3913
|
}
|
|
3914
|
-
function
|
|
3914
|
+
function bl(r) {
|
|
3915
3915
|
return r.spec.defining || r.spec.definingForContent;
|
|
3916
3916
|
}
|
|
3917
|
-
function
|
|
3917
|
+
function kl(r, e, t, n) {
|
|
3918
3918
|
if (!n.size)
|
|
3919
3919
|
return r.deleteRange(e, t);
|
|
3920
3920
|
let i = r.doc.resolve(e), s = r.doc.resolve(t);
|
|
@@ -3938,7 +3938,7 @@ function bl(r, e, t, n) {
|
|
|
3938
3938
|
f = p.content;
|
|
3939
3939
|
}
|
|
3940
3940
|
for (let f = u - 1; f >= 0; f--) {
|
|
3941
|
-
let h = c[f], p =
|
|
3941
|
+
let h = c[f], p = bl(h.type);
|
|
3942
3942
|
if (p && !h.sameMarkup(i.node(Math.abs(l) - 1)))
|
|
3943
3943
|
u = f;
|
|
3944
3944
|
else if (p || !h.type.isTextblock)
|
|
@@ -3972,14 +3972,14 @@ function gs(r, e, t, n, i) {
|
|
|
3972
3972
|
}
|
|
3973
3973
|
return r;
|
|
3974
3974
|
}
|
|
3975
|
-
function
|
|
3975
|
+
function xl(r, e, t, n) {
|
|
3976
3976
|
if (!n.isInline && e == t && r.doc.resolve(e).parent.content.size) {
|
|
3977
|
-
let i =
|
|
3977
|
+
let i = pl(r.doc, e, n.type);
|
|
3978
3978
|
i != null && (e = t = i);
|
|
3979
3979
|
}
|
|
3980
3980
|
r.replaceRange(e, t, new k(b.from(n), 0, 0));
|
|
3981
3981
|
}
|
|
3982
|
-
function
|
|
3982
|
+
function Sl(r, e, t) {
|
|
3983
3983
|
let n = r.doc.resolve(e), i = r.doc.resolve(t), s = ys(n, i);
|
|
3984
3984
|
for (let o = 0; o < s.length; o++) {
|
|
3985
3985
|
let l = s[o], a = o == s.length - 1;
|
|
@@ -4003,7 +4003,7 @@ function ys(r, e) {
|
|
|
4003
4003
|
}
|
|
4004
4004
|
return t;
|
|
4005
4005
|
}
|
|
4006
|
-
class Ze extends
|
|
4006
|
+
class Ze extends K {
|
|
4007
4007
|
/**
|
|
4008
4008
|
Construct an attribute step.
|
|
4009
4009
|
*/
|
|
@@ -4040,8 +4040,8 @@ class Ze extends q {
|
|
|
4040
4040
|
return new Ze(t.pos, t.attr, t.value);
|
|
4041
4041
|
}
|
|
4042
4042
|
}
|
|
4043
|
-
|
|
4044
|
-
class bt extends
|
|
4043
|
+
K.jsonID("attr", Ze);
|
|
4044
|
+
class bt extends K {
|
|
4045
4045
|
/**
|
|
4046
4046
|
Construct an attribute step.
|
|
4047
4047
|
*/
|
|
@@ -4074,7 +4074,7 @@ class bt extends q {
|
|
|
4074
4074
|
return new bt(t.attr, t.value);
|
|
4075
4075
|
}
|
|
4076
4076
|
}
|
|
4077
|
-
|
|
4077
|
+
K.jsonID("docAttr", bt);
|
|
4078
4078
|
let tt = class extends Error {
|
|
4079
4079
|
};
|
|
4080
4080
|
tt = function r(e) {
|
|
@@ -4084,7 +4084,7 @@ tt = function r(e) {
|
|
|
4084
4084
|
tt.prototype = Object.create(Error.prototype);
|
|
4085
4085
|
tt.prototype.constructor = tt;
|
|
4086
4086
|
tt.prototype.name = "TransformError";
|
|
4087
|
-
class
|
|
4087
|
+
class Cl {
|
|
4088
4088
|
/**
|
|
4089
4089
|
Create a transform that starts with the given document.
|
|
4090
4090
|
*/
|
|
@@ -4175,7 +4175,7 @@ class Sl {
|
|
|
4175
4175
|
control over what happens.
|
|
4176
4176
|
*/
|
|
4177
4177
|
replaceRange(e, t, n) {
|
|
4178
|
-
return
|
|
4178
|
+
return kl(this, e, t, n), this;
|
|
4179
4179
|
}
|
|
4180
4180
|
/**
|
|
4181
4181
|
Replace the given range with a node, but use `from` and `to` as
|
|
@@ -4187,14 +4187,14 @@ class Sl {
|
|
|
4187
4187
|
that parent node.
|
|
4188
4188
|
*/
|
|
4189
4189
|
replaceRangeWith(e, t, n) {
|
|
4190
|
-
return
|
|
4190
|
+
return xl(this, e, t, n), this;
|
|
4191
4191
|
}
|
|
4192
4192
|
/**
|
|
4193
4193
|
Delete the given range, expanding it to cover fully covered
|
|
4194
4194
|
parent nodes until a valid replace is found.
|
|
4195
4195
|
*/
|
|
4196
4196
|
deleteRange(e, t) {
|
|
4197
|
-
return
|
|
4197
|
+
return Sl(this, e, t), this;
|
|
4198
4198
|
}
|
|
4199
4199
|
/**
|
|
4200
4200
|
Split the content in the given range off from its parent, if there
|
|
@@ -4204,14 +4204,14 @@ class Sl {
|
|
|
4204
4204
|
sure the lift is valid.
|
|
4205
4205
|
*/
|
|
4206
4206
|
lift(e, t) {
|
|
4207
|
-
return
|
|
4207
|
+
return il(this, e, t), this;
|
|
4208
4208
|
}
|
|
4209
4209
|
/**
|
|
4210
4210
|
Join the blocks around the given position. If depth is 2, their
|
|
4211
4211
|
last and first siblings are also joined, and so on.
|
|
4212
4212
|
*/
|
|
4213
4213
|
join(e, t = 1) {
|
|
4214
|
-
return
|
|
4214
|
+
return hl(this, e, t), this;
|
|
4215
4215
|
}
|
|
4216
4216
|
/**
|
|
4217
4217
|
Wrap the given [range](https://prosemirror.net/docs/ref/#model.NodeRange) in the given set of wrappers.
|
|
@@ -4219,21 +4219,21 @@ class Sl {
|
|
|
4219
4219
|
probably be computed with [`findWrapping`](https://prosemirror.net/docs/ref/#transform.findWrapping).
|
|
4220
4220
|
*/
|
|
4221
4221
|
wrap(e, t) {
|
|
4222
|
-
return
|
|
4222
|
+
return ll(this, e, t), this;
|
|
4223
4223
|
}
|
|
4224
4224
|
/**
|
|
4225
4225
|
Set the type of all textblocks (partly) between `from` and `to` to
|
|
4226
4226
|
the given node type with the given attributes.
|
|
4227
4227
|
*/
|
|
4228
4228
|
setBlockType(e, t = e, n, i = null) {
|
|
4229
|
-
return
|
|
4229
|
+
return al(this, e, t, n, i), this;
|
|
4230
4230
|
}
|
|
4231
4231
|
/**
|
|
4232
4232
|
Change the type, attributes, and/or marks of the node at `pos`.
|
|
4233
4233
|
When `type` isn't given, the existing node type is preserved,
|
|
4234
4234
|
*/
|
|
4235
4235
|
setNodeMarkup(e, t, n = null, i) {
|
|
4236
|
-
return
|
|
4236
|
+
return ul(this, e, t, n, i), this;
|
|
4237
4237
|
}
|
|
4238
4238
|
/**
|
|
4239
4239
|
Set a single attribute on a given node to a new value.
|
|
@@ -4253,14 +4253,14 @@ class Sl {
|
|
|
4253
4253
|
Add a mark to the node at position `pos`.
|
|
4254
4254
|
*/
|
|
4255
4255
|
addNodeMark(e, t) {
|
|
4256
|
-
return this.step(new
|
|
4256
|
+
return this.step(new we(e, t)), this;
|
|
4257
4257
|
}
|
|
4258
4258
|
/**
|
|
4259
4259
|
Remove a mark (or a mark of the given type) from the node at
|
|
4260
4260
|
position `pos`.
|
|
4261
4261
|
*/
|
|
4262
4262
|
removeNodeMark(e, t) {
|
|
4263
|
-
if (!(t instanceof
|
|
4263
|
+
if (!(t instanceof v)) {
|
|
4264
4264
|
let n = this.doc.nodeAt(e);
|
|
4265
4265
|
if (!n)
|
|
4266
4266
|
throw new RangeError("No node at position " + e);
|
|
@@ -4277,13 +4277,13 @@ class Sl {
|
|
|
4277
4277
|
use after the split (with the outermost nodes coming first).
|
|
4278
4278
|
*/
|
|
4279
4279
|
split(e, t = 1, n) {
|
|
4280
|
-
return
|
|
4280
|
+
return dl(this, e, t, n), this;
|
|
4281
4281
|
}
|
|
4282
4282
|
/**
|
|
4283
4283
|
Add the given mark to the inline content between `from` and `to`.
|
|
4284
4284
|
*/
|
|
4285
4285
|
addMark(e, t, n) {
|
|
4286
|
-
return
|
|
4286
|
+
return tl(this, e, t, n), this;
|
|
4287
4287
|
}
|
|
4288
4288
|
/**
|
|
4289
4289
|
Remove marks from inline nodes between `from` and `to`. When
|
|
@@ -4292,7 +4292,7 @@ class Sl {
|
|
|
4292
4292
|
remove all marks of any type.
|
|
4293
4293
|
*/
|
|
4294
4294
|
removeMark(e, t, n) {
|
|
4295
|
-
return
|
|
4295
|
+
return nl(this, e, t, n), this;
|
|
4296
4296
|
}
|
|
4297
4297
|
/**
|
|
4298
4298
|
Removes all marks and nodes from the content of the node at
|
|
@@ -4312,7 +4312,7 @@ class O {
|
|
|
4312
4312
|
`$head`.
|
|
4313
4313
|
*/
|
|
4314
4314
|
constructor(e, t, n) {
|
|
4315
|
-
this.$anchor = e, this.$head = t, this.ranges = n || [new
|
|
4315
|
+
this.$anchor = e, this.$head = t, this.ranges = n || [new wl(e.min(t), e.max(t))];
|
|
4316
4316
|
}
|
|
4317
4317
|
/**
|
|
4318
4318
|
The selection's anchor, as an unresolved position.
|
|
@@ -4470,7 +4470,7 @@ class O {
|
|
|
4470
4470
|
}
|
|
4471
4471
|
}
|
|
4472
4472
|
O.prototype.visible = !0;
|
|
4473
|
-
class
|
|
4473
|
+
class wl {
|
|
4474
4474
|
/**
|
|
4475
4475
|
Create a range.
|
|
4476
4476
|
*/
|
|
@@ -4658,11 +4658,11 @@ class Z extends O {
|
|
|
4658
4658
|
return e instanceof Z;
|
|
4659
4659
|
}
|
|
4660
4660
|
getBookmark() {
|
|
4661
|
-
return
|
|
4661
|
+
return Ml;
|
|
4662
4662
|
}
|
|
4663
4663
|
}
|
|
4664
4664
|
O.jsonID("all", Z);
|
|
4665
|
-
const
|
|
4665
|
+
const Ml = {
|
|
4666
4666
|
map() {
|
|
4667
4667
|
return this;
|
|
4668
4668
|
},
|
|
@@ -4700,7 +4700,7 @@ function Wr(r, e, t) {
|
|
|
4700
4700
|
}), r.setSelection(O.near(r.doc.resolve(o), t));
|
|
4701
4701
|
}
|
|
4702
4702
|
const Jr = 1, qr = 2, Kr = 4;
|
|
4703
|
-
class
|
|
4703
|
+
class El extends Cl {
|
|
4704
4704
|
/**
|
|
4705
4705
|
@internal
|
|
4706
4706
|
*/
|
|
@@ -4743,7 +4743,7 @@ class Ml extends Sl {
|
|
|
4743
4743
|
this is already the case.
|
|
4744
4744
|
*/
|
|
4745
4745
|
ensureMarks(e) {
|
|
4746
|
-
return
|
|
4746
|
+
return v.sameSet(this.storedMarks || this.selection.$from.marks(), e) || this.setStoredMarks(e), this;
|
|
4747
4747
|
}
|
|
4748
4748
|
/**
|
|
4749
4749
|
Add a mark to the set of stored marks.
|
|
@@ -4788,7 +4788,7 @@ class Ml extends Sl {
|
|
|
4788
4788
|
*/
|
|
4789
4789
|
replaceSelectionWith(e, t = !0) {
|
|
4790
4790
|
let n = this.selection;
|
|
4791
|
-
return t && (e = e.mark(this.storedMarks || (n.empty ? n.$from.marks() : n.$from.marksAcross(n.$to) ||
|
|
4791
|
+
return t && (e = e.mark(this.storedMarks || (n.empty ? n.$from.marks() : n.$from.marksAcross(n.$to) || v.none))), n.replaceWith(this, e), this;
|
|
4792
4792
|
}
|
|
4793
4793
|
/**
|
|
4794
4794
|
Delete the selection.
|
|
@@ -4859,7 +4859,7 @@ class ct {
|
|
|
4859
4859
|
this.name = e, this.init = Ur(t.init, n), this.apply = Ur(t.apply, n);
|
|
4860
4860
|
}
|
|
4861
4861
|
}
|
|
4862
|
-
const
|
|
4862
|
+
const Tl = [
|
|
4863
4863
|
new ct("doc", {
|
|
4864
4864
|
init(r) {
|
|
4865
4865
|
return r.doc || r.schema.topNodeType.createAndFill();
|
|
@@ -4895,7 +4895,7 @@ const El = [
|
|
|
4895
4895
|
];
|
|
4896
4896
|
class Cn {
|
|
4897
4897
|
constructor(e, t) {
|
|
4898
|
-
this.schema = e, this.plugins = [], this.pluginsByKey = /* @__PURE__ */ Object.create(null), this.fields =
|
|
4898
|
+
this.schema = e, this.plugins = [], this.pluginsByKey = /* @__PURE__ */ Object.create(null), this.fields = Tl.slice(), t && t.forEach((n) => {
|
|
4899
4899
|
if (this.pluginsByKey[n.key])
|
|
4900
4900
|
throw new RangeError("Adding different instances of a keyed plugin (" + n.key + ")");
|
|
4901
4901
|
this.plugins.push(n), this.pluginsByKey[n.key] = n, n.spec.state && this.fields.push(new ct(n.key, n.spec.state, n));
|
|
@@ -4988,7 +4988,7 @@ class Ye {
|
|
|
4988
4988
|
Start a [transaction](https://prosemirror.net/docs/ref/#state.Transaction) from this state.
|
|
4989
4989
|
*/
|
|
4990
4990
|
get tr() {
|
|
4991
|
-
return new
|
|
4991
|
+
return new El(this);
|
|
4992
4992
|
}
|
|
4993
4993
|
/**
|
|
4994
4994
|
Create a new state.
|
|
@@ -5048,7 +5048,7 @@ class Ye {
|
|
|
5048
5048
|
let i = new Cn(e.schema, e.plugins), s = new Ye(i);
|
|
5049
5049
|
return i.fields.forEach((o) => {
|
|
5050
5050
|
if (o.name == "doc")
|
|
5051
|
-
s.doc =
|
|
5051
|
+
s.doc = ue.fromJSON(e.schema, t.doc);
|
|
5052
5052
|
else if (o.name == "selection")
|
|
5053
5053
|
s.selection = O.fromJSON(s.doc, t.selection);
|
|
5054
5054
|
else if (o.name == "storedMarks")
|
|
@@ -5122,21 +5122,21 @@ const V = function(r) {
|
|
|
5122
5122
|
return e && e.nodeType == 11 ? e.host : e;
|
|
5123
5123
|
};
|
|
5124
5124
|
let Wn = null;
|
|
5125
|
-
const
|
|
5125
|
+
const pe = function(r, e, t) {
|
|
5126
5126
|
let n = Wn || (Wn = document.createRange());
|
|
5127
5127
|
return n.setEnd(r, t ?? r.nodeValue.length), n.setStart(r, e || 0), n;
|
|
5128
|
-
},
|
|
5128
|
+
}, Ol = function() {
|
|
5129
5129
|
Wn = null;
|
|
5130
5130
|
}, He = function(r, e, t, n) {
|
|
5131
5131
|
return t && (_r(r, e, t, n, -1) || _r(r, e, t, n, 1));
|
|
5132
|
-
},
|
|
5132
|
+
}, Nl = /^(img|br|input|textarea|hr)$/i;
|
|
5133
5133
|
function _r(r, e, t, n, i) {
|
|
5134
5134
|
for (; ; ) {
|
|
5135
5135
|
if (r == t && e == n)
|
|
5136
5136
|
return !0;
|
|
5137
5137
|
if (e == (i < 0 ? 0 : ne(r))) {
|
|
5138
5138
|
let s = r.parentNode;
|
|
5139
|
-
if (!s || s.nodeType != 1 || Et(r) ||
|
|
5139
|
+
if (!s || s.nodeType != 1 || Et(r) || Nl.test(r.nodeName) || r.contentEditable == "false")
|
|
5140
5140
|
return !1;
|
|
5141
5141
|
e = V(r) + (i < 0 ? 0 : 1), r = s;
|
|
5142
5142
|
} else if (r.nodeType == 1) {
|
|
@@ -5150,7 +5150,7 @@ function _r(r, e, t, n, i) {
|
|
|
5150
5150
|
function ne(r) {
|
|
5151
5151
|
return r.nodeType == 3 ? r.nodeValue.length : r.childNodes.length;
|
|
5152
5152
|
}
|
|
5153
|
-
function
|
|
5153
|
+
function Al(r, e) {
|
|
5154
5154
|
for (; ; ) {
|
|
5155
5155
|
if (r.nodeType == 3 && e)
|
|
5156
5156
|
return r;
|
|
@@ -5164,7 +5164,7 @@ function Nl(r, e) {
|
|
|
5164
5164
|
return null;
|
|
5165
5165
|
}
|
|
5166
5166
|
}
|
|
5167
|
-
function
|
|
5167
|
+
function vl(r, e) {
|
|
5168
5168
|
for (; ; ) {
|
|
5169
5169
|
if (r.nodeType == 3 && e < r.nodeValue.length)
|
|
5170
5170
|
return r;
|
|
@@ -5178,7 +5178,7 @@ function Al(r, e) {
|
|
|
5178
5178
|
return null;
|
|
5179
5179
|
}
|
|
5180
5180
|
}
|
|
5181
|
-
function
|
|
5181
|
+
function Dl(r, e, t) {
|
|
5182
5182
|
for (let n = e == 0, i = e == ne(r); n || i; ) {
|
|
5183
5183
|
if (r == t)
|
|
5184
5184
|
return !0;
|
|
@@ -5201,13 +5201,13 @@ function De(r, e) {
|
|
|
5201
5201
|
let t = document.createEvent("Event");
|
|
5202
5202
|
return t.initEvent("keydown", !0, !0), t.keyCode = r, t.key = t.code = e, t;
|
|
5203
5203
|
}
|
|
5204
|
-
function
|
|
5204
|
+
function Il(r) {
|
|
5205
5205
|
let e = r.activeElement;
|
|
5206
5206
|
for (; e && e.shadowRoot; )
|
|
5207
5207
|
e = e.shadowRoot.activeElement;
|
|
5208
5208
|
return e;
|
|
5209
5209
|
}
|
|
5210
|
-
function
|
|
5210
|
+
function Pl(r, e, t) {
|
|
5211
5211
|
if (r.caretPositionFromPoint)
|
|
5212
5212
|
try {
|
|
5213
5213
|
let n = r.caretPositionFromPoint(e, t);
|
|
@@ -5221,10 +5221,10 @@ function Il(r, e, t) {
|
|
|
5221
5221
|
return { node: n.startContainer, offset: Math.min(ne(n.startContainer), n.startOffset) };
|
|
5222
5222
|
}
|
|
5223
5223
|
}
|
|
5224
|
-
const
|
|
5224
|
+
const de = typeof navigator < "u" ? navigator : null, Gr = typeof document < "u" ? document : null, Ae = de && de.userAgent || "", Jn = /Edge\/(\d+)/.exec(Ae), xs = /MSIE \d/.exec(Ae), qn = /Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Ae), Y = !!(xs || qn || Jn), Ee = xs ? document.documentMode : qn ? +qn[1] : Jn ? +Jn[1] : 0, oe = !Y && /gecko\/(\d+)/i.test(Ae);
|
|
5225
5225
|
oe && +(/Firefox\/(\d+)/.exec(Ae) || [0, 0])[1];
|
|
5226
|
-
const Kn = !
|
|
5227
|
-
function
|
|
5226
|
+
const Kn = !Y && /Chrome\/(\d+)/.exec(Ae), J = !!Kn, Ss = Kn ? +Kn[1] : 0, U = !Y && !!de && /Apple Computer/.test(de.vendor), rt = U && (/Mobile\/\w+/.test(Ae) || !!de && de.maxTouchPoints > 2), te = rt || (de ? /Mac/.test(de.platform) : !1), Rl = de ? /Win/.test(de.platform) : !1, me = /Android \d/.test(Ae), Tt = !!Gr && "webkitFontSmoothing" in Gr.documentElement.style, Bl = Tt ? +(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent) || [0, 0])[1] : 0;
|
|
5227
|
+
function zl(r) {
|
|
5228
5228
|
let e = r.defaultView && r.defaultView.visualViewport;
|
|
5229
5229
|
return e ? {
|
|
5230
5230
|
left: 0,
|
|
@@ -5238,10 +5238,10 @@ function Bl(r) {
|
|
|
5238
5238
|
bottom: r.documentElement.clientHeight
|
|
5239
5239
|
};
|
|
5240
5240
|
}
|
|
5241
|
-
function
|
|
5241
|
+
function he(r, e) {
|
|
5242
5242
|
return typeof r == "number" ? r : r[e];
|
|
5243
5243
|
}
|
|
5244
|
-
function
|
|
5244
|
+
function Fl(r) {
|
|
5245
5245
|
let e = r.getBoundingClientRect(), t = e.width / r.offsetWidth || 1, n = e.height / r.offsetHeight || 1;
|
|
5246
5246
|
return {
|
|
5247
5247
|
left: e.left,
|
|
@@ -5257,8 +5257,8 @@ function Yr(r, e, t) {
|
|
|
5257
5257
|
o = nt(o);
|
|
5258
5258
|
continue;
|
|
5259
5259
|
}
|
|
5260
|
-
let l = o, a = l == s.body, c = a ?
|
|
5261
|
-
if (e.top < c.top +
|
|
5260
|
+
let l = o, a = l == s.body, c = a ? zl(s) : Fl(l), u = 0, d = 0;
|
|
5261
|
+
if (e.top < c.top + he(n, "top") ? d = -(c.top - e.top + he(i, "top")) : e.bottom > c.bottom - he(n, "bottom") && (d = e.bottom - e.top > c.bottom - c.top ? e.top + he(i, "top") - c.top : e.bottom - c.bottom + he(i, "bottom")), e.left < c.left + he(n, "left") ? u = -(c.left - e.left + he(i, "left")) : e.right > c.right - he(n, "right") && (u = e.right - c.right + he(i, "right")), u || d)
|
|
5262
5262
|
if (a)
|
|
5263
5263
|
s.defaultView.scrollBy(u, d);
|
|
5264
5264
|
else {
|
|
@@ -5273,7 +5273,7 @@ function Yr(r, e, t) {
|
|
|
5273
5273
|
o = f == "absolute" ? o.offsetParent : nt(o);
|
|
5274
5274
|
}
|
|
5275
5275
|
}
|
|
5276
|
-
function
|
|
5276
|
+
function Ll(r) {
|
|
5277
5277
|
let e = r.dom.getBoundingClientRect(), t = Math.max(0, e.top), n, i;
|
|
5278
5278
|
for (let s = (e.left + e.right) / 2, o = t + 1; o < Math.min(innerHeight, e.bottom); o += 5) {
|
|
5279
5279
|
let l = r.root.elementFromPoint(s, o);
|
|
@@ -5293,7 +5293,7 @@ function Cs(r) {
|
|
|
5293
5293
|
;
|
|
5294
5294
|
return e;
|
|
5295
5295
|
}
|
|
5296
|
-
function
|
|
5296
|
+
function $l({ refDOM: r, refTop: e, stack: t }) {
|
|
5297
5297
|
let n = r ? r.getBoundingClientRect().top : 0;
|
|
5298
5298
|
ws(t, n == 0 ? 0 : n - e);
|
|
5299
5299
|
}
|
|
@@ -5304,7 +5304,7 @@ function ws(r, e) {
|
|
|
5304
5304
|
}
|
|
5305
5305
|
}
|
|
5306
5306
|
let Ke = null;
|
|
5307
|
-
function
|
|
5307
|
+
function Vl(r) {
|
|
5308
5308
|
if (r.setActive)
|
|
5309
5309
|
return r.setActive();
|
|
5310
5310
|
if (Ke)
|
|
@@ -5323,7 +5323,7 @@ function Ms(r, e) {
|
|
|
5323
5323
|
if (u.nodeType == 1)
|
|
5324
5324
|
f = u.getClientRects();
|
|
5325
5325
|
else if (u.nodeType == 3)
|
|
5326
|
-
f =
|
|
5326
|
+
f = pe(u).getClientRects();
|
|
5327
5327
|
else
|
|
5328
5328
|
continue;
|
|
5329
5329
|
for (let h = 0; h < f.length; h++) {
|
|
@@ -5342,13 +5342,13 @@ function Ms(r, e) {
|
|
|
5342
5342
|
!t && (e.left >= p.right && e.top >= p.top || e.left >= p.left && e.top >= p.bottom) && (s = d + 1);
|
|
5343
5343
|
}
|
|
5344
5344
|
}
|
|
5345
|
-
return !t && a && (t = a, i = c, n = 0), t && t.nodeType == 3 ?
|
|
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 } : Ms(t, i);
|
|
5346
5346
|
}
|
|
5347
|
-
function
|
|
5347
|
+
function jl(r, e) {
|
|
5348
5348
|
let t = r.nodeValue.length, n = document.createRange();
|
|
5349
5349
|
for (let i = 0; i < t; i++) {
|
|
5350
5350
|
n.setEnd(r, i + 1), n.setStart(r, i);
|
|
5351
|
-
let s =
|
|
5351
|
+
let s = be(n, 1);
|
|
5352
5352
|
if (s.top != s.bottom && ar(e, s))
|
|
5353
5353
|
return { node: r, offset: i + (e.left >= (s.left + s.right) / 2 ? 1 : 0) };
|
|
5354
5354
|
}
|
|
@@ -5357,11 +5357,11 @@ function Vl(r, e) {
|
|
|
5357
5357
|
function ar(r, e) {
|
|
5358
5358
|
return r.left >= e.left - 1 && r.left <= e.right + 1 && r.top >= e.top - 1 && r.top <= e.bottom + 1;
|
|
5359
5359
|
}
|
|
5360
|
-
function
|
|
5360
|
+
function Hl(r, e) {
|
|
5361
5361
|
let t = r.parentNode;
|
|
5362
5362
|
return t && /^li$/i.test(t.nodeName) && e.left < r.getBoundingClientRect().left ? t : r;
|
|
5363
5363
|
}
|
|
5364
|
-
function
|
|
5364
|
+
function Wl(r, e, t) {
|
|
5365
5365
|
let { node: n, offset: i } = Ms(e, t), s = -1;
|
|
5366
5366
|
if (n.nodeType == 1 && !n.firstChild) {
|
|
5367
5367
|
let o = n.getBoundingClientRect();
|
|
@@ -5369,7 +5369,7 @@ function Hl(r, e, t) {
|
|
|
5369
5369
|
}
|
|
5370
5370
|
return r.docView.posFromDOM(n, i, s);
|
|
5371
5371
|
}
|
|
5372
|
-
function
|
|
5372
|
+
function Jl(r, e, t, n) {
|
|
5373
5373
|
let i = -1;
|
|
5374
5374
|
for (let s = e, o = !1; s != r.dom; ) {
|
|
5375
5375
|
let l = r.docView.nearestDesc(s, !0), a;
|
|
@@ -5400,8 +5400,8 @@ function Es(r, e, t) {
|
|
|
5400
5400
|
}
|
|
5401
5401
|
return r;
|
|
5402
5402
|
}
|
|
5403
|
-
function
|
|
5404
|
-
let t = r.dom.ownerDocument, n, i = 0, s =
|
|
5403
|
+
function ql(r, e) {
|
|
5404
|
+
let t = r.dom.ownerDocument, n, i = 0, s = Pl(t, e.left, e.top);
|
|
5405
5405
|
s && ({ node: n, offset: i } = s);
|
|
5406
5406
|
let o = (r.root.elementFromPoint ? r.root : t).elementFromPoint(e.left, e.top), l;
|
|
5407
5407
|
if (!o || !r.dom.contains(o.nodeType != 1 ? o.parentNode : o)) {
|
|
@@ -5409,25 +5409,25 @@ function Jl(r, e) {
|
|
|
5409
5409
|
if (!ar(e, c) || (o = Es(r.dom, e, c), !o))
|
|
5410
5410
|
return null;
|
|
5411
5411
|
}
|
|
5412
|
-
if (
|
|
5412
|
+
if (U)
|
|
5413
5413
|
for (let c = o; n && c; c = nt(c))
|
|
5414
5414
|
c.draggable && (n = void 0);
|
|
5415
|
-
if (o =
|
|
5415
|
+
if (o = Hl(o, e), n) {
|
|
5416
5416
|
if (oe && n.nodeType == 1 && (i = Math.min(i, n.childNodes.length), i < n.childNodes.length)) {
|
|
5417
5417
|
let u = n.childNodes[i], d;
|
|
5418
5418
|
u.nodeName == "IMG" && (d = u.getBoundingClientRect()).right <= e.left && d.bottom > e.top && i++;
|
|
5419
5419
|
}
|
|
5420
5420
|
let c;
|
|
5421
|
-
Tt && 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 =
|
|
5421
|
+
Tt && 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 = Jl(r, n, i, e));
|
|
5422
5422
|
}
|
|
5423
|
-
l == null && (l =
|
|
5423
|
+
l == null && (l = Wl(r, o, e));
|
|
5424
5424
|
let a = r.docView.nearestDesc(o, !0);
|
|
5425
5425
|
return { pos: l, inside: a ? a.posAtStart - a.border : -1 };
|
|
5426
5426
|
}
|
|
5427
5427
|
function Xr(r) {
|
|
5428
5428
|
return r.top < r.bottom || r.left < r.right;
|
|
5429
5429
|
}
|
|
5430
|
-
function
|
|
5430
|
+
function be(r, e) {
|
|
5431
5431
|
let t = r.getClientRects();
|
|
5432
5432
|
if (t.length) {
|
|
5433
5433
|
let n = t[e < 0 ? 0 : t.length - 1];
|
|
@@ -5436,16 +5436,16 @@ function ye(r, e) {
|
|
|
5436
5436
|
}
|
|
5437
5437
|
return Array.prototype.find.call(t, Xr) || r.getBoundingClientRect();
|
|
5438
5438
|
}
|
|
5439
|
-
const
|
|
5439
|
+
const Kl = /[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;
|
|
5440
5440
|
function Ts(r, e, t) {
|
|
5441
5441
|
let { node: n, offset: i, atom: s } = r.docView.domFromPos(e, t < 0 ? -1 : 1), o = Tt || oe;
|
|
5442
5442
|
if (n.nodeType == 3)
|
|
5443
|
-
if (o && (
|
|
5444
|
-
let a =
|
|
5443
|
+
if (o && (Kl.test(n.nodeValue) || (t < 0 ? !i : i == n.nodeValue.length))) {
|
|
5444
|
+
let a = be(pe(n, i, i), t);
|
|
5445
5445
|
if (oe && i && /\s/.test(n.nodeValue[i - 1]) && i < n.nodeValue.length) {
|
|
5446
|
-
let c =
|
|
5446
|
+
let c = be(pe(n, i - 1, i - 1), -1);
|
|
5447
5447
|
if (c.top == a.top) {
|
|
5448
|
-
let u =
|
|
5448
|
+
let u = be(pe(n, i, i + 1), -1);
|
|
5449
5449
|
if (u.top != a.top)
|
|
5450
5450
|
return ot(u, u.left < c.left);
|
|
5451
5451
|
}
|
|
@@ -5453,7 +5453,7 @@ function Ts(r, e, t) {
|
|
|
5453
5453
|
return a;
|
|
5454
5454
|
} else {
|
|
5455
5455
|
let a = i, c = i, u = t < 0 ? 1 : -1;
|
|
5456
|
-
return t < 0 && !i ? (c++, u = -1) : t >= 0 && i == n.nodeValue.length ? (a--, u = 1) : t < 0 ? a-- : c++, ot(
|
|
5456
|
+
return t < 0 && !i ? (c++, u = -1) : t >= 0 && i == n.nodeValue.length ? (a--, u = 1) : t < 0 ? a-- : c++, ot(be(pe(n, a, c), u), u < 0);
|
|
5457
5457
|
}
|
|
5458
5458
|
if (!r.state.doc.resolve(e - (s || 0)).parent.inlineContent) {
|
|
5459
5459
|
if (s == null && i && (t < 0 || i == ne(n))) {
|
|
@@ -5469,19 +5469,19 @@ function Ts(r, e, t) {
|
|
|
5469
5469
|
return Mn(n.getBoundingClientRect(), t >= 0);
|
|
5470
5470
|
}
|
|
5471
5471
|
if (s == null && i && (t < 0 || i == ne(n))) {
|
|
5472
|
-
let a = n.childNodes[i - 1], c = a.nodeType == 3 ?
|
|
5472
|
+
let a = n.childNodes[i - 1], c = a.nodeType == 3 ? pe(a, ne(a) - (o ? 0 : 1)) : a.nodeType == 1 && (a.nodeName != "BR" || !a.nextSibling) ? a : null;
|
|
5473
5473
|
if (c)
|
|
5474
|
-
return ot(
|
|
5474
|
+
return ot(be(c, 1), !1);
|
|
5475
5475
|
}
|
|
5476
5476
|
if (s == null && i < ne(n)) {
|
|
5477
5477
|
let a = n.childNodes[i];
|
|
5478
5478
|
for (; a.pmViewDesc && a.pmViewDesc.ignoreForCoords; )
|
|
5479
5479
|
a = a.nextSibling;
|
|
5480
|
-
let c = a ? a.nodeType == 3 ?
|
|
5480
|
+
let c = a ? a.nodeType == 3 ? pe(a, 0, o ? 0 : 1) : a.nodeType == 1 ? a : null : null;
|
|
5481
5481
|
if (c)
|
|
5482
|
-
return ot(
|
|
5482
|
+
return ot(be(c, -1), !0);
|
|
5483
5483
|
}
|
|
5484
|
-
return ot(
|
|
5484
|
+
return ot(be(n.nodeType == 3 ? pe(n) : n, -t), t >= 0);
|
|
5485
5485
|
}
|
|
5486
5486
|
function ot(r, e) {
|
|
5487
5487
|
if (r.width == 0)
|
|
@@ -5504,7 +5504,7 @@ function Os(r, e, t) {
|
|
|
5504
5504
|
n != e && r.updateState(n), i != r.dom && i && i.focus();
|
|
5505
5505
|
}
|
|
5506
5506
|
}
|
|
5507
|
-
function
|
|
5507
|
+
function Ul(r, e, t) {
|
|
5508
5508
|
let n = e.selection, i = t == "up" ? n.$from : n.$to;
|
|
5509
5509
|
return Os(r, e, () => {
|
|
5510
5510
|
let { node: s } = r.docView.domFromPos(i.pos, t == "up" ? -1 : 1);
|
|
@@ -5524,7 +5524,7 @@ function Kl(r, e, t) {
|
|
|
5524
5524
|
if (l.nodeType == 1)
|
|
5525
5525
|
a = l.getClientRects();
|
|
5526
5526
|
else if (l.nodeType == 3)
|
|
5527
|
-
a =
|
|
5527
|
+
a = pe(l, 0, l.nodeValue.length).getClientRects();
|
|
5528
5528
|
else
|
|
5529
5529
|
continue;
|
|
5530
5530
|
for (let c = 0; c < a.length; c++) {
|
|
@@ -5536,13 +5536,13 @@ function Kl(r, e, t) {
|
|
|
5536
5536
|
return !0;
|
|
5537
5537
|
});
|
|
5538
5538
|
}
|
|
5539
|
-
const
|
|
5540
|
-
function
|
|
5539
|
+
const _l = /[\u0590-\u08ac]/;
|
|
5540
|
+
function Gl(r, e, t) {
|
|
5541
5541
|
let { $head: n } = e.selection;
|
|
5542
5542
|
if (!n.parent.isTextblock)
|
|
5543
5543
|
return !1;
|
|
5544
5544
|
let i = n.parentOffset, s = !i, o = i == n.parent.content.size, l = r.domSelection();
|
|
5545
|
-
return l ? !
|
|
5545
|
+
return l ? !_l.test(n.parent.textContent) || !l.modify ? t == "left" || t == "backward" ? s : o : Os(r, e, () => {
|
|
5546
5546
|
let { focusNode: a, focusOffset: c, anchorNode: u, anchorOffset: d } = r.domSelectionRange(), f = l.caretBidiLevel;
|
|
5547
5547
|
l.modify("move", t, "character");
|
|
5548
5548
|
let h = n.depth ? r.docView.domAfterPos(n.before()) : r.dom, { focusNode: p, focusOffset: m } = r.domSelectionRange(), g = p && !h.contains(p.nodeType == 1 ? p : p.parentNode) || a == p && c == m;
|
|
@@ -5554,10 +5554,10 @@ function _l(r, e, t) {
|
|
|
5554
5554
|
}) : n.pos == n.start() || n.pos == n.end();
|
|
5555
5555
|
}
|
|
5556
5556
|
let Zr = null, Qr = null, ei = !1;
|
|
5557
|
-
function
|
|
5558
|
-
return Zr == e && Qr == t ? ei : (Zr = e, Qr = t, ei = t == "up" || t == "down" ?
|
|
5557
|
+
function Yl(r, e, t) {
|
|
5558
|
+
return Zr == e && Qr == t ? ei : (Zr = e, Qr = t, ei = t == "up" || t == "down" ? Ul(r, e, t) : Gl(r, e, t));
|
|
5559
5559
|
}
|
|
5560
|
-
const ie = 0, ti = 1, Pe = 2,
|
|
5560
|
+
const ie = 0, ti = 1, Pe = 2, fe = 3;
|
|
5561
5561
|
class Ot {
|
|
5562
5562
|
constructor(e, t, n, i) {
|
|
5563
5563
|
this.parent = e, this.children = t, this.dom = n, this.contentDOM = i, this.dirty = ie, n.pmViewDesc = this;
|
|
@@ -5817,7 +5817,7 @@ class Ot {
|
|
|
5817
5817
|
p = g;
|
|
5818
5818
|
}
|
|
5819
5819
|
let l = this.domFromPos(e, e ? -1 : 1), a = t == e ? l : this.domFromPos(t, t ? -1 : 1), c = n.root.getSelection(), u = n.domSelectionRange(), d = !1;
|
|
5820
|
-
if ((oe ||
|
|
5820
|
+
if ((oe || U) && e == t) {
|
|
5821
5821
|
let { node: h, offset: p } = l;
|
|
5822
5822
|
if (h.nodeType == 3) {
|
|
5823
5823
|
if (d = !!(p && h.nodeValue[p - 1] == `
|
|
@@ -5840,7 +5840,7 @@ class Ot {
|
|
|
5840
5840
|
let h = u.focusNode.childNodes[u.focusOffset];
|
|
5841
5841
|
h && h.contentEditable == "false" && (i = !0);
|
|
5842
5842
|
}
|
|
5843
|
-
if (!(i || d &&
|
|
5843
|
+
if (!(i || d && U) && He(l.node, l.offset, u.anchorNode, u.anchorOffset) && He(a.node, a.offset, u.focusNode, u.focusOffset))
|
|
5844
5844
|
return;
|
|
5845
5845
|
let f = !1;
|
|
5846
5846
|
if ((c.extend || e == t) && !d) {
|
|
@@ -5873,10 +5873,10 @@ class Ot {
|
|
|
5873
5873
|
if (n == o ? e <= o && t >= n : e < o && t > n) {
|
|
5874
5874
|
let l = n + s.border, a = o - s.border;
|
|
5875
5875
|
if (e >= l && t <= a) {
|
|
5876
|
-
this.dirty = e == n || t == o ? Pe : ti, e == l && t == a && (s.contentLost || s.dom.parentNode != this.contentDOM) ? s.dirty =
|
|
5876
|
+
this.dirty = e == n || t == o ? Pe : ti, e == l && t == a && (s.contentLost || s.dom.parentNode != this.contentDOM) ? s.dirty = fe : s.markDirty(e - l, t - l);
|
|
5877
5877
|
return;
|
|
5878
5878
|
} else
|
|
5879
|
-
s.dirty = s.dom == s.contentDOM && s.dom.parentNode == this.contentDOM && !s.children.length ? Pe :
|
|
5879
|
+
s.dirty = s.dom == s.contentDOM && s.dom.parentNode == this.contentDOM && !s.children.length ? Pe : fe;
|
|
5880
5880
|
}
|
|
5881
5881
|
n = o;
|
|
5882
5882
|
}
|
|
@@ -5939,7 +5939,7 @@ class Ns extends Ot {
|
|
|
5939
5939
|
return this.widget.type.side;
|
|
5940
5940
|
}
|
|
5941
5941
|
}
|
|
5942
|
-
class
|
|
5942
|
+
class Xl extends Ot {
|
|
5943
5943
|
constructor(e, t, n, i) {
|
|
5944
5944
|
super(e, [], t, null), this.textDOM = n, this.text = i;
|
|
5945
5945
|
}
|
|
@@ -5965,10 +5965,10 @@ class We extends Ot {
|
|
|
5965
5965
|
return (!o || !o.dom) && (o = Je.renderSpec(document, t.type.spec.toDOM(t, n), null, t.attrs)), new We(e, t, o.dom, o.contentDOM || o.dom, o);
|
|
5966
5966
|
}
|
|
5967
5967
|
parseRule() {
|
|
5968
|
-
return this.dirty &
|
|
5968
|
+
return this.dirty & fe || this.mark.type.spec.reparseInView ? null : { mark: this.mark.type.name, attrs: this.mark.attrs, contentElement: this.contentDOM };
|
|
5969
5969
|
}
|
|
5970
5970
|
matchesMark(e) {
|
|
5971
|
-
return this.dirty !=
|
|
5971
|
+
return this.dirty != fe && this.mark.eq(e);
|
|
5972
5972
|
}
|
|
5973
5973
|
markDirty(e, t) {
|
|
5974
5974
|
if (super.markDirty(e, t), this.dirty != ie) {
|
|
@@ -6020,7 +6020,7 @@ class Te extends Ot {
|
|
|
6020
6020
|
} else u || ({ dom: u, contentDOM: d } = Je.renderSpec(document, t.type.spec.toDOM(t), null, t.attrs));
|
|
6021
6021
|
!d && !t.isText && u.nodeName != "BR" && (u.hasAttribute("contenteditable") || (u.contentEditable = "false"), t.type.spec.draggable && (u.draggable = !0));
|
|
6022
6022
|
let f = u;
|
|
6023
|
-
return u = Is(u, n, t), c ? a = new
|
|
6023
|
+
return u = Is(u, n, t), c ? a = new Zl(e, t, n, i, u, d || null, f, c, s, o + 1) : t.isText ? new ln(e, t, n, i, u, f, s) : new Te(e, t, n, i, u, d || null, f, s, o + 1);
|
|
6024
6024
|
}
|
|
6025
6025
|
parseRule() {
|
|
6026
6026
|
if (this.node.type.spec.reparseInView)
|
|
@@ -6056,14 +6056,14 @@ class Te extends Ot {
|
|
|
6056
6056
|
// separate step, syncs the DOM inside `this.contentDOM` to
|
|
6057
6057
|
// `this.children`.
|
|
6058
6058
|
updateChildren(e, t) {
|
|
6059
|
-
let n = this.node.inlineContent, i = t, s = e.composing ? this.localCompositionInfo(e, t) : null, o = s && s.pos > -1 ? s : null, l = s && s.pos < 0, a = new
|
|
6060
|
-
|
|
6061
|
-
c.spec.marks ? a.syncToMarks(c.spec.marks, n, e) : c.type.side >= 0 && !d && a.syncToMarks(u == this.node.childCount ?
|
|
6059
|
+
let n = this.node.inlineContent, i = t, s = e.composing ? this.localCompositionInfo(e, t) : null, o = s && s.pos > -1 ? s : null, l = s && s.pos < 0, a = new ea(this, o && o.node, e);
|
|
6060
|
+
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 ? v.none : this.node.child(u).marks, n, e), a.placeWidget(c, e, i);
|
|
6062
6062
|
}, (c, u, d, f) => {
|
|
6063
6063
|
a.syncToMarks(c.marks, n, e);
|
|
6064
6064
|
let h;
|
|
6065
6065
|
a.findNodeMatch(c, u, d, f) || l && e.state.selection.from > i && e.state.selection.to < i + c.nodeSize && (h = a.findIndexWithChild(s.node)) > -1 && a.updateNodeAt(c, u, d, h, e) || a.updateNextNode(c, u, d, e, f, i) || a.addNode(c, u, d, e, i), i += c.nodeSize;
|
|
6066
|
-
}), a.syncToMarks([], n, e), this.node.isTextblock && a.addTextblockHacks(), a.destroyRest(), (a.changed || this.dirty == Pe) && (o && this.protectLocalComposition(e, o), vs(this.contentDOM, this.children, e), rt &&
|
|
6066
|
+
}), a.syncToMarks([], n, e), this.node.isTextblock && a.addTextblockHacks(), a.destroyRest(), (a.changed || this.dirty == Pe) && (o && this.protectLocalComposition(e, o), vs(this.contentDOM, this.children, e), rt && ia(this.dom));
|
|
6067
6067
|
}
|
|
6068
6068
|
localCompositionInfo(e, t) {
|
|
6069
6069
|
let { from: n, to: i } = e.state.selection;
|
|
@@ -6073,7 +6073,7 @@ class Te extends Ot {
|
|
|
6073
6073
|
if (!s || !this.dom.contains(s.parentNode))
|
|
6074
6074
|
return null;
|
|
6075
6075
|
if (this.node.inlineContent) {
|
|
6076
|
-
let o = s.nodeValue, l =
|
|
6076
|
+
let o = s.nodeValue, l = sa(this.node.content, o, n - t, i - t);
|
|
6077
6077
|
return l < 0 ? null : { node: s, pos: l, text: o };
|
|
6078
6078
|
} else
|
|
6079
6079
|
return { node: s, pos: -1, text: "" };
|
|
@@ -6089,13 +6089,13 @@ class Te extends Ot {
|
|
|
6089
6089
|
s.parentNode.removeChild(s.nextSibling);
|
|
6090
6090
|
s.pmViewDesc && (s.pmViewDesc = void 0);
|
|
6091
6091
|
}
|
|
6092
|
-
let o = new
|
|
6092
|
+
let o = new Xl(this, s, t, i);
|
|
6093
6093
|
e.input.compositionNodes.push(o), this.children = _n(this.children, n, n + i.length, e, o);
|
|
6094
6094
|
}
|
|
6095
6095
|
// If this desc must be updated to match the given node decoration,
|
|
6096
6096
|
// do so and return true.
|
|
6097
6097
|
update(e, t, n, i) {
|
|
6098
|
-
return this.dirty ==
|
|
6098
|
+
return this.dirty == fe || !e.sameMarkup(this.node) ? !1 : (this.updateInner(e, t, n, i), !0);
|
|
6099
6099
|
}
|
|
6100
6100
|
updateInner(e, t, n, i) {
|
|
6101
6101
|
this.updateOuterDeco(t), this.node = e, this.innerDeco = n, this.contentDOM && this.updateChildren(i, this.posAtStart), this.dirty = ie;
|
|
@@ -6134,7 +6134,7 @@ class ln extends Te {
|
|
|
6134
6134
|
return { skip: e || !0 };
|
|
6135
6135
|
}
|
|
6136
6136
|
update(e, t, n, i) {
|
|
6137
|
-
return this.dirty ==
|
|
6137
|
+
return this.dirty == fe || this.dirty != ie && !this.inParent() || !e.sameMarkup(this.node) ? !1 : (this.updateOuterDeco(t), (this.dirty != ie || e.text != this.node.text) && e.text != this.nodeDOM.nodeValue && (this.nodeDOM.nodeValue = e.text, i.trackWrites == this.nodeDOM && (i.trackWrites = null)), this.node = e, this.dirty = ie, !0);
|
|
6138
6138
|
}
|
|
6139
6139
|
inParent() {
|
|
6140
6140
|
let e = this.parent.contentDOM;
|
|
@@ -6157,7 +6157,7 @@ class ln extends Te {
|
|
|
6157
6157
|
return new ln(this.parent, i, this.outerDeco, this.innerDeco, s, s, n);
|
|
6158
6158
|
}
|
|
6159
6159
|
markDirty(e, t) {
|
|
6160
|
-
super.markDirty(e, t), this.dom != this.nodeDOM && (e == 0 || t == this.nodeDOM.nodeValue.length) && (this.dirty =
|
|
6160
|
+
super.markDirty(e, t), this.dom != this.nodeDOM && (e == 0 || t == this.nodeDOM.nodeValue.length) && (this.dirty = fe);
|
|
6161
6161
|
}
|
|
6162
6162
|
get domAtom() {
|
|
6163
6163
|
return !1;
|
|
@@ -6180,7 +6180,7 @@ class As extends Ot {
|
|
|
6180
6180
|
return this.dom.nodeName == "IMG";
|
|
6181
6181
|
}
|
|
6182
6182
|
}
|
|
6183
|
-
class
|
|
6183
|
+
class Zl extends Te {
|
|
6184
6184
|
constructor(e, t, n, i, s, o, l, a, c, u) {
|
|
6185
6185
|
super(e, t, n, i, s, o, l, c, u), this.spec = a;
|
|
6186
6186
|
}
|
|
@@ -6188,7 +6188,7 @@ class Xl extends Te {
|
|
|
6188
6188
|
// through. If it does, and there's a `contentDOM` node, our logic
|
|
6189
6189
|
// updates the children.
|
|
6190
6190
|
update(e, t, n, i) {
|
|
6191
|
-
if (this.dirty ==
|
|
6191
|
+
if (this.dirty == fe)
|
|
6192
6192
|
return !1;
|
|
6193
6193
|
if (this.spec.update && (this.node.type == e.type || this.spec.multiType)) {
|
|
6194
6194
|
let s = this.spec.update(e, t, n);
|
|
@@ -6264,11 +6264,11 @@ function Ds(r, e, t, n) {
|
|
|
6264
6264
|
let a;
|
|
6265
6265
|
l && l.nodeName == o.nodeName && i != r && (a = i.parentNode) && a.nodeName.toLowerCase() == o.nodeName || (a = document.createElement(o.nodeName), a.pmIsDeco = !0, a.appendChild(i), l = Re[0]), i = a;
|
|
6266
6266
|
}
|
|
6267
|
-
|
|
6267
|
+
Ql(i, l || Re[0], o);
|
|
6268
6268
|
}
|
|
6269
6269
|
return i;
|
|
6270
6270
|
}
|
|
6271
|
-
function
|
|
6271
|
+
function Ql(r, e, t) {
|
|
6272
6272
|
for (let n in e)
|
|
6273
6273
|
n != "class" && n != "style" && n != "nodeName" && !(n in t) && r.removeAttribute(n);
|
|
6274
6274
|
for (let n in t)
|
|
@@ -6305,9 +6305,9 @@ function ri(r) {
|
|
|
6305
6305
|
let e = r.nextSibling;
|
|
6306
6306
|
return r.parentNode.removeChild(r), e;
|
|
6307
6307
|
}
|
|
6308
|
-
class
|
|
6308
|
+
class ea {
|
|
6309
6309
|
constructor(e, t, n) {
|
|
6310
|
-
this.lock = t, this.view = n, this.index = 0, this.stack = [], this.changed = !1, this.top = e, this.preMatch =
|
|
6310
|
+
this.lock = t, this.view = n, this.index = 0, this.stack = [], this.changed = !1, this.top = e, this.preMatch = ta(e.node.content, e);
|
|
6311
6311
|
}
|
|
6312
6312
|
// Destroy and remove the children between the given indices in
|
|
6313
6313
|
// `this.top`.
|
|
@@ -6367,7 +6367,7 @@ class Ql {
|
|
|
6367
6367
|
}
|
|
6368
6368
|
updateNodeAt(e, t, n, i, s) {
|
|
6369
6369
|
let o = this.top.children[i];
|
|
6370
|
-
return o.dirty ==
|
|
6370
|
+
return o.dirty == fe && o.dom == o.contentDOM && (o.dirty = Pe), o.update(e, t, n, s) ? (this.destroyBetween(this.index, i), this.index++, !0) : !1;
|
|
6371
6371
|
}
|
|
6372
6372
|
findIndexWithChild(e) {
|
|
6373
6373
|
for (; ; ) {
|
|
@@ -6395,7 +6395,7 @@ class Ql {
|
|
|
6395
6395
|
let c = this.preMatch.matched.get(a);
|
|
6396
6396
|
if (c != null && c != s)
|
|
6397
6397
|
return !1;
|
|
6398
|
-
let u = a.dom, d, f = this.isLocked(u) && !(e.isText && a.node && a.node.isText && a.nodeDOM.nodeValue == e.text && a.dirty !=
|
|
6398
|
+
let u = a.dom, d, f = this.isLocked(u) && !(e.isText && a.node && a.node.isText && a.nodeDOM.nodeValue == e.text && a.dirty != fe && Kt(t, a.outerDeco));
|
|
6399
6399
|
if (!f && a.update(e, t, n, i))
|
|
6400
6400
|
return this.destroyBetween(this.index, l), a.dom != u && (this.changed = !0), this.index++, !0;
|
|
6401
6401
|
if (!f && (d = this.recreateWrapper(a, e, t, n, i, o)))
|
|
@@ -6439,7 +6439,7 @@ class Ql {
|
|
|
6439
6439
|
for (; e instanceof We; )
|
|
6440
6440
|
t = e, e = t.children[t.children.length - 1];
|
|
6441
6441
|
(!e || // Empty textblock
|
|
6442
|
-
!(e instanceof ln) || /\n$/.test(e.node.text) || this.view.requiresGeckoHackNode && /\s$/.test(e.node.text)) && ((
|
|
6442
|
+
!(e instanceof ln) || /\n$/.test(e.node.text) || this.view.requiresGeckoHackNode && /\s$/.test(e.node.text)) && ((U || J) && e && e.dom.contentEditable == "false" && this.addHackNode("IMG", t), this.addHackNode("BR", this.top));
|
|
6443
6443
|
}
|
|
6444
6444
|
addHackNode(e, t) {
|
|
6445
6445
|
if (t == this.top && this.index < t.children.length && t.children[this.index].matchesHack(e))
|
|
@@ -6455,7 +6455,7 @@ class Ql {
|
|
|
6455
6455
|
return this.lock && (e == this.lock || e.nodeType == 1 && e.contains(this.lock.parentNode));
|
|
6456
6456
|
}
|
|
6457
6457
|
}
|
|
6458
|
-
function
|
|
6458
|
+
function ta(r, e) {
|
|
6459
6459
|
let t = e, n = t.children.length, i = r.childCount, s = /* @__PURE__ */ new Map(), o = [];
|
|
6460
6460
|
e: for (; i > 0; ) {
|
|
6461
6461
|
let l;
|
|
@@ -6482,10 +6482,10 @@ function ea(r, e) {
|
|
|
6482
6482
|
}
|
|
6483
6483
|
return { index: i, matched: s, matches: o.reverse() };
|
|
6484
6484
|
}
|
|
6485
|
-
function
|
|
6485
|
+
function na(r, e) {
|
|
6486
6486
|
return r.type.side - e.type.side;
|
|
6487
6487
|
}
|
|
6488
|
-
function
|
|
6488
|
+
function ra(r, e, t, n) {
|
|
6489
6489
|
let i = e.locals(r), s = 0;
|
|
6490
6490
|
if (i.length == 0) {
|
|
6491
6491
|
for (let c = 0; c < r.childCount; c++) {
|
|
@@ -6503,7 +6503,7 @@ function na(r, e, t, n) {
|
|
|
6503
6503
|
}
|
|
6504
6504
|
if (u)
|
|
6505
6505
|
if (d) {
|
|
6506
|
-
d.sort(
|
|
6506
|
+
d.sort(na);
|
|
6507
6507
|
for (let g = 0; g < d.length; g++)
|
|
6508
6508
|
t(d[g], c, !!a);
|
|
6509
6509
|
} else
|
|
@@ -6533,13 +6533,13 @@ function na(r, e, t, n) {
|
|
|
6533
6533
|
n(f, m, e.forChild(s, f), h), s = p;
|
|
6534
6534
|
}
|
|
6535
6535
|
}
|
|
6536
|
-
function
|
|
6536
|
+
function ia(r) {
|
|
6537
6537
|
if (r.nodeName == "UL" || r.nodeName == "OL") {
|
|
6538
6538
|
let e = r.style.cssText;
|
|
6539
6539
|
r.style.cssText = e + "; list-style: square !important", window.getComputedStyle(r).listStyle, r.style.cssText = e;
|
|
6540
6540
|
}
|
|
6541
6541
|
}
|
|
6542
|
-
function
|
|
6542
|
+
function sa(r, e, t, n) {
|
|
6543
6543
|
for (let i = 0, s = 0; i < r.childCount && s <= n; ) {
|
|
6544
6544
|
let o = r.child(i++), l = s;
|
|
6545
6545
|
if (s += o.nodeSize, !o.isText)
|
|
@@ -6583,7 +6583,7 @@ function cr(r, e = null) {
|
|
|
6583
6583
|
for (a = o; i && !i.node; )
|
|
6584
6584
|
i = i.parent;
|
|
6585
6585
|
let d = i.node;
|
|
6586
|
-
if (i && d.isAtom && C.isSelectable(d) && i.parent && !(d.isInline &&
|
|
6586
|
+
if (i && d.isAtom && C.isSelectable(d) && i.parent && !(d.isInline && Dl(t.focusNode, t.focusOffset, i.dom))) {
|
|
6587
6587
|
let f = i.posBefore;
|
|
6588
6588
|
c = new C(o == f ? l : n.resolve(f));
|
|
6589
6589
|
}
|
|
@@ -6612,7 +6612,7 @@ function cr(r, e = null) {
|
|
|
6612
6612
|
function Ps(r) {
|
|
6613
6613
|
return r.editable ? r.hasFocus() : Bs(r) && document.activeElement && document.activeElement.contains(r.dom);
|
|
6614
6614
|
}
|
|
6615
|
-
function
|
|
6615
|
+
function ye(r, e = !1) {
|
|
6616
6616
|
let t = r.state.selection;
|
|
6617
6617
|
if (Rs(r, t), !!Ps(r)) {
|
|
6618
6618
|
if (!e && r.input.mouseDown && r.input.mouseDown.allowDefault && J) {
|
|
@@ -6623,18 +6623,18 @@ function ge(r, e = !1) {
|
|
|
6623
6623
|
}
|
|
6624
6624
|
}
|
|
6625
6625
|
if (r.domObserver.disconnectSelection(), r.cursorWrapper)
|
|
6626
|
-
|
|
6626
|
+
la(r);
|
|
6627
6627
|
else {
|
|
6628
6628
|
let { anchor: n, head: i } = t, s, o;
|
|
6629
|
-
ii && !(t instanceof T) && (t.$from.parent.inlineContent || (s = si(r, t.from)), !t.empty && !t.$from.parent.inlineContent && (o = si(r, t.to))), r.docView.setSelection(n, i, r, e), ii && (s && oi(s), o && oi(o)), t.visible ? r.dom.classList.remove("ProseMirror-hideselection") : (r.dom.classList.add("ProseMirror-hideselection"), "onselectionchange" in document &&
|
|
6629
|
+
ii && !(t instanceof T) && (t.$from.parent.inlineContent || (s = si(r, t.from)), !t.empty && !t.$from.parent.inlineContent && (o = si(r, t.to))), r.docView.setSelection(n, i, r, e), ii && (s && oi(s), o && oi(o)), t.visible ? r.dom.classList.remove("ProseMirror-hideselection") : (r.dom.classList.add("ProseMirror-hideselection"), "onselectionchange" in document && oa(r));
|
|
6630
6630
|
}
|
|
6631
6631
|
r.domObserver.setCurSelection(), r.domObserver.connectSelection();
|
|
6632
6632
|
}
|
|
6633
6633
|
}
|
|
6634
|
-
const ii =
|
|
6634
|
+
const ii = U || J && Ss < 63;
|
|
6635
6635
|
function si(r, e) {
|
|
6636
6636
|
let { node: t, offset: n } = r.docView.domFromPos(e, 0), i = n < t.childNodes.length ? t.childNodes[n] : null, s = n ? t.childNodes[n - 1] : null;
|
|
6637
|
-
if (
|
|
6637
|
+
if (U && i && i.contentEditable == "false")
|
|
6638
6638
|
return En(i);
|
|
6639
6639
|
if ((!i || i.contentEditable == "false") && (!s || s.contentEditable == "false")) {
|
|
6640
6640
|
if (i)
|
|
@@ -6644,12 +6644,12 @@ function si(r, e) {
|
|
|
6644
6644
|
}
|
|
6645
6645
|
}
|
|
6646
6646
|
function En(r) {
|
|
6647
|
-
return r.contentEditable = "true",
|
|
6647
|
+
return r.contentEditable = "true", U && r.draggable && (r.draggable = !1, r.wasDraggable = !0), r;
|
|
6648
6648
|
}
|
|
6649
6649
|
function oi(r) {
|
|
6650
6650
|
r.contentEditable = "false", r.wasDraggable && (r.draggable = !0, r.wasDraggable = null);
|
|
6651
6651
|
}
|
|
6652
|
-
function
|
|
6652
|
+
function oa(r) {
|
|
6653
6653
|
let e = r.dom.ownerDocument;
|
|
6654
6654
|
e.removeEventListener("selectionchange", r.input.hideSelectionGuard);
|
|
6655
6655
|
let t = r.domSelectionRange(), n = t.anchorNode, i = t.anchorOffset;
|
|
@@ -6659,12 +6659,12 @@ function sa(r) {
|
|
|
6659
6659
|
}, 20));
|
|
6660
6660
|
});
|
|
6661
6661
|
}
|
|
6662
|
-
function
|
|
6662
|
+
function la(r) {
|
|
6663
6663
|
let e = r.domSelection(), t = document.createRange();
|
|
6664
6664
|
if (!e)
|
|
6665
6665
|
return;
|
|
6666
6666
|
let n = r.cursorWrapper.dom, i = n.nodeName == "IMG";
|
|
6667
|
-
i ? t.setStart(n.parentNode, V(n) + 1) : t.setStart(n, 0), t.collapse(!0), e.removeAllRanges(), e.addRange(t), !i && !r.state.selection.visible &&
|
|
6667
|
+
i ? t.setStart(n.parentNode, V(n) + 1) : t.setStart(n, 0), t.collapse(!0), e.removeAllRanges(), e.addRange(t), !i && !r.state.selection.visible && Y && Ee <= 11 && (n.disabled = !0, n.disabled = !1);
|
|
6668
6668
|
}
|
|
6669
6669
|
function Rs(r, e) {
|
|
6670
6670
|
if (e instanceof C) {
|
|
@@ -6692,7 +6692,7 @@ function Bs(r) {
|
|
|
6692
6692
|
return !1;
|
|
6693
6693
|
}
|
|
6694
6694
|
}
|
|
6695
|
-
function
|
|
6695
|
+
function aa(r) {
|
|
6696
6696
|
let e = r.docView.domFromPos(r.state.selection.anchor, 0), t = r.domSelectionRange();
|
|
6697
6697
|
return He(e.node, e.offset, t.anchorNode, t.anchorOffset);
|
|
6698
6698
|
}
|
|
@@ -6700,7 +6700,7 @@ function Gn(r, e) {
|
|
|
6700
6700
|
let { $anchor: t, $head: n } = r.selection, i = e > 0 ? t.max(n) : t.min(n), s = i.parent.inlineContent ? i.depth ? r.doc.resolve(e > 0 ? i.after() : i.before()) : null : i;
|
|
6701
6701
|
return s && O.findFrom(s, e);
|
|
6702
6702
|
}
|
|
6703
|
-
function
|
|
6703
|
+
function ke(r, e) {
|
|
6704
6704
|
return r.dispatch(r.state.tr.setSelection(e).scrollIntoView()), !0;
|
|
6705
6705
|
}
|
|
6706
6706
|
function ci(r, e, t) {
|
|
@@ -6711,25 +6711,25 @@ function ci(r, e, t) {
|
|
|
6711
6711
|
if (!s || s.isText || !s.isLeaf)
|
|
6712
6712
|
return !1;
|
|
6713
6713
|
let o = r.state.doc.resolve(i.pos + s.nodeSize * (e < 0 ? -1 : 1));
|
|
6714
|
-
return
|
|
6714
|
+
return ke(r, new T(n.$anchor, o));
|
|
6715
6715
|
} else if (n.empty) {
|
|
6716
6716
|
if (r.endOfTextblock(e > 0 ? "forward" : "backward")) {
|
|
6717
6717
|
let i = Gn(r.state, e);
|
|
6718
|
-
return i && i instanceof C ?
|
|
6718
|
+
return i && i instanceof C ? ke(r, i) : !1;
|
|
6719
6719
|
} else if (!(te && t.indexOf("m") > -1)) {
|
|
6720
6720
|
let i = n.$head, s = i.textOffset ? null : e < 0 ? i.nodeBefore : i.nodeAfter, o;
|
|
6721
6721
|
if (!s || s.isText)
|
|
6722
6722
|
return !1;
|
|
6723
6723
|
let l = e < 0 ? i.pos - s.nodeSize : i.pos;
|
|
6724
|
-
return s.isAtom || (o = r.docView.descAt(l)) && !o.contentDOM ? C.isSelectable(s) ?
|
|
6724
|
+
return s.isAtom || (o = r.docView.descAt(l)) && !o.contentDOM ? C.isSelectable(s) ? ke(r, new C(e < 0 ? r.state.doc.resolve(i.pos - s.nodeSize) : i)) : Tt ? ke(r, new T(r.state.doc.resolve(e < 0 ? l : l + s.nodeSize))) : !1 : !1;
|
|
6725
6725
|
}
|
|
6726
6726
|
} else return !1;
|
|
6727
6727
|
else {
|
|
6728
6728
|
if (n instanceof C && n.node.isInline)
|
|
6729
|
-
return
|
|
6729
|
+
return ke(r, new T(e > 0 ? n.$to : n.$from));
|
|
6730
6730
|
{
|
|
6731
6731
|
let i = Gn(r.state, e);
|
|
6732
|
-
return i ?
|
|
6732
|
+
return i ? ke(r, i) : !1;
|
|
6733
6733
|
}
|
|
6734
6734
|
}
|
|
6735
6735
|
}
|
|
@@ -6741,9 +6741,9 @@ function ht(r, e) {
|
|
|
6741
6741
|
return t && t.size == 0 && (e < 0 || r.nextSibling || r.nodeName != "BR");
|
|
6742
6742
|
}
|
|
6743
6743
|
function Ue(r, e) {
|
|
6744
|
-
return e < 0 ?
|
|
6744
|
+
return e < 0 ? ca(r) : ua(r);
|
|
6745
6745
|
}
|
|
6746
|
-
function
|
|
6746
|
+
function ca(r) {
|
|
6747
6747
|
let e = r.domSelectionRange(), t = e.focusNode, n = e.focusOffset;
|
|
6748
6748
|
if (!t)
|
|
6749
6749
|
return;
|
|
@@ -6779,7 +6779,7 @@ function aa(r) {
|
|
|
6779
6779
|
}
|
|
6780
6780
|
o ? Yn(r, t, n) : i && Yn(r, i, s);
|
|
6781
6781
|
}
|
|
6782
|
-
function
|
|
6782
|
+
function ua(r) {
|
|
6783
6783
|
let e = r.domSelectionRange(), t = e.focusNode, n = e.focusOffset;
|
|
6784
6784
|
if (!t)
|
|
6785
6785
|
return;
|
|
@@ -6815,7 +6815,7 @@ function zs(r) {
|
|
|
6815
6815
|
let e = r.pmViewDesc;
|
|
6816
6816
|
return e && e.node && e.node.isBlock;
|
|
6817
6817
|
}
|
|
6818
|
-
function
|
|
6818
|
+
function da(r, e) {
|
|
6819
6819
|
for (; r && e == r.childNodes.length && !Et(r); )
|
|
6820
6820
|
e = V(r) + 1, r = r.parentNode;
|
|
6821
6821
|
for (; r && e < r.childNodes.length; ) {
|
|
@@ -6827,7 +6827,7 @@ function ua(r, e) {
|
|
|
6827
6827
|
r = t, e = 0;
|
|
6828
6828
|
}
|
|
6829
6829
|
}
|
|
6830
|
-
function
|
|
6830
|
+
function fa(r, e) {
|
|
6831
6831
|
for (; r && !e && !Et(r); )
|
|
6832
6832
|
e = V(r), r = r.parentNode;
|
|
6833
6833
|
for (; r && e; ) {
|
|
@@ -6842,7 +6842,7 @@ function da(r, e) {
|
|
|
6842
6842
|
function Yn(r, e, t) {
|
|
6843
6843
|
if (e.nodeType != 3) {
|
|
6844
6844
|
let s, o;
|
|
6845
|
-
(o =
|
|
6845
|
+
(o = da(e, t)) ? (e = o, t = 0) : (s = fa(e, t)) && (e = s, t = s.nodeValue.length);
|
|
6846
6846
|
}
|
|
6847
6847
|
let n = r.domSelection();
|
|
6848
6848
|
if (!n)
|
|
@@ -6854,12 +6854,12 @@ function Yn(r, e, t) {
|
|
|
6854
6854
|
r.domObserver.setCurSelection();
|
|
6855
6855
|
let { state: i } = r;
|
|
6856
6856
|
setTimeout(() => {
|
|
6857
|
-
r.state == i &&
|
|
6857
|
+
r.state == i && ye(r);
|
|
6858
6858
|
}, 50);
|
|
6859
6859
|
}
|
|
6860
6860
|
function ui(r, e) {
|
|
6861
6861
|
let t = r.state.doc.resolve(e);
|
|
6862
|
-
if (!(J ||
|
|
6862
|
+
if (!(J || Rl) && t.parent.inlineContent) {
|
|
6863
6863
|
let i = r.coordsAtPos(e);
|
|
6864
6864
|
if (e > t.start()) {
|
|
6865
6865
|
let s = r.coordsAtPos(e - 1), o = (s.top + s.bottom) / 2;
|
|
@@ -6882,11 +6882,11 @@ function di(r, e, t) {
|
|
|
6882
6882
|
if (!i.parent.inlineContent || r.endOfTextblock(e < 0 ? "up" : "down")) {
|
|
6883
6883
|
let o = Gn(r.state, e);
|
|
6884
6884
|
if (o && o instanceof C)
|
|
6885
|
-
return
|
|
6885
|
+
return ke(r, o);
|
|
6886
6886
|
}
|
|
6887
6887
|
if (!i.parent.inlineContent) {
|
|
6888
6888
|
let o = e < 0 ? i : s, l = n instanceof Z ? O.near(o, e) : O.findFrom(o, e);
|
|
6889
|
-
return l ?
|
|
6889
|
+
return l ? ke(r, l) : !1;
|
|
6890
6890
|
}
|
|
6891
6891
|
return !1;
|
|
6892
6892
|
}
|
|
@@ -6910,8 +6910,8 @@ function fi(r, e) {
|
|
|
6910
6910
|
function hi(r, e, t) {
|
|
6911
6911
|
r.domObserver.stop(), e.contentEditable = t, r.domObserver.start();
|
|
6912
6912
|
}
|
|
6913
|
-
function
|
|
6914
|
-
if (!
|
|
6913
|
+
function ha(r) {
|
|
6914
|
+
if (!U || r.state.selection.$head.parentOffset > 0)
|
|
6915
6915
|
return !1;
|
|
6916
6916
|
let { focusNode: e, focusOffset: t } = r.domSelectionRange();
|
|
6917
6917
|
if (e && e.nodeType == 1 && t == 0 && e.firstChild && e.firstChild.contentEditable == "false") {
|
|
@@ -6920,12 +6920,12 @@ function fa(r) {
|
|
|
6920
6920
|
}
|
|
6921
6921
|
return !1;
|
|
6922
6922
|
}
|
|
6923
|
-
function
|
|
6923
|
+
function pa(r) {
|
|
6924
6924
|
let e = "";
|
|
6925
6925
|
return r.ctrlKey && (e += "c"), r.metaKey && (e += "m"), r.altKey && (e += "a"), r.shiftKey && (e += "s"), e;
|
|
6926
6926
|
}
|
|
6927
|
-
function
|
|
6928
|
-
let t = e.keyCode, n =
|
|
6927
|
+
function ma(r, e) {
|
|
6928
|
+
let t = e.keyCode, n = pa(e);
|
|
6929
6929
|
if (t == 8 || te && t == 72 && n == "c")
|
|
6930
6930
|
return fi(r, -1) || Ue(r, -1);
|
|
6931
6931
|
if (t == 46 && !e.shiftKey || te && t == 68 && n == "c")
|
|
@@ -6942,7 +6942,7 @@ function pa(r, e) {
|
|
|
6942
6942
|
if (t == 38 || te && t == 80 && n == "c")
|
|
6943
6943
|
return di(r, -1, n) || Ue(r, -1);
|
|
6944
6944
|
if (t == 40 || te && t == 78 && n == "c")
|
|
6945
|
-
return
|
|
6945
|
+
return ha(r) || di(r, 1, n) || Ue(r, 1);
|
|
6946
6946
|
if (n == (te ? "m" : "c") && (t == 66 || t == 73 || t == 89 || t == 90))
|
|
6947
6947
|
return !0;
|
|
6948
6948
|
}
|
|
@@ -7000,7 +7000,7 @@ function Fs(r, e, t, n, i) {
|
|
|
7000
7000
|
} else
|
|
7001
7001
|
r.someProp("transformPastedHTML", (d) => {
|
|
7002
7002
|
t = d(t, r);
|
|
7003
|
-
}), o =
|
|
7003
|
+
}), o = ka(t), Tt && xa(o);
|
|
7004
7004
|
let c = o && o.querySelector("[data-pm-slice]"), u = c && /^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice") || "");
|
|
7005
7005
|
if (u && u[3])
|
|
7006
7006
|
for (let d = +u[3]; d > 0; d--) {
|
|
@@ -7015,11 +7015,11 @@ function Fs(r, e, t, n, i) {
|
|
|
7015
7015
|
preserveWhitespace: !!(a || u),
|
|
7016
7016
|
context: i,
|
|
7017
7017
|
ruleFromNode(f) {
|
|
7018
|
-
return f.nodeName == "BR" && !f.nextSibling && f.parentNode && !
|
|
7018
|
+
return f.nodeName == "BR" && !f.nextSibling && f.parentNode && !ga.test(f.parentNode.nodeName) ? { ignore: !0 } : null;
|
|
7019
7019
|
}
|
|
7020
7020
|
})), u)
|
|
7021
|
-
l =
|
|
7022
|
-
else if (l = k.maxOpen(
|
|
7021
|
+
l = Sa(pi(l, +u[1], +u[2]), u[4]);
|
|
7022
|
+
else if (l = k.maxOpen(ya(l.content, i), !0), l.openStart || l.openEnd) {
|
|
7023
7023
|
let d = 0, f = 0;
|
|
7024
7024
|
for (let h = l.content.firstChild; d < l.openStart && !h.type.spec.isolating; d++, h = h.firstChild)
|
|
7025
7025
|
;
|
|
@@ -7031,8 +7031,8 @@ function Fs(r, e, t, n, i) {
|
|
|
7031
7031
|
l = d(l, r);
|
|
7032
7032
|
}), l;
|
|
7033
7033
|
}
|
|
7034
|
-
const
|
|
7035
|
-
function
|
|
7034
|
+
const ga = /^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;
|
|
7035
|
+
function ya(r, e) {
|
|
7036
7036
|
if (r.childCount < 2)
|
|
7037
7037
|
return r;
|
|
7038
7038
|
for (let t = e.depth; t >= 0; t--) {
|
|
@@ -7098,27 +7098,27 @@ function Hs() {
|
|
|
7098
7098
|
return mi || (mi = document.implementation.createHTMLDocument("title"));
|
|
7099
7099
|
}
|
|
7100
7100
|
let Tn = null;
|
|
7101
|
-
function
|
|
7101
|
+
function ba(r) {
|
|
7102
7102
|
let e = window.trustedTypes;
|
|
7103
7103
|
return e ? (Tn || (Tn = e.createPolicy("ProseMirrorClipboard", { createHTML: (t) => t })), Tn.createHTML(r)) : r;
|
|
7104
7104
|
}
|
|
7105
|
-
function
|
|
7105
|
+
function ka(r) {
|
|
7106
7106
|
let e = /^(\s*<meta [^>]*>)*/.exec(r);
|
|
7107
7107
|
e && (r = r.slice(e[0].length));
|
|
7108
7108
|
let t = Hs().createElement("div"), n = /<([a-z][^>\s]+)/i.exec(r), i;
|
|
7109
|
-
if ((i = n && js[n[1].toLowerCase()]) && (r = i.map((s) => "<" + s + ">").join("") + r + i.map((s) => "</" + s + ">").reverse().join("")), t.innerHTML =
|
|
7109
|
+
if ((i = n && js[n[1].toLowerCase()]) && (r = i.map((s) => "<" + s + ">").join("") + r + i.map((s) => "</" + s + ">").reverse().join("")), t.innerHTML = ba(r), i)
|
|
7110
7110
|
for (let s = 0; s < i.length; s++)
|
|
7111
7111
|
t = t.querySelector(i[s]) || t;
|
|
7112
7112
|
return t;
|
|
7113
7113
|
}
|
|
7114
|
-
function
|
|
7114
|
+
function xa(r) {
|
|
7115
7115
|
let e = r.querySelectorAll(J ? "span:not([class]):not([style])" : "span.Apple-converted-space");
|
|
7116
7116
|
for (let t = 0; t < e.length; t++) {
|
|
7117
7117
|
let n = e[t];
|
|
7118
7118
|
n.childNodes.length == 1 && n.textContent == " " && n.parentNode && n.parentNode.replaceChild(r.ownerDocument.createTextNode(" "), n);
|
|
7119
7119
|
}
|
|
7120
7120
|
}
|
|
7121
|
-
function
|
|
7121
|
+
function Sa(r, e) {
|
|
7122
7122
|
if (!r.size)
|
|
7123
7123
|
return r;
|
|
7124
7124
|
let t = r.content.firstChild.type.schema, n;
|
|
@@ -7136,25 +7136,25 @@ function xa(r, e) {
|
|
|
7136
7136
|
}
|
|
7137
7137
|
return new k(i, s, o);
|
|
7138
7138
|
}
|
|
7139
|
-
const
|
|
7140
|
-
class
|
|
7139
|
+
const _ = {}, G = {}, Ca = { touchstart: !0, touchmove: !0 };
|
|
7140
|
+
class wa {
|
|
7141
7141
|
constructor() {
|
|
7142
7142
|
this.shiftKey = !1, this.mouseDown = null, this.lastKeyCode = null, this.lastKeyCodeTime = 0, this.lastClick = { time: 0, x: 0, y: 0, type: "" }, this.lastSelectionOrigin = null, this.lastSelectionTime = 0, this.lastIOSEnter = 0, this.lastIOSEnterFallbackTimeout = -1, this.lastFocus = 0, this.lastTouch = 0, this.lastChromeDelete = 0, this.composing = !1, this.compositionNode = null, this.composingTimeout = -1, this.compositionNodes = [], this.compositionEndedAt = -2e8, this.compositionID = 1, this.compositionPendingChanges = 0, this.domChangeCount = 0, this.eventHandlers = /* @__PURE__ */ Object.create(null), this.hideSelectionGuard = null;
|
|
7143
7143
|
}
|
|
7144
7144
|
}
|
|
7145
|
-
function
|
|
7146
|
-
for (let e in
|
|
7147
|
-
let t =
|
|
7145
|
+
function Ma(r) {
|
|
7146
|
+
for (let e in _) {
|
|
7147
|
+
let t = _[e];
|
|
7148
7148
|
r.dom.addEventListener(e, r.input.eventHandlers[e] = (n) => {
|
|
7149
|
-
|
|
7150
|
-
},
|
|
7149
|
+
Ta(r, n) && !fr(r, n) && (r.editable || !(n.type in G)) && t(r, n);
|
|
7150
|
+
}, Ca[e] ? { passive: !0 } : void 0);
|
|
7151
7151
|
}
|
|
7152
|
-
|
|
7152
|
+
U && r.dom.addEventListener("input", () => null), Zn(r);
|
|
7153
7153
|
}
|
|
7154
|
-
function
|
|
7154
|
+
function Me(r, e) {
|
|
7155
7155
|
r.input.lastSelectionOrigin = e, r.input.lastSelectionTime = Date.now();
|
|
7156
7156
|
}
|
|
7157
|
-
function
|
|
7157
|
+
function Ea(r) {
|
|
7158
7158
|
r.domObserver.stop();
|
|
7159
7159
|
for (let e in r.input.eventHandlers)
|
|
7160
7160
|
r.dom.removeEventListener(e, r.input.eventHandlers[e]);
|
|
@@ -7172,7 +7172,7 @@ function fr(r, e) {
|
|
|
7172
7172
|
return n ? n(r, e) || e.defaultPrevented : !1;
|
|
7173
7173
|
});
|
|
7174
7174
|
}
|
|
7175
|
-
function
|
|
7175
|
+
function Ta(r, e) {
|
|
7176
7176
|
if (!e.bubbles)
|
|
7177
7177
|
return !0;
|
|
7178
7178
|
if (e.defaultPrevented)
|
|
@@ -7182,23 +7182,23 @@ function Ea(r, e) {
|
|
|
7182
7182
|
return !1;
|
|
7183
7183
|
return !0;
|
|
7184
7184
|
}
|
|
7185
|
-
function
|
|
7186
|
-
!fr(r, e) &&
|
|
7185
|
+
function Oa(r, e) {
|
|
7186
|
+
!fr(r, e) && _[e.type] && (r.editable || !(e.type in G)) && _[e.type](r, e);
|
|
7187
7187
|
}
|
|
7188
|
-
|
|
7188
|
+
G.keydown = (r, e) => {
|
|
7189
7189
|
let t = e;
|
|
7190
|
-
if (r.input.shiftKey = t.keyCode == 16 || t.shiftKey, !Js(r, t) && (r.input.lastKeyCode = t.keyCode, r.input.lastKeyCodeTime = Date.now(), !(
|
|
7190
|
+
if (r.input.shiftKey = t.keyCode == 16 || t.shiftKey, !Js(r, t) && (r.input.lastKeyCode = t.keyCode, r.input.lastKeyCodeTime = Date.now(), !(me && J && t.keyCode == 13)))
|
|
7191
7191
|
if (t.keyCode != 229 && r.domObserver.forceFlush(), rt && t.keyCode == 13 && !t.ctrlKey && !t.altKey && !t.metaKey) {
|
|
7192
7192
|
let n = Date.now();
|
|
7193
7193
|
r.input.lastIOSEnter = n, r.input.lastIOSEnterFallbackTimeout = setTimeout(() => {
|
|
7194
7194
|
r.input.lastIOSEnter == n && (r.someProp("handleKeyDown", (i) => i(r, De(13, "Enter"))), r.input.lastIOSEnter = 0);
|
|
7195
7195
|
}, 200);
|
|
7196
|
-
} else r.someProp("handleKeyDown", (n) => n(r, t)) ||
|
|
7196
|
+
} else r.someProp("handleKeyDown", (n) => n(r, t)) || ma(r, t) ? t.preventDefault() : Me(r, "key");
|
|
7197
7197
|
};
|
|
7198
|
-
|
|
7198
|
+
G.keyup = (r, e) => {
|
|
7199
7199
|
e.keyCode == 16 && (r.input.shiftKey = !1);
|
|
7200
7200
|
};
|
|
7201
|
-
|
|
7201
|
+
G.keypress = (r, e) => {
|
|
7202
7202
|
let t = e;
|
|
7203
7203
|
if (Js(r, t) || !t.charCode || t.ctrlKey && !t.altKey || te && t.metaKey)
|
|
7204
7204
|
return;
|
|
@@ -7215,7 +7215,7 @@ _.keypress = (r, e) => {
|
|
|
7215
7215
|
function an(r) {
|
|
7216
7216
|
return { left: r.clientX, top: r.clientY };
|
|
7217
7217
|
}
|
|
7218
|
-
function
|
|
7218
|
+
function Na(r, e) {
|
|
7219
7219
|
let t = e.x - r.clientX, n = e.y - r.clientY;
|
|
7220
7220
|
return t * t + n * n < 100;
|
|
7221
7221
|
}
|
|
@@ -7234,13 +7234,13 @@ function Qe(r, e, t) {
|
|
|
7234
7234
|
let n = r.state.tr.setSelection(e);
|
|
7235
7235
|
n.setMeta("pointer", !0), r.dispatch(n);
|
|
7236
7236
|
}
|
|
7237
|
-
function
|
|
7237
|
+
function Aa(r, e) {
|
|
7238
7238
|
if (e == -1)
|
|
7239
7239
|
return !1;
|
|
7240
7240
|
let t = r.state.doc.resolve(e), n = t.nodeAfter;
|
|
7241
7241
|
return n && n.isAtom && C.isSelectable(n) ? (Qe(r, new C(t)), !0) : !1;
|
|
7242
7242
|
}
|
|
7243
|
-
function
|
|
7243
|
+
function va(r, e) {
|
|
7244
7244
|
if (e == -1)
|
|
7245
7245
|
return !1;
|
|
7246
7246
|
let t = r.state.selection, n, i;
|
|
@@ -7255,16 +7255,16 @@ function Aa(r, e) {
|
|
|
7255
7255
|
}
|
|
7256
7256
|
return i != null ? (Qe(r, C.create(r.state.doc, i)), !0) : !1;
|
|
7257
7257
|
}
|
|
7258
|
-
function
|
|
7259
|
-
return hr(r, "handleClickOn", e, t, n) || r.someProp("handleClick", (s) => s(r, e, n)) || (i ?
|
|
7258
|
+
function Da(r, e, t, n, i) {
|
|
7259
|
+
return hr(r, "handleClickOn", e, t, n) || r.someProp("handleClick", (s) => s(r, e, n)) || (i ? va(r, t) : Aa(r, t));
|
|
7260
7260
|
}
|
|
7261
|
-
function
|
|
7261
|
+
function Ia(r, e, t, n) {
|
|
7262
7262
|
return hr(r, "handleDoubleClickOn", e, t, n) || r.someProp("handleDoubleClick", (i) => i(r, e, n));
|
|
7263
7263
|
}
|
|
7264
|
-
function
|
|
7265
|
-
return hr(r, "handleTripleClickOn", e, t, n) || r.someProp("handleTripleClick", (i) => i(r, e, n)) ||
|
|
7264
|
+
function Pa(r, e, t, n) {
|
|
7265
|
+
return hr(r, "handleTripleClickOn", e, t, n) || r.someProp("handleTripleClick", (i) => i(r, e, n)) || Ra(r, t, n);
|
|
7266
7266
|
}
|
|
7267
|
-
function
|
|
7267
|
+
function Ra(r, e, t) {
|
|
7268
7268
|
if (t.button != 0)
|
|
7269
7269
|
return !1;
|
|
7270
7270
|
let n = r.state.doc;
|
|
@@ -7286,15 +7286,15 @@ function pr(r) {
|
|
|
7286
7286
|
return _t(r);
|
|
7287
7287
|
}
|
|
7288
7288
|
const Ws = te ? "metaKey" : "ctrlKey";
|
|
7289
|
-
|
|
7289
|
+
_.mousedown = (r, e) => {
|
|
7290
7290
|
let t = e;
|
|
7291
7291
|
r.input.shiftKey = t.shiftKey;
|
|
7292
7292
|
let n = pr(r), i = Date.now(), s = "singleClick";
|
|
7293
|
-
i - r.input.lastClick.time < 500 &&
|
|
7293
|
+
i - r.input.lastClick.time < 500 && Na(t, r.input.lastClick) && !t[Ws] && (r.input.lastClick.type == "singleClick" ? s = "doubleClick" : r.input.lastClick.type == "doubleClick" && (s = "tripleClick")), r.input.lastClick = { time: i, x: t.clientX, y: t.clientY, type: s };
|
|
7294
7294
|
let o = r.posAtCoords(an(t));
|
|
7295
|
-
o && (s == "singleClick" ? (r.input.mouseDown && r.input.mouseDown.done(), r.input.mouseDown = new
|
|
7295
|
+
o && (s == "singleClick" ? (r.input.mouseDown && r.input.mouseDown.done(), r.input.mouseDown = new Ba(r, o, t, !!n)) : (s == "doubleClick" ? Ia : Pa)(r, o.pos, o.inside, t) ? t.preventDefault() : Me(r, "pointer"));
|
|
7296
7296
|
};
|
|
7297
|
-
class
|
|
7297
|
+
class Ba {
|
|
7298
7298
|
constructor(e, t, n, i) {
|
|
7299
7299
|
this.view = e, this.pos = t, this.event = n, this.flushed = i, this.delayedSelectionSync = !1, this.mightDrag = null, this.startDoc = e.state.doc, this.selectNode = !!n[Ws], this.allowDefault = n.shiftKey;
|
|
7300
7300
|
let s, o;
|
|
@@ -7314,44 +7314,44 @@ class Ra {
|
|
|
7314
7314
|
setUneditable: !!(this.target && oe && !this.target.hasAttribute("contentEditable"))
|
|
7315
7315
|
}), this.target && this.mightDrag && (this.mightDrag.addAttr || this.mightDrag.setUneditable) && (this.view.domObserver.stop(), this.mightDrag.addAttr && (this.target.draggable = !0), this.mightDrag.setUneditable && setTimeout(() => {
|
|
7316
7316
|
this.view.input.mouseDown == this && this.target.setAttribute("contentEditable", "false");
|
|
7317
|
-
}, 20), this.view.domObserver.start()), e.root.addEventListener("mouseup", this.up = this.up.bind(this)), e.root.addEventListener("mousemove", this.move = this.move.bind(this)),
|
|
7317
|
+
}, 20), this.view.domObserver.start()), e.root.addEventListener("mouseup", this.up = this.up.bind(this)), e.root.addEventListener("mousemove", this.move = this.move.bind(this)), Me(e, "pointer");
|
|
7318
7318
|
}
|
|
7319
7319
|
done() {
|
|
7320
|
-
this.view.root.removeEventListener("mouseup", this.up), this.view.root.removeEventListener("mousemove", this.move), this.mightDrag && this.target && (this.view.domObserver.stop(), this.mightDrag.addAttr && this.target.removeAttribute("draggable"), this.mightDrag.setUneditable && this.target.removeAttribute("contentEditable"), this.view.domObserver.start()), this.delayedSelectionSync && setTimeout(() =>
|
|
7320
|
+
this.view.root.removeEventListener("mouseup", this.up), this.view.root.removeEventListener("mousemove", this.move), this.mightDrag && this.target && (this.view.domObserver.stop(), this.mightDrag.addAttr && this.target.removeAttribute("draggable"), this.mightDrag.setUneditable && this.target.removeAttribute("contentEditable"), this.view.domObserver.start()), this.delayedSelectionSync && setTimeout(() => ye(this.view)), this.view.input.mouseDown = null;
|
|
7321
7321
|
}
|
|
7322
7322
|
up(e) {
|
|
7323
7323
|
if (this.done(), !this.view.dom.contains(e.target))
|
|
7324
7324
|
return;
|
|
7325
7325
|
let t = this.pos;
|
|
7326
|
-
this.view.state.doc != this.startDoc && (t = this.view.posAtCoords(an(e))), this.updateAllowDefault(e), this.allowDefault || !t ?
|
|
7327
|
-
|
|
7326
|
+
this.view.state.doc != this.startDoc && (t = this.view.posAtCoords(an(e))), this.updateAllowDefault(e), this.allowDefault || !t ? Me(this.view, "pointer") : Da(this.view, t.pos, t.inside, e, this.selectNode) ? e.preventDefault() : e.button == 0 && (this.flushed || // Safari ignores clicks on draggable elements
|
|
7327
|
+
U && this.mightDrag && !this.mightDrag.node.isAtom || // Chrome will sometimes treat a node selection as a
|
|
7328
7328
|
// cursor, but still report that the node is selected
|
|
7329
7329
|
// when asked through getSelection. You'll then get a
|
|
7330
7330
|
// situation where clicking at the point where that
|
|
7331
7331
|
// (hidden) cursor is doesn't change the selection, and
|
|
7332
7332
|
// thus doesn't get a reaction from ProseMirror. This
|
|
7333
7333
|
// works around that.
|
|
7334
|
-
J && !this.view.state.selection.visible && Math.min(Math.abs(t.pos - this.view.state.selection.from), Math.abs(t.pos - this.view.state.selection.to)) <= 2) ? (Qe(this.view, O.near(this.view.state.doc.resolve(t.pos))), e.preventDefault()) :
|
|
7334
|
+
J && !this.view.state.selection.visible && Math.min(Math.abs(t.pos - this.view.state.selection.from), Math.abs(t.pos - this.view.state.selection.to)) <= 2) ? (Qe(this.view, O.near(this.view.state.doc.resolve(t.pos))), e.preventDefault()) : Me(this.view, "pointer");
|
|
7335
7335
|
}
|
|
7336
7336
|
move(e) {
|
|
7337
|
-
this.updateAllowDefault(e),
|
|
7337
|
+
this.updateAllowDefault(e), Me(this.view, "pointer"), e.buttons == 0 && this.done();
|
|
7338
7338
|
}
|
|
7339
7339
|
updateAllowDefault(e) {
|
|
7340
7340
|
!this.allowDefault && (Math.abs(this.event.x - e.clientX) > 4 || Math.abs(this.event.y - e.clientY) > 4) && (this.allowDefault = !0);
|
|
7341
7341
|
}
|
|
7342
7342
|
}
|
|
7343
|
-
|
|
7344
|
-
r.input.lastTouch = Date.now(), pr(r),
|
|
7343
|
+
_.touchstart = (r) => {
|
|
7344
|
+
r.input.lastTouch = Date.now(), pr(r), Me(r, "pointer");
|
|
7345
7345
|
};
|
|
7346
|
-
|
|
7347
|
-
r.input.lastTouch = Date.now(),
|
|
7346
|
+
_.touchmove = (r) => {
|
|
7347
|
+
r.input.lastTouch = Date.now(), Me(r, "pointer");
|
|
7348
7348
|
};
|
|
7349
|
-
|
|
7349
|
+
_.contextmenu = (r) => pr(r);
|
|
7350
7350
|
function Js(r, e) {
|
|
7351
|
-
return r.composing ? !0 :
|
|
7351
|
+
return r.composing ? !0 : U && Math.abs(e.timeStamp - r.input.compositionEndedAt) < 500 ? (r.input.compositionEndedAt = -2e8, !0) : !1;
|
|
7352
7352
|
}
|
|
7353
|
-
const
|
|
7354
|
-
|
|
7353
|
+
const za = me ? 5e3 : -1;
|
|
7354
|
+
G.compositionstart = G.compositionupdate = (r) => {
|
|
7355
7355
|
if (!r.composing) {
|
|
7356
7356
|
r.domObserver.flush();
|
|
7357
7357
|
let { state: e } = r, t = e.selection.$to;
|
|
@@ -7373,23 +7373,23 @@ _.compositionstart = _.compositionupdate = (r) => {
|
|
|
7373
7373
|
}
|
|
7374
7374
|
r.input.composing = !0;
|
|
7375
7375
|
}
|
|
7376
|
-
qs(r,
|
|
7376
|
+
qs(r, za);
|
|
7377
7377
|
};
|
|
7378
|
-
|
|
7378
|
+
G.compositionend = (r, e) => {
|
|
7379
7379
|
r.composing && (r.input.composing = !1, r.input.compositionEndedAt = e.timeStamp, r.input.compositionPendingChanges = r.domObserver.pendingRecords().length ? r.input.compositionID : 0, r.input.compositionNode = null, r.input.compositionPendingChanges && Promise.resolve().then(() => r.domObserver.flush()), r.input.compositionID++, qs(r, 20));
|
|
7380
7380
|
};
|
|
7381
7381
|
function qs(r, e) {
|
|
7382
7382
|
clearTimeout(r.input.composingTimeout), e > -1 && (r.input.composingTimeout = setTimeout(() => _t(r), e));
|
|
7383
7383
|
}
|
|
7384
7384
|
function Ks(r) {
|
|
7385
|
-
for (r.composing && (r.input.composing = !1, r.input.compositionEndedAt =
|
|
7385
|
+
for (r.composing && (r.input.composing = !1, r.input.compositionEndedAt = La()); r.input.compositionNodes.length > 0; )
|
|
7386
7386
|
r.input.compositionNodes.pop().markParentsDirty();
|
|
7387
7387
|
}
|
|
7388
|
-
function
|
|
7388
|
+
function Fa(r) {
|
|
7389
7389
|
let e = r.domSelectionRange();
|
|
7390
7390
|
if (!e.focusNode)
|
|
7391
7391
|
return null;
|
|
7392
|
-
let t =
|
|
7392
|
+
let t = Al(e.focusNode, e.focusOffset), n = vl(e.focusNode, e.focusOffset);
|
|
7393
7393
|
if (t && n && t != n) {
|
|
7394
7394
|
let i = n.pmViewDesc, s = r.domObserver.lastChangedTextNode;
|
|
7395
7395
|
if (t == s || n == s)
|
|
@@ -7404,12 +7404,12 @@ function za(r) {
|
|
|
7404
7404
|
}
|
|
7405
7405
|
return t || n;
|
|
7406
7406
|
}
|
|
7407
|
-
function
|
|
7407
|
+
function La() {
|
|
7408
7408
|
let r = document.createEvent("Event");
|
|
7409
7409
|
return r.initEvent("event", !0, !0), r.timeStamp;
|
|
7410
7410
|
}
|
|
7411
7411
|
function _t(r, e = !1) {
|
|
7412
|
-
if (!(
|
|
7412
|
+
if (!(me && r.domObserver.flushingSoon >= 0)) {
|
|
7413
7413
|
if (r.domObserver.forceFlush(), Ks(r), e || r.docView && r.docView.dirty) {
|
|
7414
7414
|
let t = cr(r);
|
|
7415
7415
|
return t && !t.eq(r.state.selection) ? r.dispatch(r.state.tr.setSelection(t)) : (r.markCursor || e) && !r.state.selection.empty ? r.dispatch(r.state.tr.deleteSelection()) : r.updateState(r.state), !0;
|
|
@@ -7417,7 +7417,7 @@ function _t(r, e = !1) {
|
|
|
7417
7417
|
return !1;
|
|
7418
7418
|
}
|
|
7419
7419
|
}
|
|
7420
|
-
function
|
|
7420
|
+
function $a(r, e) {
|
|
7421
7421
|
if (!r.dom.parentNode)
|
|
7422
7422
|
return;
|
|
7423
7423
|
let t = r.dom.parentNode.appendChild(document.createElement("div"));
|
|
@@ -7427,18 +7427,18 @@ function La(r, e) {
|
|
|
7427
7427
|
t.parentNode && t.parentNode.removeChild(t), r.focus();
|
|
7428
7428
|
}, 50);
|
|
7429
7429
|
}
|
|
7430
|
-
const kt =
|
|
7431
|
-
|
|
7430
|
+
const kt = Y && Ee < 15 || rt && Bl < 604;
|
|
7431
|
+
_.copy = G.cut = (r, e) => {
|
|
7432
7432
|
let t = e, n = r.state.selection, i = t.type == "cut";
|
|
7433
7433
|
if (n.empty)
|
|
7434
7434
|
return;
|
|
7435
7435
|
let s = kt ? null : t.clipboardData, o = n.content(), { dom: l, text: a } = dr(r, o);
|
|
7436
|
-
s ? (t.preventDefault(), s.clearData(), s.setData("text/html", l.innerHTML), s.setData("text/plain", a)) :
|
|
7436
|
+
s ? (t.preventDefault(), s.clearData(), s.setData("text/html", l.innerHTML), s.setData("text/plain", a)) : $a(r, l), i && r.dispatch(r.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent", "cut"));
|
|
7437
7437
|
};
|
|
7438
|
-
function
|
|
7438
|
+
function Va(r) {
|
|
7439
7439
|
return r.openStart == 0 && r.openEnd == 0 && r.content.childCount == 1 ? r.content.firstChild : null;
|
|
7440
7440
|
}
|
|
7441
|
-
function
|
|
7441
|
+
function ja(r, e) {
|
|
7442
7442
|
if (!r.dom.parentNode)
|
|
7443
7443
|
return;
|
|
7444
7444
|
let t = r.input.shiftKey || r.state.selection.$from.parent.type.spec.code, n = r.dom.parentNode.appendChild(document.createElement(t ? "textarea" : "div"));
|
|
@@ -7454,7 +7454,7 @@ function xt(r, e, t, n, i) {
|
|
|
7454
7454
|
return !0;
|
|
7455
7455
|
if (!s)
|
|
7456
7456
|
return !1;
|
|
7457
|
-
let o =
|
|
7457
|
+
let o = Va(s), l = o ? r.state.tr.replaceSelectionWith(o, n) : r.state.tr.replaceSelection(s);
|
|
7458
7458
|
return r.dispatch(l.scrollIntoView().setMeta("paste", !0).setMeta("uiEvent", "paste")), !0;
|
|
7459
7459
|
}
|
|
7460
7460
|
function Us(r) {
|
|
@@ -7464,24 +7464,24 @@ function Us(r) {
|
|
|
7464
7464
|
let t = r.getData("text/uri-list");
|
|
7465
7465
|
return t ? t.replace(/\r?\n/g, " ") : "";
|
|
7466
7466
|
}
|
|
7467
|
-
|
|
7467
|
+
G.paste = (r, e) => {
|
|
7468
7468
|
let t = e;
|
|
7469
|
-
if (r.composing && !
|
|
7469
|
+
if (r.composing && !me)
|
|
7470
7470
|
return;
|
|
7471
7471
|
let n = kt ? null : t.clipboardData, i = r.input.shiftKey && r.input.lastKeyCode != 45;
|
|
7472
|
-
n && xt(r, Us(n), n.getData("text/html"), i, t) ? t.preventDefault() :
|
|
7472
|
+
n && xt(r, Us(n), n.getData("text/html"), i, t) ? t.preventDefault() : ja(r, t);
|
|
7473
7473
|
};
|
|
7474
7474
|
class _s {
|
|
7475
7475
|
constructor(e, t, n) {
|
|
7476
7476
|
this.slice = e, this.move = t, this.node = n;
|
|
7477
7477
|
}
|
|
7478
7478
|
}
|
|
7479
|
-
const
|
|
7479
|
+
const Ha = te ? "altKey" : "ctrlKey";
|
|
7480
7480
|
function Gs(r, e) {
|
|
7481
7481
|
let t = r.someProp("dragCopies", (n) => !n(e));
|
|
7482
|
-
return t ?? !e[
|
|
7482
|
+
return t ?? !e[Ha];
|
|
7483
7483
|
}
|
|
7484
|
-
|
|
7484
|
+
_.dragstart = (r, e) => {
|
|
7485
7485
|
let t = e, n = r.input.mouseDown;
|
|
7486
7486
|
if (n && n.done(), !t.dataTransfer)
|
|
7487
7487
|
return;
|
|
@@ -7497,14 +7497,14 @@ U.dragstart = (r, e) => {
|
|
|
7497
7497
|
let l = (o || r.state.selection).content(), { dom: a, text: c, slice: u } = dr(r, l);
|
|
7498
7498
|
(!t.dataTransfer.files.length || !J || Ss > 120) && t.dataTransfer.clearData(), t.dataTransfer.setData(kt ? "Text" : "text/html", a.innerHTML), t.dataTransfer.effectAllowed = "copyMove", kt || t.dataTransfer.setData("text/plain", c), r.dragging = new _s(u, Gs(r, t), o);
|
|
7499
7499
|
};
|
|
7500
|
-
|
|
7500
|
+
_.dragend = (r) => {
|
|
7501
7501
|
let e = r.dragging;
|
|
7502
7502
|
window.setTimeout(() => {
|
|
7503
7503
|
r.dragging == e && (r.dragging = null);
|
|
7504
7504
|
}, 50);
|
|
7505
7505
|
};
|
|
7506
|
-
|
|
7507
|
-
|
|
7506
|
+
G.dragover = G.dragenter = (r, e) => e.preventDefault();
|
|
7507
|
+
G.drop = (r, e) => {
|
|
7508
7508
|
let t = e, n = r.dragging;
|
|
7509
7509
|
if (r.dragging = null, !t.dataTransfer)
|
|
7510
7510
|
return;
|
|
@@ -7523,7 +7523,7 @@ _.drop = (r, e) => {
|
|
|
7523
7523
|
if (!o)
|
|
7524
7524
|
return;
|
|
7525
7525
|
t.preventDefault();
|
|
7526
|
-
let a = o ?
|
|
7526
|
+
let a = o ? ml(r.state.doc, s.pos, o) : s.pos;
|
|
7527
7527
|
a == null && (a = s.pos);
|
|
7528
7528
|
let c = r.state.tr;
|
|
7529
7529
|
if (l) {
|
|
@@ -7542,17 +7542,17 @@ _.drop = (r, e) => {
|
|
|
7542
7542
|
}
|
|
7543
7543
|
r.focus(), r.dispatch(c.setMeta("uiEvent", "drop"));
|
|
7544
7544
|
};
|
|
7545
|
-
|
|
7545
|
+
_.focus = (r) => {
|
|
7546
7546
|
r.input.lastFocus = Date.now(), r.focused || (r.domObserver.stop(), r.dom.classList.add("ProseMirror-focused"), r.domObserver.start(), r.focused = !0, setTimeout(() => {
|
|
7547
|
-
r.docView && r.hasFocus() && !r.domObserver.currentSelection.eq(r.domSelectionRange()) &&
|
|
7547
|
+
r.docView && r.hasFocus() && !r.domObserver.currentSelection.eq(r.domSelectionRange()) && ye(r);
|
|
7548
7548
|
}, 20));
|
|
7549
7549
|
};
|
|
7550
|
-
|
|
7550
|
+
_.blur = (r, e) => {
|
|
7551
7551
|
let t = e;
|
|
7552
7552
|
r.focused && (r.domObserver.stop(), r.dom.classList.remove("ProseMirror-focused"), r.domObserver.start(), t.relatedTarget && r.dom.contains(t.relatedTarget) && r.domObserver.currentSelection.clear(), r.focused = !1);
|
|
7553
7553
|
};
|
|
7554
|
-
|
|
7555
|
-
if (J &&
|
|
7554
|
+
_.beforeinput = (r, e) => {
|
|
7555
|
+
if (J && me && e.inputType == "deleteContentBackward") {
|
|
7556
7556
|
r.domObserver.flushSoon();
|
|
7557
7557
|
let { domChangeCount: n } = r.input;
|
|
7558
7558
|
setTimeout(() => {
|
|
@@ -7563,8 +7563,8 @@ U.beforeinput = (r, e) => {
|
|
|
7563
7563
|
}, 50);
|
|
7564
7564
|
}
|
|
7565
7565
|
};
|
|
7566
|
-
for (let r in
|
|
7567
|
-
|
|
7566
|
+
for (let r in G)
|
|
7567
|
+
_[r] = G[r];
|
|
7568
7568
|
function St(r, e) {
|
|
7569
7569
|
if (r == e)
|
|
7570
7570
|
return !0;
|
|
@@ -7761,7 +7761,7 @@ class B {
|
|
|
7761
7761
|
let a = this.local[l].map(e, n, i);
|
|
7762
7762
|
a && a.type.valid(t, a) ? (o || (o = [])).push(a) : s.onRemove && s.onRemove(this.local[l].spec);
|
|
7763
7763
|
}
|
|
7764
|
-
return this.children.length ?
|
|
7764
|
+
return this.children.length ? Wa(this.children, o || [], e, t, n, i, s) : o ? new B(o.sort($e), Ge) : W;
|
|
7765
7765
|
}
|
|
7766
7766
|
/**
|
|
7767
7767
|
Add the given array of decorations to the ones in the set,
|
|
@@ -7835,7 +7835,7 @@ class B {
|
|
|
7835
7835
|
}
|
|
7836
7836
|
if (i) {
|
|
7837
7837
|
let l = new B(i.sort($e), Ge);
|
|
7838
|
-
return n ? new
|
|
7838
|
+
return n ? new Se([l, n]) : l;
|
|
7839
7839
|
}
|
|
7840
7840
|
return n || W;
|
|
7841
7841
|
}
|
|
@@ -7881,13 +7881,13 @@ class B {
|
|
|
7881
7881
|
B.empty = new B([], []);
|
|
7882
7882
|
B.removeOverlap = gr;
|
|
7883
7883
|
const W = B.empty;
|
|
7884
|
-
class
|
|
7884
|
+
class Se {
|
|
7885
7885
|
constructor(e) {
|
|
7886
7886
|
this.members = e;
|
|
7887
7887
|
}
|
|
7888
7888
|
map(e, t) {
|
|
7889
7889
|
const n = this.members.map((i) => i.map(e, t, Le));
|
|
7890
|
-
return
|
|
7890
|
+
return Se.from(n);
|
|
7891
7891
|
}
|
|
7892
7892
|
forChild(e, t) {
|
|
7893
7893
|
if (t.isLeaf)
|
|
@@ -7895,12 +7895,12 @@ class xe {
|
|
|
7895
7895
|
let n = [];
|
|
7896
7896
|
for (let i = 0; i < this.members.length; i++) {
|
|
7897
7897
|
let s = this.members[i].forChild(e, t);
|
|
7898
|
-
s != W && (s instanceof
|
|
7898
|
+
s != W && (s instanceof Se ? n = n.concat(s.members) : n.push(s));
|
|
7899
7899
|
}
|
|
7900
|
-
return
|
|
7900
|
+
return Se.from(n);
|
|
7901
7901
|
}
|
|
7902
7902
|
eq(e) {
|
|
7903
|
-
if (!(e instanceof
|
|
7903
|
+
if (!(e instanceof Se) || e.members.length != this.members.length)
|
|
7904
7904
|
return !1;
|
|
7905
7905
|
for (let t = 0; t < this.members.length; t++)
|
|
7906
7906
|
if (!this.members[t].eq(e.members[t]))
|
|
@@ -7931,7 +7931,7 @@ class xe {
|
|
|
7931
7931
|
case 1:
|
|
7932
7932
|
return e[0];
|
|
7933
7933
|
default:
|
|
7934
|
-
return new
|
|
7934
|
+
return new Se(e.every((t) => t instanceof B) ? e : e.reduce((t, n) => t.concat(n instanceof B ? n : n.members), []));
|
|
7935
7935
|
}
|
|
7936
7936
|
}
|
|
7937
7937
|
forEachSet(e) {
|
|
@@ -7939,7 +7939,7 @@ class xe {
|
|
|
7939
7939
|
this.members[t].forEachSet(e);
|
|
7940
7940
|
}
|
|
7941
7941
|
}
|
|
7942
|
-
function
|
|
7942
|
+
function Wa(r, e, t, n, i, s, o) {
|
|
7943
7943
|
let l = r.slice();
|
|
7944
7944
|
for (let c = 0, u = s; c < t.maps.length; c++) {
|
|
7945
7945
|
let d = 0;
|
|
@@ -7975,7 +7975,7 @@ function Ha(r, e, t, n, i, s, o) {
|
|
|
7975
7975
|
a = !0;
|
|
7976
7976
|
}
|
|
7977
7977
|
if (a) {
|
|
7978
|
-
let c =
|
|
7978
|
+
let c = Ja(l, r, e, t, i, s, o), u = Yt(c, n, 0, o);
|
|
7979
7979
|
e = u.local;
|
|
7980
7980
|
for (let d = 0; d < l.length; d += 3)
|
|
7981
7981
|
l[d + 1] < 0 && (l.splice(d, 3), d -= 3);
|
|
@@ -7998,7 +7998,7 @@ function Ys(r, e) {
|
|
|
7998
7998
|
}
|
|
7999
7999
|
return t;
|
|
8000
8000
|
}
|
|
8001
|
-
function
|
|
8001
|
+
function Ja(r, e, t, n, i, s, o) {
|
|
8002
8002
|
function l(a, c) {
|
|
8003
8003
|
for (let u = 0; u < a.local.length; u++) {
|
|
8004
8004
|
let d = a.local[u].map(n, i, c);
|
|
@@ -8071,17 +8071,17 @@ function On(r) {
|
|
|
8071
8071
|
return r.someProp("decorations", (t) => {
|
|
8072
8072
|
let n = t(r.state);
|
|
8073
8073
|
n && n != W && e.push(n);
|
|
8074
|
-
}), r.cursorWrapper && e.push(B.create(r.state.doc, [r.cursorWrapper.deco])),
|
|
8074
|
+
}), r.cursorWrapper && e.push(B.create(r.state.doc, [r.cursorWrapper.deco])), Se.from(e);
|
|
8075
8075
|
}
|
|
8076
|
-
const
|
|
8076
|
+
const qa = {
|
|
8077
8077
|
childList: !0,
|
|
8078
8078
|
characterData: !0,
|
|
8079
8079
|
characterDataOldValue: !0,
|
|
8080
8080
|
attributes: !0,
|
|
8081
8081
|
attributeOldValue: !0,
|
|
8082
8082
|
subtree: !0
|
|
8083
|
-
},
|
|
8084
|
-
class
|
|
8083
|
+
}, Ka = Y && Ee <= 11;
|
|
8084
|
+
class Ua {
|
|
8085
8085
|
constructor() {
|
|
8086
8086
|
this.anchorNode = null, this.anchorOffset = 0, this.focusNode = null, this.focusOffset = 0;
|
|
8087
8087
|
}
|
|
@@ -8095,13 +8095,13 @@ class Ka {
|
|
|
8095
8095
|
return e.anchorNode == this.anchorNode && e.anchorOffset == this.anchorOffset && e.focusNode == this.focusNode && e.focusOffset == this.focusOffset;
|
|
8096
8096
|
}
|
|
8097
8097
|
}
|
|
8098
|
-
class
|
|
8098
|
+
class _a {
|
|
8099
8099
|
constructor(e, t) {
|
|
8100
|
-
this.view = e, this.handleDOMChange = t, this.queue = [], this.flushingSoon = -1, this.observer = null, this.currentSelection = new
|
|
8100
|
+
this.view = e, this.handleDOMChange = t, this.queue = [], this.flushingSoon = -1, this.observer = null, this.currentSelection = new Ua(), this.onCharData = null, this.suppressingSelectionUpdates = !1, this.lastChangedTextNode = null, this.observer = window.MutationObserver && new window.MutationObserver((n) => {
|
|
8101
8101
|
for (let i = 0; i < n.length; i++)
|
|
8102
8102
|
this.queue.push(n[i]);
|
|
8103
|
-
|
|
8104
|
-
}),
|
|
8103
|
+
Y && Ee <= 11 && n.some((i) => i.type == "childList" && i.removedNodes.length || i.type == "characterData" && i.oldValue.length > i.target.nodeValue.length) ? this.flushSoon() : this.flush();
|
|
8104
|
+
}), Ka && (this.onCharData = (n) => {
|
|
8105
8105
|
this.queue.push({ target: n.target, type: "characterData", oldValue: n.prevValue }), this.flushSoon();
|
|
8106
8106
|
}), this.onSelectionChange = this.onSelectionChange.bind(this);
|
|
8107
8107
|
}
|
|
@@ -8114,7 +8114,7 @@ class Ua {
|
|
|
8114
8114
|
this.flushingSoon > -1 && (window.clearTimeout(this.flushingSoon), this.flushingSoon = -1, this.flush());
|
|
8115
8115
|
}
|
|
8116
8116
|
start() {
|
|
8117
|
-
this.observer && (this.observer.takeRecords(), this.observer.observe(this.view.dom,
|
|
8117
|
+
this.observer && (this.observer.takeRecords(), this.observer.observe(this.view.dom, qa)), this.onCharData && this.view.dom.addEventListener("DOMCharacterDataModified", this.onCharData), this.connectSelection();
|
|
8118
8118
|
}
|
|
8119
8119
|
stop() {
|
|
8120
8120
|
if (this.observer) {
|
|
@@ -8140,8 +8140,8 @@ class Ua {
|
|
|
8140
8140
|
onSelectionChange() {
|
|
8141
8141
|
if (ai(this.view)) {
|
|
8142
8142
|
if (this.suppressingSelectionUpdates)
|
|
8143
|
-
return
|
|
8144
|
-
if (
|
|
8143
|
+
return ye(this.view);
|
|
8144
|
+
if (Y && Ee <= 11 && !this.view.state.selection.empty) {
|
|
8145
8145
|
let e = this.view.domSelectionRange();
|
|
8146
8146
|
if (e.focusNode && He(e.focusNode, e.focusOffset, e.anchorNode, e.anchorOffset))
|
|
8147
8147
|
return this.flushSoon();
|
|
@@ -8197,12 +8197,12 @@ class Ua {
|
|
|
8197
8197
|
let { focusNode: d } = this.currentSelection;
|
|
8198
8198
|
for (let f of u) {
|
|
8199
8199
|
let h = f.parentNode;
|
|
8200
|
-
h && h.nodeName == "LI" && (!d ||
|
|
8200
|
+
h && h.nodeName == "LI" && (!d || Xa(e, d) != h) && f.remove();
|
|
8201
8201
|
}
|
|
8202
8202
|
}
|
|
8203
8203
|
}
|
|
8204
8204
|
let c = null;
|
|
8205
|
-
s < 0 && i && e.input.lastFocus > Date.now() - 200 && Math.max(e.input.lastTouch, e.input.lastClick.time) < Date.now() - 300 && on(n) && (c = cr(e)) && c.eq(O.near(e.state.doc.resolve(0), 1)) ? (e.input.lastFocus = 0,
|
|
8205
|
+
s < 0 && i && e.input.lastFocus > Date.now() - 200 && Math.max(e.input.lastTouch, e.input.lastClick.time) < Date.now() - 300 && on(n) && (c = cr(e)) && c.eq(O.near(e.state.doc.resolve(0), 1)) ? (e.input.lastFocus = 0, ye(e), this.currentSelection.set(n), e.scrollToSelection()) : (s > -1 || i) && (s > -1 && (e.docView.markDirty(s, o), Ga(e)), this.handleDOMChange(s, o, l, a), e.docView && e.docView.dirty ? e.updateState(e.state) : this.currentSelection.eq(n) || ye(e), this.currentSelection.set(n));
|
|
8206
8206
|
}
|
|
8207
8207
|
registerMutation(e, t) {
|
|
8208
8208
|
if (t.indexOf(e.target) > -1)
|
|
@@ -8219,7 +8219,7 @@ class Ua {
|
|
|
8219
8219
|
if (n.contentDOM && n.contentDOM != n.dom && !n.contentDOM.contains(e.target))
|
|
8220
8220
|
return { from: n.posBefore, to: n.posAfter };
|
|
8221
8221
|
let i = e.previousSibling, s = e.nextSibling;
|
|
8222
|
-
if (
|
|
8222
|
+
if (Y && Ee <= 11 && e.addedNodes.length)
|
|
8223
8223
|
for (let u = 0; u < e.addedNodes.length; u++) {
|
|
8224
8224
|
let { previousSibling: d, nextSibling: f } = e.addedNodes[u];
|
|
8225
8225
|
(!d || Array.prototype.indexOf.call(e.addedNodes, d) < 0) && (i = d), (!f || Array.prototype.indexOf.call(e.addedNodes, f) < 0) && (s = f);
|
|
@@ -8238,7 +8238,7 @@ class Ua {
|
|
|
8238
8238
|
}
|
|
8239
8239
|
}
|
|
8240
8240
|
let yi = /* @__PURE__ */ new WeakMap(), bi = !1;
|
|
8241
|
-
function
|
|
8241
|
+
function Ga(r) {
|
|
8242
8242
|
if (!yi.has(r) && (yi.set(r, null), ["normal", "nowrap", "pre-line"].indexOf(getComputedStyle(r.dom).whiteSpace) !== -1)) {
|
|
8243
8243
|
if (r.requiresGeckoHackNode = oe, bi)
|
|
8244
8244
|
return;
|
|
@@ -8249,7 +8249,7 @@ function ki(r, e) {
|
|
|
8249
8249
|
let t = e.startContainer, n = e.startOffset, i = e.endContainer, s = e.endOffset, o = r.domAtPos(r.state.selection.anchor);
|
|
8250
8250
|
return He(o.node, o.offset, i, s) && ([t, n, i, s] = [i, s, t, n]), { anchorNode: t, anchorOffset: n, focusNode: i, focusOffset: s };
|
|
8251
8251
|
}
|
|
8252
|
-
function
|
|
8252
|
+
function Ya(r, e) {
|
|
8253
8253
|
if (e.getComposedRanges) {
|
|
8254
8254
|
let i = e.getComposedRanges(r.root)[0];
|
|
8255
8255
|
if (i)
|
|
@@ -8261,7 +8261,7 @@ function Ga(r, e) {
|
|
|
8261
8261
|
}
|
|
8262
8262
|
return r.dom.addEventListener("beforeinput", n, !0), document.execCommand("indent"), r.dom.removeEventListener("beforeinput", n, !0), t ? ki(r, t) : null;
|
|
8263
8263
|
}
|
|
8264
|
-
function
|
|
8264
|
+
function Xa(r, e) {
|
|
8265
8265
|
for (let t = e.parentNode; t && t != r.dom; t = t.parentNode) {
|
|
8266
8266
|
let n = r.docView.nearestDesc(t, !0);
|
|
8267
8267
|
if (n && n.node.isBlock)
|
|
@@ -8269,7 +8269,7 @@ function Ya(r, e) {
|
|
|
8269
8269
|
}
|
|
8270
8270
|
return null;
|
|
8271
8271
|
}
|
|
8272
|
-
function
|
|
8272
|
+
function Za(r, e, t) {
|
|
8273
8273
|
let { node: n, fromOffset: i, toOffset: s, from: o, to: l } = r.docView.parseRange(e, t), a = r.domSelectionRange(), c, u = a.anchorNode;
|
|
8274
8274
|
if (u && r.dom.contains(u.nodeType == 1 ? u : u.parentNode) && (c = [{ node: u, offset: a.anchorOffset }], on(a) || c.push({ node: a.focusNode, offset: a.focusOffset })), J && r.input.lastKeyCode === 8)
|
|
8275
8275
|
for (let g = s; g > i; g--) {
|
|
@@ -8289,7 +8289,7 @@ function Xa(r, e, t) {
|
|
|
8289
8289
|
to: s,
|
|
8290
8290
|
preserveWhitespace: h.parent.type.whitespace == "pre" ? "full" : !0,
|
|
8291
8291
|
findPositions: c,
|
|
8292
|
-
ruleFromNode:
|
|
8292
|
+
ruleFromNode: Qa,
|
|
8293
8293
|
context: h
|
|
8294
8294
|
});
|
|
8295
8295
|
if (c && c[0].pos != null) {
|
|
@@ -8298,27 +8298,27 @@ function Xa(r, e, t) {
|
|
|
8298
8298
|
}
|
|
8299
8299
|
return { doc: m, sel: p, from: o, to: l };
|
|
8300
8300
|
}
|
|
8301
|
-
function
|
|
8301
|
+
function Qa(r) {
|
|
8302
8302
|
let e = r.pmViewDesc;
|
|
8303
8303
|
if (e)
|
|
8304
8304
|
return e.parseRule();
|
|
8305
8305
|
if (r.nodeName == "BR" && r.parentNode) {
|
|
8306
|
-
if (
|
|
8306
|
+
if (U && /^(ul|ol)$/i.test(r.parentNode.nodeName)) {
|
|
8307
8307
|
let t = document.createElement("div");
|
|
8308
8308
|
return t.appendChild(document.createElement("li")), { skip: t };
|
|
8309
|
-
} else if (r.parentNode.lastChild == r ||
|
|
8309
|
+
} else if (r.parentNode.lastChild == r || U && /^(tr|table)$/i.test(r.parentNode.nodeName))
|
|
8310
8310
|
return { ignore: !0 };
|
|
8311
8311
|
} else if (r.nodeName == "IMG" && r.getAttribute("mark-placeholder"))
|
|
8312
8312
|
return { ignore: !0 };
|
|
8313
8313
|
return null;
|
|
8314
8314
|
}
|
|
8315
|
-
const
|
|
8316
|
-
function
|
|
8315
|
+
const ec = /^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;
|
|
8316
|
+
function tc(r, e, t, n, i) {
|
|
8317
8317
|
let s = r.input.compositionPendingChanges || (r.composing ? r.input.compositionID : 0);
|
|
8318
8318
|
if (r.input.compositionPendingChanges = 0, e < 0) {
|
|
8319
8319
|
let E = r.input.lastSelectionTime > Date.now() - 50 ? r.input.lastSelectionOrigin : null, ee = cr(r, E);
|
|
8320
8320
|
if (ee && !r.state.selection.eq(ee)) {
|
|
8321
|
-
if (J &&
|
|
8321
|
+
if (J && me && r.input.lastKeyCode === 13 && Date.now() - 100 < r.input.lastKeyCodeTime && r.someProp("handleKeyDown", (Ao) => Ao(r, De(13, "Enter"))))
|
|
8322
8322
|
return;
|
|
8323
8323
|
let Nt = r.state.tr.setSelection(ee);
|
|
8324
8324
|
E == "pointer" ? Nt.setMeta("pointer", !0) : E == "key" && Nt.scrollIntoView(), s && Nt.setMeta("composition", s), r.dispatch(Nt);
|
|
@@ -8327,10 +8327,10 @@ function ec(r, e, t, n, i) {
|
|
|
8327
8327
|
}
|
|
8328
8328
|
let o = r.state.doc.resolve(e), l = o.sharedDepth(t);
|
|
8329
8329
|
e = o.before(l + 1), t = r.state.doc.resolve(t).after(l + 1);
|
|
8330
|
-
let a = r.state.selection, c =
|
|
8330
|
+
let a = r.state.selection, c = Za(r, e, t), u = r.state.doc, d = u.slice(c.from, c.to), f, h;
|
|
8331
8331
|
r.input.lastKeyCode === 8 && Date.now() - 100 < r.input.lastKeyCodeTime ? (f = r.state.selection.to, h = "end") : (f = r.state.selection.from, h = "start"), r.input.lastKeyCode = null;
|
|
8332
|
-
let p =
|
|
8333
|
-
if (p && r.input.domChangeCount++, (rt && r.input.lastIOSEnter > Date.now() - 225 ||
|
|
8332
|
+
let p = ic(d.content, c.doc.content, c.from, f, h);
|
|
8333
|
+
if (p && r.input.domChangeCount++, (rt && r.input.lastIOSEnter > Date.now() - 225 || me) && i.some((E) => E.nodeType == 1 && !ec.test(E.nodeName)) && (!p || p.endA >= p.endB) && r.someProp("handleKeyDown", (E) => E(r, De(13, "Enter")))) {
|
|
8334
8334
|
r.input.lastIOSEnter = 0;
|
|
8335
8335
|
return;
|
|
8336
8336
|
}
|
|
@@ -8347,47 +8347,47 @@ function ec(r, e, t, n, i) {
|
|
|
8347
8347
|
}
|
|
8348
8348
|
return;
|
|
8349
8349
|
}
|
|
8350
|
-
r.state.selection.from < r.state.selection.to && p.start == p.endB && r.state.selection instanceof T && (p.start > r.state.selection.from && p.start <= r.state.selection.from + 2 && r.state.selection.from >= c.from ? p.start = r.state.selection.from : p.endA < r.state.selection.to && p.endA >= r.state.selection.to - 2 && r.state.selection.to <= c.to && (p.endB += r.state.selection.to - p.endA, p.endA = r.state.selection.to)),
|
|
8350
|
+
r.state.selection.from < r.state.selection.to && p.start == p.endB && r.state.selection instanceof T && (p.start > r.state.selection.from && p.start <= r.state.selection.from + 2 && r.state.selection.from >= c.from ? p.start = r.state.selection.from : p.endA < r.state.selection.to && p.endA >= r.state.selection.to - 2 && r.state.selection.to <= c.to && (p.endB += r.state.selection.to - p.endA, p.endA = r.state.selection.to)), 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
8351
|
let m = c.doc.resolveNoCache(p.start - c.from), g = c.doc.resolveNoCache(p.endB - c.from), y = u.resolve(p.start), S = m.sameParent(g) && m.parent.inlineContent && y.end() >= p.endA, w;
|
|
8352
8352
|
if ((rt && r.input.lastIOSEnter > Date.now() - 225 && (!S || i.some((E) => E.nodeName == "DIV" || E.nodeName == "P")) || !S && m.pos < c.doc.content.size && (!m.sameParent(g) || !m.parent.inlineContent) && (w = O.findFrom(c.doc.resolve(m.pos + 1), 1, !0)) && w.head > m.pos) && r.someProp("handleKeyDown", (E) => E(r, De(13, "Enter")))) {
|
|
8353
8353
|
r.input.lastIOSEnter = 0;
|
|
8354
8354
|
return;
|
|
8355
8355
|
}
|
|
8356
|
-
if (r.state.selection.anchor > p.start &&
|
|
8357
|
-
|
|
8356
|
+
if (r.state.selection.anchor > p.start && rc(u, p.start, p.endA, m, g) && r.someProp("handleKeyDown", (E) => E(r, De(8, "Backspace")))) {
|
|
8357
|
+
me && J && r.domObserver.suppressSelectionUpdates();
|
|
8358
8358
|
return;
|
|
8359
8359
|
}
|
|
8360
|
-
J && p.endB == p.start && (r.input.lastChromeDelete = Date.now()),
|
|
8360
|
+
J && p.endB == p.start && (r.input.lastChromeDelete = Date.now()), me && !S && m.start() != g.start() && g.parentOffset == 0 && m.depth == g.depth && c.sel && c.sel.anchor == c.sel.head && c.sel.head == p.endA && (p.endB -= 2, g = c.doc.resolveNoCache(p.endB - c.from), setTimeout(() => {
|
|
8361
8361
|
r.someProp("handleKeyDown", function(E) {
|
|
8362
8362
|
return E(r, De(13, "Enter"));
|
|
8363
8363
|
});
|
|
8364
8364
|
}, 20));
|
|
8365
|
-
let
|
|
8365
|
+
let D = p.start, A = p.endA, M, I, H;
|
|
8366
8366
|
if (S) {
|
|
8367
8367
|
if (m.pos == g.pos)
|
|
8368
|
-
|
|
8368
|
+
Y && Ee <= 11 && m.parentOffset == 0 && (r.domObserver.suppressSelectionUpdates(), setTimeout(() => ye(r), 20)), M = r.state.tr.delete(D, A), I = u.resolve(p.start).marksAcross(u.resolve(p.endA));
|
|
8369
8369
|
else if (
|
|
8370
8370
|
// Adding or removing a mark
|
|
8371
|
-
p.endA == p.endB && (H =
|
|
8371
|
+
p.endA == p.endB && (H = nc(m.parent.content.cut(m.parentOffset, g.parentOffset), y.parent.content.cut(y.parentOffset, p.endA - y.start())))
|
|
8372
8372
|
)
|
|
8373
|
-
M = r.state.tr, H.type == "add" ? M.addMark(
|
|
8373
|
+
M = r.state.tr, H.type == "add" ? M.addMark(D, A, H.mark) : M.removeMark(D, A, H.mark);
|
|
8374
8374
|
else if (m.parent.child(m.index()).isText && m.index() == g.index() - (g.textOffset ? 0 : 1)) {
|
|
8375
8375
|
let E = m.parent.textBetween(m.parentOffset, g.parentOffset);
|
|
8376
|
-
if (r.someProp("handleTextInput", (ee) => ee(r,
|
|
8376
|
+
if (r.someProp("handleTextInput", (ee) => ee(r, D, A, E)))
|
|
8377
8377
|
return;
|
|
8378
|
-
M = r.state.tr.insertText(E,
|
|
8378
|
+
M = r.state.tr.insertText(E, D, A);
|
|
8379
8379
|
}
|
|
8380
8380
|
}
|
|
8381
|
-
if (M || (M = r.state.tr.replace(
|
|
8381
|
+
if (M || (M = r.state.tr.replace(D, A, c.doc.slice(p.start - c.from, p.endB - c.from))), c.sel) {
|
|
8382
8382
|
let E = xi(r, M.doc, c.sel);
|
|
8383
|
-
E && !(J && r.composing && E.empty && (p.start != p.endB || r.input.lastChromeDelete < Date.now() - 100) && (E.head ==
|
|
8383
|
+
E && !(J && r.composing && E.empty && (p.start != p.endB || r.input.lastChromeDelete < Date.now() - 100) && (E.head == D || E.head == M.mapping.map(A) - 1) || Y && E.empty && E.head == D) && M.setSelection(E);
|
|
8384
8384
|
}
|
|
8385
8385
|
I && M.ensureMarks(I), s && M.setMeta("composition", s), r.dispatch(M.scrollIntoView());
|
|
8386
8386
|
}
|
|
8387
8387
|
function xi(r, e, t) {
|
|
8388
8388
|
return Math.max(t.anchor, t.head) > e.content.size ? null : ur(r, e.resolve(t.anchor), e.resolve(t.head));
|
|
8389
8389
|
}
|
|
8390
|
-
function
|
|
8390
|
+
function nc(r, e) {
|
|
8391
8391
|
let t = r.firstChild.marks, n = e.firstChild.marks, i = t, s = n, o, l, a;
|
|
8392
8392
|
for (let u = 0; u < n.length; u++)
|
|
8393
8393
|
i = n[u].removeFromSet(i);
|
|
@@ -8405,7 +8405,7 @@ function tc(r, e) {
|
|
|
8405
8405
|
if (b.from(c).eq(r))
|
|
8406
8406
|
return { mark: l, type: o };
|
|
8407
8407
|
}
|
|
8408
|
-
function
|
|
8408
|
+
function rc(r, e, t, n, i) {
|
|
8409
8409
|
if (
|
|
8410
8410
|
// The content must have shrunk
|
|
8411
8411
|
t - e <= i.pos - n.pos || // newEnd must point directly at or after the end of the block that newStart points into
|
|
@@ -8433,7 +8433,7 @@ function Nn(r, e, t) {
|
|
|
8433
8433
|
}
|
|
8434
8434
|
return i;
|
|
8435
8435
|
}
|
|
8436
|
-
function
|
|
8436
|
+
function ic(r, e, t, n, i) {
|
|
8437
8437
|
let s = r.findDiffStart(e, t);
|
|
8438
8438
|
if (s == null)
|
|
8439
8439
|
return null;
|
|
@@ -8457,7 +8457,7 @@ function Si(r) {
|
|
|
8457
8457
|
let e = r.charCodeAt(0), t = r.charCodeAt(1);
|
|
8458
8458
|
return e >= 56320 && e <= 57343 && t >= 55296 && t <= 56319;
|
|
8459
8459
|
}
|
|
8460
|
-
class
|
|
8460
|
+
class sc {
|
|
8461
8461
|
/**
|
|
8462
8462
|
Create a view. `place` may be a DOM node that the editor should
|
|
8463
8463
|
be appended to, a function that will place it into the document,
|
|
@@ -8466,7 +8466,7 @@ class ic {
|
|
|
8466
8466
|
added to the document.
|
|
8467
8467
|
*/
|
|
8468
8468
|
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
|
|
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 wa(), 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), wi(this), this.nodeViews = Ei(this), this.docView = ni(this.state.doc, Ci(this), On(this), this.dom, this), this.domObserver = new _a(this, (n, i, s, o) => tc(this, n, i, s, o)), this.domObserver.start(), Ma(this), this.updatePluginViews();
|
|
8470
8470
|
}
|
|
8471
8471
|
/**
|
|
8472
8472
|
Holds `true` when a
|
|
@@ -8526,22 +8526,22 @@ class ic {
|
|
|
8526
8526
|
let l = i.plugins != e.plugins || this._props.plugins != t.plugins;
|
|
8527
8527
|
if (l || this._props.plugins != t.plugins || this._props.nodeViews != t.nodeViews) {
|
|
8528
8528
|
let h = Ei(this);
|
|
8529
|
-
|
|
8529
|
+
lc(h, this.nodeViews) && (this.nodeViews = h, s = !0);
|
|
8530
8530
|
}
|
|
8531
8531
|
(l || t.handleDOMEvents != this._props.handleDOMEvents) && Zn(this), this.editable = Mi(this), wi(this);
|
|
8532
8532
|
let a = On(this), c = Ci(this), u = i.plugins != e.plugins && !i.doc.eq(e.doc) ? "reset" : e.scrollToSelection > i.scrollToSelection ? "to selection" : "preserve", d = s || !this.docView.matchesNode(e.doc, c, a);
|
|
8533
8533
|
(d || !e.selection.eq(i.selection)) && (o = !0);
|
|
8534
|
-
let f = u == "preserve" && o && this.dom.style.overflowAnchor == null &&
|
|
8534
|
+
let f = u == "preserve" && o && this.dom.style.overflowAnchor == null && Ll(this);
|
|
8535
8535
|
if (o) {
|
|
8536
8536
|
this.domObserver.stop();
|
|
8537
|
-
let h = d && (
|
|
8537
|
+
let h = d && (Y || J) && !this.composing && !i.selection.empty && !e.selection.empty && oc(i.selection, e.selection);
|
|
8538
8538
|
if (d) {
|
|
8539
8539
|
let p = J ? this.trackWrites = this.domSelectionRange().focusNode : null;
|
|
8540
|
-
this.composing && (this.input.compositionNode =
|
|
8540
|
+
this.composing && (this.input.compositionNode = Fa(this)), (s || !this.docView.update(e.doc, c, a, this)) && (this.docView.updateOuterDeco(c), this.docView.destroy(), this.docView = ni(e.doc, c, a, this.dom, this)), p && !this.trackWrites && (h = !0);
|
|
8541
8541
|
}
|
|
8542
|
-
h || !(this.input.mouseDown && this.domObserver.currentSelection.eq(this.domSelectionRange()) &&
|
|
8542
|
+
h || !(this.input.mouseDown && this.domObserver.currentSelection.eq(this.domSelectionRange()) && aa(this)) ? ye(this, h) : (Rs(this, e.selection), this.domObserver.setCurSelection()), this.domObserver.start();
|
|
8543
8543
|
}
|
|
8544
|
-
this.updatePluginViews(i), !((n = this.dragging) === null || n === void 0) && n.node && !i.doc.eq(e.doc) && this.updateDraggedNode(this.dragging, i), u == "reset" ? this.dom.scrollTop = 0 : u == "to selection" ? this.scrollToSelection() : f &&
|
|
8544
|
+
this.updatePluginViews(i), !((n = this.dragging) === null || n === void 0) && n.node && !i.doc.eq(e.doc) && this.updateDraggedNode(this.dragging, i), u == "reset" ? this.dom.scrollTop = 0 : u == "to selection" ? this.scrollToSelection() : f && $l(f);
|
|
8545
8545
|
}
|
|
8546
8546
|
/**
|
|
8547
8547
|
@internal
|
|
@@ -8609,7 +8609,7 @@ class ic {
|
|
|
8609
8609
|
Query whether the view has focus.
|
|
8610
8610
|
*/
|
|
8611
8611
|
hasFocus() {
|
|
8612
|
-
if (
|
|
8612
|
+
if (Y) {
|
|
8613
8613
|
let e = this.root.activeElement;
|
|
8614
8614
|
if (e == this.dom)
|
|
8615
8615
|
return !0;
|
|
@@ -8628,7 +8628,7 @@ class ic {
|
|
|
8628
8628
|
Focus the editor.
|
|
8629
8629
|
*/
|
|
8630
8630
|
focus() {
|
|
8631
|
-
this.domObserver.stop(), this.editable &&
|
|
8631
|
+
this.domObserver.stop(), this.editable && Vl(this.dom), ye(this), this.domObserver.start();
|
|
8632
8632
|
}
|
|
8633
8633
|
/**
|
|
8634
8634
|
Get the document root in which the editor exists. This will
|
|
@@ -8662,7 +8662,7 @@ class ic {
|
|
|
8662
8662
|
the top level, not in any node.
|
|
8663
8663
|
*/
|
|
8664
8664
|
posAtCoords(e) {
|
|
8665
|
-
return
|
|
8665
|
+
return ql(this, e);
|
|
8666
8666
|
}
|
|
8667
8667
|
/**
|
|
8668
8668
|
Returns the viewport rectangle at a given document position.
|
|
@@ -8727,7 +8727,7 @@ class ic {
|
|
|
8727
8727
|
pass a different state.
|
|
8728
8728
|
*/
|
|
8729
8729
|
endOfTextblock(e, t) {
|
|
8730
|
-
return
|
|
8730
|
+
return Yl(this, t || this.state, e);
|
|
8731
8731
|
}
|
|
8732
8732
|
/**
|
|
8733
8733
|
Run the editor's paste logic with the given HTML string. The
|
|
@@ -8759,7 +8759,7 @@ class ic {
|
|
|
8759
8759
|
views](https://prosemirror.net/docs/ref/#view.NodeView).
|
|
8760
8760
|
*/
|
|
8761
8761
|
destroy() {
|
|
8762
|
-
this.docView && (
|
|
8762
|
+
this.docView && (Ea(this), this.destroyPluginViews(), this.mounted ? (this.docView.update(this.state.doc, [], On(this), this), this.dom.textContent = "") : this.dom.parentNode && this.dom.parentNode.removeChild(this.dom), this.docView.destroy(), this.docView = null, Ol());
|
|
8763
8763
|
}
|
|
8764
8764
|
/**
|
|
8765
8765
|
This is true when the view has been
|
|
@@ -8773,7 +8773,7 @@ class ic {
|
|
|
8773
8773
|
Used for testing.
|
|
8774
8774
|
*/
|
|
8775
8775
|
dispatchEvent(e) {
|
|
8776
|
-
return
|
|
8776
|
+
return Oa(this, e);
|
|
8777
8777
|
}
|
|
8778
8778
|
/**
|
|
8779
8779
|
Dispatch a transaction. Will call
|
|
@@ -8793,7 +8793,7 @@ class ic {
|
|
|
8793
8793
|
*/
|
|
8794
8794
|
domSelectionRange() {
|
|
8795
8795
|
let e = this.domSelection();
|
|
8796
|
-
return e ?
|
|
8796
|
+
return e ? U && this.root.nodeType === 11 && Il(this.dom.ownerDocument) == this.dom && Ya(this, e) || e : { focusNode: null, focusOffset: 0, anchorNode: null, anchorOffset: 0 };
|
|
8797
8797
|
}
|
|
8798
8798
|
/**
|
|
8799
8799
|
@internal
|
|
@@ -8820,7 +8820,7 @@ function wi(r) {
|
|
|
8820
8820
|
function Mi(r) {
|
|
8821
8821
|
return !r.someProp("editable", (e) => e(r.state) === !1);
|
|
8822
8822
|
}
|
|
8823
|
-
function
|
|
8823
|
+
function oc(r, e) {
|
|
8824
8824
|
let t = Math.min(r.$anchor.sharedDepth(r.head), e.$anchor.sharedDepth(e.head));
|
|
8825
8825
|
return r.$anchor.start(t) != e.$anchor.start(t);
|
|
8826
8826
|
}
|
|
@@ -8832,7 +8832,7 @@ function Ei(r) {
|
|
|
8832
8832
|
}
|
|
8833
8833
|
return r.someProp("nodeViews", t), r.someProp("markViews", t), e;
|
|
8834
8834
|
}
|
|
8835
|
-
function
|
|
8835
|
+
function lc(r, e) {
|
|
8836
8836
|
let t = 0, n = 0;
|
|
8837
8837
|
for (let i in r) {
|
|
8838
8838
|
if (r[i] != e[i])
|
|
@@ -8925,18 +8925,18 @@ var Ne = {
|
|
|
8925
8925
|
220: "|",
|
|
8926
8926
|
221: "}",
|
|
8927
8927
|
222: '"'
|
|
8928
|
-
},
|
|
8928
|
+
}, ac = typeof navigator < "u" && /Mac/.test(navigator.platform), cc = typeof navigator < "u" && /MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);
|
|
8929
8929
|
for (var j = 0; j < 10; j++) Ne[48 + j] = Ne[96 + j] = String(j);
|
|
8930
8930
|
for (var j = 1; j <= 24; j++) Ne[j + 111] = "F" + j;
|
|
8931
8931
|
for (var j = 65; j <= 90; j++)
|
|
8932
8932
|
Ne[j] = String.fromCharCode(j + 32), Xt[j] = String.fromCharCode(j);
|
|
8933
8933
|
for (var An in Ne) Xt.hasOwnProperty(An) || (Xt[An] = Ne[An]);
|
|
8934
|
-
function
|
|
8935
|
-
var e =
|
|
8934
|
+
function uc(r) {
|
|
8935
|
+
var e = ac && r.metaKey && r.shiftKey && !r.ctrlKey && !r.altKey || cc && r.shiftKey && r.key && r.key.length == 1 || r.key == "Unidentified", t = !e && r.key || (r.shiftKey ? Xt : Ne)[r.keyCode] || r.key || "Unidentified";
|
|
8936
8936
|
return t == "Esc" && (t = "Escape"), t == "Del" && (t = "Delete"), t == "Left" && (t = "ArrowLeft"), t == "Up" && (t = "ArrowUp"), t == "Right" && (t = "ArrowRight"), t == "Down" && (t = "ArrowDown"), t;
|
|
8937
8937
|
}
|
|
8938
|
-
const
|
|
8939
|
-
function
|
|
8938
|
+
const dc = typeof navigator < "u" ? /Mac|iP(hone|[oa]d)/.test(navigator.platform) : !1;
|
|
8939
|
+
function fc(r) {
|
|
8940
8940
|
let e = r.split(/-(?!$)/), t = e[e.length - 1];
|
|
8941
8941
|
t == "Space" && (t = " ");
|
|
8942
8942
|
let n, i, s, o;
|
|
@@ -8951,28 +8951,28 @@ function dc(r) {
|
|
|
8951
8951
|
else if (/^s(hift)?$/i.test(a))
|
|
8952
8952
|
s = !0;
|
|
8953
8953
|
else if (/^mod$/i.test(a))
|
|
8954
|
-
|
|
8954
|
+
dc ? o = !0 : i = !0;
|
|
8955
8955
|
else
|
|
8956
8956
|
throw new Error("Unrecognized modifier name: " + a);
|
|
8957
8957
|
}
|
|
8958
8958
|
return n && (t = "Alt-" + t), i && (t = "Ctrl-" + t), o && (t = "Meta-" + t), s && (t = "Shift-" + t), t;
|
|
8959
8959
|
}
|
|
8960
|
-
function
|
|
8960
|
+
function hc(r) {
|
|
8961
8961
|
let e = /* @__PURE__ */ Object.create(null);
|
|
8962
8962
|
for (let t in r)
|
|
8963
|
-
e[
|
|
8963
|
+
e[fc(t)] = r[t];
|
|
8964
8964
|
return e;
|
|
8965
8965
|
}
|
|
8966
8966
|
function vn(r, e, t = !0) {
|
|
8967
8967
|
return e.altKey && (r = "Alt-" + r), e.ctrlKey && (r = "Ctrl-" + r), e.metaKey && (r = "Meta-" + r), t && e.shiftKey && (r = "Shift-" + r), r;
|
|
8968
8968
|
}
|
|
8969
|
-
function hc(r) {
|
|
8970
|
-
return new Q({ props: { handleKeyDown: pc(r) } });
|
|
8971
|
-
}
|
|
8972
8969
|
function pc(r) {
|
|
8973
|
-
|
|
8970
|
+
return new Q({ props: { handleKeyDown: mc(r) } });
|
|
8971
|
+
}
|
|
8972
|
+
function mc(r) {
|
|
8973
|
+
let e = hc(r);
|
|
8974
8974
|
return function(t, n) {
|
|
8975
|
-
let i =
|
|
8975
|
+
let i = uc(n), s, o = e[vn(i, n)];
|
|
8976
8976
|
if (o && o(t.state, t.dispatch, t))
|
|
8977
8977
|
return !0;
|
|
8978
8978
|
if (i.length == 1 && i != " ") {
|
|
@@ -9021,13 +9021,13 @@ const eo = (r, e, t) => {
|
|
|
9021
9021
|
break;
|
|
9022
9022
|
}
|
|
9023
9023
|
return s.isAtom && i.depth == n.depth - 1 ? (e && e(r.tr.delete(i.pos - s.nodeSize, i.pos).scrollIntoView()), !0) : !1;
|
|
9024
|
-
},
|
|
9024
|
+
}, gc = (r, e, t) => {
|
|
9025
9025
|
let n = Qs(r, t);
|
|
9026
9026
|
if (!n)
|
|
9027
9027
|
return !1;
|
|
9028
9028
|
let i = br(n);
|
|
9029
9029
|
return i ? to(r, i, e) : !1;
|
|
9030
|
-
},
|
|
9030
|
+
}, yc = (r, e, t) => {
|
|
9031
9031
|
let n = ro(r, t);
|
|
9032
9032
|
if (!n)
|
|
9033
9033
|
return !1;
|
|
@@ -9141,7 +9141,7 @@ function kr(r) {
|
|
|
9141
9141
|
}
|
|
9142
9142
|
return null;
|
|
9143
9143
|
}
|
|
9144
|
-
const
|
|
9144
|
+
const bc = (r, e) => {
|
|
9145
9145
|
let t = r.selection, n = t instanceof C, i;
|
|
9146
9146
|
if (n) {
|
|
9147
9147
|
if (t.node.isTextblock || !qe(r.doc, t.from))
|
|
@@ -9154,7 +9154,7 @@ const yc = (r, e) => {
|
|
|
9154
9154
|
n && s.setSelection(C.create(s.doc, i - r.doc.resolve(i).nodeBefore.nodeSize)), e(s.scrollIntoView());
|
|
9155
9155
|
}
|
|
9156
9156
|
return !0;
|
|
9157
|
-
},
|
|
9157
|
+
}, kc = (r, e) => {
|
|
9158
9158
|
let t = r.selection, n;
|
|
9159
9159
|
if (t instanceof C) {
|
|
9160
9160
|
if (t.node.isTextblock || !qe(r.doc, t.to))
|
|
@@ -9163,7 +9163,7 @@ const yc = (r, e) => {
|
|
|
9163
9163
|
} else if (n = nn(r.doc, t.to, 1), n == null)
|
|
9164
9164
|
return !1;
|
|
9165
9165
|
return e && e(r.tr.join(n).scrollIntoView()), !0;
|
|
9166
|
-
},
|
|
9166
|
+
}, xc = (r, e) => {
|
|
9167
9167
|
let { $from: t, $to: n } = r.selection, i = t.blockRange(n), s = i && st(i);
|
|
9168
9168
|
return s == null ? !1 : (e && e(r.tr.lift(i, s).scrollIntoView()), !0);
|
|
9169
9169
|
}, oo = (r, e) => {
|
|
@@ -9179,7 +9179,7 @@ function xr(r) {
|
|
|
9179
9179
|
}
|
|
9180
9180
|
return null;
|
|
9181
9181
|
}
|
|
9182
|
-
const
|
|
9182
|
+
const Sc = (r, e) => {
|
|
9183
9183
|
let { $head: t, $anchor: n } = r.selection;
|
|
9184
9184
|
if (!t.parent.type.spec.code || !t.sameParent(n))
|
|
9185
9185
|
return !1;
|
|
@@ -9209,17 +9209,17 @@ const xc = (r, e) => {
|
|
|
9209
9209
|
return !1;
|
|
9210
9210
|
if (t.depth > 1 && t.after() != t.end(-1)) {
|
|
9211
9211
|
let s = t.before();
|
|
9212
|
-
if (
|
|
9212
|
+
if (ge(r.doc, s))
|
|
9213
9213
|
return e && e(r.tr.split(s).scrollIntoView()), !0;
|
|
9214
9214
|
}
|
|
9215
9215
|
let n = t.blockRange(), i = n && st(n);
|
|
9216
9216
|
return i == null ? !1 : (e && e(r.tr.lift(n, i).scrollIntoView()), !0);
|
|
9217
9217
|
};
|
|
9218
|
-
function
|
|
9218
|
+
function Cc(r) {
|
|
9219
9219
|
return (e, t) => {
|
|
9220
9220
|
let { $from: n, $to: i } = e.selection;
|
|
9221
9221
|
if (e.selection instanceof C && e.selection.node.isBlock)
|
|
9222
|
-
return !n.parentOffset || !
|
|
9222
|
+
return !n.parentOffset || !ge(e.doc, n.pos) ? !1 : (t && t(e.tr.split(n.pos).scrollIntoView()), !0);
|
|
9223
9223
|
if (!n.depth)
|
|
9224
9224
|
return !1;
|
|
9225
9225
|
let s = [], o, l, a = !1, c = !1;
|
|
@@ -9234,8 +9234,8 @@ function Sc(r) {
|
|
|
9234
9234
|
}
|
|
9235
9235
|
let u = e.tr;
|
|
9236
9236
|
(e.selection instanceof T || e.selection instanceof Z) && u.deleteSelection();
|
|
9237
|
-
let d = u.mapping.map(n.pos), f =
|
|
9238
|
-
if (f || (s[0] = l ? { type: l } : null, f =
|
|
9237
|
+
let d = u.mapping.map(n.pos), f = ge(u.doc, d, s.length, s);
|
|
9238
|
+
if (f || (s[0] = l ? { type: l } : null, f = ge(u.doc, d, s.length, s)), !f)
|
|
9239
9239
|
return !1;
|
|
9240
9240
|
if (u.split(d, s.length, s), !a && c && n.node(o).type != l) {
|
|
9241
9241
|
let h = u.mapping.map(n.before(o)), p = u.doc.resolve(h);
|
|
@@ -9244,17 +9244,17 @@ function Sc(r) {
|
|
|
9244
9244
|
return t && t(u.scrollIntoView()), !0;
|
|
9245
9245
|
};
|
|
9246
9246
|
}
|
|
9247
|
-
const
|
|
9247
|
+
const wc = Cc(), Mc = (r, e) => {
|
|
9248
9248
|
let { $from: t, to: n } = r.selection, i, s = t.sharedDepth(n);
|
|
9249
9249
|
return s == 0 ? !1 : (i = t.before(s), e && e(r.tr.setSelection(C.create(r.doc, i))), !0);
|
|
9250
9250
|
};
|
|
9251
|
-
function
|
|
9251
|
+
function Ec(r, e, t) {
|
|
9252
9252
|
let n = e.nodeBefore, i = e.nodeAfter, s = e.index();
|
|
9253
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 || qe(r.doc, e.pos)) ? !1 : (t && t(r.tr.join(e.pos).scrollIntoView()), !0);
|
|
9254
9254
|
}
|
|
9255
9255
|
function co(r, e, t, n) {
|
|
9256
9256
|
let i = e.nodeBefore, s = e.nodeAfter, o, l, a = i.type.spec.isolating || s.type.spec.isolating;
|
|
9257
|
-
if (!a &&
|
|
9257
|
+
if (!a && Ec(r, e, t))
|
|
9258
9258
|
return !0;
|
|
9259
9259
|
let c = !a && e.parent.canReplace(e.index(), e.index() + 1);
|
|
9260
9260
|
if (c && (o = (l = i.contentMatchAt(i.childCount)).findWrapping(s.type)) && l.matchType(o[0] || s.type).validEnd) {
|
|
@@ -9302,8 +9302,8 @@ function uo(r) {
|
|
|
9302
9302
|
return i.node(s).isTextblock ? (t && t(e.tr.setSelection(T.create(e.doc, r < 0 ? i.start(s) : i.end(s)))), !0) : !1;
|
|
9303
9303
|
};
|
|
9304
9304
|
}
|
|
9305
|
-
const
|
|
9306
|
-
function
|
|
9305
|
+
const Tc = uo(-1), Oc = uo(1);
|
|
9306
|
+
function Nc(r, e = null) {
|
|
9307
9307
|
return function(t, n) {
|
|
9308
9308
|
let { $from: i, $to: s } = t.selection, o = i.blockRange(s), l = o && us(o, r, e);
|
|
9309
9309
|
return l ? (n && n(t.tr.wrap(o, l).scrollIntoView()), !0) : !1;
|
|
@@ -9349,18 +9349,18 @@ function Sr(...r) {
|
|
|
9349
9349
|
}
|
|
9350
9350
|
Sr(yr, eo, no);
|
|
9351
9351
|
Sr(yr, io, so);
|
|
9352
|
-
Sr(oo, lo, ao,
|
|
9352
|
+
Sr(oo, lo, ao, wc);
|
|
9353
9353
|
typeof navigator < "u" ? /Mac|iP(hone|[oa]d)/.test(navigator.platform) : typeof os < "u" && os.platform && os.platform() == "darwin";
|
|
9354
|
-
function
|
|
9354
|
+
function Ac(r, e = null) {
|
|
9355
9355
|
return function(t, n) {
|
|
9356
9356
|
let { $from: i, $to: s } = t.selection, o = i.blockRange(s);
|
|
9357
9357
|
if (!o)
|
|
9358
9358
|
return !1;
|
|
9359
9359
|
let l = n ? t.tr : null;
|
|
9360
|
-
return
|
|
9360
|
+
return vc(l, o, r, e) ? (n && n(l.scrollIntoView()), !0) : !1;
|
|
9361
9361
|
};
|
|
9362
9362
|
}
|
|
9363
|
-
function
|
|
9363
|
+
function vc(r, e, t, n = null) {
|
|
9364
9364
|
let i = !1, s = e, o = e.$from.doc;
|
|
9365
9365
|
if (e.depth >= 2 && e.$from.node(e.depth - 1).type.compatibleContent(t) && e.startIndex == 0) {
|
|
9366
9366
|
if (e.$from.index(e.depth - 1) == 0)
|
|
@@ -9369,9 +9369,9 @@ function Ac(r, e, t, n = null) {
|
|
|
9369
9369
|
s = new Jt(a, a, e.depth), e.endIndex < e.parent.childCount && (e = new Jt(e.$from, o.resolve(e.$to.end(e.depth)), e.depth)), i = !0;
|
|
9370
9370
|
}
|
|
9371
9371
|
let l = us(s, t, n, e);
|
|
9372
|
-
return l ? (r &&
|
|
9372
|
+
return l ? (r && Dc(r, e, l, i, t), !0) : !1;
|
|
9373
9373
|
}
|
|
9374
|
-
function
|
|
9374
|
+
function Dc(r, e, t, n, i) {
|
|
9375
9375
|
let s = b.empty;
|
|
9376
9376
|
for (let u = t.length - 1; u >= 0; u--)
|
|
9377
9377
|
s = b.from(t[u].type.create(t[u].attrs, s));
|
|
@@ -9381,16 +9381,16 @@ function vc(r, e, t, n, i) {
|
|
|
9381
9381
|
t[u].type == i && (o = u + 1);
|
|
9382
9382
|
let l = t.length - o, a = e.start + t.length - (n ? 2 : 0), c = e.parent;
|
|
9383
9383
|
for (let u = e.startIndex, d = e.endIndex, f = !0; u < d; u++, f = !1)
|
|
9384
|
-
!f &&
|
|
9384
|
+
!f && ge(r.doc, a, l) && (r.split(a, l), a += 2 * l), a += c.child(u).nodeSize;
|
|
9385
9385
|
return r;
|
|
9386
9386
|
}
|
|
9387
|
-
function
|
|
9387
|
+
function Ic(r) {
|
|
9388
9388
|
return function(e, t) {
|
|
9389
9389
|
let { $from: n, $to: i } = e.selection, s = n.blockRange(i, (o) => o.childCount > 0 && o.firstChild.type == r);
|
|
9390
|
-
return s ? t ? n.node(s.depth - 1).type == r ?
|
|
9390
|
+
return s ? t ? n.node(s.depth - 1).type == r ? Pc(e, t, r, s) : Rc(e, t, s) : !0 : !1;
|
|
9391
9391
|
};
|
|
9392
9392
|
}
|
|
9393
|
-
function
|
|
9393
|
+
function Pc(r, e, t, n) {
|
|
9394
9394
|
let i = r.tr, s = n.end, o = n.$to.end(n.depth);
|
|
9395
9395
|
s < o && (i.step(new z(s - 1, o, s, o, new k(b.from(t.create(null, n.parent.copy())), 1, 0), 1, !0)), n = new Jt(i.doc.resolve(n.$from.pos), i.doc.resolve(o), n.depth));
|
|
9396
9396
|
const l = st(n);
|
|
@@ -9400,7 +9400,7 @@ function Ic(r, e, t, n) {
|
|
|
9400
9400
|
let a = i.doc.resolve(i.mapping.map(s, -1) - 1);
|
|
9401
9401
|
return qe(i.doc, a.pos) && a.nodeBefore.type == a.nodeAfter.type && i.join(a.pos), e(i.scrollIntoView()), !0;
|
|
9402
9402
|
}
|
|
9403
|
-
function
|
|
9403
|
+
function Rc(r, e, t) {
|
|
9404
9404
|
let n = r.tr, i = t.parent;
|
|
9405
9405
|
for (let h = t.end, p = t.endIndex - 1, m = t.startIndex; p > m; p--)
|
|
9406
9406
|
h -= i.child(p).nodeSize, n.delete(h - 1, h + 1);
|
|
@@ -9413,7 +9413,7 @@ function Pc(r, e, t) {
|
|
|
9413
9413
|
let d = s.pos, f = d + o.nodeSize;
|
|
9414
9414
|
return n.step(new z(d - (l ? 1 : 0), f + (a ? 1 : 0), d + 1, f - 1, new k((l ? b.empty : b.from(i.copy(b.empty))).append(a ? b.empty : b.from(i.copy(b.empty))), l ? 0 : 1, a ? 0 : 1), l ? 0 : 1)), e(n.scrollIntoView()), !0;
|
|
9415
9415
|
}
|
|
9416
|
-
function
|
|
9416
|
+
function Bc(r) {
|
|
9417
9417
|
return function(e, t) {
|
|
9418
9418
|
let { $from: n, $to: i } = e.selection, s = n.blockRange(i, (c) => c.childCount > 0 && c.firstChild.type == r);
|
|
9419
9419
|
if (!s)
|
|
@@ -9516,7 +9516,7 @@ class un {
|
|
|
9516
9516
|
return l;
|
|
9517
9517
|
}
|
|
9518
9518
|
}
|
|
9519
|
-
class
|
|
9519
|
+
class zc {
|
|
9520
9520
|
constructor() {
|
|
9521
9521
|
this.callbacks = {};
|
|
9522
9522
|
}
|
|
@@ -9617,7 +9617,7 @@ function L(r, e) {
|
|
|
9617
9617
|
}
|
|
9618
9618
|
return r;
|
|
9619
9619
|
}
|
|
9620
|
-
function
|
|
9620
|
+
function Fc(...r) {
|
|
9621
9621
|
return r.filter((e) => !!e).reduce((e, t) => {
|
|
9622
9622
|
const n = { ...e };
|
|
9623
9623
|
return Object.entries(t).forEach(([i, s]) => {
|
|
@@ -9645,7 +9645,7 @@ function zc(...r) {
|
|
|
9645
9645
|
function Qn(r, e) {
|
|
9646
9646
|
return e.filter((t) => t.type === r.type.name).filter((t) => t.attribute.rendered).map((t) => t.attribute.renderHTML ? t.attribute.renderHTML(r.attrs) || {} : {
|
|
9647
9647
|
[t.name]: r.attrs[t.name]
|
|
9648
|
-
}).reduce((t, n) =>
|
|
9648
|
+
}).reduce((t, n) => Fc(t, n), {});
|
|
9649
9649
|
}
|
|
9650
9650
|
function ho(r) {
|
|
9651
9651
|
return typeof r == "function";
|
|
@@ -9653,10 +9653,10 @@ function ho(r) {
|
|
|
9653
9653
|
function N(r, e = void 0, ...t) {
|
|
9654
9654
|
return ho(r) ? e ? r.bind(e)(...t) : r(...t) : r;
|
|
9655
9655
|
}
|
|
9656
|
-
function
|
|
9656
|
+
function Lc(r = {}) {
|
|
9657
9657
|
return Object.keys(r).length === 0 && r.constructor === Object;
|
|
9658
9658
|
}
|
|
9659
|
-
function
|
|
9659
|
+
function $c(r) {
|
|
9660
9660
|
return typeof r != "string" ? r : r.match(/^[+-]?(?:\d*\.)?\d+$/) ? Number(r) : r === "true" ? !0 : r === "false" ? !1 : r;
|
|
9661
9661
|
}
|
|
9662
9662
|
function Ni(r, e) {
|
|
@@ -9667,7 +9667,7 @@ function Ni(r, e) {
|
|
|
9667
9667
|
if (n === !1)
|
|
9668
9668
|
return !1;
|
|
9669
9669
|
const i = e.reduce((s, o) => {
|
|
9670
|
-
const l = o.attribute.parseHTML ? o.attribute.parseHTML(t) :
|
|
9670
|
+
const l = o.attribute.parseHTML ? o.attribute.parseHTML(t) : $c(t.getAttribute(o.name));
|
|
9671
9671
|
return l == null ? s : {
|
|
9672
9672
|
...s,
|
|
9673
9673
|
[o.name]: l
|
|
@@ -9680,10 +9680,10 @@ function Ni(r, e) {
|
|
|
9680
9680
|
function Ai(r) {
|
|
9681
9681
|
return Object.fromEntries(
|
|
9682
9682
|
// @ts-ignore
|
|
9683
|
-
Object.entries(r).filter(([e, t]) => e === "attrs" &&
|
|
9683
|
+
Object.entries(r).filter(([e, t]) => e === "attrs" && Lc(t) ? !1 : t != null)
|
|
9684
9684
|
);
|
|
9685
9685
|
}
|
|
9686
|
-
function
|
|
9686
|
+
function Vc(r, e) {
|
|
9687
9687
|
var t;
|
|
9688
9688
|
const n = fo(r), { nodeExtensions: i, markExtensions: s } = dn(r), o = (t = i.find((c) => x(c, "topNode"))) === null || t === void 0 ? void 0 : t.name, l = Object.fromEntries(i.map((c) => {
|
|
9689
9689
|
const u = n.filter((y) => y.type === c.name), d = {
|
|
@@ -9771,7 +9771,7 @@ function Cr(r, e) {
|
|
|
9771
9771
|
const t = Je.fromSchema(e).serializeFragment(r), i = document.implementation.createHTMLDocument().createElement("div");
|
|
9772
9772
|
return i.appendChild(t), i.innerHTML;
|
|
9773
9773
|
}
|
|
9774
|
-
const
|
|
9774
|
+
const jc = (r, e = 500) => {
|
|
9775
9775
|
let t = "";
|
|
9776
9776
|
const n = r.parentOffset;
|
|
9777
9777
|
return r.parent.nodesBetween(Math.max(0, n - e), n, (i, s, o, l) => {
|
|
@@ -9788,7 +9788,12 @@ const Vc = (r, e = 500) => {
|
|
|
9788
9788
|
function wr(r) {
|
|
9789
9789
|
return Object.prototype.toString.call(r) === "[object RegExp]";
|
|
9790
9790
|
}
|
|
9791
|
-
|
|
9791
|
+
class Hc {
|
|
9792
|
+
constructor(e) {
|
|
9793
|
+
this.find = e.find, this.handler = e.handler;
|
|
9794
|
+
}
|
|
9795
|
+
}
|
|
9796
|
+
const Wc = (r, e) => {
|
|
9792
9797
|
if (wr(e))
|
|
9793
9798
|
return e.exec(r);
|
|
9794
9799
|
const t = e(r);
|
|
@@ -9809,11 +9814,11 @@ function Dt(r) {
|
|
|
9809
9814
|
)
|
|
9810
9815
|
return !1;
|
|
9811
9816
|
let u = !1;
|
|
9812
|
-
const d =
|
|
9817
|
+
const d = jc(c) + s;
|
|
9813
9818
|
return o.forEach((f) => {
|
|
9814
9819
|
if (u)
|
|
9815
9820
|
return;
|
|
9816
|
-
const h =
|
|
9821
|
+
const h = Wc(d, f.find);
|
|
9817
9822
|
if (!h)
|
|
9818
9823
|
return;
|
|
9819
9824
|
const p = a.state.tr, m = cn({
|
|
@@ -9841,7 +9846,7 @@ function Dt(r) {
|
|
|
9841
9846
|
}), a.dispatch(p), u = !0);
|
|
9842
9847
|
}), u;
|
|
9843
9848
|
}
|
|
9844
|
-
function
|
|
9849
|
+
function Jc(r) {
|
|
9845
9850
|
const { editor: e, rules: t } = r, n = new Q({
|
|
9846
9851
|
state: {
|
|
9847
9852
|
init() {
|
|
@@ -9913,11 +9918,11 @@ function Hc(r) {
|
|
|
9913
9918
|
});
|
|
9914
9919
|
return n;
|
|
9915
9920
|
}
|
|
9916
|
-
function
|
|
9921
|
+
function qc(r) {
|
|
9917
9922
|
return Object.prototype.toString.call(r).slice(8, -1);
|
|
9918
9923
|
}
|
|
9919
9924
|
function It(r) {
|
|
9920
|
-
return
|
|
9925
|
+
return qc(r) !== "Object" ? !1 : r.constructor === Object && Object.getPrototypeOf(r) === Object.prototype;
|
|
9921
9926
|
}
|
|
9922
9927
|
function fn(r, e) {
|
|
9923
9928
|
const t = { ...r };
|
|
@@ -9971,10 +9976,10 @@ class Ct {
|
|
|
9971
9976
|
return !1;
|
|
9972
9977
|
}
|
|
9973
9978
|
}
|
|
9974
|
-
function
|
|
9979
|
+
function Kc(r) {
|
|
9975
9980
|
return typeof r == "number";
|
|
9976
9981
|
}
|
|
9977
|
-
const
|
|
9982
|
+
const Uc = (r, e, t) => {
|
|
9978
9983
|
if (wr(e))
|
|
9979
9984
|
return [...r.matchAll(e)];
|
|
9980
9985
|
const n = e(r, t);
|
|
@@ -9983,7 +9988,7 @@ const qc = (r, e, t) => {
|
|
|
9983
9988
|
return s.index = i.index, s.input = r, s.data = i.data, i.replaceWith && (i.text.includes(i.replaceWith) || console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'), s.push(i.replaceWith)), s;
|
|
9984
9989
|
}) : [];
|
|
9985
9990
|
};
|
|
9986
|
-
function
|
|
9991
|
+
function _c(r) {
|
|
9987
9992
|
const { editor: e, state: t, from: n, to: i, rule: s, pasteEvent: o, dropEvent: l } = r, { commands: a, chain: c, can: u } = new un({
|
|
9988
9993
|
editor: e,
|
|
9989
9994
|
state: t
|
|
@@ -9992,11 +9997,11 @@ function Kc(r) {
|
|
|
9992
9997
|
if (!h.isTextblock || h.type.spec.code)
|
|
9993
9998
|
return;
|
|
9994
9999
|
const m = Math.max(n, p), g = Math.min(i, p + h.content.size), y = h.textBetween(m - p, g - p, void 0, "");
|
|
9995
|
-
|
|
10000
|
+
Uc(y, s.find, o).forEach((w) => {
|
|
9996
10001
|
if (w.index === void 0)
|
|
9997
10002
|
return;
|
|
9998
|
-
const
|
|
9999
|
-
from: t.tr.mapping.map(
|
|
10003
|
+
const D = m + w.index + 1, A = D + w[0].length, M = {
|
|
10004
|
+
from: t.tr.mapping.map(D),
|
|
10000
10005
|
to: t.tr.mapping.map(A)
|
|
10001
10006
|
}, I = s.handler({
|
|
10002
10007
|
state: t,
|
|
@@ -10013,14 +10018,14 @@ function Kc(r) {
|
|
|
10013
10018
|
}), d.every((h) => h !== null);
|
|
10014
10019
|
}
|
|
10015
10020
|
let Pt = null;
|
|
10016
|
-
const
|
|
10021
|
+
const Gc = (r) => {
|
|
10017
10022
|
var e;
|
|
10018
10023
|
const t = new ClipboardEvent("paste", {
|
|
10019
10024
|
clipboardData: new DataTransfer()
|
|
10020
10025
|
});
|
|
10021
10026
|
return (e = t.clipboardData) === null || e === void 0 || e.setData("text/html", r), t;
|
|
10022
10027
|
};
|
|
10023
|
-
function
|
|
10028
|
+
function Yc(r) {
|
|
10024
10029
|
const { editor: e, rules: t } = r;
|
|
10025
10030
|
let n = null, i = !1, s = !1, o = typeof ClipboardEvent < "u" ? new ClipboardEvent("paste") : null, l;
|
|
10026
10031
|
try {
|
|
@@ -10033,7 +10038,7 @@ function _c(r) {
|
|
|
10033
10038
|
state: u,
|
|
10034
10039
|
transaction: m
|
|
10035
10040
|
});
|
|
10036
|
-
if (!(!
|
|
10041
|
+
if (!(!_c({
|
|
10037
10042
|
editor: e,
|
|
10038
10043
|
state: g,
|
|
10039
10044
|
from: Math.max(d - 1, 0),
|
|
@@ -10091,7 +10096,7 @@ function _c(r) {
|
|
|
10091
10096
|
if (S) {
|
|
10092
10097
|
let { text: A } = y;
|
|
10093
10098
|
typeof A == "string" ? A = A : A = Cr(b.from(A), h.schema);
|
|
10094
|
-
const { from: M } = y, I = M + A.length, H =
|
|
10099
|
+
const { from: M } = y, I = M + A.length, H = Gc(A);
|
|
10095
10100
|
return a({
|
|
10096
10101
|
rule: u,
|
|
10097
10102
|
state: h,
|
|
@@ -10100,25 +10105,25 @@ function _c(r) {
|
|
|
10100
10105
|
pasteEvt: H
|
|
10101
10106
|
});
|
|
10102
10107
|
}
|
|
10103
|
-
const w = f.doc.content.findDiffStart(h.doc.content),
|
|
10104
|
-
if (!(!
|
|
10108
|
+
const w = f.doc.content.findDiffStart(h.doc.content), D = f.doc.content.findDiffEnd(h.doc.content);
|
|
10109
|
+
if (!(!Kc(w) || !D || w === D.b))
|
|
10105
10110
|
return a({
|
|
10106
10111
|
rule: u,
|
|
10107
10112
|
state: h,
|
|
10108
10113
|
from: w,
|
|
10109
|
-
to:
|
|
10114
|
+
to: D,
|
|
10110
10115
|
pasteEvt: o
|
|
10111
10116
|
});
|
|
10112
10117
|
}
|
|
10113
10118
|
}));
|
|
10114
10119
|
}
|
|
10115
|
-
function
|
|
10120
|
+
function Xc(r) {
|
|
10116
10121
|
const e = r.filter((t, n) => r.indexOf(t) !== n);
|
|
10117
10122
|
return Array.from(new Set(e));
|
|
10118
10123
|
}
|
|
10119
10124
|
class Xe {
|
|
10120
10125
|
constructor(e, t) {
|
|
10121
|
-
this.splittableMarks = [], this.editor = t, this.extensions = Xe.resolve(e), this.schema =
|
|
10126
|
+
this.splittableMarks = [], this.editor = t, this.extensions = Xe.resolve(e), this.schema = Vc(this.extensions, t), this.setupExtensions();
|
|
10122
10127
|
}
|
|
10123
10128
|
/**
|
|
10124
10129
|
* Returns a flattened and sorted extension list while
|
|
@@ -10127,7 +10132,7 @@ class Xe {
|
|
|
10127
10132
|
* @returns An flattened and sorted array of Tiptap extensions
|
|
10128
10133
|
*/
|
|
10129
10134
|
static resolve(e) {
|
|
10130
|
-
const t = Xe.sort(Xe.flatten(e)), n =
|
|
10135
|
+
const t = Xe.sort(Xe.flatten(e)), n = Xc(t.map((i) => i.name));
|
|
10131
10136
|
return n.length && console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map((i) => `'${i}'`).join(", ")}]. This can lead to issues.`), t;
|
|
10132
10137
|
}
|
|
10133
10138
|
/**
|
|
@@ -10193,7 +10198,7 @@ class Xe {
|
|
|
10193
10198
|
const m = Object.fromEntries(Object.entries(c()).map(([g, y]) => [g, () => y({ editor: e })]));
|
|
10194
10199
|
u = { ...u, ...m };
|
|
10195
10200
|
}
|
|
10196
|
-
const d =
|
|
10201
|
+
const d = pc(u);
|
|
10197
10202
|
a.push(d);
|
|
10198
10203
|
const f = x(o, "addInputRules", l);
|
|
10199
10204
|
vi(o, e.options.enableInputRules) && f && n.push(...f());
|
|
@@ -10207,11 +10212,11 @@ class Xe {
|
|
|
10207
10212
|
return a;
|
|
10208
10213
|
}).flat();
|
|
10209
10214
|
return [
|
|
10210
|
-
|
|
10215
|
+
Jc({
|
|
10211
10216
|
editor: e,
|
|
10212
10217
|
rules: n
|
|
10213
10218
|
}),
|
|
10214
|
-
...
|
|
10219
|
+
...Yc({
|
|
10215
10220
|
editor: e,
|
|
10216
10221
|
rules: i
|
|
10217
10222
|
}),
|
|
@@ -10280,7 +10285,7 @@ class Xe {
|
|
|
10280
10285
|
});
|
|
10281
10286
|
}
|
|
10282
10287
|
}
|
|
10283
|
-
class
|
|
10288
|
+
class q {
|
|
10284
10289
|
constructor(e = {}) {
|
|
10285
10290
|
this.type = "extension", this.name = "extension", this.parent = null, this.child = null, this.config = {
|
|
10286
10291
|
name: this.name,
|
|
@@ -10296,7 +10301,7 @@ class Y {
|
|
|
10296
10301
|
})) || {};
|
|
10297
10302
|
}
|
|
10298
10303
|
static create(e = {}) {
|
|
10299
|
-
return new
|
|
10304
|
+
return new q(e);
|
|
10300
10305
|
}
|
|
10301
10306
|
configure(e = {}) {
|
|
10302
10307
|
const t = this.extend({
|
|
@@ -10306,7 +10311,7 @@ class Y {
|
|
|
10306
10311
|
return t.name = this.name, t.parent = this.parent, t;
|
|
10307
10312
|
}
|
|
10308
10313
|
extend(e = {}) {
|
|
10309
|
-
const t = new
|
|
10314
|
+
const t = new q({ ...this.config, ...e });
|
|
10310
10315
|
return t.parent = this, this.child = t, t.name = e.name ? e.name : t.parent.name, e.defaultOptions && Object.keys(e.defaultOptions).length > 0 && console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${t.name}".`), t.options = N(x(t, "addOptions", {
|
|
10311
10316
|
name: t.name
|
|
10312
10317
|
})), t.storage = N(x(t, "addStorage", {
|
|
@@ -10338,7 +10343,7 @@ function po(r, e, t) {
|
|
|
10338
10343
|
function mo(r) {
|
|
10339
10344
|
return Object.fromEntries(Object.entries(r.nodes).filter(([, e]) => e.spec.toText).map(([e, t]) => [e, t.spec.toText]));
|
|
10340
10345
|
}
|
|
10341
|
-
const
|
|
10346
|
+
const Zc = q.create({
|
|
10342
10347
|
name: "clipboardTextSerializer",
|
|
10343
10348
|
addOptions() {
|
|
10344
10349
|
return {
|
|
@@ -10361,10 +10366,10 @@ const Yc = Y.create({
|
|
|
10361
10366
|
})
|
|
10362
10367
|
];
|
|
10363
10368
|
}
|
|
10364
|
-
}),
|
|
10369
|
+
}), Qc = () => ({ editor: r, view: e }) => (requestAnimationFrame(() => {
|
|
10365
10370
|
var t;
|
|
10366
10371
|
r.isDestroyed || (e.dom.blur(), (t = window == null ? void 0 : window.getSelection()) === null || t === void 0 || t.removeAllRanges());
|
|
10367
|
-
}), !0),
|
|
10372
|
+
}), !0), eu = (r = !1) => ({ commands: e }) => e.setContent("", r), tu = () => ({ state: r, tr: e, dispatch: t }) => {
|
|
10368
10373
|
const { selection: n } = e, { ranges: i } = n;
|
|
10369
10374
|
return t && i.forEach(({ $from: s, $to: o }) => {
|
|
10370
10375
|
r.doc.nodesBetween(s.pos, o.pos, (l, a) => {
|
|
@@ -10381,12 +10386,12 @@ const Yc = Y.create({
|
|
|
10381
10386
|
(p || p === 0) && e.lift(h, p);
|
|
10382
10387
|
});
|
|
10383
10388
|
}), !0;
|
|
10384
|
-
},
|
|
10389
|
+
}, nu = (r) => (e) => r(e), ru = () => ({ state: r, dispatch: e }) => lo(r, e), iu = (r, e) => ({ editor: t, tr: n }) => {
|
|
10385
10390
|
const { state: i } = t, s = i.doc.slice(r.from, r.to);
|
|
10386
10391
|
n.deleteRange(r.from, r.to);
|
|
10387
10392
|
const o = n.mapping.map(e);
|
|
10388
10393
|
return n.insert(o, s.content), n.setSelection(new T(n.doc.resolve(o - 1))), !0;
|
|
10389
|
-
},
|
|
10394
|
+
}, su = () => ({ tr: r, dispatch: e }) => {
|
|
10390
10395
|
const { selection: t } = r, n = t.$anchor.node();
|
|
10391
10396
|
if (n.content.size > 0)
|
|
10392
10397
|
return !1;
|
|
@@ -10400,7 +10405,7 @@ const Yc = Y.create({
|
|
|
10400
10405
|
return !0;
|
|
10401
10406
|
}
|
|
10402
10407
|
return !1;
|
|
10403
|
-
},
|
|
10408
|
+
}, ou = (r) => ({ tr: e, state: t, dispatch: n }) => {
|
|
10404
10409
|
const i = L(r, t.schema), s = e.selection.$anchor;
|
|
10405
10410
|
for (let o = s.depth; o > 0; o -= 1)
|
|
10406
10411
|
if (s.node(o).type === i) {
|
|
@@ -10411,10 +10416,10 @@ const Yc = Y.create({
|
|
|
10411
10416
|
return !0;
|
|
10412
10417
|
}
|
|
10413
10418
|
return !1;
|
|
10414
|
-
},
|
|
10419
|
+
}, lu = (r) => ({ tr: e, dispatch: t }) => {
|
|
10415
10420
|
const { from: n, to: i } = r;
|
|
10416
10421
|
return t && e.delete(n, i), !0;
|
|
10417
|
-
},
|
|
10422
|
+
}, au = () => ({ state: r, dispatch: e }) => yr(r, e), cu = () => ({ commands: r }) => r.keyboardShortcut("Enter"), uu = () => ({ state: r, dispatch: e }) => Sc(r, e);
|
|
10418
10423
|
function Zt(r, e, t = { strict: !0 }) {
|
|
10419
10424
|
const n = Object.keys(e);
|
|
10420
10425
|
return n.length ? n.every((i) => t.strict ? e[i] === r[i] : wr(e[i]) ? e[i].test(r[i]) : e[i] === r[i]) : !0;
|
|
@@ -10454,7 +10459,7 @@ function ve(r, e) {
|
|
|
10454
10459
|
}
|
|
10455
10460
|
return r;
|
|
10456
10461
|
}
|
|
10457
|
-
const
|
|
10462
|
+
const du = (r, e = {}) => ({ tr: t, state: n, dispatch: i }) => {
|
|
10458
10463
|
const s = ve(r, n.schema), { doc: o, selection: l } = t, { $from: a, from: c, to: u } = l;
|
|
10459
10464
|
if (i) {
|
|
10460
10465
|
const d = Mr(a, s, e);
|
|
@@ -10464,7 +10469,7 @@ const cu = (r, e = {}) => ({ tr: t, state: n, dispatch: i }) => {
|
|
|
10464
10469
|
}
|
|
10465
10470
|
}
|
|
10466
10471
|
return !0;
|
|
10467
|
-
},
|
|
10472
|
+
}, fu = (r) => (e) => {
|
|
10468
10473
|
const t = typeof r == "function" ? r(e) : r;
|
|
10469
10474
|
for (let n = 0; n < t.length; n += 1)
|
|
10470
10475
|
if (t[n](e))
|
|
@@ -10488,7 +10493,7 @@ function bo(r, e = null) {
|
|
|
10488
10493
|
const i = t.from, s = n.to;
|
|
10489
10494
|
return e === "all" ? T.create(r, Be(0, i, s), Be(r.content.size, i, s)) : T.create(r, Be(e, i, s), Be(e, i, s));
|
|
10490
10495
|
}
|
|
10491
|
-
function
|
|
10496
|
+
function hu() {
|
|
10492
10497
|
return navigator.platform === "Android" || /android/i.test(navigator.userAgent);
|
|
10493
10498
|
}
|
|
10494
10499
|
function Er() {
|
|
@@ -10501,13 +10506,13 @@ function Er() {
|
|
|
10501
10506
|
"iPod"
|
|
10502
10507
|
].includes(navigator.platform) || navigator.userAgent.includes("Mac") && "ontouchend" in document;
|
|
10503
10508
|
}
|
|
10504
|
-
const
|
|
10509
|
+
const pu = (r = null, e = {}) => ({ editor: t, view: n, tr: i, dispatch: s }) => {
|
|
10505
10510
|
e = {
|
|
10506
10511
|
scrollIntoView: !0,
|
|
10507
10512
|
...e
|
|
10508
10513
|
};
|
|
10509
10514
|
const o = () => {
|
|
10510
|
-
(Er() ||
|
|
10515
|
+
(Er() || hu()) && n.dom.focus(), requestAnimationFrame(() => {
|
|
10511
10516
|
t.isDestroyed || (n.focus(), e != null && e.scrollIntoView && t.commands.scrollIntoView());
|
|
10512
10517
|
});
|
|
10513
10518
|
};
|
|
@@ -10517,7 +10522,7 @@ const fu = (r = null, e = {}) => ({ editor: t, view: n, tr: i, dispatch: s }) =>
|
|
|
10517
10522
|
return o(), !0;
|
|
10518
10523
|
const l = bo(i.doc, r) || t.state.selection, a = t.state.selection.eq(l);
|
|
10519
10524
|
return s && (a || i.setSelection(l), a && i.storedMarks && i.setStoredMarks(i.storedMarks), o()), !0;
|
|
10520
|
-
},
|
|
10525
|
+
}, mu = (r, e) => (t) => r.every((n, i) => e(n, { ...t, index: i })), gu = (r, e) => ({ tr: t, commands: n }) => n.insertContentAt({ from: t.selection.from, to: t.selection.to }, r, e), ko = (r) => {
|
|
10521
10526
|
const e = r.childNodes;
|
|
10522
10527
|
for (let t = e.length - 1; t >= 0; t -= 1) {
|
|
10523
10528
|
const n = e[t];
|
|
@@ -10530,7 +10535,7 @@ function Rt(r) {
|
|
|
10530
10535
|
return ko(t);
|
|
10531
10536
|
}
|
|
10532
10537
|
function Qt(r, e, t) {
|
|
10533
|
-
if (r instanceof
|
|
10538
|
+
if (r instanceof ue || r instanceof b)
|
|
10534
10539
|
return r;
|
|
10535
10540
|
t = {
|
|
10536
10541
|
slice: !0,
|
|
@@ -10578,7 +10583,7 @@ function Qt(r, e, t) {
|
|
|
10578
10583
|
}
|
|
10579
10584
|
return Qt("", e, t);
|
|
10580
10585
|
}
|
|
10581
|
-
function
|
|
10586
|
+
function yu(r, e, t) {
|
|
10582
10587
|
const n = r.steps.length - 1;
|
|
10583
10588
|
if (n < e)
|
|
10584
10589
|
return;
|
|
@@ -10591,7 +10596,7 @@ function mu(r, e, t) {
|
|
|
10591
10596
|
o === 0 && (o = u);
|
|
10592
10597
|
}), r.setSelection(O.near(r.doc.resolve(o), t));
|
|
10593
10598
|
}
|
|
10594
|
-
const
|
|
10599
|
+
const bu = (r) => !("type" in r), ku = (r, e, t) => ({ tr: n, dispatch: i, editor: s }) => {
|
|
10595
10600
|
var o;
|
|
10596
10601
|
if (i) {
|
|
10597
10602
|
t = {
|
|
@@ -10620,7 +10625,7 @@ const gu = (r) => !("type" in r), yu = (r, e, t) => ({ tr: n, dispatch: i, edito
|
|
|
10620
10625
|
}), !1;
|
|
10621
10626
|
}
|
|
10622
10627
|
let { from: a, to: c } = typeof r == "number" ? { from: r, to: r } : { from: r.from, to: r.to }, u = !0, d = !0;
|
|
10623
|
-
if ((
|
|
10628
|
+
if ((bu(l) ? l : [l]).forEach((p) => {
|
|
10624
10629
|
p.check(), u = u ? p.isText && p.marks.length === 0 : !1, d = d ? p.isBlock : !1;
|
|
10625
10630
|
}), a === c && d) {
|
|
10626
10631
|
const { parent: p } = n.doc.resolve(a);
|
|
@@ -10639,28 +10644,28 @@ const gu = (r) => !("type" in r), yu = (r, e, t) => ({ tr: n, dispatch: i, edito
|
|
|
10639
10644
|
n.insertText(h, a, c);
|
|
10640
10645
|
} else
|
|
10641
10646
|
h = l, n.replaceWith(a, c, h);
|
|
10642
|
-
t.updateSelection &&
|
|
10647
|
+
t.updateSelection && yu(n, n.steps.length - 1, -1), t.applyInputRules && n.setMeta("applyInputRules", { from: a, text: h }), t.applyPasteRules && n.setMeta("applyPasteRules", { from: a, text: h });
|
|
10643
10648
|
}
|
|
10644
10649
|
return !0;
|
|
10645
|
-
},
|
|
10650
|
+
}, xu = () => ({ state: r, dispatch: e }) => bc(r, e), Su = () => ({ state: r, dispatch: e }) => kc(r, e), Cu = () => ({ state: r, dispatch: e }) => eo(r, e), wu = () => ({ state: r, dispatch: e }) => io(r, e), Mu = () => ({ state: r, dispatch: e, tr: t }) => {
|
|
10646
10651
|
try {
|
|
10647
10652
|
const n = nn(r.doc, r.selection.$from.pos, -1);
|
|
10648
10653
|
return n == null ? !1 : (t.join(n, 2), e && e(t), !0);
|
|
10649
10654
|
} catch {
|
|
10650
10655
|
return !1;
|
|
10651
10656
|
}
|
|
10652
|
-
},
|
|
10657
|
+
}, Eu = () => ({ state: r, dispatch: e, tr: t }) => {
|
|
10653
10658
|
try {
|
|
10654
10659
|
const n = nn(r.doc, r.selection.$from.pos, 1);
|
|
10655
10660
|
return n == null ? !1 : (t.join(n, 2), e && e(t), !0);
|
|
10656
10661
|
} catch {
|
|
10657
10662
|
return !1;
|
|
10658
10663
|
}
|
|
10659
|
-
},
|
|
10664
|
+
}, Tu = () => ({ state: r, dispatch: e }) => gc(r, e), Ou = () => ({ state: r, dispatch: e }) => yc(r, e);
|
|
10660
10665
|
function xo() {
|
|
10661
10666
|
return typeof navigator < "u" ? /Mac/.test(navigator.platform) : !1;
|
|
10662
10667
|
}
|
|
10663
|
-
function
|
|
10668
|
+
function Nu(r) {
|
|
10664
10669
|
const e = r.split(/-(?!$)/);
|
|
10665
10670
|
let t = e[e.length - 1];
|
|
10666
10671
|
t === "Space" && (t = " ");
|
|
@@ -10682,8 +10687,8 @@ function Tu(r) {
|
|
|
10682
10687
|
}
|
|
10683
10688
|
return n && (t = `Alt-${t}`), i && (t = `Ctrl-${t}`), o && (t = `Meta-${t}`), s && (t = `Shift-${t}`), t;
|
|
10684
10689
|
}
|
|
10685
|
-
const
|
|
10686
|
-
const s =
|
|
10690
|
+
const Au = (r) => ({ editor: e, view: t, tr: n, dispatch: i }) => {
|
|
10691
|
+
const s = Nu(r).split(/-(?!$)/), o = s.find((c) => !["Alt", "Ctrl", "Meta", "Shift"].includes(c)), l = new KeyboardEvent("keydown", {
|
|
10687
10692
|
key: o === "Space" ? " " : o,
|
|
10688
10693
|
altKey: s.includes("Alt"),
|
|
10689
10694
|
ctrlKey: s.includes("Ctrl"),
|
|
@@ -10714,13 +10719,13 @@ function wt(r, e, t = {}) {
|
|
|
10714
10719
|
const a = i - n, c = l.filter((d) => o ? o.name === d.node.type.name : !0).filter((d) => Zt(d.node.attrs, t, { strict: !1 }));
|
|
10715
10720
|
return s ? !!c.length : c.reduce((d, f) => d + f.to - f.from, 0) >= a;
|
|
10716
10721
|
}
|
|
10717
|
-
const
|
|
10722
|
+
const vu = (r, e = {}) => ({ state: t, dispatch: n }) => {
|
|
10718
10723
|
const i = L(r, t.schema);
|
|
10719
|
-
return wt(t, i, e) ?
|
|
10720
|
-
},
|
|
10724
|
+
return wt(t, i, e) ? xc(t, n) : !1;
|
|
10725
|
+
}, Du = () => ({ state: r, dispatch: e }) => ao(r, e), Iu = (r) => ({ state: e, dispatch: t }) => {
|
|
10721
10726
|
const n = L(r, e.schema);
|
|
10722
|
-
return
|
|
10723
|
-
},
|
|
10727
|
+
return Ic(n)(e, t);
|
|
10728
|
+
}, Pu = () => ({ state: r, dispatch: e }) => oo(r, e);
|
|
10724
10729
|
function hn(r, e) {
|
|
10725
10730
|
return e.nodes[r] ? "node" : e.marks[r] ? "mark" : null;
|
|
10726
10731
|
}
|
|
@@ -10728,7 +10733,7 @@ function Ii(r, e) {
|
|
|
10728
10733
|
const t = typeof e == "string" ? [e] : e;
|
|
10729
10734
|
return Object.keys(r).reduce((n, i) => (t.includes(i) || (n[i] = r[i]), n), {});
|
|
10730
10735
|
}
|
|
10731
|
-
const
|
|
10736
|
+
const Ru = (r, e) => ({ tr: t, state: n, dispatch: i }) => {
|
|
10732
10737
|
let s = null, o = null;
|
|
10733
10738
|
const l = hn(typeof r == "string" ? r : r.name, n.schema);
|
|
10734
10739
|
return l ? (l === "node" && (s = L(r, n.schema)), l === "mark" && (o = ve(r, n.schema)), i && t.selection.ranges.forEach((a) => {
|
|
@@ -10738,13 +10743,13 @@ const Iu = (r, e) => ({ tr: t, state: n, dispatch: i }) => {
|
|
|
10738
10743
|
});
|
|
10739
10744
|
});
|
|
10740
10745
|
}), !0) : !1;
|
|
10741
|
-
},
|
|
10746
|
+
}, Bu = () => ({ tr: r, dispatch: e }) => (e && r.scrollIntoView(), !0), zu = () => ({ tr: r, dispatch: e }) => {
|
|
10742
10747
|
if (e) {
|
|
10743
10748
|
const t = new Z(r.doc);
|
|
10744
10749
|
r.setSelection(t);
|
|
10745
10750
|
}
|
|
10746
10751
|
return !0;
|
|
10747
|
-
},
|
|
10752
|
+
}, Fu = () => ({ state: r, dispatch: e }) => no(r, e), Lu = () => ({ state: r, dispatch: e }) => so(r, e), $u = () => ({ state: r, dispatch: e }) => Mc(r, e), Vu = () => ({ state: r, dispatch: e }) => Oc(r, e), ju = () => ({ state: r, dispatch: e }) => Tc(r, e);
|
|
10748
10753
|
function er(r, e, t = {}, n = {}) {
|
|
10749
10754
|
return Qt(r, e, {
|
|
10750
10755
|
slice: !1,
|
|
@@ -10752,7 +10757,7 @@ function er(r, e, t = {}, n = {}) {
|
|
|
10752
10757
|
errorOnInvalidContent: n.errorOnInvalidContent
|
|
10753
10758
|
});
|
|
10754
10759
|
}
|
|
10755
|
-
const
|
|
10760
|
+
const Hu = (r, e = !1, t = {}, n = {}) => ({ editor: i, tr: s, dispatch: o, commands: l }) => {
|
|
10756
10761
|
var a, c;
|
|
10757
10762
|
const { doc: u } = s;
|
|
10758
10763
|
if (t.preserveWhitespace !== "full") {
|
|
@@ -10774,7 +10779,7 @@ function So(r, e) {
|
|
|
10774
10779
|
const l = o.find((a) => a.type.name === t.name);
|
|
10775
10780
|
return l ? { ...l.attrs } : {};
|
|
10776
10781
|
}
|
|
10777
|
-
function
|
|
10782
|
+
function Wu(r) {
|
|
10778
10783
|
for (let e = 0; e < r.edgeCount; e += 1) {
|
|
10779
10784
|
const { type: t } = r.edge(e);
|
|
10780
10785
|
if (t.isTextblock && !t.hasRequiredAttrs())
|
|
@@ -10797,14 +10802,14 @@ function pt(r, e) {
|
|
|
10797
10802
|
function Tr(r) {
|
|
10798
10803
|
return (e) => pt(e.$from, r);
|
|
10799
10804
|
}
|
|
10800
|
-
function
|
|
10805
|
+
function Ju(r, e) {
|
|
10801
10806
|
const t = {
|
|
10802
10807
|
from: 0,
|
|
10803
10808
|
to: r.content.size
|
|
10804
10809
|
};
|
|
10805
10810
|
return po(r, t, e);
|
|
10806
10811
|
}
|
|
10807
|
-
function
|
|
10812
|
+
function qu(r, e) {
|
|
10808
10813
|
const t = L(e, r.schema), { from: n, to: i } = r.selection, s = [];
|
|
10809
10814
|
r.doc.nodesBetween(n, i, (l) => {
|
|
10810
10815
|
s.push(l);
|
|
@@ -10812,9 +10817,9 @@ function Wu(r, e) {
|
|
|
10812
10817
|
const o = s.reverse().find((l) => l.type.name === t.name);
|
|
10813
10818
|
return o ? { ...o.attrs } : {};
|
|
10814
10819
|
}
|
|
10815
|
-
function
|
|
10820
|
+
function Ku(r, e) {
|
|
10816
10821
|
const t = hn(typeof e == "string" ? e : e.name, r.schema);
|
|
10817
|
-
return t === "node" ?
|
|
10822
|
+
return t === "node" ? qu(r, e) : t === "mark" ? So(r, e) : {};
|
|
10818
10823
|
}
|
|
10819
10824
|
function Lt(r, e, t) {
|
|
10820
10825
|
return Object.fromEntries(Object.entries(t).filter(([n]) => {
|
|
@@ -10834,8 +10839,8 @@ function tr(r, e, t = {}) {
|
|
|
10834
10839
|
if (!m.isText && !m.marks.length)
|
|
10835
10840
|
return;
|
|
10836
10841
|
const y = Math.max(h, g), S = Math.min(p, g + m.nodeSize), w = S - y;
|
|
10837
|
-
o += w, l.push(...m.marks.map((
|
|
10838
|
-
mark:
|
|
10842
|
+
o += w, l.push(...m.marks.map((D) => ({
|
|
10843
|
+
mark: D,
|
|
10839
10844
|
from: y,
|
|
10840
10845
|
to: S
|
|
10841
10846
|
})));
|
|
@@ -10845,7 +10850,7 @@ function tr(r, e, t = {}) {
|
|
|
10845
10850
|
const a = l.filter((d) => s ? s.name === d.mark.type.name : !0).filter((d) => Zt(d.mark.attrs, t, { strict: !1 })).reduce((d, f) => d + f.to - f.from, 0), c = l.filter((d) => s ? d.mark.type !== s && d.mark.type.excludes(s) : !0).reduce((d, f) => d + f.to - f.from, 0);
|
|
10846
10851
|
return (a > 0 ? a + c : a) >= o;
|
|
10847
10852
|
}
|
|
10848
|
-
function
|
|
10853
|
+
function Uu(r, e, t = {}) {
|
|
10849
10854
|
if (!e)
|
|
10850
10855
|
return wt(r, null, t) || tr(r, null, t);
|
|
10851
10856
|
const n = hn(e, r.schema);
|
|
@@ -10884,7 +10889,7 @@ function pn(r, { checkChildren: e = !0, ignoreWhitespace: t = !1 } = {}) {
|
|
|
10884
10889
|
}
|
|
10885
10890
|
return !1;
|
|
10886
10891
|
}
|
|
10887
|
-
function
|
|
10892
|
+
function _u(r, e, t) {
|
|
10888
10893
|
var n;
|
|
10889
10894
|
const { selection: i } = e;
|
|
10890
10895
|
let s = null;
|
|
@@ -10906,7 +10911,7 @@ function Ku(r, e, t) {
|
|
|
10906
10911
|
}), c;
|
|
10907
10912
|
});
|
|
10908
10913
|
}
|
|
10909
|
-
const
|
|
10914
|
+
const Gu = (r, e = {}) => ({ tr: t, state: n, dispatch: i }) => {
|
|
10910
10915
|
const { selection: s } = t, { empty: o, ranges: l } = s, a = ve(r, n.schema);
|
|
10911
10916
|
if (i)
|
|
10912
10917
|
if (o) {
|
|
@@ -10928,26 +10933,26 @@ const Uu = (r, e = {}) => ({ tr: t, state: n, dispatch: i }) => {
|
|
|
10928
10933
|
}) : t.addMark(p, m, a.create(e));
|
|
10929
10934
|
});
|
|
10930
10935
|
});
|
|
10931
|
-
return
|
|
10932
|
-
},
|
|
10936
|
+
return _u(n, t, a);
|
|
10937
|
+
}, Yu = (r, e) => ({ tr: t }) => (t.setMeta(r, e), !0), Xu = (r, e = {}) => ({ state: t, dispatch: n, chain: i }) => {
|
|
10933
10938
|
const s = L(r, t.schema);
|
|
10934
10939
|
let o;
|
|
10935
10940
|
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);
|
|
10936
|
-
},
|
|
10941
|
+
}, Zu = (r) => ({ tr: e, dispatch: t }) => {
|
|
10937
10942
|
if (t) {
|
|
10938
10943
|
const { doc: n } = e, i = Be(r, 0, n.content.size), s = C.create(n, i);
|
|
10939
10944
|
e.setSelection(s);
|
|
10940
10945
|
}
|
|
10941
10946
|
return !0;
|
|
10942
|
-
},
|
|
10947
|
+
}, Qu = (r) => ({ tr: e, dispatch: t }) => {
|
|
10943
10948
|
if (t) {
|
|
10944
10949
|
const { doc: n } = e, { from: i, to: s } = typeof r == "number" ? { from: r, to: r } : r, o = T.atStart(n).from, l = T.atEnd(n).to, a = Be(i, o, l), c = Be(s, o, l), u = T.create(n, a, c);
|
|
10945
10950
|
e.setSelection(u);
|
|
10946
10951
|
}
|
|
10947
10952
|
return !0;
|
|
10948
|
-
},
|
|
10953
|
+
}, ed = (r) => ({ state: e, dispatch: t }) => {
|
|
10949
10954
|
const n = L(r, e.schema);
|
|
10950
|
-
return
|
|
10955
|
+
return Bc(n)(e, t);
|
|
10951
10956
|
};
|
|
10952
10957
|
function Ri(r, e) {
|
|
10953
10958
|
const t = r.storedMarks || r.selection.$to.parentOffset && r.selection.$from.marks();
|
|
@@ -10956,20 +10961,20 @@ function Ri(r, e) {
|
|
|
10956
10961
|
r.tr.ensureMarks(n);
|
|
10957
10962
|
}
|
|
10958
10963
|
}
|
|
10959
|
-
const
|
|
10964
|
+
const td = ({ keepMarks: r = !0 } = {}) => ({ tr: e, state: t, dispatch: n, editor: i }) => {
|
|
10960
10965
|
const { selection: s, doc: o } = e, { $from: l, $to: a } = s, c = i.extensionManager.attributes, u = Lt(c, l.node().type.name, l.node().attrs);
|
|
10961
10966
|
if (s instanceof C && s.node.isBlock)
|
|
10962
|
-
return !l.parentOffset || !
|
|
10967
|
+
return !l.parentOffset || !ge(o, l.pos) ? !1 : (n && (r && Ri(t, i.extensionManager.splittableMarks), e.split(l.pos).scrollIntoView()), !0);
|
|
10963
10968
|
if (!l.parent.isBlock)
|
|
10964
10969
|
return !1;
|
|
10965
|
-
const d = a.parentOffset === a.parent.content.size, f = l.depth === 0 ? void 0 :
|
|
10970
|
+
const d = a.parentOffset === a.parent.content.size, f = l.depth === 0 ? void 0 : Wu(l.node(-1).contentMatchAt(l.indexAfter(-1)));
|
|
10966
10971
|
let h = d && f ? [
|
|
10967
10972
|
{
|
|
10968
10973
|
type: f,
|
|
10969
10974
|
attrs: u
|
|
10970
10975
|
}
|
|
10971
|
-
] : void 0, p =
|
|
10972
|
-
if (!h && !p &&
|
|
10976
|
+
] : void 0, p = ge(e.doc, e.mapping.map(l.pos), 1, h);
|
|
10977
|
+
if (!h && !p && ge(e.doc, e.mapping.map(l.pos), 1, f ? [{ type: f }] : void 0) && (p = !0, h = f ? [
|
|
10973
10978
|
{
|
|
10974
10979
|
type: f,
|
|
10975
10980
|
attrs: u
|
|
@@ -10982,7 +10987,7 @@ const Qu = ({ keepMarks: r = !0 } = {}) => ({ tr: e, state: t, dispatch: n, edit
|
|
|
10982
10987
|
r && Ri(t, i.extensionManager.splittableMarks), e.scrollIntoView();
|
|
10983
10988
|
}
|
|
10984
10989
|
return p;
|
|
10985
|
-
},
|
|
10990
|
+
}, nd = (r, e = {}) => ({ tr: t, state: n, dispatch: i, editor: s }) => {
|
|
10986
10991
|
var o;
|
|
10987
10992
|
const l = L(r, n.schema), { $from: a, $to: c } = n.selection, u = n.selection.node;
|
|
10988
10993
|
if (u && u.isBlock || a.depth < 2 || !a.sameParent(c))
|
|
@@ -10999,10 +11004,10 @@ const Qu = ({ keepMarks: r = !0 } = {}) => ({ tr: e, state: t, dispatch: n, edit
|
|
|
10999
11004
|
const S = a.index(-1) ? 1 : a.index(-2) ? 2 : 3;
|
|
11000
11005
|
for (let H = a.depth - S; H >= a.depth - 3; H -= 1)
|
|
11001
11006
|
y = b.from(a.node(H).copy(y));
|
|
11002
|
-
const w = a.indexAfter(-1) < a.node(-2).childCount ? 1 : a.indexAfter(-2) < a.node(-3).childCount ? 2 : 3,
|
|
11007
|
+
const w = a.indexAfter(-1) < a.node(-2).childCount ? 1 : a.indexAfter(-2) < a.node(-3).childCount ? 2 : 3, D = {
|
|
11003
11008
|
...Lt(f, a.node().type.name, a.node().attrs),
|
|
11004
11009
|
...e
|
|
11005
|
-
}, A = ((o = l.contentMatch.defaultType) === null || o === void 0 ? void 0 : o.createAndFill(
|
|
11010
|
+
}, A = ((o = l.contentMatch.defaultType) === null || o === void 0 ? void 0 : o.createAndFill(D)) || void 0;
|
|
11006
11011
|
y = y.append(b.from(l.createAndFill(null, A) || void 0));
|
|
11007
11012
|
const M = a.before(a.depth - (S - 1));
|
|
11008
11013
|
t.replace(M, a.after(-w), new k(y, 4 - S, 0));
|
|
@@ -11027,13 +11032,13 @@ const Qu = ({ keepMarks: r = !0 } = {}) => ({ tr: e, state: t, dispatch: n, edit
|
|
|
11027
11032
|
{ type: l, attrs: p },
|
|
11028
11033
|
{ type: h, attrs: m }
|
|
11029
11034
|
] : [{ type: l, attrs: p }];
|
|
11030
|
-
if (!
|
|
11035
|
+
if (!ge(t.doc, a.pos, 2))
|
|
11031
11036
|
return !1;
|
|
11032
11037
|
if (i) {
|
|
11033
|
-
const { selection: y, storedMarks: S } = n, { splittableMarks: w } = s.extensionManager,
|
|
11034
|
-
if (t.split(a.pos, 2, g).scrollIntoView(), !
|
|
11038
|
+
const { selection: y, storedMarks: S } = n, { splittableMarks: w } = s.extensionManager, D = S || y.$to.parentOffset && y.$from.marks();
|
|
11039
|
+
if (t.split(a.pos, 2, g).scrollIntoView(), !D || !i)
|
|
11035
11040
|
return !0;
|
|
11036
|
-
const A =
|
|
11041
|
+
const A = D.filter((M) => w.includes(M.type.name));
|
|
11037
11042
|
t.ensureMarks(A);
|
|
11038
11043
|
}
|
|
11039
11044
|
return !0;
|
|
@@ -11055,8 +11060,8 @@ const Qu = ({ keepMarks: r = !0 } = {}) => ({ tr: e, state: t, dispatch: n, edit
|
|
|
11055
11060
|
return !0;
|
|
11056
11061
|
const i = r.doc.nodeAt(n);
|
|
11057
11062
|
return t.node.type === (i == null ? void 0 : i.type) && qe(r.doc, n) && r.join(n), !0;
|
|
11058
|
-
},
|
|
11059
|
-
const { extensions: d, splittableMarks: f } = i.extensionManager, h = L(r, o.schema), p = L(e, o.schema), { selection: m, storedMarks: g } = o, { $from: y, $to: S } = m, w = y.blockRange(S),
|
|
11063
|
+
}, rd = (r, e, t, n = {}) => ({ editor: i, tr: s, state: o, dispatch: l, chain: a, commands: c, can: u }) => {
|
|
11064
|
+
const { extensions: d, splittableMarks: f } = i.extensionManager, h = L(r, o.schema), p = L(e, o.schema), { selection: m, storedMarks: g } = o, { $from: y, $to: S } = m, w = y.blockRange(S), D = g || m.$to.parentOffset && m.$from.marks();
|
|
11060
11065
|
if (!w)
|
|
11061
11066
|
return !1;
|
|
11062
11067
|
const A = Tr((M) => Pi(M.type.name, d))(m);
|
|
@@ -11066,21 +11071,21 @@ const Qu = ({ keepMarks: r = !0 } = {}) => ({ tr: e, state: t, dispatch: n, edit
|
|
|
11066
11071
|
if (Pi(A.node.type.name, d) && h.validContent(A.node.content) && l)
|
|
11067
11072
|
return a().command(() => (s.setNodeMarkup(A.pos, h), !0)).command(() => In(s, h)).command(() => Pn(s, h)).run();
|
|
11068
11073
|
}
|
|
11069
|
-
return !t || !
|
|
11070
|
-
const M = u().wrapInList(h, n), I =
|
|
11074
|
+
return !t || !D || !l ? a().command(() => u().wrapInList(h, n) ? !0 : c.clearNodes()).wrapInList(h, n).command(() => In(s, h)).command(() => Pn(s, h)).run() : a().command(() => {
|
|
11075
|
+
const M = u().wrapInList(h, n), I = D.filter((H) => f.includes(H.type.name));
|
|
11071
11076
|
return s.ensureMarks(I), M ? !0 : c.clearNodes();
|
|
11072
11077
|
}).wrapInList(h, n).command(() => In(s, h)).command(() => Pn(s, h)).run();
|
|
11073
|
-
},
|
|
11078
|
+
}, id = (r, e = {}, t = {}) => ({ state: n, commands: i }) => {
|
|
11074
11079
|
const { extendEmptyMarkRange: s = !1 } = t, o = ve(r, n.schema);
|
|
11075
11080
|
return tr(n, o, e) ? i.unsetMark(o, { extendEmptyMarkRange: s }) : i.setMark(o, e);
|
|
11076
|
-
},
|
|
11081
|
+
}, sd = (r, e, t = {}) => ({ state: n, commands: i }) => {
|
|
11077
11082
|
const s = L(r, n.schema), o = L(e, n.schema), l = wt(n, s, t);
|
|
11078
11083
|
let a;
|
|
11079
11084
|
return n.selection.$anchor.sameParent(n.selection.$head) && (a = n.selection.$anchor.parent.attrs), l ? i.setNode(o, a) : i.setNode(s, { ...a, ...t });
|
|
11080
|
-
},
|
|
11085
|
+
}, od = (r, e = {}) => ({ state: t, commands: n }) => {
|
|
11081
11086
|
const i = L(r, t.schema);
|
|
11082
11087
|
return wt(t, i, e) ? n.lift(i) : n.wrapIn(i, e);
|
|
11083
|
-
},
|
|
11088
|
+
}, ld = () => ({ state: r, dispatch: e }) => {
|
|
11084
11089
|
const t = r.plugins;
|
|
11085
11090
|
for (let n = 0; n < t.length; n += 1) {
|
|
11086
11091
|
const i = t[n];
|
|
@@ -11100,12 +11105,12 @@ const Qu = ({ keepMarks: r = !0 } = {}) => ({ tr: e, state: t, dispatch: n, edit
|
|
|
11100
11105
|
}
|
|
11101
11106
|
}
|
|
11102
11107
|
return !1;
|
|
11103
|
-
},
|
|
11108
|
+
}, ad = () => ({ tr: r, dispatch: e }) => {
|
|
11104
11109
|
const { selection: t } = r, { empty: n, ranges: i } = t;
|
|
11105
11110
|
return n || e && i.forEach((s) => {
|
|
11106
11111
|
r.removeMark(s.$from.pos, s.$to.pos);
|
|
11107
11112
|
}), !0;
|
|
11108
|
-
},
|
|
11113
|
+
}, cd = (r, e = {}) => ({ tr: t, state: n, dispatch: i }) => {
|
|
11109
11114
|
var s;
|
|
11110
11115
|
const { extendEmptyMarkRange: o = !1 } = e, { selection: l } = t, a = ve(r, n.schema), { $from: c, empty: u, ranges: d } = l;
|
|
11111
11116
|
if (!i)
|
|
@@ -11119,7 +11124,7 @@ const Qu = ({ keepMarks: r = !0 } = {}) => ({ tr: e, state: t, dispatch: n, edit
|
|
|
11119
11124
|
t.removeMark(f.$from.pos, f.$to.pos, a);
|
|
11120
11125
|
});
|
|
11121
11126
|
return t.removeStoredMark(a), !0;
|
|
11122
|
-
},
|
|
11127
|
+
}, ud = (r, e = {}) => ({ tr: t, state: n, dispatch: i }) => {
|
|
11123
11128
|
let s = null, o = null;
|
|
11124
11129
|
const l = hn(typeof r == "string" ? r : r.name, n.schema);
|
|
11125
11130
|
return l ? (l === "node" && (s = L(r, n.schema)), l === "mark" && (o = ve(r, n.schema)), i && t.selection.ranges.forEach((a) => {
|
|
@@ -11150,82 +11155,82 @@ const Qu = ({ keepMarks: r = !0 } = {}) => ({ tr: e, state: t, dispatch: n, edit
|
|
|
11150
11155
|
}));
|
|
11151
11156
|
}));
|
|
11152
11157
|
}), !0) : !1;
|
|
11153
|
-
},
|
|
11154
|
-
const i = L(r, t.schema);
|
|
11155
|
-
return Oc(i, e)(t, n);
|
|
11156
|
-
}, ud = (r, e = {}) => ({ state: t, dispatch: n }) => {
|
|
11158
|
+
}, dd = (r, e = {}) => ({ state: t, dispatch: n }) => {
|
|
11157
11159
|
const i = L(r, t.schema);
|
|
11158
11160
|
return Nc(i, e)(t, n);
|
|
11161
|
+
}, fd = (r, e = {}) => ({ state: t, dispatch: n }) => {
|
|
11162
|
+
const i = L(r, t.schema);
|
|
11163
|
+
return Ac(i, e)(t, n);
|
|
11159
11164
|
};
|
|
11160
|
-
var
|
|
11165
|
+
var hd = /* @__PURE__ */ Object.freeze({
|
|
11161
11166
|
__proto__: null,
|
|
11162
|
-
blur:
|
|
11163
|
-
clearContent:
|
|
11164
|
-
clearNodes:
|
|
11165
|
-
command:
|
|
11166
|
-
createParagraphNear:
|
|
11167
|
-
cut:
|
|
11168
|
-
deleteCurrentNode:
|
|
11169
|
-
deleteNode:
|
|
11170
|
-
deleteRange:
|
|
11171
|
-
deleteSelection:
|
|
11172
|
-
enter:
|
|
11173
|
-
exitCode:
|
|
11174
|
-
extendMarkRange:
|
|
11175
|
-
first:
|
|
11176
|
-
focus:
|
|
11177
|
-
forEach:
|
|
11178
|
-
insertContent:
|
|
11179
|
-
insertContentAt:
|
|
11180
|
-
joinBackward:
|
|
11181
|
-
joinDown:
|
|
11182
|
-
joinForward:
|
|
11183
|
-
joinItemBackward:
|
|
11184
|
-
joinItemForward:
|
|
11185
|
-
joinTextblockBackward:
|
|
11186
|
-
joinTextblockForward:
|
|
11187
|
-
joinUp:
|
|
11188
|
-
keyboardShortcut:
|
|
11189
|
-
lift:
|
|
11190
|
-
liftEmptyBlock:
|
|
11191
|
-
liftListItem:
|
|
11192
|
-
newlineInCode:
|
|
11193
|
-
resetAttributes:
|
|
11194
|
-
scrollIntoView:
|
|
11195
|
-
selectAll:
|
|
11196
|
-
selectNodeBackward:
|
|
11197
|
-
selectNodeForward:
|
|
11198
|
-
selectParentNode:
|
|
11199
|
-
selectTextblockEnd:
|
|
11200
|
-
selectTextblockStart:
|
|
11201
|
-
setContent:
|
|
11202
|
-
setMark:
|
|
11203
|
-
setMeta:
|
|
11204
|
-
setNode:
|
|
11205
|
-
setNodeSelection:
|
|
11206
|
-
setTextSelection:
|
|
11207
|
-
sinkListItem:
|
|
11208
|
-
splitBlock:
|
|
11209
|
-
splitListItem:
|
|
11210
|
-
toggleList:
|
|
11211
|
-
toggleMark:
|
|
11212
|
-
toggleNode:
|
|
11213
|
-
toggleWrap:
|
|
11214
|
-
undoInputRule:
|
|
11215
|
-
unsetAllMarks:
|
|
11216
|
-
unsetMark:
|
|
11217
|
-
updateAttributes:
|
|
11218
|
-
wrapIn:
|
|
11219
|
-
wrapInList:
|
|
11167
|
+
blur: Qc,
|
|
11168
|
+
clearContent: eu,
|
|
11169
|
+
clearNodes: tu,
|
|
11170
|
+
command: nu,
|
|
11171
|
+
createParagraphNear: ru,
|
|
11172
|
+
cut: iu,
|
|
11173
|
+
deleteCurrentNode: su,
|
|
11174
|
+
deleteNode: ou,
|
|
11175
|
+
deleteRange: lu,
|
|
11176
|
+
deleteSelection: au,
|
|
11177
|
+
enter: cu,
|
|
11178
|
+
exitCode: uu,
|
|
11179
|
+
extendMarkRange: du,
|
|
11180
|
+
first: fu,
|
|
11181
|
+
focus: pu,
|
|
11182
|
+
forEach: mu,
|
|
11183
|
+
insertContent: gu,
|
|
11184
|
+
insertContentAt: ku,
|
|
11185
|
+
joinBackward: Cu,
|
|
11186
|
+
joinDown: Su,
|
|
11187
|
+
joinForward: wu,
|
|
11188
|
+
joinItemBackward: Mu,
|
|
11189
|
+
joinItemForward: Eu,
|
|
11190
|
+
joinTextblockBackward: Tu,
|
|
11191
|
+
joinTextblockForward: Ou,
|
|
11192
|
+
joinUp: xu,
|
|
11193
|
+
keyboardShortcut: Au,
|
|
11194
|
+
lift: vu,
|
|
11195
|
+
liftEmptyBlock: Du,
|
|
11196
|
+
liftListItem: Iu,
|
|
11197
|
+
newlineInCode: Pu,
|
|
11198
|
+
resetAttributes: Ru,
|
|
11199
|
+
scrollIntoView: Bu,
|
|
11200
|
+
selectAll: zu,
|
|
11201
|
+
selectNodeBackward: Fu,
|
|
11202
|
+
selectNodeForward: Lu,
|
|
11203
|
+
selectParentNode: $u,
|
|
11204
|
+
selectTextblockEnd: Vu,
|
|
11205
|
+
selectTextblockStart: ju,
|
|
11206
|
+
setContent: Hu,
|
|
11207
|
+
setMark: Gu,
|
|
11208
|
+
setMeta: Yu,
|
|
11209
|
+
setNode: Xu,
|
|
11210
|
+
setNodeSelection: Zu,
|
|
11211
|
+
setTextSelection: Qu,
|
|
11212
|
+
sinkListItem: ed,
|
|
11213
|
+
splitBlock: td,
|
|
11214
|
+
splitListItem: nd,
|
|
11215
|
+
toggleList: rd,
|
|
11216
|
+
toggleMark: id,
|
|
11217
|
+
toggleNode: sd,
|
|
11218
|
+
toggleWrap: od,
|
|
11219
|
+
undoInputRule: ld,
|
|
11220
|
+
unsetAllMarks: ad,
|
|
11221
|
+
unsetMark: cd,
|
|
11222
|
+
updateAttributes: ud,
|
|
11223
|
+
wrapIn: dd,
|
|
11224
|
+
wrapInList: fd
|
|
11220
11225
|
});
|
|
11221
|
-
const
|
|
11226
|
+
const pd = q.create({
|
|
11222
11227
|
name: "commands",
|
|
11223
11228
|
addCommands() {
|
|
11224
11229
|
return {
|
|
11225
|
-
...
|
|
11230
|
+
...hd
|
|
11226
11231
|
};
|
|
11227
11232
|
}
|
|
11228
|
-
}),
|
|
11233
|
+
}), md = q.create({
|
|
11229
11234
|
name: "drop",
|
|
11230
11235
|
addProseMirrorPlugins() {
|
|
11231
11236
|
return [
|
|
@@ -11244,7 +11249,7 @@ const fd = Y.create({
|
|
|
11244
11249
|
})
|
|
11245
11250
|
];
|
|
11246
11251
|
}
|
|
11247
|
-
}),
|
|
11252
|
+
}), gd = q.create({
|
|
11248
11253
|
name: "editable",
|
|
11249
11254
|
addProseMirrorPlugins() {
|
|
11250
11255
|
return [
|
|
@@ -11256,13 +11261,13 @@ const fd = Y.create({
|
|
|
11256
11261
|
})
|
|
11257
11262
|
];
|
|
11258
11263
|
}
|
|
11259
|
-
}),
|
|
11264
|
+
}), yd = new le("focusEvents"), bd = q.create({
|
|
11260
11265
|
name: "focusEvents",
|
|
11261
11266
|
addProseMirrorPlugins() {
|
|
11262
11267
|
const { editor: r } = this;
|
|
11263
11268
|
return [
|
|
11264
11269
|
new Q({
|
|
11265
|
-
key:
|
|
11270
|
+
key: yd,
|
|
11266
11271
|
props: {
|
|
11267
11272
|
handleDOMEvents: {
|
|
11268
11273
|
focus: (e, t) => {
|
|
@@ -11280,7 +11285,7 @@ const fd = Y.create({
|
|
|
11280
11285
|
})
|
|
11281
11286
|
];
|
|
11282
11287
|
}
|
|
11283
|
-
}),
|
|
11288
|
+
}), kd = q.create({
|
|
11284
11289
|
name: "keymap",
|
|
11285
11290
|
addKeyboardShortcuts() {
|
|
11286
11291
|
const r = () => this.editor.commands.first(({ commands: o }) => [
|
|
@@ -11358,7 +11363,7 @@ const fd = Y.create({
|
|
|
11358
11363
|
})
|
|
11359
11364
|
];
|
|
11360
11365
|
}
|
|
11361
|
-
}),
|
|
11366
|
+
}), xd = q.create({
|
|
11362
11367
|
name: "paste",
|
|
11363
11368
|
addProseMirrorPlugins() {
|
|
11364
11369
|
return [
|
|
@@ -11376,7 +11381,7 @@ const fd = Y.create({
|
|
|
11376
11381
|
})
|
|
11377
11382
|
];
|
|
11378
11383
|
}
|
|
11379
|
-
}),
|
|
11384
|
+
}), Sd = q.create({
|
|
11380
11385
|
name: "tabindex",
|
|
11381
11386
|
addProseMirrorPlugins() {
|
|
11382
11387
|
return [
|
|
@@ -11512,7 +11517,7 @@ class Ie {
|
|
|
11512
11517
|
}), this.editor.view.dispatch(t);
|
|
11513
11518
|
}
|
|
11514
11519
|
}
|
|
11515
|
-
const
|
|
11520
|
+
const Cd = `.ProseMirror {
|
|
11516
11521
|
position: relative;
|
|
11517
11522
|
}
|
|
11518
11523
|
|
|
@@ -11587,14 +11592,14 @@ img.ProseMirror-separator {
|
|
|
11587
11592
|
.tippy-box[data-animation=fade][data-state=hidden] {
|
|
11588
11593
|
opacity: 0
|
|
11589
11594
|
}`;
|
|
11590
|
-
function
|
|
11595
|
+
function wd(r, e, t) {
|
|
11591
11596
|
const n = document.querySelector("style[data-tiptap-style]");
|
|
11592
11597
|
if (n !== null)
|
|
11593
11598
|
return n;
|
|
11594
11599
|
const i = document.createElement("style");
|
|
11595
11600
|
return e && i.setAttribute("nonce", e), i.setAttribute("data-tiptap-style", ""), i.innerHTML = r, document.getElementsByTagName("head")[0].appendChild(i), i;
|
|
11596
11601
|
}
|
|
11597
|
-
class
|
|
11602
|
+
class Md extends zc {
|
|
11598
11603
|
constructor(e = {}) {
|
|
11599
11604
|
super(), this.isFocused = !1, this.isInitialized = !1, this.extensionStorage = {}, this.options = {
|
|
11600
11605
|
element: document.createElement("div"),
|
|
@@ -11656,7 +11661,7 @@ class Cd extends Bc {
|
|
|
11656
11661
|
* Inject CSS styles.
|
|
11657
11662
|
*/
|
|
11658
11663
|
injectCSS() {
|
|
11659
|
-
this.options.injectCSS && document && (this.css =
|
|
11664
|
+
this.options.injectCSS && document && (this.css = wd(Cd, this.options.injectNonce));
|
|
11660
11665
|
}
|
|
11661
11666
|
/**
|
|
11662
11667
|
* Update editor options.
|
|
@@ -11725,16 +11730,16 @@ class Cd extends Bc {
|
|
|
11725
11730
|
createExtensionManager() {
|
|
11726
11731
|
var e, t;
|
|
11727
11732
|
const i = [...this.options.enableCoreExtensions ? [
|
|
11728
|
-
|
|
11729
|
-
|
|
11733
|
+
gd,
|
|
11734
|
+
Zc.configure({
|
|
11730
11735
|
blockSeparator: (t = (e = this.options.coreExtensionOptions) === null || e === void 0 ? void 0 : e.clipboardTextSerializer) === null || t === void 0 ? void 0 : t.blockSeparator
|
|
11731
11736
|
}),
|
|
11732
|
-
|
|
11733
|
-
|
|
11734
|
-
yd,
|
|
11737
|
+
pd,
|
|
11738
|
+
bd,
|
|
11735
11739
|
kd,
|
|
11736
|
-
|
|
11737
|
-
|
|
11740
|
+
Sd,
|
|
11741
|
+
md,
|
|
11742
|
+
xd
|
|
11738
11743
|
].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));
|
|
11739
11744
|
this.extensionManager = new Xe(i, this);
|
|
11740
11745
|
}
|
|
@@ -11772,7 +11777,7 @@ class Cd extends Bc {
|
|
|
11772
11777
|
}), t = er(this.options.content, this.schema, this.options.parseOptions, { errorOnInvalidContent: !1 });
|
|
11773
11778
|
}
|
|
11774
11779
|
const n = bo(t, this.options.autofocus);
|
|
11775
|
-
this.view = new
|
|
11780
|
+
this.view = new sc(this.options.element, {
|
|
11776
11781
|
...this.options.editorProps,
|
|
11777
11782
|
attributes: {
|
|
11778
11783
|
// add `role="textbox"` to the editor element
|
|
@@ -11860,11 +11865,11 @@ class Cd extends Bc {
|
|
|
11860
11865
|
* Get attributes of the currently selected node or mark.
|
|
11861
11866
|
*/
|
|
11862
11867
|
getAttributes(e) {
|
|
11863
|
-
return
|
|
11868
|
+
return Ku(this.state, e);
|
|
11864
11869
|
}
|
|
11865
11870
|
isActive(e, t) {
|
|
11866
11871
|
const n = typeof e == "string" ? e : null, i = typeof e == "string" ? t : e;
|
|
11867
|
-
return
|
|
11872
|
+
return Uu(this.state, n, i);
|
|
11868
11873
|
}
|
|
11869
11874
|
/**
|
|
11870
11875
|
* Get the document as JSON.
|
|
@@ -11885,7 +11890,7 @@ class Cd extends Bc {
|
|
|
11885
11890
|
const { blockSeparator: t = `
|
|
11886
11891
|
|
|
11887
11892
|
`, textSerializers: n = {} } = e || {};
|
|
11888
|
-
return
|
|
11893
|
+
return Ju(this.state.doc, {
|
|
11889
11894
|
blockSeparator: t,
|
|
11890
11895
|
textSerializers: {
|
|
11891
11896
|
...mo(this.schema),
|
|
@@ -11940,6 +11945,22 @@ class Cd extends Bc {
|
|
|
11940
11945
|
return this.$pos(0);
|
|
11941
11946
|
}
|
|
11942
11947
|
}
|
|
11948
|
+
function Co(r) {
|
|
11949
|
+
return new Hc({
|
|
11950
|
+
find: r.find,
|
|
11951
|
+
handler: ({ state: e, range: t, match: n }) => {
|
|
11952
|
+
let i = r.replace, s = t.from;
|
|
11953
|
+
const o = t.to;
|
|
11954
|
+
if (n[1]) {
|
|
11955
|
+
const l = n[0].lastIndexOf(n[1]);
|
|
11956
|
+
i += n[0].slice(l + n[1].length), s += l;
|
|
11957
|
+
const a = s - o;
|
|
11958
|
+
a > 0 && (i = n[0].slice(l - a, l) + i, s = o);
|
|
11959
|
+
}
|
|
11960
|
+
e.tr.insertText(i, s, o);
|
|
11961
|
+
}
|
|
11962
|
+
});
|
|
11963
|
+
}
|
|
11943
11964
|
let Or = class nr {
|
|
11944
11965
|
constructor(e = {}) {
|
|
11945
11966
|
this.type = "node", this.name = "node", this.parent = null, this.child = null, this.config = {
|
|
@@ -11984,7 +12005,7 @@ F.prototype.prepend = function(e) {
|
|
|
11984
12005
|
return e.length ? F.from(e).append(this) : this;
|
|
11985
12006
|
};
|
|
11986
12007
|
F.prototype.appendInner = function(e) {
|
|
11987
|
-
return new
|
|
12008
|
+
return new Ed(this, e);
|
|
11988
12009
|
};
|
|
11989
12010
|
F.prototype.slice = function(e, t) {
|
|
11990
12011
|
return e === void 0 && (e = 0), t === void 0 && (t = this.length), e >= t ? F.empty : this.sliceInner(Math.max(0, e), Math.min(this.length, t));
|
|
@@ -12004,9 +12025,9 @@ F.prototype.map = function(e, t, n) {
|
|
|
12004
12025
|
}, t, n), i;
|
|
12005
12026
|
};
|
|
12006
12027
|
F.from = function(e) {
|
|
12007
|
-
return e instanceof F ? e : e && e.length ? new
|
|
12028
|
+
return e instanceof F ? e : e && e.length ? new wo(e) : F.empty;
|
|
12008
12029
|
};
|
|
12009
|
-
var
|
|
12030
|
+
var wo = /* @__PURE__ */ function(r) {
|
|
12010
12031
|
function e(n) {
|
|
12011
12032
|
r.call(this), this.values = n;
|
|
12012
12033
|
}
|
|
@@ -12038,8 +12059,8 @@ var Co = /* @__PURE__ */ function(r) {
|
|
|
12038
12059
|
return 0;
|
|
12039
12060
|
}, Object.defineProperties(e.prototype, t), e;
|
|
12040
12061
|
}(F);
|
|
12041
|
-
F.empty = new
|
|
12042
|
-
var
|
|
12062
|
+
F.empty = new wo([]);
|
|
12063
|
+
var Ed = /* @__PURE__ */ function(r) {
|
|
12043
12064
|
function e(t, n) {
|
|
12044
12065
|
r.call(this), this.left = t, this.right = n, this.length = t.length + n.length, this.depth = Math.max(t.depth, n.depth) + 1;
|
|
12045
12066
|
}
|
|
@@ -12072,7 +12093,7 @@ var wd = /* @__PURE__ */ function(r) {
|
|
|
12072
12093
|
return this.left.depth >= Math.max(this.right.depth, n.depth) + 1 ? new e(this.left, new e(this.right, n)) : new e(this, n);
|
|
12073
12094
|
}, e;
|
|
12074
12095
|
}(F);
|
|
12075
|
-
const
|
|
12096
|
+
const Td = 500;
|
|
12076
12097
|
class se {
|
|
12077
12098
|
constructor(e, t) {
|
|
12078
12099
|
this.items = e, this.eventCount = t;
|
|
@@ -12114,7 +12135,7 @@ class se {
|
|
|
12114
12135
|
(h = a && a.merge(f)) && (f = h, u ? s.pop() : l = l.slice(0, l.length - 1)), s.push(f), t && (o++, t = void 0), i || (a = f);
|
|
12115
12136
|
}
|
|
12116
12137
|
let c = o - n.depth;
|
|
12117
|
-
return c >
|
|
12138
|
+
return c > Nd && (l = Od(l, c), o -= c), new se(l.append(s), o);
|
|
12118
12139
|
}
|
|
12119
12140
|
remapping(e, t) {
|
|
12120
12141
|
let n = new yt();
|
|
@@ -12154,7 +12175,7 @@ class se {
|
|
|
12154
12175
|
for (let f = t; f < o; f++)
|
|
12155
12176
|
c.push(new ae(s.maps[f]));
|
|
12156
12177
|
let u = this.items.slice(0, i).append(c).append(n), d = new se(u, l);
|
|
12157
|
-
return d.emptyItemCount() >
|
|
12178
|
+
return d.emptyItemCount() > Td && (d = d.compress(this.items.length - n.length)), d;
|
|
12158
12179
|
}
|
|
12159
12180
|
emptyItemCount() {
|
|
12160
12181
|
let e = 0;
|
|
@@ -12186,7 +12207,7 @@ class se {
|
|
|
12186
12207
|
}
|
|
12187
12208
|
}
|
|
12188
12209
|
se.empty = new se(F.empty, 0);
|
|
12189
|
-
function
|
|
12210
|
+
function Od(r, e) {
|
|
12190
12211
|
let t;
|
|
12191
12212
|
return r.forEach((n, i) => {
|
|
12192
12213
|
if (n.selection && e-- == 0)
|
|
@@ -12205,28 +12226,28 @@ class ae {
|
|
|
12205
12226
|
}
|
|
12206
12227
|
}
|
|
12207
12228
|
}
|
|
12208
|
-
class
|
|
12229
|
+
class xe {
|
|
12209
12230
|
constructor(e, t, n, i, s) {
|
|
12210
12231
|
this.done = e, this.undone = t, this.prevRanges = n, this.prevTime = i, this.prevComposition = s;
|
|
12211
12232
|
}
|
|
12212
12233
|
}
|
|
12213
|
-
const
|
|
12214
|
-
function
|
|
12234
|
+
const Nd = 20;
|
|
12235
|
+
function Ad(r, e, t, n) {
|
|
12215
12236
|
let i = t.getMeta(Ve), s;
|
|
12216
12237
|
if (i)
|
|
12217
12238
|
return i.historyState;
|
|
12218
|
-
t.getMeta(
|
|
12239
|
+
t.getMeta(Id) && (r = new xe(r.done, r.undone, null, 0, -1));
|
|
12219
12240
|
let o = t.getMeta("appendedTransaction");
|
|
12220
12241
|
if (t.steps.length == 0)
|
|
12221
12242
|
return r;
|
|
12222
12243
|
if (o && o.getMeta(Ve))
|
|
12223
|
-
return o.getMeta(Ve).redo ? new
|
|
12244
|
+
return o.getMeta(Ve).redo ? new xe(r.done.addTransform(t, void 0, n, $t(e)), r.undone, Bi(t.mapping.maps), r.prevTime, r.prevComposition) : new xe(r.done, r.undone.addTransform(t, void 0, n, $t(e)), null, r.prevTime, r.prevComposition);
|
|
12224
12245
|
if (t.getMeta("addToHistory") !== !1 && !(o && o.getMeta("addToHistory") === !1)) {
|
|
12225
|
-
let l = t.getMeta("composition"), a = r.prevTime == 0 || !o && r.prevComposition != l && (r.prevTime < (t.time || 0) - n.newGroupDelay || !
|
|
12226
|
-
return new
|
|
12227
|
-
} else return (s = t.getMeta("rebased")) ? new
|
|
12246
|
+
let l = t.getMeta("composition"), a = r.prevTime == 0 || !o && r.prevComposition != l && (r.prevTime < (t.time || 0) - n.newGroupDelay || !vd(t, r.prevRanges)), c = o ? Rn(r.prevRanges, t.mapping) : Bi(t.mapping.maps);
|
|
12247
|
+
return new xe(r.done.addTransform(t, a ? e.selection.getBookmark() : void 0, n, $t(e)), se.empty, c, t.time, l ?? r.prevComposition);
|
|
12248
|
+
} else return (s = t.getMeta("rebased")) ? new xe(r.done.rebased(t, s), r.undone.rebased(t, s), Rn(r.prevRanges, t.mapping), r.prevTime, r.prevComposition) : new xe(r.done.addMaps(t.mapping.maps), r.undone.addMaps(t.mapping.maps), Rn(r.prevRanges, t.mapping), r.prevTime, r.prevComposition);
|
|
12228
12249
|
}
|
|
12229
|
-
function
|
|
12250
|
+
function vd(r, e) {
|
|
12230
12251
|
if (!e)
|
|
12231
12252
|
return !1;
|
|
12232
12253
|
if (!r.docChanged)
|
|
@@ -12253,11 +12274,11 @@ function Rn(r, e) {
|
|
|
12253
12274
|
}
|
|
12254
12275
|
return t;
|
|
12255
12276
|
}
|
|
12256
|
-
function
|
|
12277
|
+
function Dd(r, e, t) {
|
|
12257
12278
|
let n = $t(e), i = Ve.get(e).spec.config, s = (t ? r.undone : r.done).popEvent(e, n);
|
|
12258
12279
|
if (!s)
|
|
12259
12280
|
return null;
|
|
12260
|
-
let o = s.selection.resolve(s.transform.doc), l = (t ? r.done : r.undone).addTransform(s.transform, e.selection.getBookmark(), i, n), a = new
|
|
12281
|
+
let o = s.selection.resolve(s.transform.doc), l = (t ? r.done : r.undone).addTransform(s.transform, e.selection.getBookmark(), i, n), a = new xe(t ? l : s.remaining, t ? s.remaining : l, null, 0, -1);
|
|
12261
12282
|
return s.transform.setSelection(o).setMeta(Ve, { redo: t, historyState: a });
|
|
12262
12283
|
}
|
|
12263
12284
|
let Bn = !1, zi = null;
|
|
@@ -12273,8 +12294,8 @@ function $t(r) {
|
|
|
12273
12294
|
}
|
|
12274
12295
|
return Bn;
|
|
12275
12296
|
}
|
|
12276
|
-
const Ve = new le("history"),
|
|
12277
|
-
function
|
|
12297
|
+
const Ve = new le("history"), Id = new le("closeHistory");
|
|
12298
|
+
function Pd(r = {}) {
|
|
12278
12299
|
return r = {
|
|
12279
12300
|
depth: r.depth || 100,
|
|
12280
12301
|
newGroupDelay: r.newGroupDelay || 500
|
|
@@ -12282,36 +12303,36 @@ function Dd(r = {}) {
|
|
|
12282
12303
|
key: Ve,
|
|
12283
12304
|
state: {
|
|
12284
12305
|
init() {
|
|
12285
|
-
return new
|
|
12306
|
+
return new xe(se.empty, se.empty, null, 0, -1);
|
|
12286
12307
|
},
|
|
12287
12308
|
apply(e, t, n) {
|
|
12288
|
-
return
|
|
12309
|
+
return Ad(t, n, e, r);
|
|
12289
12310
|
}
|
|
12290
12311
|
},
|
|
12291
12312
|
config: r,
|
|
12292
12313
|
props: {
|
|
12293
12314
|
handleDOMEvents: {
|
|
12294
12315
|
beforeinput(e, t) {
|
|
12295
|
-
let n = t.inputType, i = n == "historyUndo" ?
|
|
12316
|
+
let n = t.inputType, i = n == "historyUndo" ? Eo : n == "historyRedo" ? To : null;
|
|
12296
12317
|
return i ? (t.preventDefault(), i(e.state, e.dispatch)) : !1;
|
|
12297
12318
|
}
|
|
12298
12319
|
}
|
|
12299
12320
|
}
|
|
12300
12321
|
});
|
|
12301
12322
|
}
|
|
12302
|
-
function
|
|
12323
|
+
function Mo(r, e) {
|
|
12303
12324
|
return (t, n) => {
|
|
12304
12325
|
let i = Ve.getState(t);
|
|
12305
12326
|
if (!i || (r ? i.undone : i.done).eventCount == 0)
|
|
12306
12327
|
return !1;
|
|
12307
12328
|
if (n) {
|
|
12308
|
-
let s =
|
|
12329
|
+
let s = Dd(i, t, r);
|
|
12309
12330
|
s && n(e ? s.scrollIntoView() : s);
|
|
12310
12331
|
}
|
|
12311
12332
|
return !0;
|
|
12312
12333
|
};
|
|
12313
12334
|
}
|
|
12314
|
-
const
|
|
12335
|
+
const Eo = Mo(!1, !0), To = Mo(!0, !0), Rd = q.create({
|
|
12315
12336
|
name: "history",
|
|
12316
12337
|
addOptions() {
|
|
12317
12338
|
return {
|
|
@@ -12321,13 +12342,13 @@ const Mo = wo(!1, !0), Eo = wo(!0, !0), Id = Y.create({
|
|
|
12321
12342
|
},
|
|
12322
12343
|
addCommands() {
|
|
12323
12344
|
return {
|
|
12324
|
-
undo: () => ({ state: r, dispatch: e }) =>
|
|
12325
|
-
redo: () => ({ state: r, dispatch: e }) =>
|
|
12345
|
+
undo: () => ({ state: r, dispatch: e }) => Eo(r, e),
|
|
12346
|
+
redo: () => ({ state: r, dispatch: e }) => To(r, e)
|
|
12326
12347
|
};
|
|
12327
12348
|
},
|
|
12328
12349
|
addProseMirrorPlugins() {
|
|
12329
12350
|
return [
|
|
12330
|
-
|
|
12351
|
+
Pd(this.options)
|
|
12331
12352
|
];
|
|
12332
12353
|
},
|
|
12333
12354
|
addKeyboardShortcuts() {
|
|
@@ -12340,7 +12361,7 @@ const Mo = wo(!1, !0), Eo = wo(!0, !0), Id = Y.create({
|
|
|
12340
12361
|
"Shift-Mod-я": () => this.editor.commands.redo()
|
|
12341
12362
|
};
|
|
12342
12363
|
}
|
|
12343
|
-
}),
|
|
12364
|
+
}), Bd = q.create({
|
|
12344
12365
|
name: "placeholder",
|
|
12345
12366
|
addOptions() {
|
|
12346
12367
|
return {
|
|
@@ -12387,7 +12408,7 @@ const Mo = wo(!1, !0), Eo = wo(!0, !0), Id = Y.create({
|
|
|
12387
12408
|
}
|
|
12388
12409
|
});
|
|
12389
12410
|
function Fi(r) {
|
|
12390
|
-
const t = r.state.doc.toJSON(), n = new
|
|
12411
|
+
const t = r.state.doc.toJSON(), n = new zd(r);
|
|
12391
12412
|
let i = [];
|
|
12392
12413
|
return t.content.forEach((s) => {
|
|
12393
12414
|
i.push(n.serialize(s));
|
|
@@ -12397,7 +12418,7 @@ function Fi(r) {
|
|
|
12397
12418
|
function Li(r, e) {
|
|
12398
12419
|
return r.type === e.type && JSON.stringify(r.attrs) === JSON.stringify(e.attrs);
|
|
12399
12420
|
}
|
|
12400
|
-
class
|
|
12421
|
+
class zd {
|
|
12401
12422
|
constructor(e) {
|
|
12402
12423
|
this.editor = e, this.openMarks = [];
|
|
12403
12424
|
}
|
|
@@ -12428,14 +12449,14 @@ class Rd {
|
|
|
12428
12449
|
}), this.openMarks = [], e;
|
|
12429
12450
|
}
|
|
12430
12451
|
}
|
|
12431
|
-
const
|
|
12452
|
+
const Fd = Or.create({
|
|
12432
12453
|
name: "doc",
|
|
12433
12454
|
topNode: !0,
|
|
12434
12455
|
content: "block+"
|
|
12435
|
-
}),
|
|
12456
|
+
}), Ld = Or.create({
|
|
12436
12457
|
name: "text",
|
|
12437
12458
|
group: "inline"
|
|
12438
|
-
}),
|
|
12459
|
+
}), $d = Ct.create({
|
|
12439
12460
|
name: "inline",
|
|
12440
12461
|
addOptions() {
|
|
12441
12462
|
return {
|
|
@@ -12524,14 +12545,11 @@ const Bd = Or.create({
|
|
|
12524
12545
|
}), r;
|
|
12525
12546
|
},
|
|
12526
12547
|
addCommands() {
|
|
12527
|
-
const r = this.name.charAt(0).toUpperCase() + this.name.slice(1);
|
|
12528
12548
|
return {
|
|
12529
|
-
[`
|
|
12530
|
-
[`wrap${r}`]: () => ({ commands: e, attributes: t }) => e.wrapIn(this.name, t),
|
|
12531
|
-
[`lift${r}`]: () => ({ commands: e, attributes: t }) => e.lift(this.name, t)
|
|
12549
|
+
[`wrap${this.name.charAt(0).toUpperCase() + this.name.slice(1)}`]: () => ({ commands: e, attributes: t }) => e.wrapIn(this.name, t)
|
|
12532
12550
|
};
|
|
12533
12551
|
}
|
|
12534
|
-
}),
|
|
12552
|
+
}), Vd = mn.extend({
|
|
12535
12553
|
name: "list",
|
|
12536
12554
|
content: "head? item+",
|
|
12537
12555
|
group: "block",
|
|
@@ -12565,7 +12583,7 @@ const Bd = Or.create({
|
|
|
12565
12583
|
r[e] = () => this.editor.commands[`toggle${n}`](this.name);
|
|
12566
12584
|
}), r;
|
|
12567
12585
|
}
|
|
12568
|
-
}),
|
|
12586
|
+
}), jd = mn.extend({
|
|
12569
12587
|
name: "item",
|
|
12570
12588
|
content: "p block*",
|
|
12571
12589
|
group: "item",
|
|
@@ -12582,10 +12600,10 @@ const Bd = Or.create({
|
|
|
12582
12600
|
};
|
|
12583
12601
|
}
|
|
12584
12602
|
});
|
|
12585
|
-
function
|
|
12603
|
+
function Hd(r) {
|
|
12586
12604
|
return Object.entries(r || {}).map(([e, t]) => `${e}="${t}"`).join(" ");
|
|
12587
12605
|
}
|
|
12588
|
-
const
|
|
12606
|
+
const Oo = mn.extend({
|
|
12589
12607
|
name: "emptyElement",
|
|
12590
12608
|
group: "inline",
|
|
12591
12609
|
content: "",
|
|
@@ -12618,7 +12636,7 @@ const To = mn.extend({
|
|
|
12618
12636
|
if (t.type !== r.type)
|
|
12619
12637
|
return !1;
|
|
12620
12638
|
r.attrs = t.attrs;
|
|
12621
|
-
const n =
|
|
12639
|
+
const n = Hd(t.attrs);
|
|
12622
12640
|
return n && e.setAttribute("data-tooltip", n), Object.entries(r.attrs).forEach(([i, s]) => {
|
|
12623
12641
|
s ? e.setAttribute(i, s) : e.removeAttribute(i);
|
|
12624
12642
|
}), !0;
|
|
@@ -12641,7 +12659,7 @@ function $i() {
|
|
|
12641
12659
|
return `fn-${r}-${e}`;
|
|
12642
12660
|
}
|
|
12643
12661
|
const rr = /* @__PURE__ */ new Map();
|
|
12644
|
-
function
|
|
12662
|
+
function Wd(r) {
|
|
12645
12663
|
const e = [];
|
|
12646
12664
|
return r.nodesBetween(0, r.content.size, (t, n) => {
|
|
12647
12665
|
t.type.name === "anchor" && e.push({ node: t, pos: n });
|
|
@@ -12653,7 +12671,7 @@ function jd(r) {
|
|
|
12653
12671
|
function Mt(r) {
|
|
12654
12672
|
return rr.get(r) || -1;
|
|
12655
12673
|
}
|
|
12656
|
-
function
|
|
12674
|
+
function Jd(r, e) {
|
|
12657
12675
|
return e.nodesBetween(0, e.content.size, (t, n) => {
|
|
12658
12676
|
if (t.type.name === "note") {
|
|
12659
12677
|
const i = t.attrs.target;
|
|
@@ -12668,7 +12686,7 @@ function Hd(r, e) {
|
|
|
12668
12686
|
}
|
|
12669
12687
|
}), r;
|
|
12670
12688
|
}
|
|
12671
|
-
function
|
|
12689
|
+
function qd(r, e, t = null) {
|
|
12672
12690
|
let n = null;
|
|
12673
12691
|
if (e.descendants((c, u) => {
|
|
12674
12692
|
if (c.type.name === "noteGrp")
|
|
@@ -12706,7 +12724,7 @@ function Wd(r, e, t = null) {
|
|
|
12706
12724
|
}
|
|
12707
12725
|
return r;
|
|
12708
12726
|
}
|
|
12709
|
-
function
|
|
12727
|
+
function Kd(r, e) {
|
|
12710
12728
|
const t = Date.now();
|
|
12711
12729
|
return e.nodesBetween(0, e.content.size, (n, i) => {
|
|
12712
12730
|
if (n.type.name === "anchor") {
|
|
@@ -12720,7 +12738,7 @@ function Jd(r, e) {
|
|
|
12720
12738
|
}
|
|
12721
12739
|
}), r;
|
|
12722
12740
|
}
|
|
12723
|
-
const
|
|
12741
|
+
const Ud = Oo.extend({
|
|
12724
12742
|
name: "anchor",
|
|
12725
12743
|
group: "inline",
|
|
12726
12744
|
content: "",
|
|
@@ -12801,7 +12819,7 @@ const qd = To.extend({
|
|
|
12801
12819
|
};
|
|
12802
12820
|
};
|
|
12803
12821
|
}
|
|
12804
|
-
}),
|
|
12822
|
+
}), _d = q.create({
|
|
12805
12823
|
name: "footnoteRules",
|
|
12806
12824
|
priority: 1e3,
|
|
12807
12825
|
addProseMirrorPlugins() {
|
|
@@ -12866,29 +12884,29 @@ const qd = To.extend({
|
|
|
12866
12884
|
h + 1
|
|
12867
12885
|
)));
|
|
12868
12886
|
}
|
|
12869
|
-
return s && (
|
|
12887
|
+
return s && (Wd(n.doc), n = Kd(n, n.doc), n = Jd(n, n.doc), n = qd(n, n.doc, i)), n;
|
|
12870
12888
|
}
|
|
12871
12889
|
})
|
|
12872
12890
|
];
|
|
12873
12891
|
}
|
|
12874
12892
|
});
|
|
12875
|
-
function
|
|
12893
|
+
function Gd(r) {
|
|
12876
12894
|
const e = [
|
|
12877
|
-
|
|
12878
|
-
|
|
12895
|
+
Yd,
|
|
12896
|
+
Ld
|
|
12879
12897
|
];
|
|
12880
12898
|
return Object.entries(r.schema).forEach(([t, n]) => {
|
|
12881
12899
|
let i;
|
|
12882
|
-
n.type === "inline" ? i =
|
|
12900
|
+
n.type === "inline" ? i = $d.extend({
|
|
12883
12901
|
name: t
|
|
12884
|
-
}) : n.type === "anchor" ? i =
|
|
12902
|
+
}) : n.type === "anchor" ? i = Ud.extend({
|
|
12885
12903
|
name: t
|
|
12886
|
-
}) : n.type === "empty" ? i =
|
|
12904
|
+
}) : n.type === "empty" ? i = Oo.extend({
|
|
12887
12905
|
name: t
|
|
12888
|
-
}) : n.type === "list" ? i =
|
|
12906
|
+
}) : n.type === "list" ? i = Vd.extend({
|
|
12889
12907
|
name: t,
|
|
12890
12908
|
content: n.content || "item+"
|
|
12891
|
-
}) : n.type === "listItem" ? i =
|
|
12909
|
+
}) : n.type === "listItem" ? i = jd.extend({
|
|
12892
12910
|
name: t,
|
|
12893
12911
|
content: n.content || "p block*"
|
|
12894
12912
|
}) : n.type === "block" && (i = mn.extend({
|
|
@@ -12908,10 +12926,34 @@ function Ud(r) {
|
|
|
12908
12926
|
}));
|
|
12909
12927
|
}), e;
|
|
12910
12928
|
}
|
|
12911
|
-
const
|
|
12929
|
+
const Yd = Fd.extend({
|
|
12912
12930
|
content: "block+ noteGrp?"
|
|
12931
|
+
}), Xd = Co({
|
|
12932
|
+
find: /---|–-/,
|
|
12933
|
+
replace: "—"
|
|
12934
|
+
}), Zd = Co({
|
|
12935
|
+
find: /--(?!-)/,
|
|
12936
|
+
replace: "–"
|
|
12937
|
+
}), Qd = q.create({
|
|
12938
|
+
name: "inputRules",
|
|
12939
|
+
addInputRules() {
|
|
12940
|
+
return [
|
|
12941
|
+
Xd,
|
|
12942
|
+
Zd
|
|
12943
|
+
];
|
|
12944
|
+
}
|
|
12945
|
+
}), ef = q.create({
|
|
12946
|
+
name: "jinnTapCommands",
|
|
12947
|
+
addCommands() {
|
|
12948
|
+
return {
|
|
12949
|
+
moveUp: () => ({ commands: r }) => {
|
|
12950
|
+
const { from: e } = this.editor.state.selection, n = this.editor.state.doc.resolve(e).node();
|
|
12951
|
+
r.lift(n.type, n.attrs);
|
|
12952
|
+
}
|
|
12953
|
+
};
|
|
12954
|
+
}
|
|
12913
12955
|
});
|
|
12914
|
-
function
|
|
12956
|
+
function No(r, e, t) {
|
|
12915
12957
|
let n = null;
|
|
12916
12958
|
return r.state.doc.nodesBetween(e, t, (i, s, o, l) => {
|
|
12917
12959
|
i.isText && (n == null ? n = i.marks.map((a) => ({ mark: a, pos: s })) : n = n.filter((a) => i.marks.find((c) => c.type.name === a.mark.type.name)));
|
|
@@ -12923,7 +12965,7 @@ function Oo(r, e, t) {
|
|
|
12923
12965
|
return (((o = s.text) == null ? void 0 : o.length) || 0) - (((l = i.text) == null ? void 0 : l.length) || 0);
|
|
12924
12966
|
})), n;
|
|
12925
12967
|
}
|
|
12926
|
-
function
|
|
12968
|
+
function tf(r, e = []) {
|
|
12927
12969
|
const t = {}, n = [];
|
|
12928
12970
|
return r.state.doc.nodesBetween(0, r.state.doc.content.size, (i, s) => {
|
|
12929
12971
|
i.isText && e.forEach((o) => {
|
|
@@ -12937,11 +12979,11 @@ function Gd(r, e = []) {
|
|
|
12937
12979
|
});
|
|
12938
12980
|
}), t;
|
|
12939
12981
|
}
|
|
12940
|
-
function
|
|
12982
|
+
function nf(r) {
|
|
12941
12983
|
const t = new DOMParser().parseFromString(r, "application/xml"), n = t.querySelector("parsererror");
|
|
12942
12984
|
return n ? (console.error("XML Parsing Error:", n.textContent), null) : t;
|
|
12943
12985
|
}
|
|
12944
|
-
function
|
|
12986
|
+
function rf(r) {
|
|
12945
12987
|
if (!r) return "";
|
|
12946
12988
|
const e = [], t = r.querySelectorAll("text > body > *"), n = (i) => {
|
|
12947
12989
|
if (i.nodeType === Node.ELEMENT_NODE) {
|
|
@@ -12959,11 +13001,11 @@ function Xd(r) {
|
|
|
12959
13001
|
e.push(s.outerHTML);
|
|
12960
13002
|
}), e.join("");
|
|
12961
13003
|
}
|
|
12962
|
-
function
|
|
12963
|
-
const e =
|
|
12964
|
-
return e.documentElement.namespaceURI === "http://www.tei-c.org/ns/1.0" ?
|
|
13004
|
+
function sf(r) {
|
|
13005
|
+
const e = nf(r);
|
|
13006
|
+
return e.documentElement.namespaceURI === "http://www.tei-c.org/ns/1.0" ? rf(e) : xml;
|
|
12965
13007
|
}
|
|
12966
|
-
function
|
|
13008
|
+
function of(r, e, t, n = 3) {
|
|
12967
13009
|
let i = e - 1, s = 0;
|
|
12968
13010
|
for (; i >= 0; ) {
|
|
12969
13011
|
if (/[\p{P}\s]/.test(r.charAt(i))) {
|
|
@@ -12986,7 +13028,7 @@ function Qd(r, e, t, n = 3) {
|
|
|
12986
13028
|
}
|
|
12987
13029
|
return `… ${r.substring(i, e)}<mark>${r.substring(e, t)}</mark>${r.substring(t, o + 1)} …`;
|
|
12988
13030
|
}
|
|
12989
|
-
class
|
|
13031
|
+
class lf {
|
|
12990
13032
|
constructor(e, t) {
|
|
12991
13033
|
this.editor = e.tiptap, this.schemaDef = t, this.panel = e.querySelector(".attribute-panel"), this.currentElement = null, this.currentMark = null, this.setupEventListeners(), this.overlay = document.createElement("div"), this.overlay.className = "jinn-tap overlay", this.overlay.style.display = "block", this.overlay.style.position = "fixed", this.overlay.style.pointerEvents = "none", this.overlay.style.zIndex = "1000", this.overlay.style.display = "none";
|
|
12992
13034
|
}
|
|
@@ -13001,7 +13043,7 @@ class ef {
|
|
|
13001
13043
|
}
|
|
13002
13044
|
updatePanelForCurrentPosition(e) {
|
|
13003
13045
|
var l;
|
|
13004
|
-
const { from: t, to: n } = e.state.selection, i =
|
|
13046
|
+
const { from: t, to: n } = e.state.selection, i = No(e, t, n);
|
|
13005
13047
|
if (i && i.length > 0) {
|
|
13006
13048
|
this.currentElement = null;
|
|
13007
13049
|
const a = i[i.length - 1];
|
|
@@ -13100,10 +13142,22 @@ class ef {
|
|
|
13100
13142
|
a !== "" ? t[l] = a : i.push(l);
|
|
13101
13143
|
console.log("<jinn-tap> pendingChanges: %o, cleared: %o", t, i);
|
|
13102
13144
|
const { from: s, to: o } = this.editor.state.selection;
|
|
13103
|
-
this.editor.chain().focus().extendMarkRange(e.type).run(),
|
|
13145
|
+
if (e instanceof v && this.editor.chain().focus().extendMarkRange(e.type).run(), Object.keys(t).length > 0)
|
|
13146
|
+
if (e instanceof v)
|
|
13147
|
+
i.length > 0 && this.editor.commands.resetAttributes(e.type, i), this.editor.chain().focus().updateAttributes(e.type, t).setTextSelection({ from: s, to: o }).run();
|
|
13148
|
+
else {
|
|
13149
|
+
let l = null;
|
|
13150
|
+
if (this.editor.state.doc.nodesBetween(0, this.editor.state.doc.content.size, (a, c) => {
|
|
13151
|
+
if (a.eq(e))
|
|
13152
|
+
return l = c, !1;
|
|
13153
|
+
}), l !== null) {
|
|
13154
|
+
const a = this.editor.state.tr;
|
|
13155
|
+
a.setNodeMarkup(l, e.type, { ...e.attrs, ...t }), this.editor.view.dispatch(a);
|
|
13156
|
+
}
|
|
13157
|
+
}
|
|
13104
13158
|
}
|
|
13105
13159
|
updateOccurrences(e, t, n) {
|
|
13106
|
-
const i =
|
|
13160
|
+
const i = tf(e, n), s = document.createElement("div");
|
|
13107
13161
|
s.classList.add("occurrences"), s.innerHTML = `
|
|
13108
13162
|
<h5>Other Occurrences
|
|
13109
13163
|
<div role="group">
|
|
@@ -13131,14 +13185,14 @@ class ef {
|
|
|
13131
13185
|
to: d.pos + d.index + d.length,
|
|
13132
13186
|
hasMark: m
|
|
13133
13187
|
});
|
|
13134
|
-
const w = e.state.doc.textBetween(d.pos, f.end()),
|
|
13135
|
-
A.innerHTML =
|
|
13188
|
+
const w = e.state.doc.textBetween(d.pos, f.end()), D = of(w, d.index, d.index + d.length), A = document.createElement("span");
|
|
13189
|
+
A.innerHTML = D, y.appendChild(A), g.appendChild(y), o.appendChild(g), y.addEventListener("mouseenter", (M) => {
|
|
13136
13190
|
M.preventDefault(), M.stopPropagation();
|
|
13137
13191
|
const I = e.view.nodeDOM(d.pos);
|
|
13138
13192
|
if (I) {
|
|
13139
|
-
(I.nodeType ===
|
|
13193
|
+
(I.nodeType === ue.TEXT_NODE ? I.parentNode : I).scrollIntoView({ behavior: "instant", block: "center" });
|
|
13140
13194
|
let E;
|
|
13141
|
-
if (I.nodeType ===
|
|
13195
|
+
if (I.nodeType === ue.TEXT_NODE) {
|
|
13142
13196
|
const ee = document.createRange();
|
|
13143
13197
|
ee.setStart(I, d.index), ee.setEnd(I, d.index + d.length), E = ee.getBoundingClientRect();
|
|
13144
13198
|
} else
|
|
@@ -13163,7 +13217,7 @@ class ef {
|
|
|
13163
13217
|
});
|
|
13164
13218
|
}
|
|
13165
13219
|
}
|
|
13166
|
-
class
|
|
13220
|
+
class af {
|
|
13167
13221
|
constructor(e, t) {
|
|
13168
13222
|
this.editor = e.tiptap, this.attributePanel = t, this.panel = e.querySelector(".navigation-panel"), this.setupEventListeners();
|
|
13169
13223
|
}
|
|
@@ -13177,7 +13231,7 @@ class tf {
|
|
|
13177
13231
|
const { from: t, to: n } = e.state.selection, i = e.state.doc.nodeAt(t), s = [];
|
|
13178
13232
|
let o;
|
|
13179
13233
|
if (i) {
|
|
13180
|
-
i.isText && (o =
|
|
13234
|
+
i.isText && (o = No(e, t, n));
|
|
13181
13235
|
let a = t, c = e.state.doc.resolve(a).depth;
|
|
13182
13236
|
const u = e.state.doc.resolve(a);
|
|
13183
13237
|
for (; c > 0; ) {
|
|
@@ -13197,7 +13251,7 @@ class tf {
|
|
|
13197
13251
|
s.reverse().forEach((a, c) => {
|
|
13198
13252
|
const u = document.createElement("li"), d = document.createElement("a");
|
|
13199
13253
|
d.setAttribute("href", "#"), d.textContent = a.type, d.addEventListener("click", (f) => {
|
|
13200
|
-
f.preventDefault(), this.editor.chain().focus().setTextSelection(a.pos).run(), this.attributePanel.showNodeAttributes(a.node);
|
|
13254
|
+
f.preventDefault(), this.editor.chain().focus().setTextSelection({ from: a.pos.from - 1, to: a.pos.to + 1 }).run(), this.attributePanel.showNodeAttributes(a.node);
|
|
13201
13255
|
}), u.appendChild(d), l.appendChild(u);
|
|
13202
13256
|
}), o && o.forEach((a) => {
|
|
13203
13257
|
const c = document.createElement("li"), u = document.createElement("a");
|
|
@@ -13207,16 +13261,22 @@ class tf {
|
|
|
13207
13261
|
}), this.panel.appendChild(l);
|
|
13208
13262
|
}
|
|
13209
13263
|
}
|
|
13210
|
-
class
|
|
13264
|
+
class cf {
|
|
13211
13265
|
/**
|
|
13212
13266
|
* Create a new Toolbar instance.
|
|
13213
13267
|
*
|
|
13214
13268
|
* @param {Object} editor - The editor instance.
|
|
13215
13269
|
* @param {Object} schemaDef - The schema definition.
|
|
13216
|
-
* @param {Element} toolbarSlot - The toolbar slot element.
|
|
13217
13270
|
*/
|
|
13218
13271
|
constructor(e, t) {
|
|
13219
|
-
this.editor = e.tiptap, this.toolbar = e.querySelector(".toolbar"), this.schemaDef = t, this.addButtons(t)
|
|
13272
|
+
this.editor = e.tiptap, this.toolbar = e.querySelector(".toolbar"), this.schemaDef = t, this.addButtons(t), t.toolbar && Object.entries(t.toolbar).forEach(([s, o]) => {
|
|
13273
|
+
const l = this.createButton(s, s, o);
|
|
13274
|
+
l.addEventListener("click", (c) => {
|
|
13275
|
+
c.preventDefault(), o.command && this.editor.chain().focus()[o.command]().run();
|
|
13276
|
+
});
|
|
13277
|
+
const a = document.createElement("li");
|
|
13278
|
+
a.appendChild(l), this.toolbar.appendChild(a);
|
|
13279
|
+
});
|
|
13220
13280
|
const n = document.createElement("a");
|
|
13221
13281
|
n.href = "#", n.dataset.tooltip = "Toggle debug mode", n.dataset.placement = "bottom", n.className = "outline toolbar-button", n.innerHTML = '<i class="bi bi-question-circle"></i>', n.title = "Toggle debug mode", n.addEventListener("click", (s) => {
|
|
13222
13282
|
s.preventDefault();
|
|
@@ -13330,7 +13390,7 @@ class nf {
|
|
|
13330
13390
|
}), e.querySelector("ul").appendChild(o);
|
|
13331
13391
|
}
|
|
13332
13392
|
}
|
|
13333
|
-
function
|
|
13393
|
+
function uf(r) {
|
|
13334
13394
|
const e = "#E48500", t = {}, n = [], i = (u) => {
|
|
13335
13395
|
let d = parseInt(u.substring(1, 3), 16) / 255, f = parseInt(u.substring(3, 5), 16) / 255, h = parseInt(u.substring(5, 7), 16) / 255, p = Math.max(d, f, h), m = Math.min(d, f, h), g, y, S = (p + m) / 2;
|
|
13336
13396
|
if (p === m)
|
|
@@ -13382,14 +13442,19 @@ function rf(r) {
|
|
|
13382
13442
|
`)}
|
|
13383
13443
|
`;
|
|
13384
13444
|
}
|
|
13385
|
-
const
|
|
13445
|
+
const df = {
|
|
13386
13446
|
rend: {
|
|
13387
13447
|
type: "string"
|
|
13388
13448
|
},
|
|
13389
13449
|
id: {
|
|
13390
13450
|
type: "string"
|
|
13391
13451
|
}
|
|
13392
|
-
},
|
|
13452
|
+
}, ff = {
|
|
13453
|
+
"Move Up": {
|
|
13454
|
+
command: "moveUp",
|
|
13455
|
+
label: "<i class='bi bi-unindent'></i>"
|
|
13456
|
+
}
|
|
13457
|
+
}, hf = {
|
|
13393
13458
|
div: {
|
|
13394
13459
|
type: "block",
|
|
13395
13460
|
defining: !0,
|
|
@@ -13406,22 +13471,14 @@ const sf = {
|
|
|
13406
13471
|
"Mod-Shift-e": {
|
|
13407
13472
|
attributes: {},
|
|
13408
13473
|
command: "wrapDiv"
|
|
13409
|
-
},
|
|
13410
|
-
"Mod-Alt-e": {
|
|
13411
|
-
attributes: {},
|
|
13412
|
-
command: "liftDiv"
|
|
13413
13474
|
}
|
|
13414
13475
|
},
|
|
13415
13476
|
toolbar: {
|
|
13416
13477
|
Division: {
|
|
13478
|
+
select: "Blocks",
|
|
13417
13479
|
attributes: {},
|
|
13418
13480
|
command: "wrapDiv",
|
|
13419
13481
|
label: "<i class='bi bi-body-text'></i>"
|
|
13420
|
-
},
|
|
13421
|
-
"Unwrap nodes in division": {
|
|
13422
|
-
attributes: {},
|
|
13423
|
-
command: "liftDiv",
|
|
13424
|
-
label: "<i class='bi bi-arrow-up-left'></i>"
|
|
13425
13482
|
}
|
|
13426
13483
|
}
|
|
13427
13484
|
},
|
|
@@ -13820,8 +13877,9 @@ const sf = {
|
|
|
13820
13877
|
}
|
|
13821
13878
|
}
|
|
13822
13879
|
}, Vt = {
|
|
13823
|
-
attributes:
|
|
13824
|
-
|
|
13880
|
+
attributes: df,
|
|
13881
|
+
toolbar: ff,
|
|
13882
|
+
schema: hf
|
|
13825
13883
|
}, ir = document.createElement("style");
|
|
13826
13884
|
ir.textContent = `
|
|
13827
13885
|
jinn-tap {
|
|
@@ -13908,10 +13966,10 @@ ir.textContent = `
|
|
|
13908
13966
|
border-radius: 5px;
|
|
13909
13967
|
}
|
|
13910
13968
|
|
|
13911
|
-
${
|
|
13969
|
+
${uf(Vt)}
|
|
13912
13970
|
`;
|
|
13913
13971
|
document.querySelector("#jinn-tap-styles") || (ir.id = "jinn-tap-styles", document.head.appendChild(ir));
|
|
13914
|
-
class
|
|
13972
|
+
class pf extends HTMLElement {
|
|
13915
13973
|
static get observedAttributes() {
|
|
13916
13974
|
return ["debug", "url"];
|
|
13917
13975
|
}
|
|
@@ -13926,7 +13984,7 @@ class lf extends HTMLElement {
|
|
|
13926
13984
|
const t = await fetch(e);
|
|
13927
13985
|
if (!t.ok)
|
|
13928
13986
|
throw new Error(`HTTP error! status: ${t.status}`);
|
|
13929
|
-
const n = await t.text(), i =
|
|
13987
|
+
const n = await t.text(), i = sf(n);
|
|
13930
13988
|
this.editor ? this.content = i : this._pendingContent = i;
|
|
13931
13989
|
} catch (t) {
|
|
13932
13990
|
console.error("Error loading content from URL:", t), this.dispatchEvent(new CustomEvent("error", {
|
|
@@ -13952,14 +14010,16 @@ class lf extends HTMLElement {
|
|
|
13952
14010
|
<div class="attribute-panel"></div>
|
|
13953
14011
|
</div>
|
|
13954
14012
|
`, this.applySlots(e);
|
|
13955
|
-
const t = e.innerHTML.trim(), n =
|
|
13956
|
-
this.editor = new
|
|
14013
|
+
const t = e.innerHTML.trim(), n = Gd(Vt);
|
|
14014
|
+
this.editor = new Md({
|
|
13957
14015
|
element: this.querySelector(".editor-area"),
|
|
13958
14016
|
extensions: [
|
|
13959
14017
|
...n,
|
|
13960
|
-
|
|
13961
|
-
|
|
13962
|
-
|
|
14018
|
+
Qd,
|
|
14019
|
+
ef,
|
|
14020
|
+
_d,
|
|
14021
|
+
Rd,
|
|
14022
|
+
Bd.configure({
|
|
13963
14023
|
placeholder: "Write something...",
|
|
13964
14024
|
includeChildren: !0
|
|
13965
14025
|
})
|
|
@@ -13974,7 +14034,7 @@ class lf extends HTMLElement {
|
|
|
13974
14034
|
this.dispatchContentChange(), this.dispatchEvent(new CustomEvent("ready"));
|
|
13975
14035
|
},
|
|
13976
14036
|
onUpdate: () => this.dispatchContentChange()
|
|
13977
|
-
}), this.
|
|
14037
|
+
}), this.attributePanel = new lf(this, Vt), this.navigationPanel = new af(this, this.attributePanel), this.toolbar = new cf(this, Vt);
|
|
13978
14038
|
const i = this.getAttribute("url");
|
|
13979
14039
|
i && this.loadFromUrl(i);
|
|
13980
14040
|
}
|
|
@@ -14021,8 +14081,8 @@ class lf extends HTMLElement {
|
|
|
14021
14081
|
return t.forEach((n) => n.remove()), e;
|
|
14022
14082
|
}
|
|
14023
14083
|
}
|
|
14024
|
-
customElements.define("jinn-tap",
|
|
14084
|
+
customElements.define("jinn-tap", pf);
|
|
14025
14085
|
export {
|
|
14026
|
-
|
|
14086
|
+
pf as JinnTap
|
|
14027
14087
|
};
|
|
14028
14088
|
//# sourceMappingURL=jinn-tap.es.js.map
|