@nine-lab/nine-ux 0.1.35 → 0.1.36
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/nine-ux.es.js +612 -607
- package/dist/nine-ux.es.js.map +1 -1
- package/dist/nine-ux.umd.js +19 -19
- package/dist/nine-ux.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/nine-ux.es.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
var bl = Object.defineProperty;
|
|
2
|
-
var
|
|
2
|
+
var si = (n) => {
|
|
3
3
|
throw TypeError(n);
|
|
4
4
|
};
|
|
5
5
|
var kl = (n, e, t) => e in n ? bl(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
|
|
6
|
-
var ye = (n, e, t) => kl(n, typeof e != "symbol" ? e + "" : e, t), Wn = (n, e, t) => e.has(n) ||
|
|
7
|
-
var O = (n, e, t) => (Wn(n, e, "read from private field"), t ? t.call(n) : e.get(n)), W = (n, e, t) => e.has(n) ?
|
|
8
|
-
import { nine as
|
|
6
|
+
var ye = (n, e, t) => kl(n, typeof e != "symbol" ? e + "" : e, t), Wn = (n, e, t) => e.has(n) || si("Cannot " + t);
|
|
7
|
+
var O = (n, e, t) => (Wn(n, e, "read from private field"), t ? t.call(n) : e.get(n)), W = (n, e, t) => e.has(n) ? si("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(n) : e.set(n, t), oe = (n, e, t, r) => (Wn(n, e, "write to private field"), r ? r.call(n, t) : e.set(n, t), t), Q = (n, e, t) => (Wn(n, e, "access private method"), t);
|
|
8
|
+
import { nine as cr, subscribeConfig as xl } from "@nine-lab/nine-util";
|
|
9
9
|
const Sl = `
|
|
10
10
|
dialog::backdrop {
|
|
11
11
|
background: rgba(0, 0, 0, 0.3);
|
|
@@ -410,7 +410,7 @@ class Ml extends HTMLElement {
|
|
|
410
410
|
}
|
|
411
411
|
Oe = new WeakMap(), q = new WeakMap(), Tn = new WeakMap(), On = new WeakMap(), En = new WeakMap();
|
|
412
412
|
customElements.get("nine-dialog") || customElements.define("nine-dialog", Ml);
|
|
413
|
-
class
|
|
413
|
+
class Rr extends HTMLElement {
|
|
414
414
|
constructor() {
|
|
415
415
|
super(), this.attachShadow({ mode: "open" });
|
|
416
416
|
}
|
|
@@ -426,7 +426,7 @@ class Ir extends HTMLElement {
|
|
|
426
426
|
`;
|
|
427
427
|
}
|
|
428
428
|
}
|
|
429
|
-
ye(
|
|
429
|
+
ye(Rr, "confirm", async (e, t = "Confirm", r = {}) => {
|
|
430
430
|
var d;
|
|
431
431
|
const i = {
|
|
432
432
|
"true-text": "Yes",
|
|
@@ -448,7 +448,7 @@ ye(Ir, "confirm", async (e, t = "Confirm", r = {}) => {
|
|
|
448
448
|
}, o.addEventListener("close", () => u(void 0)), o.showModal();
|
|
449
449
|
});
|
|
450
450
|
});
|
|
451
|
-
class
|
|
451
|
+
class Pr extends HTMLElement {
|
|
452
452
|
constructor() {
|
|
453
453
|
super(), this.attachShadow({ mode: "open" });
|
|
454
454
|
}
|
|
@@ -463,7 +463,7 @@ class Rr extends HTMLElement {
|
|
|
463
463
|
`;
|
|
464
464
|
}
|
|
465
465
|
}
|
|
466
|
-
ye(
|
|
466
|
+
ye(Pr, "alert", async (e, t = "Alert", r = {}) => {
|
|
467
467
|
var c;
|
|
468
468
|
const i = {
|
|
469
469
|
class: "",
|
|
@@ -482,8 +482,8 @@ ye(Rr, "alert", async (e, t = "Alert", r = {}) => {
|
|
|
482
482
|
l.onclick = u, o.showModal();
|
|
483
483
|
});
|
|
484
484
|
});
|
|
485
|
-
customElements.get("nine-confirm-popup") || customElements.define("nine-confirm-popup",
|
|
486
|
-
customElements.get("nine-alert-popup") || customElements.define("nine-alert-popup",
|
|
485
|
+
customElements.get("nine-confirm-popup") || customElements.define("nine-confirm-popup", Rr);
|
|
486
|
+
customElements.get("nine-alert-popup") || customElements.define("nine-alert-popup", Pr);
|
|
487
487
|
var qt;
|
|
488
488
|
class wl {
|
|
489
489
|
constructor() {
|
|
@@ -492,7 +492,7 @@ class wl {
|
|
|
492
492
|
// 1. 값만 깔끔하게 반환
|
|
493
493
|
get cssPath() {
|
|
494
494
|
var e;
|
|
495
|
-
return ((e =
|
|
495
|
+
return ((e = cr.config.ux) == null ? void 0 : e.cssPath) || O(this, qt);
|
|
496
496
|
}
|
|
497
497
|
set cssPath(e) {
|
|
498
498
|
oe(this, qt, e);
|
|
@@ -500,10 +500,10 @@ class wl {
|
|
|
500
500
|
// 이제 setup이나 window 교체 로직은 여기서 다 제거합니다.
|
|
501
501
|
// 오직 팝업을 실행하는 인터페이스 역할만 수행.
|
|
502
502
|
async alert(e, t = "Alert", r = {}) {
|
|
503
|
-
return await
|
|
503
|
+
return await Pr.alert(e, t, r);
|
|
504
504
|
}
|
|
505
505
|
async confirm(e, t = "Confirm", r = {}) {
|
|
506
|
-
return await
|
|
506
|
+
return await Rr.confirm(e, t, r);
|
|
507
507
|
}
|
|
508
508
|
/**
|
|
509
509
|
* 컴포넌트별 CSS 경로 생성 헬퍼 (복구!)
|
|
@@ -515,7 +515,7 @@ class wl {
|
|
|
515
515
|
}
|
|
516
516
|
qt = new WeakMap();
|
|
517
517
|
const It = new wl();
|
|
518
|
-
var jt, Xe, Kt, ae, Ct,
|
|
518
|
+
var jt, Xe, Kt, ae, Ct, dr, ur, Jt, vn;
|
|
519
519
|
class Cl extends HTMLElement {
|
|
520
520
|
constructor() {
|
|
521
521
|
super();
|
|
@@ -540,20 +540,20 @@ class Cl extends HTMLElement {
|
|
|
540
540
|
});
|
|
541
541
|
// 파라미터가 있으면 해당 값으로, 없으면 전체 공백 초기화
|
|
542
542
|
ye(this, "clearData", (t = {}) => {
|
|
543
|
-
Q(this, ae,
|
|
543
|
+
Q(this, ae, ur).call(this), Q(this, ae, Ct).call(this).forEach((r) => {
|
|
544
544
|
const i = r.name;
|
|
545
545
|
if (!i) return;
|
|
546
546
|
const s = t && t[i] !== void 0 ? t[i] : "";
|
|
547
|
-
Q(this, ae,
|
|
547
|
+
Q(this, ae, dr).call(this, r, s);
|
|
548
548
|
}), this.changed = !1;
|
|
549
549
|
});
|
|
550
550
|
ye(this, "setData", (t) => {
|
|
551
551
|
if (!t || typeof t != "object") return;
|
|
552
|
-
Q(this, ae,
|
|
552
|
+
Q(this, ae, ur).call(this);
|
|
553
553
|
let r = !1;
|
|
554
554
|
Q(this, ae, Ct).call(this).forEach((i) => {
|
|
555
555
|
const s = i.name;
|
|
556
|
-
!s || !t.hasOwnProperty(s) || Q(this, ae,
|
|
556
|
+
!s || !t.hasOwnProperty(s) || Q(this, ae, dr).call(this, i, t[s]) && (r = !0);
|
|
557
557
|
}), r && (this.changed = !0);
|
|
558
558
|
});
|
|
559
559
|
ye(this, "initData", (t) => {
|
|
@@ -592,7 +592,7 @@ jt = new WeakMap(), Xe = new WeakMap(), Kt = new WeakMap(), ae = new WeakSet(),
|
|
|
592
592
|
Ct = function() {
|
|
593
593
|
return ninegrid.querySelectorAll("input[name], textarea[name], select[name], nx-editor[name]", O(this, Xe));
|
|
594
594
|
}, // [공통 로직 1] 특정 요소에 값을 쓰거나 초기화하는 핵심 함수
|
|
595
|
-
|
|
595
|
+
dr = function(t, r) {
|
|
596
596
|
const i = t.tagName.toUpperCase(), s = t.type;
|
|
597
597
|
let o = !1;
|
|
598
598
|
if (["INPUT", "TEXTAREA", "SELECT", "NX-EDITOR"].includes(i))
|
|
@@ -608,7 +608,7 @@ cr = function(t, r) {
|
|
|
608
608
|
t.textContent !== r && (o = !0), t.textContent = r;
|
|
609
609
|
return o;
|
|
610
610
|
}, // [공통 로직 2] 이벤트 리스너 일괄 등록
|
|
611
|
-
|
|
611
|
+
ur = function() {
|
|
612
612
|
Q(this, ae, Ct).call(this).forEach((t) => {
|
|
613
613
|
t.removeEventListener("input", O(this, Jt)), t.addEventListener("input", O(this, Jt));
|
|
614
614
|
});
|
|
@@ -713,7 +713,7 @@ j.from = function(n) {
|
|
|
713
713
|
if (n) for (var t in n) e.push(t, n[t]);
|
|
714
714
|
return new j(e);
|
|
715
715
|
};
|
|
716
|
-
function
|
|
716
|
+
function Ms(n, e, t) {
|
|
717
717
|
for (let r = 0; ; r++) {
|
|
718
718
|
if (r == n.childCount || r == e.childCount)
|
|
719
719
|
return n.childCount == e.childCount ? null : t;
|
|
@@ -730,14 +730,14 @@ function Ss(n, e, t) {
|
|
|
730
730
|
return t;
|
|
731
731
|
}
|
|
732
732
|
if (i.content.size || s.content.size) {
|
|
733
|
-
let o =
|
|
733
|
+
let o = Ms(i.content, s.content, t + 1);
|
|
734
734
|
if (o != null)
|
|
735
735
|
return o;
|
|
736
736
|
}
|
|
737
737
|
t += i.nodeSize;
|
|
738
738
|
}
|
|
739
739
|
}
|
|
740
|
-
function
|
|
740
|
+
function ws(n, e, t, r) {
|
|
741
741
|
for (let i = n.childCount, s = e.childCount; ; ) {
|
|
742
742
|
if (i == 0 || s == 0)
|
|
743
743
|
return i == s ? null : { a: t, b: r };
|
|
@@ -755,7 +755,7 @@ function Ms(n, e, t, r) {
|
|
|
755
755
|
return { a: t, b: r };
|
|
756
756
|
}
|
|
757
757
|
if (o.content.size || l.content.size) {
|
|
758
|
-
let c =
|
|
758
|
+
let c = ws(o.content, l.content, t - 1, r - 1);
|
|
759
759
|
if (c)
|
|
760
760
|
return c;
|
|
761
761
|
}
|
|
@@ -924,7 +924,7 @@ class b {
|
|
|
924
924
|
fragment differ, or `null` if they are the same.
|
|
925
925
|
*/
|
|
926
926
|
findDiffStart(e, t = 0) {
|
|
927
|
-
return
|
|
927
|
+
return Ms(this, e, t);
|
|
928
928
|
}
|
|
929
929
|
/**
|
|
930
930
|
Find the first position, searching from the end, at which this
|
|
@@ -933,7 +933,7 @@ class b {
|
|
|
933
933
|
nodes, an object with two separate positions is returned.
|
|
934
934
|
*/
|
|
935
935
|
findDiffEnd(e, t = this.size, r = e.size) {
|
|
936
|
-
return
|
|
936
|
+
return ws(this, e, t, r);
|
|
937
937
|
}
|
|
938
938
|
/**
|
|
939
939
|
Find the index and inner offset corresponding to a given relative
|
|
@@ -1043,7 +1043,7 @@ function un(n, e) {
|
|
|
1043
1043
|
}
|
|
1044
1044
|
return !0;
|
|
1045
1045
|
}
|
|
1046
|
-
let A = class
|
|
1046
|
+
let A = class fr {
|
|
1047
1047
|
/**
|
|
1048
1048
|
@internal
|
|
1049
1049
|
*/
|
|
@@ -1141,8 +1141,8 @@ let A = class ur {
|
|
|
1141
1141
|
*/
|
|
1142
1142
|
static setFrom(e) {
|
|
1143
1143
|
if (!e || Array.isArray(e) && e.length == 0)
|
|
1144
|
-
return
|
|
1145
|
-
if (e instanceof
|
|
1144
|
+
return fr.none;
|
|
1145
|
+
if (e instanceof fr)
|
|
1146
1146
|
return [e];
|
|
1147
1147
|
let t = e.slice();
|
|
1148
1148
|
return t.sort((r, i) => r.type.rank - i.type.rank), t;
|
|
@@ -1177,14 +1177,14 @@ class k {
|
|
|
1177
1177
|
@internal
|
|
1178
1178
|
*/
|
|
1179
1179
|
insertAt(e, t) {
|
|
1180
|
-
let r =
|
|
1180
|
+
let r = Ts(this.content, e + this.openStart, t);
|
|
1181
1181
|
return r && new k(r, this.openStart, this.openEnd);
|
|
1182
1182
|
}
|
|
1183
1183
|
/**
|
|
1184
1184
|
@internal
|
|
1185
1185
|
*/
|
|
1186
1186
|
removeBetween(e, t) {
|
|
1187
|
-
return new k(
|
|
1187
|
+
return new k(Cs(this.content, e + this.openStart, t + this.openStart), this.openStart, this.openEnd);
|
|
1188
1188
|
}
|
|
1189
1189
|
/**
|
|
1190
1190
|
Tests whether this slice is equal to another slice.
|
|
@@ -1232,7 +1232,7 @@ class k {
|
|
|
1232
1232
|
}
|
|
1233
1233
|
}
|
|
1234
1234
|
k.empty = new k(b.empty, 0, 0);
|
|
1235
|
-
function
|
|
1235
|
+
function Cs(n, e, t) {
|
|
1236
1236
|
let { index: r, offset: i } = n.findIndex(e), s = n.maybeChild(r), { index: o, offset: l } = n.findIndex(t);
|
|
1237
1237
|
if (i == e || s.isText) {
|
|
1238
1238
|
if (l != t && !n.child(o).isText)
|
|
@@ -1241,13 +1241,13 @@ function ws(n, e, t) {
|
|
|
1241
1241
|
}
|
|
1242
1242
|
if (r != o)
|
|
1243
1243
|
throw new RangeError("Removing non-flat range");
|
|
1244
|
-
return n.replaceChild(r, s.copy(
|
|
1244
|
+
return n.replaceChild(r, s.copy(Cs(s.content, e - i - 1, t - i - 1)));
|
|
1245
1245
|
}
|
|
1246
|
-
function
|
|
1246
|
+
function Ts(n, e, t, r) {
|
|
1247
1247
|
let { index: i, offset: s } = n.findIndex(e), o = n.maybeChild(i);
|
|
1248
1248
|
if (s == e || o.isText)
|
|
1249
1249
|
return r && !r.canReplace(i, i, t) ? null : n.cut(0, e).append(t).append(n.cut(e));
|
|
1250
|
-
let l =
|
|
1250
|
+
let l = Ts(o.content, e - s - 1, t, o);
|
|
1251
1251
|
return l && n.replaceChild(i, o.copy(l));
|
|
1252
1252
|
}
|
|
1253
1253
|
function Tl(n, e, t) {
|
|
@@ -1255,12 +1255,12 @@ function Tl(n, e, t) {
|
|
|
1255
1255
|
throw new fn("Inserted content deeper than insertion position");
|
|
1256
1256
|
if (n.depth - t.openStart != e.depth - t.openEnd)
|
|
1257
1257
|
throw new fn("Inconsistent open depths");
|
|
1258
|
-
return
|
|
1258
|
+
return Os(n, e, t, 0);
|
|
1259
1259
|
}
|
|
1260
|
-
function
|
|
1260
|
+
function Os(n, e, t, r) {
|
|
1261
1261
|
let i = n.index(r), s = n.node(r);
|
|
1262
1262
|
if (i == e.index(r) && r < n.depth - t.openStart) {
|
|
1263
|
-
let o =
|
|
1263
|
+
let o = Os(n, e, t, r + 1);
|
|
1264
1264
|
return s.copy(s.content.replaceChild(i, o));
|
|
1265
1265
|
} else if (t.content.size)
|
|
1266
1266
|
if (!t.openStart && !t.openEnd && n.depth == r && e.depth == r) {
|
|
@@ -1268,17 +1268,17 @@ function Ts(n, e, t, r) {
|
|
|
1268
1268
|
return Qe(o, l.cut(0, n.parentOffset).append(t.content).append(l.cut(e.parentOffset)));
|
|
1269
1269
|
} else {
|
|
1270
1270
|
let { start: o, end: l } = Ol(t, n);
|
|
1271
|
-
return Qe(s,
|
|
1271
|
+
return Qe(s, vs(n, o, l, e, r));
|
|
1272
1272
|
}
|
|
1273
1273
|
else return Qe(s, hn(n, e, r));
|
|
1274
1274
|
}
|
|
1275
|
-
function
|
|
1275
|
+
function Es(n, e) {
|
|
1276
1276
|
if (!e.type.compatibleContent(n.type))
|
|
1277
1277
|
throw new fn("Cannot join " + e.type.name + " onto " + n.type.name);
|
|
1278
1278
|
}
|
|
1279
|
-
function
|
|
1279
|
+
function hr(n, e, t) {
|
|
1280
1280
|
let r = n.node(t);
|
|
1281
|
-
return
|
|
1281
|
+
return Es(r, e.node(t)), r;
|
|
1282
1282
|
}
|
|
1283
1283
|
function Ze(n, e) {
|
|
1284
1284
|
let t = e.length - 1;
|
|
@@ -1294,14 +1294,14 @@ function vt(n, e, t, r) {
|
|
|
1294
1294
|
function Qe(n, e) {
|
|
1295
1295
|
return n.type.checkContent(e), n.copy(e);
|
|
1296
1296
|
}
|
|
1297
|
-
function
|
|
1298
|
-
let s = n.depth > i &&
|
|
1299
|
-
return vt(null, n, i, l), s && o && e.index(i) == t.index(i) ? (
|
|
1297
|
+
function vs(n, e, t, r, i) {
|
|
1298
|
+
let s = n.depth > i && hr(n, e, i + 1), o = r.depth > i && hr(t, r, i + 1), l = [];
|
|
1299
|
+
return vt(null, n, i, l), s && o && e.index(i) == t.index(i) ? (Es(s, o), Ze(Qe(s, vs(n, e, t, r, i + 1)), l)) : (s && Ze(Qe(s, hn(n, e, i + 1)), l), vt(e, t, i, l), o && Ze(Qe(o, hn(t, r, i + 1)), l)), vt(r, null, i, l), new b(l);
|
|
1300
1300
|
}
|
|
1301
1301
|
function hn(n, e, t) {
|
|
1302
1302
|
let r = [];
|
|
1303
1303
|
if (vt(null, n, t, r), n.depth > t) {
|
|
1304
|
-
let i =
|
|
1304
|
+
let i = hr(n, e, t + 1);
|
|
1305
1305
|
Ze(Qe(i, hn(n, e, t + 1)), r);
|
|
1306
1306
|
}
|
|
1307
1307
|
return vt(e, null, t, r), new b(r);
|
|
@@ -1549,7 +1549,7 @@ class Rt {
|
|
|
1549
1549
|
@internal
|
|
1550
1550
|
*/
|
|
1551
1551
|
static resolveCached(e, t) {
|
|
1552
|
-
let r =
|
|
1552
|
+
let r = oi.get(e);
|
|
1553
1553
|
if (r)
|
|
1554
1554
|
for (let s = 0; s < r.elts.length; s++) {
|
|
1555
1555
|
let o = r.elts[s];
|
|
@@ -1557,7 +1557,7 @@ class Rt {
|
|
|
1557
1557
|
return o;
|
|
1558
1558
|
}
|
|
1559
1559
|
else
|
|
1560
|
-
|
|
1560
|
+
oi.set(e, r = new El());
|
|
1561
1561
|
let i = r.elts[r.i] = Rt.resolve(e, t);
|
|
1562
1562
|
return r.i = (r.i + 1) % vl, i;
|
|
1563
1563
|
}
|
|
@@ -1567,7 +1567,7 @@ class El {
|
|
|
1567
1567
|
this.elts = [], this.i = 0;
|
|
1568
1568
|
}
|
|
1569
1569
|
}
|
|
1570
|
-
const vl = 12,
|
|
1570
|
+
const vl = 12, oi = /* @__PURE__ */ new WeakMap();
|
|
1571
1571
|
class pn {
|
|
1572
1572
|
/**
|
|
1573
1573
|
Construct a node range. `$from` and `$to` should point into the
|
|
@@ -1609,7 +1609,7 @@ class pn {
|
|
|
1609
1609
|
}
|
|
1610
1610
|
}
|
|
1611
1611
|
const Nl = /* @__PURE__ */ Object.create(null);
|
|
1612
|
-
let ze = class
|
|
1612
|
+
let ze = class pr {
|
|
1613
1613
|
/**
|
|
1614
1614
|
@internal
|
|
1615
1615
|
*/
|
|
@@ -1734,14 +1734,14 @@ let ze = class hr {
|
|
|
1734
1734
|
the given content (or empty, if no content is given).
|
|
1735
1735
|
*/
|
|
1736
1736
|
copy(e = null) {
|
|
1737
|
-
return e == this.content ? this : new
|
|
1737
|
+
return e == this.content ? this : new pr(this.type, this.attrs, e, this.marks);
|
|
1738
1738
|
}
|
|
1739
1739
|
/**
|
|
1740
1740
|
Create a copy of this node, with the given set of marks instead
|
|
1741
1741
|
of the node's own marks.
|
|
1742
1742
|
*/
|
|
1743
1743
|
mark(e) {
|
|
1744
|
-
return e == this.marks ? this : new
|
|
1744
|
+
return e == this.marks ? this : new pr(this.type, this.attrs, this.content, e);
|
|
1745
1745
|
}
|
|
1746
1746
|
/**
|
|
1747
1747
|
Create a copy of this node with only the content between the
|
|
@@ -1885,7 +1885,7 @@ let ze = class hr {
|
|
|
1885
1885
|
if (this.type.spec.toDebugString)
|
|
1886
1886
|
return this.type.spec.toDebugString(this);
|
|
1887
1887
|
let e = this.type.name;
|
|
1888
|
-
return this.content.size && (e += "(" + this.content.toStringInner() + ")"),
|
|
1888
|
+
return this.content.size && (e += "(" + this.content.toStringInner() + ")"), Ns(this.marks, e);
|
|
1889
1889
|
}
|
|
1890
1890
|
/**
|
|
1891
1891
|
Get the content match in this node at the given index.
|
|
@@ -1989,7 +1989,7 @@ class mn extends ze {
|
|
|
1989
1989
|
this.text = r;
|
|
1990
1990
|
}
|
|
1991
1991
|
toString() {
|
|
1992
|
-
return this.type.spec.toDebugString ? this.type.spec.toDebugString(this) :
|
|
1992
|
+
return this.type.spec.toDebugString ? this.type.spec.toDebugString(this) : Ns(this.marks, JSON.stringify(this.text));
|
|
1993
1993
|
}
|
|
1994
1994
|
get textContent() {
|
|
1995
1995
|
return this.text;
|
|
@@ -2017,7 +2017,7 @@ class mn extends ze {
|
|
|
2017
2017
|
return e.text = this.text, e;
|
|
2018
2018
|
}
|
|
2019
2019
|
}
|
|
2020
|
-
function
|
|
2020
|
+
function Ns(n, e) {
|
|
2021
2021
|
for (let t = n.length - 1; t >= 0; t--)
|
|
2022
2022
|
e = n[t].type.name + "(" + e + ")";
|
|
2023
2023
|
return e;
|
|
@@ -2036,7 +2036,7 @@ class rt {
|
|
|
2036
2036
|
let r = new Al(e, t);
|
|
2037
2037
|
if (r.next == null)
|
|
2038
2038
|
return rt.empty;
|
|
2039
|
-
let i =
|
|
2039
|
+
let i = As(r);
|
|
2040
2040
|
r.next && r.err("Unexpected trailing text");
|
|
2041
2041
|
let s = zl(Ll(i));
|
|
2042
2042
|
return Fl(s, r), s;
|
|
@@ -2199,7 +2199,7 @@ class Al {
|
|
|
2199
2199
|
throw new SyntaxError(e + " (in content expression '" + this.string + "')");
|
|
2200
2200
|
}
|
|
2201
2201
|
}
|
|
2202
|
-
function
|
|
2202
|
+
function As(n) {
|
|
2203
2203
|
let e = [];
|
|
2204
2204
|
do
|
|
2205
2205
|
e.push(Dl(n));
|
|
@@ -2228,14 +2228,14 @@ function Il(n) {
|
|
|
2228
2228
|
break;
|
|
2229
2229
|
return e;
|
|
2230
2230
|
}
|
|
2231
|
-
function
|
|
2231
|
+
function li(n) {
|
|
2232
2232
|
/\D/.test(n.next) && n.err("Expected number, got '" + n.next + "'");
|
|
2233
2233
|
let e = Number(n.next);
|
|
2234
2234
|
return n.pos++, e;
|
|
2235
2235
|
}
|
|
2236
2236
|
function Rl(n, e) {
|
|
2237
|
-
let t =
|
|
2238
|
-
return n.eat(",") && (n.next != "}" ? r =
|
|
2237
|
+
let t = li(n), r = t;
|
|
2238
|
+
return n.eat(",") && (n.next != "}" ? r = li(n) : r = -1), n.eat("}") || n.err("Unclosed braced range"), { type: "range", min: t, max: r, expr: e };
|
|
2239
2239
|
}
|
|
2240
2240
|
function Pl(n, e) {
|
|
2241
2241
|
let t = n.nodeTypes, r = t[e];
|
|
@@ -2250,7 +2250,7 @@ function Pl(n, e) {
|
|
|
2250
2250
|
}
|
|
2251
2251
|
function Bl(n) {
|
|
2252
2252
|
if (n.eat("(")) {
|
|
2253
|
-
let e =
|
|
2253
|
+
let e = As(n);
|
|
2254
2254
|
return n.eat(")") || n.err("Missing closing paren"), e;
|
|
2255
2255
|
} else if (/\W/.test(n.next))
|
|
2256
2256
|
n.err("Unexpected token '" + n.next + "'");
|
|
@@ -2313,12 +2313,12 @@ function Ll(n) {
|
|
|
2313
2313
|
}
|
|
2314
2314
|
}
|
|
2315
2315
|
}
|
|
2316
|
-
function
|
|
2316
|
+
function Ds(n, e) {
|
|
2317
2317
|
return e - n;
|
|
2318
2318
|
}
|
|
2319
|
-
function
|
|
2319
|
+
function ai(n, e) {
|
|
2320
2320
|
let t = [];
|
|
2321
|
-
return r(e), t.sort(
|
|
2321
|
+
return r(e), t.sort(Ds);
|
|
2322
2322
|
function r(i) {
|
|
2323
2323
|
let s = n[i];
|
|
2324
2324
|
if (s.length == 1 && !s[0].term)
|
|
@@ -2332,7 +2332,7 @@ function li(n, e) {
|
|
|
2332
2332
|
}
|
|
2333
2333
|
function zl(n) {
|
|
2334
2334
|
let e = /* @__PURE__ */ Object.create(null);
|
|
2335
|
-
return t(
|
|
2335
|
+
return t(ai(n, 0));
|
|
2336
2336
|
function t(r) {
|
|
2337
2337
|
let i = [];
|
|
2338
2338
|
r.forEach((o) => {
|
|
@@ -2342,14 +2342,14 @@ function zl(n) {
|
|
|
2342
2342
|
let c;
|
|
2343
2343
|
for (let d = 0; d < i.length; d++)
|
|
2344
2344
|
i[d][0] == l && (c = i[d][1]);
|
|
2345
|
-
|
|
2345
|
+
ai(n, a).forEach((d) => {
|
|
2346
2346
|
c || i.push([l, c = []]), c.indexOf(d) == -1 && c.push(d);
|
|
2347
2347
|
});
|
|
2348
2348
|
});
|
|
2349
2349
|
});
|
|
2350
2350
|
let s = e[r.join(",")] = new rt(r.indexOf(n.length - 1) > -1);
|
|
2351
2351
|
for (let o = 0; o < i.length; o++) {
|
|
2352
|
-
let l = i[o][1].sort(
|
|
2352
|
+
let l = i[o][1].sort(Ds);
|
|
2353
2353
|
s.next.push({ type: i[o][0], next: e[l.join(",")] || t(l) });
|
|
2354
2354
|
}
|
|
2355
2355
|
return s;
|
|
@@ -2365,7 +2365,7 @@ function Fl(n, e) {
|
|
|
2365
2365
|
s && e.err("Only non-generatable nodes (" + o.join(", ") + ") in a required position (see https://prosemirror.net/docs/guide/#generatable)");
|
|
2366
2366
|
}
|
|
2367
2367
|
}
|
|
2368
|
-
function
|
|
2368
|
+
function Is(n) {
|
|
2369
2369
|
let e = /* @__PURE__ */ Object.create(null);
|
|
2370
2370
|
for (let t in n) {
|
|
2371
2371
|
let r = n[t];
|
|
@@ -2375,7 +2375,7 @@ function Ds(n) {
|
|
|
2375
2375
|
}
|
|
2376
2376
|
return e;
|
|
2377
2377
|
}
|
|
2378
|
-
function
|
|
2378
|
+
function Rs(n, e) {
|
|
2379
2379
|
let t = /* @__PURE__ */ Object.create(null);
|
|
2380
2380
|
for (let r in n) {
|
|
2381
2381
|
let i = e && e[r];
|
|
@@ -2390,7 +2390,7 @@ function Is(n, e) {
|
|
|
2390
2390
|
}
|
|
2391
2391
|
return t;
|
|
2392
2392
|
}
|
|
2393
|
-
function
|
|
2393
|
+
function Ps(n, e, t, r) {
|
|
2394
2394
|
for (let i in e)
|
|
2395
2395
|
if (!(i in n))
|
|
2396
2396
|
throw new RangeError(`Unsupported attribute ${i} for ${t} of type ${i}`);
|
|
@@ -2399,19 +2399,19 @@ function Rs(n, e, t, r) {
|
|
|
2399
2399
|
s.validate && s.validate(e[i]);
|
|
2400
2400
|
}
|
|
2401
2401
|
}
|
|
2402
|
-
function
|
|
2402
|
+
function Bs(n, e) {
|
|
2403
2403
|
let t = /* @__PURE__ */ Object.create(null);
|
|
2404
2404
|
if (e)
|
|
2405
2405
|
for (let r in e)
|
|
2406
2406
|
t[r] = new Vl(n, r, e[r]);
|
|
2407
2407
|
return t;
|
|
2408
2408
|
}
|
|
2409
|
-
let
|
|
2409
|
+
let ci = class Ls {
|
|
2410
2410
|
/**
|
|
2411
2411
|
@internal
|
|
2412
2412
|
*/
|
|
2413
2413
|
constructor(e, t, r) {
|
|
2414
|
-
this.name = e, this.schema = t, this.spec = r, this.markSet = null, this.groups = r.group ? r.group.split(" ") : [], this.attrs =
|
|
2414
|
+
this.name = e, this.schema = t, this.spec = r, this.markSet = null, this.groups = r.group ? r.group.split(" ") : [], this.attrs = Bs(e, r.attrs), this.defaultAttrs = Is(this.attrs), this.contentMatch = null, this.inlineContent = null, this.isBlock = !(r.inline || e == "text"), this.isText = e == "text";
|
|
2415
2415
|
}
|
|
2416
2416
|
/**
|
|
2417
2417
|
True if this is an inline type.
|
|
@@ -2472,7 +2472,7 @@ let ai = class Bs {
|
|
|
2472
2472
|
@internal
|
|
2473
2473
|
*/
|
|
2474
2474
|
computeAttrs(e) {
|
|
2475
|
-
return !e && this.defaultAttrs ? this.defaultAttrs :
|
|
2475
|
+
return !e && this.defaultAttrs ? this.defaultAttrs : Rs(this.attrs, e);
|
|
2476
2476
|
}
|
|
2477
2477
|
/**
|
|
2478
2478
|
Create a `Node` of this type. The given attributes are
|
|
@@ -2539,7 +2539,7 @@ let ai = class Bs {
|
|
|
2539
2539
|
@internal
|
|
2540
2540
|
*/
|
|
2541
2541
|
checkAttrs(e) {
|
|
2542
|
-
|
|
2542
|
+
Ps(this.attrs, e, "node", this.name);
|
|
2543
2543
|
}
|
|
2544
2544
|
/**
|
|
2545
2545
|
Check whether the given mark type is allowed in this node.
|
|
@@ -2574,7 +2574,7 @@ let ai = class Bs {
|
|
|
2574
2574
|
*/
|
|
2575
2575
|
static compile(e, t) {
|
|
2576
2576
|
let r = /* @__PURE__ */ Object.create(null);
|
|
2577
|
-
e.forEach((s, o) => r[s] = new
|
|
2577
|
+
e.forEach((s, o) => r[s] = new Ls(s, t, o));
|
|
2578
2578
|
let i = t.spec.topNode || "doc";
|
|
2579
2579
|
if (!r[i])
|
|
2580
2580
|
throw new RangeError("Schema is missing its top node type ('" + i + "')");
|
|
@@ -2606,8 +2606,8 @@ class Nn {
|
|
|
2606
2606
|
@internal
|
|
2607
2607
|
*/
|
|
2608
2608
|
constructor(e, t, r, i) {
|
|
2609
|
-
this.name = e, this.rank = t, this.schema = r, this.spec = i, this.attrs =
|
|
2610
|
-
let s =
|
|
2609
|
+
this.name = e, this.rank = t, this.schema = r, this.spec = i, this.attrs = Bs(e, i.attrs), this.excluded = null;
|
|
2610
|
+
let s = Is(this.attrs);
|
|
2611
2611
|
this.instance = s ? new A(this, s) : null;
|
|
2612
2612
|
}
|
|
2613
2613
|
/**
|
|
@@ -2616,7 +2616,7 @@ class Nn {
|
|
|
2616
2616
|
they have defaults, will be added.
|
|
2617
2617
|
*/
|
|
2618
2618
|
create(e = null) {
|
|
2619
|
-
return !e && this.instance ? this.instance : new A(this,
|
|
2619
|
+
return !e && this.instance ? this.instance : new A(this, Rs(this.attrs, e));
|
|
2620
2620
|
}
|
|
2621
2621
|
/**
|
|
2622
2622
|
@internal
|
|
@@ -2646,7 +2646,7 @@ class Nn {
|
|
|
2646
2646
|
@internal
|
|
2647
2647
|
*/
|
|
2648
2648
|
checkAttrs(e) {
|
|
2649
|
-
|
|
2649
|
+
Ps(this.attrs, e, "mark", this.name);
|
|
2650
2650
|
}
|
|
2651
2651
|
/**
|
|
2652
2652
|
Queries whether a given mark type is
|
|
@@ -2656,7 +2656,7 @@ class Nn {
|
|
|
2656
2656
|
return this.excluded.indexOf(e) > -1;
|
|
2657
2657
|
}
|
|
2658
2658
|
}
|
|
2659
|
-
class
|
|
2659
|
+
class zs {
|
|
2660
2660
|
/**
|
|
2661
2661
|
Construct a schema from a schema [specification](https://prosemirror.net/docs/ref/#model.SchemaSpec).
|
|
2662
2662
|
*/
|
|
@@ -2665,7 +2665,7 @@ class Ls {
|
|
|
2665
2665
|
let t = this.spec = {};
|
|
2666
2666
|
for (let i in e)
|
|
2667
2667
|
t[i] = e[i];
|
|
2668
|
-
t.nodes = j.from(e.nodes), t.marks = j.from(e.marks || {}), this.nodes =
|
|
2668
|
+
t.nodes = j.from(e.nodes), t.marks = j.from(e.marks || {}), this.nodes = ci.compile(this.spec.nodes, this), this.marks = Nn.compile(this.spec.marks, this);
|
|
2669
2669
|
let r = /* @__PURE__ */ Object.create(null);
|
|
2670
2670
|
for (let i in this.nodes) {
|
|
2671
2671
|
if (i in this.marks)
|
|
@@ -2678,11 +2678,11 @@ class Ls {
|
|
|
2678
2678
|
throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");
|
|
2679
2679
|
this.linebreakReplacement = s;
|
|
2680
2680
|
}
|
|
2681
|
-
s.markSet = l == "_" ? null : l ?
|
|
2681
|
+
s.markSet = l == "_" ? null : l ? di(this, l.split(" ")) : l == "" || !s.inlineContent ? [] : null;
|
|
2682
2682
|
}
|
|
2683
2683
|
for (let i in this.marks) {
|
|
2684
2684
|
let s = this.marks[i], o = s.spec.excludes;
|
|
2685
|
-
s.excluded = o == null ? [s] : o == "" ? [] :
|
|
2685
|
+
s.excluded = o == null ? [s] : o == "" ? [] : di(this, o.split(" "));
|
|
2686
2686
|
}
|
|
2687
2687
|
this.nodeFromJSON = (i) => ze.fromJSON(this, i), this.markFromJSON = (i) => A.fromJSON(this, i), this.topNodeType = this.nodes[this.spec.topNode || "doc"], this.cached.wrappings = /* @__PURE__ */ Object.create(null);
|
|
2688
2688
|
}
|
|
@@ -2695,7 +2695,7 @@ class Ls {
|
|
|
2695
2695
|
node(e, t = null, r, i) {
|
|
2696
2696
|
if (typeof e == "string")
|
|
2697
2697
|
e = this.nodeType(e);
|
|
2698
|
-
else if (e instanceof
|
|
2698
|
+
else if (e instanceof ci) {
|
|
2699
2699
|
if (e.schema != this)
|
|
2700
2700
|
throw new RangeError("Node type from different schema used (" + e.name + ")");
|
|
2701
2701
|
} else throw new RangeError("Invalid node type: " + e);
|
|
@@ -2725,7 +2725,7 @@ class Ls {
|
|
|
2725
2725
|
return t;
|
|
2726
2726
|
}
|
|
2727
2727
|
}
|
|
2728
|
-
function
|
|
2728
|
+
function di(n, e) {
|
|
2729
2729
|
let t = [];
|
|
2730
2730
|
for (let r = 0; r < e.length; r++) {
|
|
2731
2731
|
let i = e[r], s = n.marks[i], o = s;
|
|
@@ -2773,7 +2773,7 @@ class Fe {
|
|
|
2773
2773
|
Parse a document from the content of a DOM node.
|
|
2774
2774
|
*/
|
|
2775
2775
|
parse(e, t = {}) {
|
|
2776
|
-
let r = new
|
|
2776
|
+
let r = new fi(this, t, !1);
|
|
2777
2777
|
return r.addAll(e, A.none, t.from, t.to), r.finish();
|
|
2778
2778
|
}
|
|
2779
2779
|
/**
|
|
@@ -2785,7 +2785,7 @@ class Fe {
|
|
|
2785
2785
|
the left of the input and the end of nodes at the end.
|
|
2786
2786
|
*/
|
|
2787
2787
|
parseSlice(e, t = {}) {
|
|
2788
|
-
let r = new
|
|
2788
|
+
let r = new fi(this, t, !0);
|
|
2789
2789
|
return r.addAll(e, A.none, t.from, t.to), k.maxOpen(r.finish());
|
|
2790
2790
|
}
|
|
2791
2791
|
/**
|
|
@@ -2842,13 +2842,13 @@ class Fe {
|
|
|
2842
2842
|
for (let i in e.marks) {
|
|
2843
2843
|
let s = e.marks[i].spec.parseDOM;
|
|
2844
2844
|
s && s.forEach((o) => {
|
|
2845
|
-
r(o =
|
|
2845
|
+
r(o = hi(o)), o.mark || o.ignore || o.clearMark || (o.mark = i);
|
|
2846
2846
|
});
|
|
2847
2847
|
}
|
|
2848
2848
|
for (let i in e.nodes) {
|
|
2849
2849
|
let s = e.nodes[i].spec.parseDOM;
|
|
2850
2850
|
s && s.forEach((o) => {
|
|
2851
|
-
r(o =
|
|
2851
|
+
r(o = hi(o)), o.node || o.ignore || o.mark || (o.node = i);
|
|
2852
2852
|
});
|
|
2853
2853
|
}
|
|
2854
2854
|
return t;
|
|
@@ -2862,7 +2862,7 @@ class Fe {
|
|
|
2862
2862
|
return e.cached.domParser || (e.cached.domParser = new Fe(e, Fe.schemaRules(e)));
|
|
2863
2863
|
}
|
|
2864
2864
|
}
|
|
2865
|
-
const
|
|
2865
|
+
const Fs = {
|
|
2866
2866
|
address: !0,
|
|
2867
2867
|
article: !0,
|
|
2868
2868
|
aside: !0,
|
|
@@ -2902,9 +2902,9 @@ const zs = {
|
|
|
2902
2902
|
script: !0,
|
|
2903
2903
|
style: !0,
|
|
2904
2904
|
title: !0
|
|
2905
|
-
},
|
|
2906
|
-
function
|
|
2907
|
-
return e != null ? (e ? Pt : 0) | (e === "full" ?
|
|
2905
|
+
}, $s = { ol: !0, ul: !0 }, Pt = 1, mr = 2, Nt = 4;
|
|
2906
|
+
function ui(n, e, t) {
|
|
2907
|
+
return e != null ? (e ? Pt : 0) | (e === "full" ? mr : 0) : n && n.whitespace == "pre" ? Pt | mr : t & ~Nt;
|
|
2908
2908
|
}
|
|
2909
2909
|
class Qt {
|
|
2910
2910
|
constructor(e, t, r, i, s, o) {
|
|
@@ -2936,13 +2936,13 @@ class Qt {
|
|
|
2936
2936
|
return !e && this.match && (t = t.append(this.match.fillBefore(b.empty, !0))), this.type ? this.type.create(this.attrs, t, this.marks) : t;
|
|
2937
2937
|
}
|
|
2938
2938
|
inlineContext(e) {
|
|
2939
|
-
return this.type ? this.type.inlineContent : this.content.length ? this.content[0].isInline : e.parentNode && !
|
|
2939
|
+
return this.type ? this.type.inlineContent : this.content.length ? this.content[0].isInline : e.parentNode && !Fs.hasOwnProperty(e.parentNode.nodeName.toLowerCase());
|
|
2940
2940
|
}
|
|
2941
2941
|
}
|
|
2942
|
-
class
|
|
2942
|
+
class fi {
|
|
2943
2943
|
constructor(e, t, r) {
|
|
2944
2944
|
this.parser = e, this.options = t, this.isOpen = r, this.open = 0, this.localPreserveWS = !1;
|
|
2945
|
-
let i = t.topNode, s, o =
|
|
2945
|
+
let i = t.topNode, s, o = ui(null, t.preserveWhitespace, 0) | (r ? Nt : 0);
|
|
2946
2946
|
i ? s = new Qt(i.type, i.attrs, A.none, !0, t.topMatch || i.type.contentMatch, o) : r ? s = new Qt(null, null, A.none, !0, null, o) : s = new Qt(e.schema.topNodeType, null, A.none, !0, null, o), this.nodes = [s], this.find = t.findPositions, this.needsBlock = !1;
|
|
2947
2947
|
}
|
|
2948
2948
|
get top() {
|
|
@@ -2955,7 +2955,7 @@ class ui {
|
|
|
2955
2955
|
e.nodeType == 3 ? this.addTextNode(e, t) : e.nodeType == 1 && this.addElement(e, t);
|
|
2956
2956
|
}
|
|
2957
2957
|
addTextNode(e, t) {
|
|
2958
|
-
let r = e.nodeValue, i = this.top, s = i.options &
|
|
2958
|
+
let r = e.nodeValue, i = this.top, s = i.options & mr ? "full" : this.localPreserveWS || (i.options & Pt) > 0, { schema: o } = this.parser;
|
|
2959
2959
|
if (s === "full" || i.inlineContext(e) || /[^ \t\r\n\u000c]/.test(r)) {
|
|
2960
2960
|
if (s)
|
|
2961
2961
|
if (s === "full")
|
|
@@ -2982,14 +2982,14 @@ class ui {
|
|
|
2982
2982
|
let i = this.localPreserveWS, s = this.top;
|
|
2983
2983
|
(e.tagName == "PRE" || /pre/.test(e.style && e.style.whiteSpace)) && (this.localPreserveWS = !0);
|
|
2984
2984
|
let o = e.nodeName.toLowerCase(), l;
|
|
2985
|
-
|
|
2985
|
+
$s.hasOwnProperty(o) && this.parser.normalizeLists && jl(e);
|
|
2986
2986
|
let a = this.options.ruleFromNode && this.options.ruleFromNode(e) || (l = this.parser.matchTag(e, this, r));
|
|
2987
2987
|
e: if (a ? a.ignore : ql.hasOwnProperty(o))
|
|
2988
2988
|
this.findInside(e), this.ignoreFallback(e, t);
|
|
2989
2989
|
else if (!a || a.skip || a.closeParent) {
|
|
2990
2990
|
a && a.closeParent ? this.open = Math.max(0, this.open - 1) : a && a.skip.nodeType && (e = a.skip);
|
|
2991
2991
|
let c, d = this.needsBlock;
|
|
2992
|
-
if (
|
|
2992
|
+
if (Fs.hasOwnProperty(o))
|
|
2993
2993
|
s.content.length && s.content[0].isInline && this.open && (this.open--, s = this.top), c = !0, s.type || (this.needsBlock = !0);
|
|
2994
2994
|
else if (!e.firstChild) {
|
|
2995
2995
|
this.leafFallback(e, t);
|
|
@@ -3108,7 +3108,7 @@ class ui {
|
|
|
3108
3108
|
s.match && (s.match = s.match.matchType(e.type));
|
|
3109
3109
|
let o = A.none;
|
|
3110
3110
|
for (let l of i.concat(e.marks))
|
|
3111
|
-
(s.type ? s.type.allowsMarkType(l.type) :
|
|
3111
|
+
(s.type ? s.type.allowsMarkType(l.type) : pi(l.type, e.type)) && (o = l.addToSet(o));
|
|
3112
3112
|
return s.content.push(e.mark(o)), !0;
|
|
3113
3113
|
}
|
|
3114
3114
|
return !1;
|
|
@@ -3124,10 +3124,10 @@ class ui {
|
|
|
3124
3124
|
this.closeExtra();
|
|
3125
3125
|
let o = this.top;
|
|
3126
3126
|
o.match = o.match && o.match.matchType(e);
|
|
3127
|
-
let l =
|
|
3127
|
+
let l = ui(e, s, o.options);
|
|
3128
3128
|
o.options & Nt && o.content.length == 0 && (l |= Nt);
|
|
3129
3129
|
let a = A.none;
|
|
3130
|
-
return r = r.filter((c) => (o.type ? o.type.allowsMarkType(c.type) :
|
|
3130
|
+
return r = r.filter((c) => (o.type ? o.type.allowsMarkType(c.type) : pi(c.type, e)) ? (a = c.addToSet(a), !1) : !0), this.nodes.push(new Qt(e, t, a, i, null, l)), this.open++, r;
|
|
3131
3131
|
}
|
|
3132
3132
|
// Make sure all nodes above this.open are finished and added to
|
|
3133
3133
|
// their parents
|
|
@@ -3224,19 +3224,19 @@ class ui {
|
|
|
3224
3224
|
function jl(n) {
|
|
3225
3225
|
for (let e = n.firstChild, t = null; e; e = e.nextSibling) {
|
|
3226
3226
|
let r = e.nodeType == 1 ? e.nodeName.toLowerCase() : null;
|
|
3227
|
-
r &&
|
|
3227
|
+
r && $s.hasOwnProperty(r) && t ? (t.appendChild(e), e = t) : r == "li" ? t = e : r && (t = null);
|
|
3228
3228
|
}
|
|
3229
3229
|
}
|
|
3230
3230
|
function Kl(n, e) {
|
|
3231
3231
|
return (n.matches || n.msMatchesSelector || n.webkitMatchesSelector || n.mozMatchesSelector).call(n, e);
|
|
3232
3232
|
}
|
|
3233
|
-
function
|
|
3233
|
+
function hi(n) {
|
|
3234
3234
|
let e = {};
|
|
3235
3235
|
for (let t in n)
|
|
3236
3236
|
e[t] = n[t];
|
|
3237
3237
|
return e;
|
|
3238
3238
|
}
|
|
3239
|
-
function
|
|
3239
|
+
function pi(n, e) {
|
|
3240
3240
|
let t = e.schema.nodes;
|
|
3241
3241
|
for (let r in t) {
|
|
3242
3242
|
let i = t[r];
|
|
@@ -3348,17 +3348,17 @@ class ct {
|
|
|
3348
3348
|
This can be useful as a base to build a custom serializer from.
|
|
3349
3349
|
*/
|
|
3350
3350
|
static nodesFromSchema(e) {
|
|
3351
|
-
let t =
|
|
3351
|
+
let t = mi(e.nodes);
|
|
3352
3352
|
return t.text || (t.text = (r) => r.text), t;
|
|
3353
3353
|
}
|
|
3354
3354
|
/**
|
|
3355
3355
|
Gather the serializers in a schema's mark specs into an object.
|
|
3356
3356
|
*/
|
|
3357
3357
|
static marksFromSchema(e) {
|
|
3358
|
-
return
|
|
3358
|
+
return mi(e.marks);
|
|
3359
3359
|
}
|
|
3360
3360
|
}
|
|
3361
|
-
function
|
|
3361
|
+
function mi(n) {
|
|
3362
3362
|
let e = {};
|
|
3363
3363
|
for (let t in n) {
|
|
3364
3364
|
let r = n[t].spec.toDOM;
|
|
@@ -3369,10 +3369,10 @@ function pi(n) {
|
|
|
3369
3369
|
function jn(n) {
|
|
3370
3370
|
return n.document || window.document;
|
|
3371
3371
|
}
|
|
3372
|
-
const
|
|
3372
|
+
const gi = /* @__PURE__ */ new WeakMap();
|
|
3373
3373
|
function Jl(n) {
|
|
3374
|
-
let e =
|
|
3375
|
-
return e === void 0 &&
|
|
3374
|
+
let e = gi.get(n);
|
|
3375
|
+
return e === void 0 && gi.set(n, e = Ul(n)), e;
|
|
3376
3376
|
}
|
|
3377
3377
|
function Ul(n) {
|
|
3378
3378
|
let e = null;
|
|
@@ -3430,18 +3430,18 @@ function ln(n, e, t, r) {
|
|
|
3430
3430
|
}
|
|
3431
3431
|
return { dom: a, contentDOM: l };
|
|
3432
3432
|
}
|
|
3433
|
-
const
|
|
3433
|
+
const Vs = 65535, Hs = Math.pow(2, 16);
|
|
3434
3434
|
function _l(n, e) {
|
|
3435
|
-
return n + e *
|
|
3435
|
+
return n + e * Hs;
|
|
3436
3436
|
}
|
|
3437
|
-
function
|
|
3438
|
-
return n &
|
|
3437
|
+
function yi(n) {
|
|
3438
|
+
return n & Vs;
|
|
3439
3439
|
}
|
|
3440
3440
|
function Gl(n) {
|
|
3441
|
-
return (n - (n &
|
|
3441
|
+
return (n - (n & Vs)) / Hs;
|
|
3442
3442
|
}
|
|
3443
|
-
const
|
|
3444
|
-
class
|
|
3443
|
+
const Ws = 1, qs = 2, an = 4, js = 8;
|
|
3444
|
+
class gr {
|
|
3445
3445
|
/**
|
|
3446
3446
|
@internal
|
|
3447
3447
|
*/
|
|
@@ -3454,19 +3454,19 @@ class mr {
|
|
|
3454
3454
|
argument from the document.
|
|
3455
3455
|
*/
|
|
3456
3456
|
get deleted() {
|
|
3457
|
-
return (this.delInfo &
|
|
3457
|
+
return (this.delInfo & js) > 0;
|
|
3458
3458
|
}
|
|
3459
3459
|
/**
|
|
3460
3460
|
Tells you whether the token before the mapped position was deleted.
|
|
3461
3461
|
*/
|
|
3462
3462
|
get deletedBefore() {
|
|
3463
|
-
return (this.delInfo & (
|
|
3463
|
+
return (this.delInfo & (Ws | an)) > 0;
|
|
3464
3464
|
}
|
|
3465
3465
|
/**
|
|
3466
3466
|
True when the token after the mapped position was deleted.
|
|
3467
3467
|
*/
|
|
3468
3468
|
get deletedAfter() {
|
|
3469
|
-
return (this.delInfo & (
|
|
3469
|
+
return (this.delInfo & (qs | an)) > 0;
|
|
3470
3470
|
}
|
|
3471
3471
|
/**
|
|
3472
3472
|
Tells whether any of the steps mapped through deletes across the
|
|
@@ -3491,7 +3491,7 @@ class le {
|
|
|
3491
3491
|
@internal
|
|
3492
3492
|
*/
|
|
3493
3493
|
recover(e) {
|
|
3494
|
-
let t = 0, r =
|
|
3494
|
+
let t = 0, r = yi(e);
|
|
3495
3495
|
if (!this.inverted)
|
|
3496
3496
|
for (let i = 0; i < r; i++)
|
|
3497
3497
|
t += this.ranges[i * 3 + 2] - this.ranges[i * 3 + 1];
|
|
@@ -3517,18 +3517,18 @@ class le {
|
|
|
3517
3517
|
let f = c ? e == a ? -1 : e == u ? 1 : t : t, h = a + i + (f < 0 ? 0 : d);
|
|
3518
3518
|
if (r)
|
|
3519
3519
|
return h;
|
|
3520
|
-
let p = e == (t < 0 ? a : u) ? null : _l(l / 3, e - a), m = e == a ?
|
|
3521
|
-
return (t < 0 ? e != a : e != u) && (m |=
|
|
3520
|
+
let p = e == (t < 0 ? a : u) ? null : _l(l / 3, e - a), m = e == a ? qs : e == u ? Ws : an;
|
|
3521
|
+
return (t < 0 ? e != a : e != u) && (m |= js), new gr(h, m, p);
|
|
3522
3522
|
}
|
|
3523
3523
|
i += d - c;
|
|
3524
3524
|
}
|
|
3525
|
-
return r ? e + i : new
|
|
3525
|
+
return r ? e + i : new gr(e + i, 0, null);
|
|
3526
3526
|
}
|
|
3527
3527
|
/**
|
|
3528
3528
|
@internal
|
|
3529
3529
|
*/
|
|
3530
3530
|
touches(e, t) {
|
|
3531
|
-
let r = 0, i =
|
|
3531
|
+
let r = 0, i = yi(t), s = this.inverted ? 2 : 1, o = this.inverted ? 1 : 2;
|
|
3532
3532
|
for (let l = 0; l < this.ranges.length; l += 3) {
|
|
3533
3533
|
let a = this.ranges[l] - (this.inverted ? r : 0);
|
|
3534
3534
|
if (a > e)
|
|
@@ -3678,7 +3678,7 @@ class Bt {
|
|
|
3678
3678
|
}
|
|
3679
3679
|
i |= l.delInfo, e = l.pos;
|
|
3680
3680
|
}
|
|
3681
|
-
return r ? e : new
|
|
3681
|
+
return r ? e : new gr(e, i, null);
|
|
3682
3682
|
}
|
|
3683
3683
|
}
|
|
3684
3684
|
const Kn = /* @__PURE__ */ Object.create(null);
|
|
@@ -3757,11 +3757,11 @@ class B {
|
|
|
3757
3757
|
}
|
|
3758
3758
|
}
|
|
3759
3759
|
}
|
|
3760
|
-
function
|
|
3760
|
+
function Br(n, e, t) {
|
|
3761
3761
|
let r = [];
|
|
3762
3762
|
for (let i = 0; i < n.childCount; i++) {
|
|
3763
3763
|
let s = n.child(i);
|
|
3764
|
-
s.content.size && (s = s.copy(
|
|
3764
|
+
s.content.size && (s = s.copy(Br(s.content, e, s))), s.isInline && (s = e(s, t, i)), r.push(s);
|
|
3765
3765
|
}
|
|
3766
3766
|
return b.fromArray(r);
|
|
3767
3767
|
}
|
|
@@ -3773,7 +3773,7 @@ class Pe extends Z {
|
|
|
3773
3773
|
super(), this.from = e, this.to = t, this.mark = r;
|
|
3774
3774
|
}
|
|
3775
3775
|
apply(e) {
|
|
3776
|
-
let t = e.slice(this.from, this.to), r = e.resolve(this.from), i = r.node(r.sharedDepth(this.to)), s = new k(
|
|
3776
|
+
let t = e.slice(this.from, this.to), r = e.resolve(this.from), i = r.node(r.sharedDepth(this.to)), s = new k(Br(t.content, (o, l) => !o.isAtom || !l.type.allowsMarkType(this.mark.type) ? o : o.mark(this.mark.addToSet(o.marks)), i), t.openStart, t.openEnd);
|
|
3777
3777
|
return B.fromReplace(e, this.from, this.to, s);
|
|
3778
3778
|
}
|
|
3779
3779
|
invert() {
|
|
@@ -3812,7 +3812,7 @@ class ke extends Z {
|
|
|
3812
3812
|
super(), this.from = e, this.to = t, this.mark = r;
|
|
3813
3813
|
}
|
|
3814
3814
|
apply(e) {
|
|
3815
|
-
let t = e.slice(this.from, this.to), r = new k(
|
|
3815
|
+
let t = e.slice(this.from, this.to), r = new k(Br(t.content, (i) => i.mark(this.mark.removeFromSet(i.marks)), e), t.openStart, t.openEnd);
|
|
3816
3816
|
return B.fromReplace(e, this.from, this.to, r);
|
|
3817
3817
|
}
|
|
3818
3818
|
invert() {
|
|
@@ -3936,7 +3936,7 @@ class P extends Z {
|
|
|
3936
3936
|
super(), this.from = e, this.to = t, this.slice = r, this.structure = i;
|
|
3937
3937
|
}
|
|
3938
3938
|
apply(e) {
|
|
3939
|
-
return this.structure &&
|
|
3939
|
+
return this.structure && yr(e, this.from, this.to) ? B.fail("Structure replace would overwrite content") : B.fromReplace(e, this.from, this.to, this.slice);
|
|
3940
3940
|
}
|
|
3941
3941
|
getMap() {
|
|
3942
3942
|
return new le([this.from, this.to - this.from, this.slice.size]);
|
|
@@ -3986,7 +3986,7 @@ class F extends Z {
|
|
|
3986
3986
|
super(), this.from = e, this.to = t, this.gapFrom = r, this.gapTo = i, this.slice = s, this.insert = o, this.structure = l;
|
|
3987
3987
|
}
|
|
3988
3988
|
apply(e) {
|
|
3989
|
-
if (this.structure && (
|
|
3989
|
+
if (this.structure && (yr(e, this.from, this.gapFrom) || yr(e, this.gapTo, this.to)))
|
|
3990
3990
|
return B.fail("Structure gap-replace would overwrite content");
|
|
3991
3991
|
let t = e.slice(this.gapFrom, this.gapTo);
|
|
3992
3992
|
if (t.openStart || t.openEnd)
|
|
@@ -4033,7 +4033,7 @@ class F extends Z {
|
|
|
4033
4033
|
}
|
|
4034
4034
|
}
|
|
4035
4035
|
Z.jsonID("replaceAround", F);
|
|
4036
|
-
function
|
|
4036
|
+
function yr(n, e, t) {
|
|
4037
4037
|
let r = n.resolve(e), i = t - e, s = r.depth;
|
|
4038
4038
|
for (; i > 0 && s > 0 && r.indexAfter(s) == r.node(s).childCount; )
|
|
4039
4039
|
s--, i--;
|
|
@@ -4086,7 +4086,7 @@ function Xl(n, e, t, r) {
|
|
|
4086
4086
|
}
|
|
4087
4087
|
}), i.forEach((o) => n.step(new ke(o.from, o.to, o.style)));
|
|
4088
4088
|
}
|
|
4089
|
-
function
|
|
4089
|
+
function Lr(n, e, t, r = t.contentMatch, i = !0) {
|
|
4090
4090
|
let s = n.doc.nodeAt(e), o = [], l = e + 1;
|
|
4091
4091
|
for (let a = 0; a < s.childCount; a++) {
|
|
4092
4092
|
let c = s.child(a), d = l + c.nodeSize, u = r.matchType(c.type);
|
|
@@ -4135,11 +4135,11 @@ function Ql(n, e, t) {
|
|
|
4135
4135
|
m || i.after(p + 1) < i.end(p) ? (m = !0, f = b.from(i.node(p).copy(f)), h++) : c++;
|
|
4136
4136
|
n.step(new F(a, c, o, l, new k(d.append(f), u, h), d.size - u, !0));
|
|
4137
4137
|
}
|
|
4138
|
-
function
|
|
4138
|
+
function zr(n, e, t = null, r = n) {
|
|
4139
4139
|
let i = ea(n, e), s = i && ta(r, e);
|
|
4140
|
-
return s ? i.map(
|
|
4140
|
+
return s ? i.map(bi).concat({ type: e, attrs: t }).concat(s.map(bi)) : null;
|
|
4141
4141
|
}
|
|
4142
|
-
function
|
|
4142
|
+
function bi(n) {
|
|
4143
4143
|
return { type: n, attrs: null };
|
|
4144
4144
|
}
|
|
4145
4145
|
function ea(n, e) {
|
|
@@ -4183,13 +4183,13 @@ function ra(n, e, t, r, i) {
|
|
|
4183
4183
|
let h = r.whitespace == "pre", p = !!r.contentMatch.matchType(r.schema.linebreakReplacement);
|
|
4184
4184
|
h && !p ? c = !1 : !h && p && (c = !0);
|
|
4185
4185
|
}
|
|
4186
|
-
c === !1 &&
|
|
4186
|
+
c === !1 && Js(n, o, l, s), Lr(n, n.mapping.slice(s).map(l, 1), r, void 0, c === null);
|
|
4187
4187
|
let d = n.mapping.slice(s), u = d.map(l, 1), f = d.map(l + o.nodeSize, 1);
|
|
4188
|
-
return n.step(new F(u, f, u + 1, f - 1, new k(b.from(r.create(a, null, o.marks)), 0, 0), 1, !0)), c === !0 &&
|
|
4188
|
+
return n.step(new F(u, f, u + 1, f - 1, new k(b.from(r.create(a, null, o.marks)), 0, 0), 1, !0)), c === !0 && Ks(n, o, l, s), !1;
|
|
4189
4189
|
}
|
|
4190
4190
|
});
|
|
4191
4191
|
}
|
|
4192
|
-
function
|
|
4192
|
+
function Ks(n, e, t, r) {
|
|
4193
4193
|
e.forEach((i, s) => {
|
|
4194
4194
|
if (i.isText) {
|
|
4195
4195
|
let o, l = /\r?\n|\r/g;
|
|
@@ -4200,7 +4200,7 @@ function js(n, e, t, r) {
|
|
|
4200
4200
|
}
|
|
4201
4201
|
});
|
|
4202
4202
|
}
|
|
4203
|
-
function
|
|
4203
|
+
function Js(n, e, t, r) {
|
|
4204
4204
|
e.forEach((i, s) => {
|
|
4205
4205
|
if (i.type == i.type.schema.linebreakReplacement) {
|
|
4206
4206
|
let o = n.mapping.slice(r).map(t + 1 + s);
|
|
@@ -4253,7 +4253,7 @@ function oa(n, e, t = 1, r) {
|
|
|
4253
4253
|
}
|
|
4254
4254
|
function qe(n, e) {
|
|
4255
4255
|
let t = n.resolve(e), r = t.index();
|
|
4256
|
-
return
|
|
4256
|
+
return Us(t.nodeBefore, t.nodeAfter) && t.parent.canReplace(r, r + 1);
|
|
4257
4257
|
}
|
|
4258
4258
|
function la(n, e) {
|
|
4259
4259
|
e.content.size || n.type.compatibleContent(e.type);
|
|
@@ -4265,14 +4265,14 @@ function la(n, e) {
|
|
|
4265
4265
|
}
|
|
4266
4266
|
return t.validEnd;
|
|
4267
4267
|
}
|
|
4268
|
-
function
|
|
4268
|
+
function Us(n, e) {
|
|
4269
4269
|
return !!(n && e && !n.isLeaf && la(n, e));
|
|
4270
4270
|
}
|
|
4271
4271
|
function An(n, e, t = -1) {
|
|
4272
4272
|
let r = n.resolve(e);
|
|
4273
4273
|
for (let i = r.depth; ; i--) {
|
|
4274
4274
|
let s, o, l = r.index(i);
|
|
4275
|
-
if (i == r.depth ? (s = r.nodeBefore, o = r.nodeAfter) : t > 0 ? (s = r.node(i + 1), l++, o = r.node(i).maybeChild(l)) : (s = r.node(i).maybeChild(l - 1), o = r.node(i + 1)), s && !s.isTextblock &&
|
|
4275
|
+
if (i == r.depth ? (s = r.nodeBefore, o = r.nodeAfter) : t > 0 ? (s = r.node(i + 1), l++, o = r.node(i).maybeChild(l)) : (s = r.node(i).maybeChild(l - 1), o = r.node(i + 1)), s && !s.isTextblock && Us(s, o) && r.node(i).canReplace(l, l + 1))
|
|
4276
4276
|
return e;
|
|
4277
4277
|
if (i == 0)
|
|
4278
4278
|
break;
|
|
@@ -4288,13 +4288,13 @@ function aa(n, e, t) {
|
|
|
4288
4288
|
let l = n.steps.length;
|
|
4289
4289
|
if (r === !1) {
|
|
4290
4290
|
let d = n.doc.resolve(e + t);
|
|
4291
|
-
|
|
4291
|
+
Js(n, d.node(), d.before(), l);
|
|
4292
4292
|
}
|
|
4293
|
-
o.inlineContent &&
|
|
4293
|
+
o.inlineContent && Lr(n, e + t - 1, o, s.node().contentMatchAt(s.index()), r == null);
|
|
4294
4294
|
let a = n.mapping.slice(l), c = a.map(e - t);
|
|
4295
4295
|
if (n.step(new P(c, a.map(e + t, -1), k.empty, !0)), r === !0) {
|
|
4296
4296
|
let d = n.doc.resolve(c);
|
|
4297
|
-
|
|
4297
|
+
Ks(n, d.node(), d.before(), n.steps.length);
|
|
4298
4298
|
}
|
|
4299
4299
|
return n;
|
|
4300
4300
|
}
|
|
@@ -4320,7 +4320,7 @@ function ca(n, e, t) {
|
|
|
4320
4320
|
}
|
|
4321
4321
|
return null;
|
|
4322
4322
|
}
|
|
4323
|
-
function
|
|
4323
|
+
function _s(n, e, t) {
|
|
4324
4324
|
let r = n.resolve(e);
|
|
4325
4325
|
if (!t.content.size)
|
|
4326
4326
|
return e;
|
|
@@ -4345,9 +4345,9 @@ function Dn(n, e, t = e, r = k.empty) {
|
|
|
4345
4345
|
if (e == t && !r.size)
|
|
4346
4346
|
return null;
|
|
4347
4347
|
let i = n.resolve(e), s = n.resolve(t);
|
|
4348
|
-
return
|
|
4348
|
+
return Gs(i, s, r) ? new P(e, t, r) : new da(i, s, r).fit();
|
|
4349
4349
|
}
|
|
4350
|
-
function
|
|
4350
|
+
function Gs(n, e, t) {
|
|
4351
4351
|
return !t.openStart && !t.openEnd && n.start() == e.start() && n.parent.canReplace(n.index(), e.index(), t.content);
|
|
4352
4352
|
}
|
|
4353
4353
|
class da {
|
|
@@ -4441,7 +4441,7 @@ class da {
|
|
|
4441
4441
|
let m = l.child(c), g = u.matchType(m.type);
|
|
4442
4442
|
if (!g)
|
|
4443
4443
|
break;
|
|
4444
|
-
c++, (c > 1 || a == 0 || m.content.size) && (u = g, d.push(
|
|
4444
|
+
c++, (c > 1 || a == 0 || m.content.size) && (u = g, d.push(Ys(m.mark(f.allowedMarks(m.marks)), c == 1 ? a : 0, c == l.childCount ? h : -1)));
|
|
4445
4445
|
}
|
|
4446
4446
|
let p = c == l.childCount;
|
|
4447
4447
|
p || (h = -1), this.placed = Ot(this.placed, t, b.from(d)), this.frontier[t].match = u, p && h < 0 && r && r.type == this.frontier[this.depth].type && this.frontier.length > 1 && this.closeFrontierNode();
|
|
@@ -4508,11 +4508,11 @@ function Jn(n, e) {
|
|
|
4508
4508
|
n = n.firstChild.content;
|
|
4509
4509
|
return n;
|
|
4510
4510
|
}
|
|
4511
|
-
function
|
|
4511
|
+
function Ys(n, e, t) {
|
|
4512
4512
|
if (e <= 0)
|
|
4513
4513
|
return n;
|
|
4514
4514
|
let r = n.content;
|
|
4515
|
-
return e > 1 && (r = r.replaceChild(0,
|
|
4515
|
+
return e > 1 && (r = r.replaceChild(0, Ys(r.firstChild, e - 1, r.childCount == 1 ? t - 1 : 0))), e > 0 && (r = n.type.contentMatch.fillBefore(r).append(r), t <= 0 && (r = r.append(n.type.contentMatch.matchFragment(r).fillBefore(b.empty, !0)))), n.copy(r);
|
|
4516
4516
|
}
|
|
4517
4517
|
function Un(n, e, t, r, i) {
|
|
4518
4518
|
let s = n.node(e), o = i ? n.indexAfter(e) : n.index(e);
|
|
@@ -4534,9 +4534,9 @@ function ha(n, e, t, r) {
|
|
|
4534
4534
|
if (!r.size)
|
|
4535
4535
|
return n.deleteRange(e, t);
|
|
4536
4536
|
let i = n.doc.resolve(e), s = n.doc.resolve(t);
|
|
4537
|
-
if (
|
|
4537
|
+
if (Gs(i, s, r))
|
|
4538
4538
|
return n.step(new P(e, t, r));
|
|
4539
|
-
let o =
|
|
4539
|
+
let o = Zs(i, s);
|
|
4540
4540
|
o[o.length - 1] == 0 && o.pop();
|
|
4541
4541
|
let l = -(i.depth + 1);
|
|
4542
4542
|
o.unshift(l);
|
|
@@ -4568,7 +4568,7 @@ function ha(n, e, t, r) {
|
|
|
4568
4568
|
g < 0 && (y = !1, g = -g);
|
|
4569
4569
|
let T = i.node(g - 1), w = i.index(g - 1);
|
|
4570
4570
|
if (T.canReplaceWith(w, w, p.type, p.marks))
|
|
4571
|
-
return n.replace(i.before(g), y ? s.after(g) : t, new k(
|
|
4571
|
+
return n.replace(i.before(g), y ? s.after(g) : t, new k(Xs(r.content, 0, r.openStart, h), h, r.openEnd));
|
|
4572
4572
|
}
|
|
4573
4573
|
}
|
|
4574
4574
|
let u = n.steps.length;
|
|
@@ -4577,10 +4577,10 @@ function ha(n, e, t, r) {
|
|
|
4577
4577
|
h < 0 || (e = i.before(h), t = s.after(h));
|
|
4578
4578
|
}
|
|
4579
4579
|
}
|
|
4580
|
-
function
|
|
4580
|
+
function Xs(n, e, t, r, i) {
|
|
4581
4581
|
if (e < t) {
|
|
4582
4582
|
let s = n.firstChild;
|
|
4583
|
-
n = n.replaceChild(0, s.copy(
|
|
4583
|
+
n = n.replaceChild(0, s.copy(Xs(s.content, e + 1, t, r, s)));
|
|
4584
4584
|
}
|
|
4585
4585
|
if (e > r) {
|
|
4586
4586
|
let s = i.contentMatchAt(0), o = s.fillBefore(n).append(n);
|
|
@@ -4611,7 +4611,7 @@ function ma(n, e, t) {
|
|
|
4611
4611
|
r = n.doc.resolve(e), i = n.doc.resolve(t);
|
|
4612
4612
|
}
|
|
4613
4613
|
}
|
|
4614
|
-
let s =
|
|
4614
|
+
let s = Zs(r, i);
|
|
4615
4615
|
for (let o = 0; o < s.length; o++) {
|
|
4616
4616
|
let l = s[o], a = o == s.length - 1;
|
|
4617
4617
|
if (a && l == 0 || r.node(l).type.contentMatch.validEnd)
|
|
@@ -4624,7 +4624,7 @@ function ma(n, e, t) {
|
|
|
4624
4624
|
return n.delete(r.before(o), t);
|
|
4625
4625
|
n.delete(e, t);
|
|
4626
4626
|
}
|
|
4627
|
-
function
|
|
4627
|
+
function Zs(n, e) {
|
|
4628
4628
|
let t = [], r = Math.min(n.depth, e.depth);
|
|
4629
4629
|
for (let i = r; i >= 0; i--) {
|
|
4630
4630
|
let s = n.start(i);
|
|
@@ -4953,7 +4953,7 @@ class ga {
|
|
|
4953
4953
|
third argument.
|
|
4954
4954
|
*/
|
|
4955
4955
|
clearIncompatible(e, t, r) {
|
|
4956
|
-
return
|
|
4956
|
+
return Lr(this, e, t, r), this;
|
|
4957
4957
|
}
|
|
4958
4958
|
}
|
|
4959
4959
|
const _n = /* @__PURE__ */ Object.create(null);
|
|
@@ -5029,7 +5029,7 @@ class E {
|
|
|
5029
5029
|
let s = e.steps.length, o = this.ranges;
|
|
5030
5030
|
for (let l = 0; l < o.length; l++) {
|
|
5031
5031
|
let { $from: a, $to: c } = o[l], d = e.mapping.slice(s);
|
|
5032
|
-
e.replaceRange(d.map(a.pos), d.map(c.pos), l ? k.empty : t), l == 0 &&
|
|
5032
|
+
e.replaceRange(d.map(a.pos), d.map(c.pos), l ? k.empty : t), l == 0 && Si(e, s, (r ? r.isInline : i && i.isTextblock) ? -1 : 1);
|
|
5033
5033
|
}
|
|
5034
5034
|
}
|
|
5035
5035
|
/**
|
|
@@ -5040,7 +5040,7 @@ class E {
|
|
|
5040
5040
|
let r = e.steps.length, i = this.ranges;
|
|
5041
5041
|
for (let s = 0; s < i.length; s++) {
|
|
5042
5042
|
let { $from: o, $to: l } = i[s], a = e.mapping.slice(r), c = a.map(o.pos), d = a.map(l.pos);
|
|
5043
|
-
s ? e.deleteRange(c, d) : (e.replaceRangeWith(c, d, t),
|
|
5043
|
+
s ? e.deleteRange(c, d) : (e.replaceRangeWith(c, d, t), Si(e, r, t.isInline ? -1 : 1));
|
|
5044
5044
|
}
|
|
5045
5045
|
}
|
|
5046
5046
|
/**
|
|
@@ -5130,16 +5130,16 @@ class ya {
|
|
|
5130
5130
|
this.$from = e, this.$to = t;
|
|
5131
5131
|
}
|
|
5132
5132
|
}
|
|
5133
|
-
let
|
|
5134
|
-
function
|
|
5135
|
-
!
|
|
5133
|
+
let ki = !1;
|
|
5134
|
+
function xi(n) {
|
|
5135
|
+
!ki && !n.parent.inlineContent && (ki = !0, console.warn("TextSelection endpoint not pointing into a node with inline content (" + n.parent.type.name + ")"));
|
|
5136
5136
|
}
|
|
5137
5137
|
class M extends E {
|
|
5138
5138
|
/**
|
|
5139
5139
|
Construct a text selection between the given points.
|
|
5140
5140
|
*/
|
|
5141
5141
|
constructor(e, t = e) {
|
|
5142
|
-
|
|
5142
|
+
xi(e), xi(t), super(e, t);
|
|
5143
5143
|
}
|
|
5144
5144
|
/**
|
|
5145
5145
|
Returns a resolved position if this is a cursor selection (an
|
|
@@ -5240,7 +5240,7 @@ class S extends E {
|
|
|
5240
5240
|
return { type: "node", anchor: this.anchor };
|
|
5241
5241
|
}
|
|
5242
5242
|
getBookmark() {
|
|
5243
|
-
return new
|
|
5243
|
+
return new Fr(this.anchor);
|
|
5244
5244
|
}
|
|
5245
5245
|
/**
|
|
5246
5246
|
@internal
|
|
@@ -5266,13 +5266,13 @@ class S extends E {
|
|
|
5266
5266
|
}
|
|
5267
5267
|
S.prototype.visible = !1;
|
|
5268
5268
|
E.jsonID("node", S);
|
|
5269
|
-
class
|
|
5269
|
+
class Fr {
|
|
5270
5270
|
constructor(e) {
|
|
5271
5271
|
this.anchor = e;
|
|
5272
5272
|
}
|
|
5273
5273
|
map(e) {
|
|
5274
5274
|
let { deleted: t, pos: r } = e.mapResult(this.anchor);
|
|
5275
|
-
return t ? new In(r, r) : new
|
|
5275
|
+
return t ? new In(r, r) : new Fr(r);
|
|
5276
5276
|
}
|
|
5277
5277
|
resolve(e) {
|
|
5278
5278
|
let t = e.resolve(this.anchor), r = t.nodeAfter;
|
|
@@ -5339,7 +5339,7 @@ function ft(n, e, t, r, i, s = !1) {
|
|
|
5339
5339
|
}
|
|
5340
5340
|
return null;
|
|
5341
5341
|
}
|
|
5342
|
-
function
|
|
5342
|
+
function Si(n, e, t) {
|
|
5343
5343
|
let r = n.steps.length - 1;
|
|
5344
5344
|
if (r < e)
|
|
5345
5345
|
return;
|
|
@@ -5351,7 +5351,7 @@ function xi(n, e, t) {
|
|
|
5351
5351
|
o == null && (o = d);
|
|
5352
5352
|
}), n.setSelection(E.near(n.doc.resolve(o), t));
|
|
5353
5353
|
}
|
|
5354
|
-
const
|
|
5354
|
+
const Mi = 1, en = 2, wi = 4;
|
|
5355
5355
|
class ka extends ga {
|
|
5356
5356
|
/**
|
|
5357
5357
|
@internal
|
|
@@ -5375,13 +5375,13 @@ class ka extends ga {
|
|
|
5375
5375
|
setSelection(e) {
|
|
5376
5376
|
if (e.$from.doc != this.doc)
|
|
5377
5377
|
throw new RangeError("Selection passed to setSelection must point at the current document");
|
|
5378
|
-
return this.curSelection = e, this.curSelectionFor = this.steps.length, this.updated = (this.updated |
|
|
5378
|
+
return this.curSelection = e, this.curSelectionFor = this.steps.length, this.updated = (this.updated | Mi) & ~en, this.storedMarks = null, this;
|
|
5379
5379
|
}
|
|
5380
5380
|
/**
|
|
5381
5381
|
Whether the selection was explicitly updated by this transaction.
|
|
5382
5382
|
*/
|
|
5383
5383
|
get selectionSet() {
|
|
5384
|
-
return (this.updated &
|
|
5384
|
+
return (this.updated & Mi) > 0;
|
|
5385
5385
|
}
|
|
5386
5386
|
/**
|
|
5387
5387
|
Set the current stored marks.
|
|
@@ -5494,21 +5494,21 @@ class ka extends ga {
|
|
|
5494
5494
|
when updated to the state produced by this transaction.
|
|
5495
5495
|
*/
|
|
5496
5496
|
scrollIntoView() {
|
|
5497
|
-
return this.updated |=
|
|
5497
|
+
return this.updated |= wi, this;
|
|
5498
5498
|
}
|
|
5499
5499
|
/**
|
|
5500
5500
|
True when this transaction has had `scrollIntoView` called on it.
|
|
5501
5501
|
*/
|
|
5502
5502
|
get scrolledIntoView() {
|
|
5503
|
-
return (this.updated &
|
|
5503
|
+
return (this.updated & wi) > 0;
|
|
5504
5504
|
}
|
|
5505
5505
|
}
|
|
5506
|
-
function
|
|
5506
|
+
function Ci(n, e) {
|
|
5507
5507
|
return !e || !n ? n : n.bind(e);
|
|
5508
5508
|
}
|
|
5509
5509
|
class Et {
|
|
5510
5510
|
constructor(e, t, r) {
|
|
5511
|
-
this.name = e, this.init =
|
|
5511
|
+
this.name = e, this.init = Ci(t.init, r), this.apply = Ci(t.apply, r);
|
|
5512
5512
|
}
|
|
5513
5513
|
}
|
|
5514
5514
|
const xa = [
|
|
@@ -5719,10 +5719,10 @@ class pt {
|
|
|
5719
5719
|
}), s;
|
|
5720
5720
|
}
|
|
5721
5721
|
}
|
|
5722
|
-
function
|
|
5722
|
+
function Qs(n, e, t) {
|
|
5723
5723
|
for (let r in n) {
|
|
5724
5724
|
let i = n[r];
|
|
5725
|
-
i instanceof Function ? i = i.bind(e) : r == "handleDOMEvents" && (i =
|
|
5725
|
+
i instanceof Function ? i = i.bind(e) : r == "handleDOMEvents" && (i = Qs(i, e, {})), t[r] = i;
|
|
5726
5726
|
}
|
|
5727
5727
|
return t;
|
|
5728
5728
|
}
|
|
@@ -5731,7 +5731,7 @@ class se {
|
|
|
5731
5731
|
Create a plugin.
|
|
5732
5732
|
*/
|
|
5733
5733
|
constructor(e) {
|
|
5734
|
-
this.spec = e, this.props = {}, e.props &&
|
|
5734
|
+
this.spec = e, this.props = {}, e.props && Qs(e.props, this, this.props), this.key = e.key ? e.key.key : eo("plugin");
|
|
5735
5735
|
}
|
|
5736
5736
|
/**
|
|
5737
5737
|
Extract the plugin's state field from an editor state.
|
|
@@ -5741,7 +5741,7 @@ class se {
|
|
|
5741
5741
|
}
|
|
5742
5742
|
}
|
|
5743
5743
|
const Yn = /* @__PURE__ */ Object.create(null);
|
|
5744
|
-
function
|
|
5744
|
+
function eo(n) {
|
|
5745
5745
|
return n in Yn ? n + "$" + ++Yn[n] : (Yn[n] = 0, n + "$");
|
|
5746
5746
|
}
|
|
5747
5747
|
class we {
|
|
@@ -5749,7 +5749,7 @@ class we {
|
|
|
5749
5749
|
Create a plugin key.
|
|
5750
5750
|
*/
|
|
5751
5751
|
constructor(e = "key") {
|
|
5752
|
-
this.key =
|
|
5752
|
+
this.key = eo(e);
|
|
5753
5753
|
}
|
|
5754
5754
|
/**
|
|
5755
5755
|
Get the active plugin with this key, if any, from an editor
|
|
@@ -5773,16 +5773,16 @@ const K = function(n) {
|
|
|
5773
5773
|
let e = n.assignedSlot || n.parentNode;
|
|
5774
5774
|
return e && e.nodeType == 11 ? e.host : e;
|
|
5775
5775
|
};
|
|
5776
|
-
let
|
|
5776
|
+
let br = null;
|
|
5777
5777
|
const Te = function(n, e, t) {
|
|
5778
|
-
let r =
|
|
5778
|
+
let r = br || (br = document.createRange());
|
|
5779
5779
|
return r.setEnd(n, t ?? n.nodeValue.length), r.setStart(n, e || 0), r;
|
|
5780
5780
|
}, Sa = function() {
|
|
5781
|
-
|
|
5781
|
+
br = null;
|
|
5782
5782
|
}, st = function(n, e, t, r) {
|
|
5783
|
-
return t && (
|
|
5783
|
+
return t && (Ti(n, e, t, r, -1) || Ti(n, e, t, r, 1));
|
|
5784
5784
|
}, Ma = /^(img|br|input|textarea|hr)$/i;
|
|
5785
|
-
function
|
|
5785
|
+
function Ti(n, e, t, r, i) {
|
|
5786
5786
|
for (var s; ; ) {
|
|
5787
5787
|
if (n == t && e == r)
|
|
5788
5788
|
return !0;
|
|
@@ -5878,9 +5878,9 @@ function Ea(n, e, t) {
|
|
|
5878
5878
|
return { node: r.startContainer, offset: Math.min(fe(r.startContainer), r.startOffset) };
|
|
5879
5879
|
}
|
|
5880
5880
|
}
|
|
5881
|
-
const xe = typeof navigator < "u" ? navigator : null,
|
|
5881
|
+
const xe = typeof navigator < "u" ? navigator : null, Oi = typeof document < "u" ? document : null, je = xe && xe.userAgent || "", kr = /Edge\/(\d+)/.exec(je), to = /MSIE \d/.exec(je), xr = /Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(je), ie = !!(to || xr || kr), $e = to ? document.documentMode : xr ? +xr[1] : kr ? +kr[1] : 0, pe = !ie && /gecko\/(\d+)/i.test(je);
|
|
5882
5882
|
pe && +(/Firefox\/(\d+)/.exec(je) || [0, 0])[1];
|
|
5883
|
-
const
|
|
5883
|
+
const Sr = !ie && /Chrome\/(\d+)/.exec(je), U = !!Sr, no = Sr ? +Sr[1] : 0, X = !ie && !!xe && /Apple Computer/.test(xe.vendor), xt = X && (/Mobile\/\w+/.test(je) || !!xe && xe.maxTouchPoints > 2), ue = xt || (xe ? /Mac/.test(xe.platform) : !1), ro = xe ? /Win/.test(xe.platform) : !1, Ee = /Android \d/.test(je), Yt = !!Oi && "webkitFontSmoothing" in Oi.documentElement.style, va = Yt ? +(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent) || [0, 0])[1] : 0;
|
|
5884
5884
|
function Na(n) {
|
|
5885
5885
|
let e = n.defaultView && n.defaultView.visualViewport;
|
|
5886
5886
|
return e ? {
|
|
@@ -5907,7 +5907,7 @@ function Aa(n) {
|
|
|
5907
5907
|
bottom: e.top + n.clientHeight * r
|
|
5908
5908
|
};
|
|
5909
5909
|
}
|
|
5910
|
-
function
|
|
5910
|
+
function Ei(n, e, t) {
|
|
5911
5911
|
let r = n.someProp("scrollThreshold") || 0, i = n.someProp("scrollMargin") || 5, s = n.dom.ownerDocument;
|
|
5912
5912
|
for (let o = t || n.dom; o; ) {
|
|
5913
5913
|
if (o.nodeType != 1) {
|
|
@@ -5942,9 +5942,9 @@ function Da(n) {
|
|
|
5942
5942
|
break;
|
|
5943
5943
|
}
|
|
5944
5944
|
}
|
|
5945
|
-
return { refDOM: r, refTop: i, stack:
|
|
5945
|
+
return { refDOM: r, refTop: i, stack: io(n.dom) };
|
|
5946
5946
|
}
|
|
5947
|
-
function
|
|
5947
|
+
function io(n) {
|
|
5948
5948
|
let e = [], t = n.ownerDocument;
|
|
5949
5949
|
for (let r = n; r && (e.push({ dom: r, top: r.scrollTop, left: r.scrollLeft }), n != t); r = kt(r))
|
|
5950
5950
|
;
|
|
@@ -5952,9 +5952,9 @@ function ro(n) {
|
|
|
5952
5952
|
}
|
|
5953
5953
|
function Ia({ refDOM: n, refTop: e, stack: t }) {
|
|
5954
5954
|
let r = n ? n.getBoundingClientRect().top : 0;
|
|
5955
|
-
|
|
5955
|
+
so(t, r == 0 ? 0 : r - e);
|
|
5956
5956
|
}
|
|
5957
|
-
function
|
|
5957
|
+
function so(n, e) {
|
|
5958
5958
|
for (let t = 0; t < n.length; t++) {
|
|
5959
5959
|
let { dom: r, top: i, left: s } = n[t];
|
|
5960
5960
|
r.scrollTop != i + e && (r.scrollTop = i + e), r.scrollLeft != s && (r.scrollLeft = s);
|
|
@@ -5966,14 +5966,14 @@ function Ra(n) {
|
|
|
5966
5966
|
return n.setActive();
|
|
5967
5967
|
if (dt)
|
|
5968
5968
|
return n.focus(dt);
|
|
5969
|
-
let e =
|
|
5969
|
+
let e = io(n);
|
|
5970
5970
|
n.focus(dt == null ? {
|
|
5971
5971
|
get preventScroll() {
|
|
5972
5972
|
return dt = { preventScroll: !0 }, !0;
|
|
5973
5973
|
}
|
|
5974
|
-
} : void 0), dt || (dt = !1,
|
|
5974
|
+
} : void 0), dt || (dt = !1, so(e, 0));
|
|
5975
5975
|
}
|
|
5976
|
-
function
|
|
5976
|
+
function oo(n, e) {
|
|
5977
5977
|
let t, r = 2e8, i, s = 0, o = e.top, l = e.top, a, c;
|
|
5978
5978
|
for (let d = n.firstChild, u = 0; d; d = d.nextSibling, u++) {
|
|
5979
5979
|
let f;
|
|
@@ -5999,21 +5999,21 @@ function so(n, e) {
|
|
|
5999
5999
|
!t && (e.left >= p.right && e.top >= p.top || e.left >= p.left && e.top >= p.bottom) && (s = u + 1);
|
|
6000
6000
|
}
|
|
6001
6001
|
}
|
|
6002
|
-
return !t && a && (t = a, i = c, r = 0), t && t.nodeType == 3 ? Pa(t, i) : !t || r && t.nodeType == 1 ? { node: n, offset: s } :
|
|
6002
|
+
return !t && a && (t = a, i = c, r = 0), t && t.nodeType == 3 ? Pa(t, i) : !t || r && t.nodeType == 1 ? { node: n, offset: s } : oo(t, i);
|
|
6003
6003
|
}
|
|
6004
6004
|
function Pa(n, e) {
|
|
6005
6005
|
let t = n.nodeValue.length, r = document.createRange(), i;
|
|
6006
6006
|
for (let s = 0; s < t; s++) {
|
|
6007
6007
|
r.setEnd(n, s + 1), r.setStart(n, s);
|
|
6008
6008
|
let o = Ae(r, 1);
|
|
6009
|
-
if (o.top != o.bottom &&
|
|
6009
|
+
if (o.top != o.bottom && $r(e, o)) {
|
|
6010
6010
|
i = { node: n, offset: s + (e.left >= (o.left + o.right) / 2 ? 1 : 0) };
|
|
6011
6011
|
break;
|
|
6012
6012
|
}
|
|
6013
6013
|
}
|
|
6014
6014
|
return r.detach(), i || { node: n, offset: 0 };
|
|
6015
6015
|
}
|
|
6016
|
-
function
|
|
6016
|
+
function $r(n, e) {
|
|
6017
6017
|
return n.left >= e.left - 1 && n.left <= e.right + 1 && n.top >= e.top - 1 && n.top <= e.bottom + 1;
|
|
6018
6018
|
}
|
|
6019
6019
|
function Ba(n, e) {
|
|
@@ -6021,7 +6021,7 @@ function Ba(n, e) {
|
|
|
6021
6021
|
return t && /^li$/i.test(t.nodeName) && e.left < n.getBoundingClientRect().left ? t : n;
|
|
6022
6022
|
}
|
|
6023
6023
|
function La(n, e, t) {
|
|
6024
|
-
let { node: r, offset: i } =
|
|
6024
|
+
let { node: r, offset: i } = oo(e, t), s = -1;
|
|
6025
6025
|
if (r.nodeType == 1 && !r.firstChild) {
|
|
6026
6026
|
let o = r.getBoundingClientRect();
|
|
6027
6027
|
s = o.left != o.right && t.left > (o.left + o.right) / 2 ? 1 : -1;
|
|
@@ -6041,7 +6041,7 @@ function za(n, e, t, r) {
|
|
|
6041
6041
|
}
|
|
6042
6042
|
return i > -1 ? i : n.docView.posFromDOM(e, t, -1);
|
|
6043
6043
|
}
|
|
6044
|
-
function
|
|
6044
|
+
function lo(n, e, t) {
|
|
6045
6045
|
let r = n.childNodes.length;
|
|
6046
6046
|
if (r && t.top < t.bottom)
|
|
6047
6047
|
for (let i = Math.max(0, Math.min(r - 1, Math.floor(r * (e.top - t.top) / (t.bottom - t.top)) - 2)), s = i; ; ) {
|
|
@@ -6050,8 +6050,8 @@ function oo(n, e, t) {
|
|
|
6050
6050
|
let l = o.getClientRects();
|
|
6051
6051
|
for (let a = 0; a < l.length; a++) {
|
|
6052
6052
|
let c = l[a];
|
|
6053
|
-
if (
|
|
6054
|
-
return
|
|
6053
|
+
if ($r(e, c))
|
|
6054
|
+
return lo(o, e, c);
|
|
6055
6055
|
}
|
|
6056
6056
|
}
|
|
6057
6057
|
if ((s = (s + 1) % r) == i)
|
|
@@ -6065,7 +6065,7 @@ function Fa(n, e) {
|
|
|
6065
6065
|
let o = (n.root.elementFromPoint ? n.root : t).elementFromPoint(e.left, e.top), l;
|
|
6066
6066
|
if (!o || !n.dom.contains(o.nodeType != 1 ? o.parentNode : o)) {
|
|
6067
6067
|
let c = n.dom.getBoundingClientRect();
|
|
6068
|
-
if (
|
|
6068
|
+
if (!$r(e, c) || (o = lo(n.dom, e, c), !o))
|
|
6069
6069
|
return null;
|
|
6070
6070
|
}
|
|
6071
6071
|
if (X)
|
|
@@ -6083,20 +6083,20 @@ function Fa(n, e) {
|
|
|
6083
6083
|
let a = n.docView.nearestDesc(o, !0);
|
|
6084
6084
|
return { pos: l, inside: a ? a.posAtStart - a.border : -1 };
|
|
6085
6085
|
}
|
|
6086
|
-
function
|
|
6086
|
+
function vi(n) {
|
|
6087
6087
|
return n.top < n.bottom || n.left < n.right;
|
|
6088
6088
|
}
|
|
6089
6089
|
function Ae(n, e) {
|
|
6090
6090
|
let t = n.getClientRects();
|
|
6091
6091
|
if (t.length) {
|
|
6092
6092
|
let r = t[e < 0 ? 0 : t.length - 1];
|
|
6093
|
-
if (
|
|
6093
|
+
if (vi(r))
|
|
6094
6094
|
return r;
|
|
6095
6095
|
}
|
|
6096
|
-
return Array.prototype.find.call(t,
|
|
6096
|
+
return Array.prototype.find.call(t, vi) || n.getBoundingClientRect();
|
|
6097
6097
|
}
|
|
6098
6098
|
const $a = /[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;
|
|
6099
|
-
function
|
|
6099
|
+
function ao(n, e, t) {
|
|
6100
6100
|
let { node: r, offset: i, atom: s } = n.docView.domFromPos(e, t < 0 ? -1 : 1), o = Yt || pe;
|
|
6101
6101
|
if (r.nodeType == 3)
|
|
6102
6102
|
if (o && ($a.test(r.nodeValue) || (t < 0 ? !i : i == r.nodeValue.length))) {
|
|
@@ -6154,7 +6154,7 @@ function Xn(n, e) {
|
|
|
6154
6154
|
let t = e ? n.top : n.bottom;
|
|
6155
6155
|
return { top: t, bottom: t, left: n.left, right: n.right };
|
|
6156
6156
|
}
|
|
6157
|
-
function
|
|
6157
|
+
function co(n, e, t) {
|
|
6158
6158
|
let r = n.state, i = n.root.activeElement;
|
|
6159
6159
|
r != e && n.updateState(e), i != n.dom && n.focus();
|
|
6160
6160
|
try {
|
|
@@ -6165,7 +6165,7 @@ function ao(n, e, t) {
|
|
|
6165
6165
|
}
|
|
6166
6166
|
function Va(n, e, t) {
|
|
6167
6167
|
let r = e.selection, i = t == "up" ? r.$from : r.$to;
|
|
6168
|
-
return
|
|
6168
|
+
return co(n, e, () => {
|
|
6169
6169
|
let { node: s } = n.docView.domFromPos(i.pos, t == "up" ? -1 : 1);
|
|
6170
6170
|
for (; ; ) {
|
|
6171
6171
|
let l = n.docView.nearestDesc(s, !0);
|
|
@@ -6177,7 +6177,7 @@ function Va(n, e, t) {
|
|
|
6177
6177
|
}
|
|
6178
6178
|
s = l.dom.parentNode;
|
|
6179
6179
|
}
|
|
6180
|
-
let o =
|
|
6180
|
+
let o = ao(n, i.pos, 1);
|
|
6181
6181
|
for (let l = s.firstChild; l; l = l.nextSibling) {
|
|
6182
6182
|
let a;
|
|
6183
6183
|
if (l.nodeType == 1)
|
|
@@ -6201,7 +6201,7 @@ function Wa(n, e, t) {
|
|
|
6201
6201
|
if (!r.parent.isTextblock)
|
|
6202
6202
|
return !1;
|
|
6203
6203
|
let i = r.parentOffset, s = !i, o = i == r.parent.content.size, l = n.domSelection();
|
|
6204
|
-
return l ? !Ha.test(r.parent.textContent) || !l.modify ? t == "left" || t == "backward" ? s : o :
|
|
6204
|
+
return l ? !Ha.test(r.parent.textContent) || !l.modify ? t == "left" || t == "backward" ? s : o : co(n, e, () => {
|
|
6205
6205
|
let { focusNode: a, focusOffset: c, anchorNode: d, anchorOffset: u } = n.domSelectionRange(), f = l.caretBidiLevel;
|
|
6206
6206
|
l.modify("move", t, "character");
|
|
6207
6207
|
let h = r.depth ? n.docView.domAfterPos(r.before()) : n.dom, { focusNode: p, focusOffset: m } = n.domSelectionRange(), g = p && !h.contains(p.nodeType == 1 ? p : p.parentNode) || a == p && c == m;
|
|
@@ -6212,11 +6212,11 @@ function Wa(n, e, t) {
|
|
|
6212
6212
|
return f != null && (l.caretBidiLevel = f), g;
|
|
6213
6213
|
}) : r.pos == r.start() || r.pos == r.end();
|
|
6214
6214
|
}
|
|
6215
|
-
let
|
|
6215
|
+
let Ni = null, Ai = null, Di = !1;
|
|
6216
6216
|
function qa(n, e, t) {
|
|
6217
|
-
return
|
|
6217
|
+
return Ni == e && Ai == t ? Di : (Ni = e, Ai = t, Di = t == "up" || t == "down" ? Va(n, e, t) : Wa(n, e, t));
|
|
6218
6218
|
}
|
|
6219
|
-
const me = 0,
|
|
6219
|
+
const me = 0, Ii = 1, _e = 2, Se = 3;
|
|
6220
6220
|
class Xt {
|
|
6221
6221
|
constructor(e, t, r, i) {
|
|
6222
6222
|
this.parent = e, this.children = t, this.dom = r, this.contentDOM = i, this.dirty = me, r.pmViewDesc = this;
|
|
@@ -6388,7 +6388,7 @@ class Xt {
|
|
|
6388
6388
|
let r = 0, i = 0;
|
|
6389
6389
|
for (let s = 0; r < this.children.length; r++) {
|
|
6390
6390
|
let o = this.children[r], l = s + o.size;
|
|
6391
|
-
if (l > e || o instanceof
|
|
6391
|
+
if (l > e || o instanceof fo) {
|
|
6392
6392
|
i = e - s;
|
|
6393
6393
|
break;
|
|
6394
6394
|
}
|
|
@@ -6396,7 +6396,7 @@ class Xt {
|
|
|
6396
6396
|
}
|
|
6397
6397
|
if (i)
|
|
6398
6398
|
return this.children[r].domFromPos(i - this.children[r].border, t);
|
|
6399
|
-
for (let s; r && !(s = this.children[r - 1]).size && s instanceof
|
|
6399
|
+
for (let s; r && !(s = this.children[r - 1]).size && s instanceof uo && s.side >= 0; r--)
|
|
6400
6400
|
;
|
|
6401
6401
|
if (t <= 0) {
|
|
6402
6402
|
let s, o = !0;
|
|
@@ -6532,7 +6532,7 @@ class Xt {
|
|
|
6532
6532
|
if (r == o ? e <= o && t >= r : e < o && t > r) {
|
|
6533
6533
|
let l = r + s.border, a = o - s.border;
|
|
6534
6534
|
if (e >= l && t <= a) {
|
|
6535
|
-
this.dirty = e == r || t == o ? _e :
|
|
6535
|
+
this.dirty = e == r || t == o ? _e : Ii, e == l && t == a && (s.contentLost || s.dom.parentNode != this.contentDOM) ? s.dirty = Se : s.markDirty(e - l, t - l);
|
|
6536
6536
|
return;
|
|
6537
6537
|
} else
|
|
6538
6538
|
s.dirty = s.dom == s.contentDOM && s.dom.parentNode == this.contentDOM && !s.children.length ? _e : Se;
|
|
@@ -6544,7 +6544,7 @@ class Xt {
|
|
|
6544
6544
|
markParentsDirty() {
|
|
6545
6545
|
let e = 1;
|
|
6546
6546
|
for (let t = this.parent; t; t = t.parent, e++) {
|
|
6547
|
-
let r = e == 1 ? _e :
|
|
6547
|
+
let r = e == 1 ? _e : Ii;
|
|
6548
6548
|
t.dirty < r && (t.dirty = r);
|
|
6549
6549
|
}
|
|
6550
6550
|
}
|
|
@@ -6561,7 +6561,7 @@ class Xt {
|
|
|
6561
6561
|
return !1;
|
|
6562
6562
|
}
|
|
6563
6563
|
}
|
|
6564
|
-
class
|
|
6564
|
+
class uo extends Xt {
|
|
6565
6565
|
constructor(e, t, r, i) {
|
|
6566
6566
|
let s, o = t.type.toDOM;
|
|
6567
6567
|
if (typeof o == "function" && (o = o(r, () => {
|
|
@@ -6645,7 +6645,7 @@ class ot extends Xt {
|
|
|
6645
6645
|
}
|
|
6646
6646
|
slice(e, t, r) {
|
|
6647
6647
|
let i = ot.create(this.parent, this.mark, !0, r), s = this.children, o = this.size;
|
|
6648
|
-
t < o && (s =
|
|
6648
|
+
t < o && (s = wr(s, t, o, r)), e > 0 && (s = wr(s, 0, e, r));
|
|
6649
6649
|
for (let l = 0; l < s.length; l++)
|
|
6650
6650
|
s[l].parent = i;
|
|
6651
6651
|
return i.children = s, i;
|
|
@@ -6685,7 +6685,7 @@ class Ve extends Xt {
|
|
|
6685
6685
|
} else d || ({ dom: d, contentDOM: u } = ct.renderSpec(document, t.type.spec.toDOM(t), null, t.attrs));
|
|
6686
6686
|
!u && !t.isText && d.nodeName != "BR" && (d.hasAttribute("contenteditable") || (d.contentEditable = "false"), t.type.spec.draggable && (d.draggable = !0));
|
|
6687
6687
|
let f = d;
|
|
6688
|
-
return d =
|
|
6688
|
+
return d = mo(d, r, t), c ? a = new Ka(e, t, r, i, d, u || null, f, c, s, o + 1) : t.isText ? new Pn(e, t, r, i, d, f, s) : new Ve(e, t, r, i, d, u || null, f, s, o + 1);
|
|
6689
6689
|
}
|
|
6690
6690
|
parseRule() {
|
|
6691
6691
|
if (this.node.type.spec.reparseInView)
|
|
@@ -6728,7 +6728,7 @@ class Ve extends Xt {
|
|
|
6728
6728
|
a.syncToMarks(c.marks, r, e, f);
|
|
6729
6729
|
let h;
|
|
6730
6730
|
a.findNodeMatch(c, d, u, f) || l && e.state.selection.from > i && e.state.selection.to < i + c.nodeSize && (h = a.findIndexWithChild(s.node)) > -1 && a.updateNodeAt(c, d, u, h, e) || a.updateNextNode(c, d, u, e, f, i) || a.addNode(c, d, u, e, i), i += c.nodeSize;
|
|
6731
|
-
}), a.syncToMarks([], r, e, 0), this.node.isTextblock && a.addTextblockHacks(), a.destroyRest(), (a.changed || this.dirty == _e) && (o && this.protectLocalComposition(e, o),
|
|
6731
|
+
}), a.syncToMarks([], r, e, 0), this.node.isTextblock && a.addTextblockHacks(), a.destroyRest(), (a.changed || this.dirty == _e) && (o && this.protectLocalComposition(e, o), ho(this.contentDOM, this.children, e), xt && Xa(this.dom));
|
|
6732
6732
|
}
|
|
6733
6733
|
localCompositionInfo(e, t) {
|
|
6734
6734
|
let { from: r, to: i } = e.state.selection;
|
|
@@ -6755,7 +6755,7 @@ class Ve extends Xt {
|
|
|
6755
6755
|
s.pmViewDesc && (s.pmViewDesc = void 0);
|
|
6756
6756
|
}
|
|
6757
6757
|
let o = new ja(this, s, t, i);
|
|
6758
|
-
e.input.compositionNodes.push(o), this.children =
|
|
6758
|
+
e.input.compositionNodes.push(o), this.children = wr(this.children, r, r + i.length, e, o);
|
|
6759
6759
|
}
|
|
6760
6760
|
// If this desc must be updated to match the given node decoration,
|
|
6761
6761
|
// do so and return true.
|
|
@@ -6769,7 +6769,7 @@ class Ve extends Xt {
|
|
|
6769
6769
|
if (gn(e, this.outerDeco))
|
|
6770
6770
|
return;
|
|
6771
6771
|
let t = this.nodeDOM.nodeType != 1, r = this.dom;
|
|
6772
|
-
this.dom =
|
|
6772
|
+
this.dom = po(this.dom, this.nodeDOM, Mr(this.outerDeco, this.node, t), Mr(e, this.node, t)), this.dom != r && (r.pmViewDesc = void 0, this.dom.pmViewDesc = this), this.outerDeco = e;
|
|
6773
6773
|
}
|
|
6774
6774
|
// Mark this node as being the selected node.
|
|
6775
6775
|
selectNode() {
|
|
@@ -6783,8 +6783,8 @@ class Ve extends Xt {
|
|
|
6783
6783
|
return this.node.isAtom;
|
|
6784
6784
|
}
|
|
6785
6785
|
}
|
|
6786
|
-
function
|
|
6787
|
-
|
|
6786
|
+
function Ri(n, e, t, r, i) {
|
|
6787
|
+
mo(r, e, n);
|
|
6788
6788
|
let s = new Ve(void 0, n, e, t, r, r, r, i, 0);
|
|
6789
6789
|
return s.contentDOM && s.updateChildren(i, 0), s;
|
|
6790
6790
|
}
|
|
@@ -6831,7 +6831,7 @@ class Pn extends Ve {
|
|
|
6831
6831
|
return this.node.text == e;
|
|
6832
6832
|
}
|
|
6833
6833
|
}
|
|
6834
|
-
class
|
|
6834
|
+
class fo extends Xt {
|
|
6835
6835
|
parseRule() {
|
|
6836
6836
|
return { ignore: !0 };
|
|
6837
6837
|
}
|
|
@@ -6879,23 +6879,23 @@ class Ka extends Ve {
|
|
|
6879
6879
|
return this.spec.ignoreMutation ? this.spec.ignoreMutation(e) : super.ignoreMutation(e);
|
|
6880
6880
|
}
|
|
6881
6881
|
}
|
|
6882
|
-
function
|
|
6882
|
+
function ho(n, e, t) {
|
|
6883
6883
|
let r = n.firstChild, i = !1;
|
|
6884
6884
|
for (let s = 0; s < e.length; s++) {
|
|
6885
6885
|
let o = e[s], l = o.dom;
|
|
6886
6886
|
if (l.parentNode == n) {
|
|
6887
6887
|
for (; l != r; )
|
|
6888
|
-
r =
|
|
6888
|
+
r = Pi(r), i = !0;
|
|
6889
6889
|
r = r.nextSibling;
|
|
6890
6890
|
} else
|
|
6891
6891
|
i = !0, n.insertBefore(l, r);
|
|
6892
6892
|
if (o instanceof ot) {
|
|
6893
6893
|
let a = r ? r.previousSibling : n.lastChild;
|
|
6894
|
-
|
|
6894
|
+
ho(o.contentDOM, o.children, t), r = a ? a.nextSibling : n.firstChild;
|
|
6895
6895
|
}
|
|
6896
6896
|
}
|
|
6897
6897
|
for (; r; )
|
|
6898
|
-
r =
|
|
6898
|
+
r = Pi(r), i = !0;
|
|
6899
6899
|
i && t.trackWrites == n && (t.trackWrites = null);
|
|
6900
6900
|
}
|
|
6901
6901
|
const At = function(n) {
|
|
@@ -6903,7 +6903,7 @@ const At = function(n) {
|
|
|
6903
6903
|
};
|
|
6904
6904
|
At.prototype = /* @__PURE__ */ Object.create(null);
|
|
6905
6905
|
const Ge = [new At()];
|
|
6906
|
-
function
|
|
6906
|
+
function Mr(n, e, t) {
|
|
6907
6907
|
if (n.length == 0)
|
|
6908
6908
|
return Ge;
|
|
6909
6909
|
let r = t ? Ge[0] : new At(), i = [r];
|
|
@@ -6919,7 +6919,7 @@ function Sr(n, e, t) {
|
|
|
6919
6919
|
}
|
|
6920
6920
|
return i;
|
|
6921
6921
|
}
|
|
6922
|
-
function
|
|
6922
|
+
function po(n, e, t, r) {
|
|
6923
6923
|
if (t == Ge && r == Ge)
|
|
6924
6924
|
return e;
|
|
6925
6925
|
let i = e;
|
|
@@ -6955,8 +6955,8 @@ function Ja(n, e, t) {
|
|
|
6955
6955
|
t.style && (n.style.cssText += t.style);
|
|
6956
6956
|
}
|
|
6957
6957
|
}
|
|
6958
|
-
function
|
|
6959
|
-
return
|
|
6958
|
+
function mo(n, e, t) {
|
|
6959
|
+
return po(n, n, Ge, Mr(e, t, n.nodeType != 1));
|
|
6960
6960
|
}
|
|
6961
6961
|
function gn(n, e) {
|
|
6962
6962
|
if (n.length != e.length)
|
|
@@ -6966,7 +6966,7 @@ function gn(n, e) {
|
|
|
6966
6966
|
return !1;
|
|
6967
6967
|
return !0;
|
|
6968
6968
|
}
|
|
6969
|
-
function
|
|
6969
|
+
function Pi(n) {
|
|
6970
6970
|
let e = n.nextSibling;
|
|
6971
6971
|
return n.parentNode.removeChild(n), e;
|
|
6972
6972
|
}
|
|
@@ -7094,7 +7094,7 @@ class Ua {
|
|
|
7094
7094
|
if (i && i.matchesWidget(e) && (e == i.widget || !i.widget.type.toDOM.parentNode))
|
|
7095
7095
|
this.index++;
|
|
7096
7096
|
else {
|
|
7097
|
-
let s = new
|
|
7097
|
+
let s = new uo(this.top, e, t, r);
|
|
7098
7098
|
this.top.children.splice(this.index++, 0, s), this.changed = !0;
|
|
7099
7099
|
}
|
|
7100
7100
|
}
|
|
@@ -7113,7 +7113,7 @@ class Ua {
|
|
|
7113
7113
|
else {
|
|
7114
7114
|
let r = document.createElement(e);
|
|
7115
7115
|
e == "IMG" && (r.className = "ProseMirror-separator", r.alt = ""), e == "BR" && (r.className = "ProseMirror-trailingBreak");
|
|
7116
|
-
let i = new
|
|
7116
|
+
let i = new fo(this.top, [], r, null);
|
|
7117
7117
|
t != this.top ? t.children.push(i) : t.children.splice(this.index++, 0, i), this.changed = !0;
|
|
7118
7118
|
}
|
|
7119
7119
|
}
|
|
@@ -7229,7 +7229,7 @@ function Za(n, e, t, r) {
|
|
|
7229
7229
|
}
|
|
7230
7230
|
return -1;
|
|
7231
7231
|
}
|
|
7232
|
-
function
|
|
7232
|
+
function wr(n, e, t, r, i) {
|
|
7233
7233
|
let s = [];
|
|
7234
7234
|
for (let o = 0, l = 0; o < n.length; o++) {
|
|
7235
7235
|
let a = n[o], c = l, d = l += a.size;
|
|
@@ -7237,7 +7237,7 @@ function Mr(n, e, t, r, i) {
|
|
|
7237
7237
|
}
|
|
7238
7238
|
return s;
|
|
7239
7239
|
}
|
|
7240
|
-
function
|
|
7240
|
+
function Vr(n, e = null) {
|
|
7241
7241
|
let t = n.domSelectionRange(), r = n.state.doc;
|
|
7242
7242
|
if (!t.focusNode)
|
|
7243
7243
|
return null;
|
|
@@ -7271,16 +7271,16 @@ function $r(n, e = null) {
|
|
|
7271
7271
|
let d = r.resolve(a);
|
|
7272
7272
|
if (!c) {
|
|
7273
7273
|
let u = e == "pointer" || n.state.selection.head < l.pos && !s ? 1 : -1;
|
|
7274
|
-
c =
|
|
7274
|
+
c = Hr(n, d, l, u);
|
|
7275
7275
|
}
|
|
7276
7276
|
return c;
|
|
7277
7277
|
}
|
|
7278
|
-
function
|
|
7279
|
-
return n.editable ? n.hasFocus() :
|
|
7278
|
+
function go(n) {
|
|
7279
|
+
return n.editable ? n.hasFocus() : bo(n) && document.activeElement && document.activeElement.contains(n.dom);
|
|
7280
7280
|
}
|
|
7281
7281
|
function Ne(n, e = !1) {
|
|
7282
7282
|
let t = n.state.selection;
|
|
7283
|
-
if (
|
|
7283
|
+
if (yo(n, t), !!go(n)) {
|
|
7284
7284
|
if (!e && n.input.mouseDown && n.input.mouseDown.allowDefault && U) {
|
|
7285
7285
|
let r = n.domSelectionRange(), i = n.domObserver.currentSelection;
|
|
7286
7286
|
if (r.anchorNode && i.anchorNode && st(r.anchorNode, r.anchorOffset, i.anchorNode, i.anchorOffset)) {
|
|
@@ -7292,13 +7292,13 @@ function Ne(n, e = !1) {
|
|
|
7292
7292
|
ec(n);
|
|
7293
7293
|
else {
|
|
7294
7294
|
let { anchor: r, head: i } = t, s, o;
|
|
7295
|
-
|
|
7295
|
+
Bi && !(t instanceof M) && (t.$from.parent.inlineContent || (s = Li(n, t.from)), !t.empty && !t.$from.parent.inlineContent && (o = Li(n, t.to))), n.docView.setSelection(r, i, n, e), Bi && (s && zi(s), o && zi(o)), t.visible ? n.dom.classList.remove("ProseMirror-hideselection") : (n.dom.classList.add("ProseMirror-hideselection"), "onselectionchange" in document && Qa(n));
|
|
7296
7296
|
}
|
|
7297
7297
|
n.domObserver.setCurSelection(), n.domObserver.connectSelection();
|
|
7298
7298
|
}
|
|
7299
7299
|
}
|
|
7300
|
-
const
|
|
7301
|
-
function
|
|
7300
|
+
const Bi = X || U && no < 63;
|
|
7301
|
+
function Li(n, e) {
|
|
7302
7302
|
let { node: t, offset: r } = n.docView.domFromPos(e, 0), i = r < t.childNodes.length ? t.childNodes[r] : null, s = r ? t.childNodes[r - 1] : null;
|
|
7303
7303
|
if (X && i && i.contentEditable == "false")
|
|
7304
7304
|
return Zn(i);
|
|
@@ -7312,7 +7312,7 @@ function Bi(n, e) {
|
|
|
7312
7312
|
function Zn(n) {
|
|
7313
7313
|
return n.contentEditable = "true", X && n.draggable && (n.draggable = !1, n.wasDraggable = !0), n;
|
|
7314
7314
|
}
|
|
7315
|
-
function
|
|
7315
|
+
function zi(n) {
|
|
7316
7316
|
n.contentEditable = "false", n.wasDraggable && (n.draggable = !0, n.wasDraggable = null);
|
|
7317
7317
|
}
|
|
7318
7318
|
function Qa(n) {
|
|
@@ -7321,7 +7321,7 @@ function Qa(n) {
|
|
|
7321
7321
|
let t = n.domSelectionRange(), r = t.anchorNode, i = t.anchorOffset;
|
|
7322
7322
|
e.addEventListener("selectionchange", n.input.hideSelectionGuard = () => {
|
|
7323
7323
|
(t.anchorNode != r || t.anchorOffset != i) && (e.removeEventListener("selectionchange", n.input.hideSelectionGuard), setTimeout(() => {
|
|
7324
|
-
(!
|
|
7324
|
+
(!go(n) || n.state.selection.visible) && n.dom.classList.remove("ProseMirror-hideselection");
|
|
7325
7325
|
}, 20));
|
|
7326
7326
|
});
|
|
7327
7327
|
}
|
|
@@ -7332,23 +7332,23 @@ function ec(n) {
|
|
|
7332
7332
|
let t = n.cursorWrapper.dom, r = t.nodeName == "IMG";
|
|
7333
7333
|
r ? e.collapse(t.parentNode, K(t) + 1) : e.collapse(t, 0), !r && !n.state.selection.visible && ie && $e <= 11 && (t.disabled = !0, t.disabled = !1);
|
|
7334
7334
|
}
|
|
7335
|
-
function
|
|
7335
|
+
function yo(n, e) {
|
|
7336
7336
|
if (e instanceof S) {
|
|
7337
7337
|
let t = n.docView.descAt(e.from);
|
|
7338
|
-
t != n.lastSelectedViewDesc && (
|
|
7338
|
+
t != n.lastSelectedViewDesc && (Fi(n), t && t.selectNode(), n.lastSelectedViewDesc = t);
|
|
7339
7339
|
} else
|
|
7340
|
-
|
|
7340
|
+
Fi(n);
|
|
7341
7341
|
}
|
|
7342
|
-
function
|
|
7342
|
+
function Fi(n) {
|
|
7343
7343
|
n.lastSelectedViewDesc && (n.lastSelectedViewDesc.parent && n.lastSelectedViewDesc.deselectNode(), n.lastSelectedViewDesc = void 0);
|
|
7344
7344
|
}
|
|
7345
|
-
function
|
|
7345
|
+
function Hr(n, e, t, r) {
|
|
7346
7346
|
return n.someProp("createSelectionBetween", (i) => i(n, e, t)) || M.between(e, t, r);
|
|
7347
7347
|
}
|
|
7348
|
-
function
|
|
7349
|
-
return n.editable && !n.hasFocus() ? !1 :
|
|
7348
|
+
function $i(n) {
|
|
7349
|
+
return n.editable && !n.hasFocus() ? !1 : bo(n);
|
|
7350
7350
|
}
|
|
7351
|
-
function
|
|
7351
|
+
function bo(n) {
|
|
7352
7352
|
let e = n.domSelectionRange();
|
|
7353
7353
|
if (!e.anchorNode)
|
|
7354
7354
|
return !1;
|
|
@@ -7362,14 +7362,14 @@ function tc(n) {
|
|
|
7362
7362
|
let e = n.docView.domFromPos(n.state.selection.anchor, 0), t = n.domSelectionRange();
|
|
7363
7363
|
return st(e.node, e.offset, t.anchorNode, t.anchorOffset);
|
|
7364
7364
|
}
|
|
7365
|
-
function
|
|
7365
|
+
function Cr(n, e) {
|
|
7366
7366
|
let { $anchor: t, $head: r } = n.selection, i = e > 0 ? t.max(r) : t.min(r), s = i.parent.inlineContent ? i.depth ? n.doc.resolve(e > 0 ? i.after() : i.before()) : null : i;
|
|
7367
7367
|
return s && E.findFrom(s, e);
|
|
7368
7368
|
}
|
|
7369
7369
|
function De(n, e) {
|
|
7370
7370
|
return n.dispatch(n.state.tr.setSelection(e).scrollIntoView()), !0;
|
|
7371
7371
|
}
|
|
7372
|
-
function
|
|
7372
|
+
function Vi(n, e, t) {
|
|
7373
7373
|
let r = n.state.selection;
|
|
7374
7374
|
if (r instanceof M)
|
|
7375
7375
|
if (t.indexOf("s") > -1) {
|
|
@@ -7380,7 +7380,7 @@ function $i(n, e, t) {
|
|
|
7380
7380
|
return De(n, new M(r.$anchor, o));
|
|
7381
7381
|
} else if (r.empty) {
|
|
7382
7382
|
if (n.endOfTextblock(e > 0 ? "forward" : "backward")) {
|
|
7383
|
-
let i =
|
|
7383
|
+
let i = Cr(n.state, e);
|
|
7384
7384
|
return i && i instanceof S ? De(n, i) : !1;
|
|
7385
7385
|
} else if (!(ue && t.indexOf("m") > -1)) {
|
|
7386
7386
|
let i = r.$head, s = i.textOffset ? null : e < 0 ? i.nodeBefore : i.nodeAfter, o;
|
|
@@ -7394,7 +7394,7 @@ function $i(n, e, t) {
|
|
|
7394
7394
|
if (r instanceof S && r.node.isInline)
|
|
7395
7395
|
return De(n, new M(e > 0 ? r.$to : r.$from));
|
|
7396
7396
|
{
|
|
7397
|
-
let i =
|
|
7397
|
+
let i = Cr(n.state, e);
|
|
7398
7398
|
return i ? De(n, i) : !1;
|
|
7399
7399
|
}
|
|
7400
7400
|
}
|
|
@@ -7428,7 +7428,7 @@ function nc(n) {
|
|
|
7428
7428
|
break;
|
|
7429
7429
|
}
|
|
7430
7430
|
} else {
|
|
7431
|
-
if (
|
|
7431
|
+
if (ko(t))
|
|
7432
7432
|
break;
|
|
7433
7433
|
{
|
|
7434
7434
|
let l = t.previousSibling;
|
|
@@ -7443,7 +7443,7 @@ function nc(n) {
|
|
|
7443
7443
|
}
|
|
7444
7444
|
}
|
|
7445
7445
|
}
|
|
7446
|
-
o ?
|
|
7446
|
+
o ? Tr(n, t, r) : i && Tr(n, i, s);
|
|
7447
7447
|
}
|
|
7448
7448
|
function rc(n) {
|
|
7449
7449
|
let e = n.domSelectionRange(), t = e.focusNode, r = e.focusOffset;
|
|
@@ -7460,7 +7460,7 @@ function rc(n) {
|
|
|
7460
7460
|
else
|
|
7461
7461
|
break;
|
|
7462
7462
|
} else {
|
|
7463
|
-
if (
|
|
7463
|
+
if (ko(t))
|
|
7464
7464
|
break;
|
|
7465
7465
|
{
|
|
7466
7466
|
let l = t.nextSibling;
|
|
@@ -7475,9 +7475,9 @@ function rc(n) {
|
|
|
7475
7475
|
}
|
|
7476
7476
|
}
|
|
7477
7477
|
}
|
|
7478
|
-
s &&
|
|
7478
|
+
s && Tr(n, s, o);
|
|
7479
7479
|
}
|
|
7480
|
-
function
|
|
7480
|
+
function ko(n) {
|
|
7481
7481
|
let e = n.pmViewDesc;
|
|
7482
7482
|
return e && e.node && e.node.isBlock;
|
|
7483
7483
|
}
|
|
@@ -7505,7 +7505,7 @@ function sc(n, e) {
|
|
|
7505
7505
|
n = t, e = n.childNodes.length;
|
|
7506
7506
|
}
|
|
7507
7507
|
}
|
|
7508
|
-
function
|
|
7508
|
+
function Tr(n, e, t) {
|
|
7509
7509
|
if (e.nodeType != 3) {
|
|
7510
7510
|
let s, o;
|
|
7511
7511
|
(o = ic(e, t)) ? (e = o, t = 0) : (s = sc(e, t)) && (e = s, t = s.nodeValue.length);
|
|
@@ -7523,9 +7523,9 @@ function Cr(n, e, t) {
|
|
|
7523
7523
|
n.state == i && Ne(n);
|
|
7524
7524
|
}, 50);
|
|
7525
7525
|
}
|
|
7526
|
-
function
|
|
7526
|
+
function Hi(n, e) {
|
|
7527
7527
|
let t = n.state.doc.resolve(e);
|
|
7528
|
-
if (!(U ||
|
|
7528
|
+
if (!(U || ro) && t.parent.inlineContent) {
|
|
7529
7529
|
let i = n.coordsAtPos(e);
|
|
7530
7530
|
if (e > t.start()) {
|
|
7531
7531
|
let s = n.coordsAtPos(e - 1), o = (s.top + s.bottom) / 2;
|
|
@@ -7540,13 +7540,13 @@ function Vi(n, e) {
|
|
|
7540
7540
|
}
|
|
7541
7541
|
return getComputedStyle(n.dom).direction == "rtl" ? "rtl" : "ltr";
|
|
7542
7542
|
}
|
|
7543
|
-
function
|
|
7543
|
+
function Wi(n, e, t) {
|
|
7544
7544
|
let r = n.state.selection;
|
|
7545
7545
|
if (r instanceof M && !r.empty || t.indexOf("s") > -1 || ue && t.indexOf("m") > -1)
|
|
7546
7546
|
return !1;
|
|
7547
7547
|
let { $from: i, $to: s } = r;
|
|
7548
7548
|
if (!i.parent.inlineContent || n.endOfTextblock(e < 0 ? "up" : "down")) {
|
|
7549
|
-
let o =
|
|
7549
|
+
let o = Cr(n.state, e);
|
|
7550
7550
|
if (o && o instanceof S)
|
|
7551
7551
|
return De(n, o);
|
|
7552
7552
|
}
|
|
@@ -7556,7 +7556,7 @@ function Hi(n, e, t) {
|
|
|
7556
7556
|
}
|
|
7557
7557
|
return !1;
|
|
7558
7558
|
}
|
|
7559
|
-
function
|
|
7559
|
+
function qi(n, e) {
|
|
7560
7560
|
if (!(n.state.selection instanceof M))
|
|
7561
7561
|
return !0;
|
|
7562
7562
|
let { $head: t, $anchor: r, empty: i } = n.state.selection;
|
|
@@ -7573,7 +7573,7 @@ function Wi(n, e) {
|
|
|
7573
7573
|
}
|
|
7574
7574
|
return !1;
|
|
7575
7575
|
}
|
|
7576
|
-
function
|
|
7576
|
+
function ji(n, e, t) {
|
|
7577
7577
|
n.domObserver.stop(), e.contentEditable = t, n.domObserver.start();
|
|
7578
7578
|
}
|
|
7579
7579
|
function oc(n) {
|
|
@@ -7582,7 +7582,7 @@ function oc(n) {
|
|
|
7582
7582
|
let { focusNode: e, focusOffset: t } = n.domSelectionRange();
|
|
7583
7583
|
if (e && e.nodeType == 1 && t == 0 && e.firstChild && e.firstChild.contentEditable == "false") {
|
|
7584
7584
|
let r = e.firstChild;
|
|
7585
|
-
|
|
7585
|
+
ji(n, r, "true"), setTimeout(() => ji(n, r, "false"), 20);
|
|
7586
7586
|
}
|
|
7587
7587
|
return !1;
|
|
7588
7588
|
}
|
|
@@ -7593,28 +7593,28 @@ function lc(n) {
|
|
|
7593
7593
|
function ac(n, e) {
|
|
7594
7594
|
let t = e.keyCode, r = lc(e);
|
|
7595
7595
|
if (t == 8 || ue && t == 72 && r == "c")
|
|
7596
|
-
return
|
|
7596
|
+
return qi(n, -1) || ut(n, -1);
|
|
7597
7597
|
if (t == 46 && !e.shiftKey || ue && t == 68 && r == "c")
|
|
7598
|
-
return
|
|
7598
|
+
return qi(n, 1) || ut(n, 1);
|
|
7599
7599
|
if (t == 13 || t == 27)
|
|
7600
7600
|
return !0;
|
|
7601
7601
|
if (t == 37 || ue && t == 66 && r == "c") {
|
|
7602
|
-
let i = t == 37 ?
|
|
7603
|
-
return
|
|
7602
|
+
let i = t == 37 ? Hi(n, n.state.selection.from) == "ltr" ? -1 : 1 : -1;
|
|
7603
|
+
return Vi(n, i, r) || ut(n, i);
|
|
7604
7604
|
} else if (t == 39 || ue && t == 70 && r == "c") {
|
|
7605
|
-
let i = t == 39 ?
|
|
7606
|
-
return
|
|
7605
|
+
let i = t == 39 ? Hi(n, n.state.selection.from) == "ltr" ? 1 : -1 : 1;
|
|
7606
|
+
return Vi(n, i, r) || ut(n, i);
|
|
7607
7607
|
} else {
|
|
7608
7608
|
if (t == 38 || ue && t == 80 && r == "c")
|
|
7609
|
-
return
|
|
7609
|
+
return Wi(n, -1, r) || ut(n, -1);
|
|
7610
7610
|
if (t == 40 || ue && t == 78 && r == "c")
|
|
7611
|
-
return oc(n) ||
|
|
7611
|
+
return oc(n) || Wi(n, 1, r) || ut(n, 1);
|
|
7612
7612
|
if (r == (ue ? "m" : "c") && (t == 66 || t == 73 || t == 89 || t == 90))
|
|
7613
7613
|
return !0;
|
|
7614
7614
|
}
|
|
7615
7615
|
return !1;
|
|
7616
7616
|
}
|
|
7617
|
-
function
|
|
7617
|
+
function Wr(n, e) {
|
|
7618
7618
|
n.someProp("transformCopied", (h) => {
|
|
7619
7619
|
e = h(e, n);
|
|
7620
7620
|
});
|
|
@@ -7624,10 +7624,10 @@ function Hr(n, e) {
|
|
|
7624
7624
|
let h = r.firstChild;
|
|
7625
7625
|
t.push(h.type.name, h.attrs != h.type.defaultAttrs ? h.attrs : null), r = h.content;
|
|
7626
7626
|
}
|
|
7627
|
-
let o = n.someProp("clipboardSerializer") || ct.fromSchema(n.state.schema), l =
|
|
7627
|
+
let o = n.someProp("clipboardSerializer") || ct.fromSchema(n.state.schema), l = To(), a = l.createElement("div");
|
|
7628
7628
|
a.appendChild(o.serializeFragment(r, { document: l }));
|
|
7629
7629
|
let c = a.firstChild, d, u = 0;
|
|
7630
|
-
for (; c && c.nodeType == 1 && (d =
|
|
7630
|
+
for (; c && c.nodeType == 1 && (d = Co[c.nodeName.toLowerCase()]); ) {
|
|
7631
7631
|
for (let h = d.length - 1; h >= 0; h--) {
|
|
7632
7632
|
let p = l.createElement(d[h]);
|
|
7633
7633
|
for (; a.firstChild; )
|
|
@@ -7642,7 +7642,7 @@ function Hr(n, e) {
|
|
|
7642
7642
|
`);
|
|
7643
7643
|
return { dom: a, text: f, slice: e };
|
|
7644
7644
|
}
|
|
7645
|
-
function
|
|
7645
|
+
function xo(n, e, t, r, i) {
|
|
7646
7646
|
let s = i.parent.type.spec.code, o, l;
|
|
7647
7647
|
if (!t && !e)
|
|
7648
7648
|
return null;
|
|
@@ -7686,14 +7686,14 @@ function ko(n, e, t, r, i) {
|
|
|
7686
7686
|
return f.nodeName == "BR" && !f.nextSibling && f.parentNode && !cc.test(f.parentNode.nodeName) ? { ignore: !0 } : null;
|
|
7687
7687
|
}
|
|
7688
7688
|
})), d)
|
|
7689
|
-
l = pc(
|
|
7689
|
+
l = pc(Ki(l, +d[1], +d[2]), d[4]);
|
|
7690
7690
|
else if (l = k.maxOpen(dc(l.content, i), !0), l.openStart || l.openEnd) {
|
|
7691
7691
|
let u = 0, f = 0;
|
|
7692
7692
|
for (let h = l.content.firstChild; u < l.openStart && !h.type.spec.isolating; u++, h = h.firstChild)
|
|
7693
7693
|
;
|
|
7694
7694
|
for (let h = l.content.lastChild; f < l.openEnd && !h.type.spec.isolating; f++, h = h.lastChild)
|
|
7695
7695
|
;
|
|
7696
|
-
l =
|
|
7696
|
+
l = Ki(l, u, f);
|
|
7697
7697
|
}
|
|
7698
7698
|
return n.someProp("transformPasted", (u) => {
|
|
7699
7699
|
l = u(l, n, a);
|
|
@@ -7711,11 +7711,11 @@ function dc(n, e) {
|
|
|
7711
7711
|
let a = i.findWrapping(l.type), c;
|
|
7712
7712
|
if (!a)
|
|
7713
7713
|
return o = null;
|
|
7714
|
-
if (c = o.length && s.length &&
|
|
7714
|
+
if (c = o.length && s.length && Mo(a, s, l, o[o.length - 1], 0))
|
|
7715
7715
|
o[o.length - 1] = c;
|
|
7716
7716
|
else {
|
|
7717
|
-
o.length && (o[o.length - 1] =
|
|
7718
|
-
let d =
|
|
7717
|
+
o.length && (o[o.length - 1] = wo(o[o.length - 1], s.length));
|
|
7718
|
+
let d = So(l, a);
|
|
7719
7719
|
o.push(d), i = i.matchType(d.type), s = a;
|
|
7720
7720
|
}
|
|
7721
7721
|
}), o)
|
|
@@ -7723,34 +7723,34 @@ function dc(n, e) {
|
|
|
7723
7723
|
}
|
|
7724
7724
|
return n;
|
|
7725
7725
|
}
|
|
7726
|
-
function
|
|
7726
|
+
function So(n, e, t = 0) {
|
|
7727
7727
|
for (let r = e.length - 1; r >= t; r--)
|
|
7728
7728
|
n = e[r].create(null, b.from(n));
|
|
7729
7729
|
return n;
|
|
7730
7730
|
}
|
|
7731
|
-
function
|
|
7731
|
+
function Mo(n, e, t, r, i) {
|
|
7732
7732
|
if (i < n.length && i < e.length && n[i] == e[i]) {
|
|
7733
|
-
let s =
|
|
7733
|
+
let s = Mo(n, e, t, r.lastChild, i + 1);
|
|
7734
7734
|
if (s)
|
|
7735
7735
|
return r.copy(r.content.replaceChild(r.childCount - 1, s));
|
|
7736
7736
|
if (r.contentMatchAt(r.childCount).matchType(i == n.length - 1 ? t.type : n[i + 1]))
|
|
7737
|
-
return r.copy(r.content.append(b.from(
|
|
7737
|
+
return r.copy(r.content.append(b.from(So(t, n, i + 1))));
|
|
7738
7738
|
}
|
|
7739
7739
|
}
|
|
7740
|
-
function
|
|
7740
|
+
function wo(n, e) {
|
|
7741
7741
|
if (e == 0)
|
|
7742
7742
|
return n;
|
|
7743
|
-
let t = n.content.replaceChild(n.childCount - 1,
|
|
7743
|
+
let t = n.content.replaceChild(n.childCount - 1, wo(n.lastChild, e - 1)), r = n.contentMatchAt(n.childCount).fillBefore(b.empty, !0);
|
|
7744
7744
|
return n.copy(t.append(r));
|
|
7745
7745
|
}
|
|
7746
|
-
function
|
|
7746
|
+
function Or(n, e, t, r, i, s) {
|
|
7747
7747
|
let o = e < 0 ? n.firstChild : n.lastChild, l = o.content;
|
|
7748
|
-
return n.childCount > 1 && (s = 0), i < r - 1 && (l =
|
|
7748
|
+
return n.childCount > 1 && (s = 0), i < r - 1 && (l = Or(l, e, t, r, i + 1, s)), i >= t && (l = e < 0 ? o.contentMatchAt(0).fillBefore(l, s <= i).append(l) : l.append(o.contentMatchAt(o.childCount).fillBefore(b.empty, !0))), n.replaceChild(e < 0 ? 0 : n.childCount - 1, o.copy(l));
|
|
7749
7749
|
}
|
|
7750
|
-
function
|
|
7751
|
-
return e < n.openStart && (n = new k(
|
|
7750
|
+
function Ki(n, e, t) {
|
|
7751
|
+
return e < n.openStart && (n = new k(Or(n.content, -1, e, n.openStart, 0, n.openEnd), e, n.openEnd)), t < n.openEnd && (n = new k(Or(n.content, 1, t, n.openEnd, 0, 0), n.openStart, t)), n;
|
|
7752
7752
|
}
|
|
7753
|
-
const
|
|
7753
|
+
const Co = {
|
|
7754
7754
|
thead: ["table"],
|
|
7755
7755
|
tbody: ["table"],
|
|
7756
7756
|
tfoot: ["table"],
|
|
@@ -7761,9 +7761,9 @@ const wo = {
|
|
|
7761
7761
|
td: ["table", "tbody", "tr"],
|
|
7762
7762
|
th: ["table", "tbody", "tr"]
|
|
7763
7763
|
};
|
|
7764
|
-
let
|
|
7765
|
-
function
|
|
7766
|
-
return
|
|
7764
|
+
let Ji = null;
|
|
7765
|
+
function To() {
|
|
7766
|
+
return Ji || (Ji = document.implementation.createHTMLDocument("title"));
|
|
7767
7767
|
}
|
|
7768
7768
|
let Qn = null;
|
|
7769
7769
|
function uc(n) {
|
|
@@ -7773,8 +7773,8 @@ function uc(n) {
|
|
|
7773
7773
|
function fc(n) {
|
|
7774
7774
|
let e = /^(\s*<meta [^>]*>)*/.exec(n);
|
|
7775
7775
|
e && (n = n.slice(e[0].length));
|
|
7776
|
-
let t =
|
|
7777
|
-
if ((i = r &&
|
|
7776
|
+
let t = To().createElement("div"), r = /<([a-z][^>\s]+)/i.exec(n), i;
|
|
7777
|
+
if ((i = r && Co[r[1].toLowerCase()]) && (n = i.map((s) => "<" + s + ">").join("") + n + i.map((s) => "</" + s + ">").reverse().join("")), t.innerHTML = uc(n), i)
|
|
7778
7778
|
for (let s = 0; s < i.length; s++)
|
|
7779
7779
|
t = t.querySelector(i[s]) || t;
|
|
7780
7780
|
return t;
|
|
@@ -7814,10 +7814,10 @@ function yc(n) {
|
|
|
7814
7814
|
for (let e in ee) {
|
|
7815
7815
|
let t = ee[e];
|
|
7816
7816
|
n.dom.addEventListener(e, n.input.eventHandlers[e] = (r) => {
|
|
7817
|
-
kc(n, r) && !
|
|
7817
|
+
kc(n, r) && !qr(n, r) && (n.editable || !(r.type in te)) && t(n, r);
|
|
7818
7818
|
}, mc[e] ? { passive: !0 } : void 0);
|
|
7819
7819
|
}
|
|
7820
|
-
X && n.dom.addEventListener("input", () => null),
|
|
7820
|
+
X && n.dom.addEventListener("input", () => null), Er(n);
|
|
7821
7821
|
}
|
|
7822
7822
|
function Le(n, e) {
|
|
7823
7823
|
n.input.lastSelectionOrigin = e, n.input.lastSelectionTime = Date.now();
|
|
@@ -7828,13 +7828,13 @@ function bc(n) {
|
|
|
7828
7828
|
n.dom.removeEventListener(e, n.input.eventHandlers[e]);
|
|
7829
7829
|
clearTimeout(n.input.composingTimeout), clearTimeout(n.input.lastIOSEnterFallbackTimeout);
|
|
7830
7830
|
}
|
|
7831
|
-
function
|
|
7831
|
+
function Er(n) {
|
|
7832
7832
|
n.someProp("handleDOMEvents", (e) => {
|
|
7833
7833
|
for (let t in e)
|
|
7834
|
-
n.input.eventHandlers[t] || n.dom.addEventListener(t, n.input.eventHandlers[t] = (r) =>
|
|
7834
|
+
n.input.eventHandlers[t] || n.dom.addEventListener(t, n.input.eventHandlers[t] = (r) => qr(n, r));
|
|
7835
7835
|
});
|
|
7836
7836
|
}
|
|
7837
|
-
function
|
|
7837
|
+
function qr(n, e) {
|
|
7838
7838
|
return n.someProp("handleDOMEvents", (t) => {
|
|
7839
7839
|
let r = t[e.type];
|
|
7840
7840
|
return r ? r(n, e) || e.defaultPrevented : !1;
|
|
@@ -7851,11 +7851,11 @@ function kc(n, e) {
|
|
|
7851
7851
|
return !0;
|
|
7852
7852
|
}
|
|
7853
7853
|
function xc(n, e) {
|
|
7854
|
-
!
|
|
7854
|
+
!qr(n, e) && ee[e.type] && (n.editable || !(e.type in te)) && ee[e.type](n, e);
|
|
7855
7855
|
}
|
|
7856
7856
|
te.keydown = (n, e) => {
|
|
7857
7857
|
let t = e;
|
|
7858
|
-
if (n.input.shiftKey = t.keyCode == 16 || t.shiftKey, !
|
|
7858
|
+
if (n.input.shiftKey = t.keyCode == 16 || t.shiftKey, !Eo(n, t) && (n.input.lastKeyCode = t.keyCode, n.input.lastKeyCodeTime = Date.now(), !(Ee && U && t.keyCode == 13)))
|
|
7859
7859
|
if (t.keyCode != 229 && n.domObserver.forceFlush(), xt && t.keyCode == 13 && !t.ctrlKey && !t.altKey && !t.metaKey) {
|
|
7860
7860
|
let r = Date.now();
|
|
7861
7861
|
n.input.lastIOSEnter = r, n.input.lastIOSEnterFallbackTimeout = setTimeout(() => {
|
|
@@ -7868,7 +7868,7 @@ te.keyup = (n, e) => {
|
|
|
7868
7868
|
};
|
|
7869
7869
|
te.keypress = (n, e) => {
|
|
7870
7870
|
let t = e;
|
|
7871
|
-
if (
|
|
7871
|
+
if (Eo(n, t) || !t.charCode || t.ctrlKey && !t.altKey || ue && t.metaKey)
|
|
7872
7872
|
return;
|
|
7873
7873
|
if (n.someProp("handleKeyPress", (i) => i(n, t))) {
|
|
7874
7874
|
t.preventDefault();
|
|
@@ -7887,7 +7887,7 @@ function Sc(n, e) {
|
|
|
7887
7887
|
let t = e.x - n.clientX, r = e.y - n.clientY;
|
|
7888
7888
|
return t * t + r * r < 100;
|
|
7889
7889
|
}
|
|
7890
|
-
function
|
|
7890
|
+
function jr(n, e, t, r, i) {
|
|
7891
7891
|
if (r == -1)
|
|
7892
7892
|
return !1;
|
|
7893
7893
|
let s = n.state.doc.resolve(r);
|
|
@@ -7924,13 +7924,13 @@ function wc(n, e) {
|
|
|
7924
7924
|
return i != null ? (yt(n, S.create(n.state.doc, i)), !0) : !1;
|
|
7925
7925
|
}
|
|
7926
7926
|
function Cc(n, e, t, r, i) {
|
|
7927
|
-
return
|
|
7927
|
+
return jr(n, "handleClickOn", e, t, r) || n.someProp("handleClick", (s) => s(n, e, r)) || (i ? wc(n, t) : Mc(n, t));
|
|
7928
7928
|
}
|
|
7929
7929
|
function Tc(n, e, t, r) {
|
|
7930
|
-
return
|
|
7930
|
+
return jr(n, "handleDoubleClickOn", e, t, r) || n.someProp("handleDoubleClick", (i) => i(n, e, r));
|
|
7931
7931
|
}
|
|
7932
7932
|
function Oc(n, e, t, r) {
|
|
7933
|
-
return
|
|
7933
|
+
return jr(n, "handleTripleClickOn", e, t, r) || n.someProp("handleTripleClick", (i) => i(n, e, r)) || Ec(n, t, r);
|
|
7934
7934
|
}
|
|
7935
7935
|
function Ec(n, e, t) {
|
|
7936
7936
|
if (t.button != 0)
|
|
@@ -7950,21 +7950,21 @@ function Ec(n, e, t) {
|
|
|
7950
7950
|
return !0;
|
|
7951
7951
|
}
|
|
7952
7952
|
}
|
|
7953
|
-
function
|
|
7953
|
+
function Kr(n) {
|
|
7954
7954
|
return bn(n);
|
|
7955
7955
|
}
|
|
7956
|
-
const
|
|
7956
|
+
const Oo = ue ? "metaKey" : "ctrlKey";
|
|
7957
7957
|
ee.mousedown = (n, e) => {
|
|
7958
7958
|
let t = e;
|
|
7959
7959
|
n.input.shiftKey = t.shiftKey;
|
|
7960
|
-
let r =
|
|
7961
|
-
i - n.input.lastClick.time < 500 && Sc(t, n.input.lastClick) && !t[
|
|
7960
|
+
let r = Kr(n), i = Date.now(), s = "singleClick";
|
|
7961
|
+
i - n.input.lastClick.time < 500 && Sc(t, n.input.lastClick) && !t[Oo] && n.input.lastClick.button == t.button && (n.input.lastClick.type == "singleClick" ? s = "doubleClick" : n.input.lastClick.type == "doubleClick" && (s = "tripleClick")), n.input.lastClick = { time: i, x: t.clientX, y: t.clientY, type: s, button: t.button };
|
|
7962
7962
|
let o = n.posAtCoords(Bn(t));
|
|
7963
7963
|
o && (s == "singleClick" ? (n.input.mouseDown && n.input.mouseDown.done(), n.input.mouseDown = new vc(n, o, t, !!r)) : (s == "doubleClick" ? Tc : Oc)(n, o.pos, o.inside, t) ? t.preventDefault() : Le(n, "pointer"));
|
|
7964
7964
|
};
|
|
7965
7965
|
class vc {
|
|
7966
7966
|
constructor(e, t, r, i) {
|
|
7967
|
-
this.view = e, this.pos = t, this.event = r, this.flushed = i, this.delayedSelectionSync = !1, this.mightDrag = null, this.startDoc = e.state.doc, this.selectNode = !!r[
|
|
7967
|
+
this.view = e, this.pos = t, this.event = r, this.flushed = i, this.delayedSelectionSync = !1, this.mightDrag = null, this.startDoc = e.state.doc, this.selectNode = !!r[Oo], this.allowDefault = r.shiftKey;
|
|
7968
7968
|
let s, o;
|
|
7969
7969
|
if (t.inside > -1)
|
|
7970
7970
|
s = e.state.doc.nodeAt(t.inside), o = t.inside;
|
|
@@ -8009,13 +8009,13 @@ class vc {
|
|
|
8009
8009
|
}
|
|
8010
8010
|
}
|
|
8011
8011
|
ee.touchstart = (n) => {
|
|
8012
|
-
n.input.lastTouch = Date.now(),
|
|
8012
|
+
n.input.lastTouch = Date.now(), Kr(n), Le(n, "pointer");
|
|
8013
8013
|
};
|
|
8014
8014
|
ee.touchmove = (n) => {
|
|
8015
8015
|
n.input.lastTouch = Date.now(), Le(n, "pointer");
|
|
8016
8016
|
};
|
|
8017
|
-
ee.contextmenu = (n) =>
|
|
8018
|
-
function
|
|
8017
|
+
ee.contextmenu = (n) => Kr(n);
|
|
8018
|
+
function Eo(n, e) {
|
|
8019
8019
|
return n.composing ? !0 : X && Math.abs(e.timeStamp - n.input.compositionEndedAt) < 500 ? (n.input.compositionEndedAt = -2e8, !0) : !1;
|
|
8020
8020
|
}
|
|
8021
8021
|
const Nc = Ee ? 5e3 : -1;
|
|
@@ -8023,7 +8023,7 @@ te.compositionstart = te.compositionupdate = (n) => {
|
|
|
8023
8023
|
if (!n.composing) {
|
|
8024
8024
|
n.domObserver.flush();
|
|
8025
8025
|
let { state: e } = n, t = e.selection.$to;
|
|
8026
|
-
if (e.selection instanceof M && (e.storedMarks || !t.textOffset && t.parentOffset && t.nodeBefore.marks.some((r) => r.type.spec.inclusive === !1) || U &&
|
|
8026
|
+
if (e.selection instanceof M && (e.storedMarks || !t.textOffset && t.parentOffset && t.nodeBefore.marks.some((r) => r.type.spec.inclusive === !1) || U && ro && Ac(n)))
|
|
8027
8027
|
n.markCursor = n.state.storedMarks || t.marks(), bn(n, !0), n.markCursor = null;
|
|
8028
8028
|
else if (bn(n, !e.selection.empty), pe && e.selection.empty && t.parentOffset && !t.textOffset && t.nodeBefore.marks.length) {
|
|
8029
8029
|
let r = n.domSelectionRange();
|
|
@@ -8041,7 +8041,7 @@ te.compositionstart = te.compositionupdate = (n) => {
|
|
|
8041
8041
|
}
|
|
8042
8042
|
n.input.composing = !0;
|
|
8043
8043
|
}
|
|
8044
|
-
|
|
8044
|
+
vo(n, Nc);
|
|
8045
8045
|
};
|
|
8046
8046
|
function Ac(n) {
|
|
8047
8047
|
let { focusNode: e, focusOffset: t } = n.domSelectionRange();
|
|
@@ -8051,12 +8051,12 @@ function Ac(n) {
|
|
|
8051
8051
|
return r.nodeType == 1 && r.contentEditable == "false";
|
|
8052
8052
|
}
|
|
8053
8053
|
te.compositionend = (n, e) => {
|
|
8054
|
-
n.composing && (n.input.composing = !1, n.input.compositionEndedAt = e.timeStamp, n.input.compositionPendingChanges = n.domObserver.pendingRecords().length ? n.input.compositionID : 0, n.input.compositionNode = null, n.input.badSafariComposition ? n.domObserver.forceFlush() : n.input.compositionPendingChanges && Promise.resolve().then(() => n.domObserver.flush()), n.input.compositionID++,
|
|
8054
|
+
n.composing && (n.input.composing = !1, n.input.compositionEndedAt = e.timeStamp, n.input.compositionPendingChanges = n.domObserver.pendingRecords().length ? n.input.compositionID : 0, n.input.compositionNode = null, n.input.badSafariComposition ? n.domObserver.forceFlush() : n.input.compositionPendingChanges && Promise.resolve().then(() => n.domObserver.flush()), n.input.compositionID++, vo(n, 20));
|
|
8055
8055
|
};
|
|
8056
|
-
function
|
|
8056
|
+
function vo(n, e) {
|
|
8057
8057
|
clearTimeout(n.input.composingTimeout), e > -1 && (n.input.composingTimeout = setTimeout(() => bn(n), e));
|
|
8058
8058
|
}
|
|
8059
|
-
function
|
|
8059
|
+
function No(n) {
|
|
8060
8060
|
for (n.composing && (n.input.composing = !1, n.input.compositionEndedAt = Ic()); n.input.compositionNodes.length > 0; )
|
|
8061
8061
|
n.input.compositionNodes.pop().markParentsDirty();
|
|
8062
8062
|
}
|
|
@@ -8085,8 +8085,8 @@ function Ic() {
|
|
|
8085
8085
|
}
|
|
8086
8086
|
function bn(n, e = !1) {
|
|
8087
8087
|
if (!(Ee && n.domObserver.flushingSoon >= 0)) {
|
|
8088
|
-
if (n.domObserver.forceFlush(),
|
|
8089
|
-
let t =
|
|
8088
|
+
if (n.domObserver.forceFlush(), No(n), e || n.docView && n.docView.dirty) {
|
|
8089
|
+
let t = Vr(n), r = n.state.selection;
|
|
8090
8090
|
return t && !t.eq(r) ? n.dispatch(n.state.tr.setSelection(t)) : (n.markCursor || e) && !r.$from.node(r.$from.sharedDepth(r.to)).inlineContent ? n.dispatch(n.state.tr.deleteSelection()) : n.updateState(n.state), !0;
|
|
8091
8091
|
}
|
|
8092
8092
|
return !1;
|
|
@@ -8107,7 +8107,7 @@ ee.copy = te.cut = (n, e) => {
|
|
|
8107
8107
|
let t = e, r = n.state.selection, i = t.type == "cut";
|
|
8108
8108
|
if (r.empty)
|
|
8109
8109
|
return;
|
|
8110
|
-
let s = zt ? null : t.clipboardData, o = r.content(), { dom: l, text: a } =
|
|
8110
|
+
let s = zt ? null : t.clipboardData, o = r.content(), { dom: l, text: a } = Wr(n, o);
|
|
8111
8111
|
s ? (t.preventDefault(), s.clearData(), s.setData("text/html", l.innerHTML), s.setData("text/plain", a)) : Rc(n, l), i && n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent", "cut"));
|
|
8112
8112
|
};
|
|
8113
8113
|
function Pc(n) {
|
|
@@ -8124,7 +8124,7 @@ function Bc(n, e) {
|
|
|
8124
8124
|
}, 50);
|
|
8125
8125
|
}
|
|
8126
8126
|
function Ft(n, e, t, r, i) {
|
|
8127
|
-
let s =
|
|
8127
|
+
let s = xo(n, e, t, r, n.state.selection.$from);
|
|
8128
8128
|
if (n.someProp("handlePaste", (a) => a(n, i, s || k.empty)))
|
|
8129
8129
|
return !0;
|
|
8130
8130
|
if (!s)
|
|
@@ -8132,7 +8132,7 @@ function Ft(n, e, t, r, i) {
|
|
|
8132
8132
|
let o = Pc(s), l = o ? n.state.tr.replaceSelectionWith(o, r) : n.state.tr.replaceSelection(s);
|
|
8133
8133
|
return n.dispatch(l.scrollIntoView().setMeta("paste", !0).setMeta("uiEvent", "paste")), !0;
|
|
8134
8134
|
}
|
|
8135
|
-
function
|
|
8135
|
+
function Ao(n) {
|
|
8136
8136
|
let e = n.getData("text/plain") || n.getData("Text");
|
|
8137
8137
|
if (e)
|
|
8138
8138
|
return e;
|
|
@@ -8144,15 +8144,15 @@ te.paste = (n, e) => {
|
|
|
8144
8144
|
if (n.composing && !Ee)
|
|
8145
8145
|
return;
|
|
8146
8146
|
let r = zt ? null : t.clipboardData, i = n.input.shiftKey && n.input.lastKeyCode != 45;
|
|
8147
|
-
r && Ft(n,
|
|
8147
|
+
r && Ft(n, Ao(r), r.getData("text/html"), i, t) ? t.preventDefault() : Bc(n, t);
|
|
8148
8148
|
};
|
|
8149
|
-
class
|
|
8149
|
+
class Do {
|
|
8150
8150
|
constructor(e, t, r) {
|
|
8151
8151
|
this.slice = e, this.move = t, this.node = r;
|
|
8152
8152
|
}
|
|
8153
8153
|
}
|
|
8154
8154
|
const Lc = ue ? "altKey" : "ctrlKey";
|
|
8155
|
-
function
|
|
8155
|
+
function Io(n, e) {
|
|
8156
8156
|
let t;
|
|
8157
8157
|
return n.someProp("dragCopies", (r) => {
|
|
8158
8158
|
t = t || r(e);
|
|
@@ -8171,8 +8171,8 @@ ee.dragstart = (n, e) => {
|
|
|
8171
8171
|
u && u.node.type.spec.draggable && u != n.docView && (o = S.create(n.state.doc, u.posBefore));
|
|
8172
8172
|
}
|
|
8173
8173
|
}
|
|
8174
|
-
let l = (o || n.state.selection).content(), { dom: a, text: c, slice: d } =
|
|
8175
|
-
(!t.dataTransfer.files.length || !U ||
|
|
8174
|
+
let l = (o || n.state.selection).content(), { dom: a, text: c, slice: d } = Wr(n, l);
|
|
8175
|
+
(!t.dataTransfer.files.length || !U || no > 120) && t.dataTransfer.clearData(), t.dataTransfer.setData(zt ? "Text" : "text/html", a.innerHTML), t.dataTransfer.effectAllowed = "copyMove", zt || t.dataTransfer.setData("text/plain", c), n.dragging = new Do(d, Io(n, t), o);
|
|
8176
8176
|
};
|
|
8177
8177
|
ee.dragend = (n) => {
|
|
8178
8178
|
let e = n.dragging;
|
|
@@ -8197,8 +8197,8 @@ function zc(n, e, t) {
|
|
|
8197
8197
|
let i = n.state.doc.resolve(r.pos), s = t && t.slice;
|
|
8198
8198
|
s ? n.someProp("transformPasted", (h) => {
|
|
8199
8199
|
s = h(s, n, !1);
|
|
8200
|
-
}) : s =
|
|
8201
|
-
let o = !!(t &&
|
|
8200
|
+
}) : s = xo(n, Ao(e.dataTransfer), zt ? null : e.dataTransfer.getData("text/html"), !1, i);
|
|
8201
|
+
let o = !!(t && Io(n, e));
|
|
8202
8202
|
if (n.someProp("handleDrop", (h) => h(n, e, s || k.empty, o))) {
|
|
8203
8203
|
e.preventDefault();
|
|
8204
8204
|
return;
|
|
@@ -8206,7 +8206,7 @@ function zc(n, e, t) {
|
|
|
8206
8206
|
if (!s)
|
|
8207
8207
|
return;
|
|
8208
8208
|
e.preventDefault();
|
|
8209
|
-
let l = s ?
|
|
8209
|
+
let l = s ? _s(n.state.doc, i.pos, s) : i.pos;
|
|
8210
8210
|
l == null && (l = i.pos);
|
|
8211
8211
|
let a = n.state.tr;
|
|
8212
8212
|
if (o) {
|
|
@@ -8221,7 +8221,7 @@ function zc(n, e, t) {
|
|
|
8221
8221
|
a.setSelection(new S(f));
|
|
8222
8222
|
else {
|
|
8223
8223
|
let h = a.mapping.map(l);
|
|
8224
|
-
a.mapping.maps[a.mapping.maps.length - 1].forEach((p, m, g, y) => h = y), a.setSelection(
|
|
8224
|
+
a.mapping.maps[a.mapping.maps.length - 1].forEach((p, m, g, y) => h = y), a.setSelection(Hr(n, f, a.doc.resolve(h)));
|
|
8225
8225
|
}
|
|
8226
8226
|
n.focus(), n.dispatch(a.setMeta("uiEvent", "drop"));
|
|
8227
8227
|
}
|
|
@@ -8297,7 +8297,7 @@ class He {
|
|
|
8297
8297
|
destroy() {
|
|
8298
8298
|
}
|
|
8299
8299
|
}
|
|
8300
|
-
class
|
|
8300
|
+
class Jr {
|
|
8301
8301
|
constructor(e, t) {
|
|
8302
8302
|
this.attrs = e, this.spec = t || et;
|
|
8303
8303
|
}
|
|
@@ -8313,7 +8313,7 @@ class Kr {
|
|
|
8313
8313
|
return i == t.from && !(s = e.child(r)).isText && i + s.nodeSize == t.to;
|
|
8314
8314
|
}
|
|
8315
8315
|
eq(e) {
|
|
8316
|
-
return this == e || e instanceof
|
|
8316
|
+
return this == e || e instanceof Jr && $t(this.attrs, e.attrs) && $t(this.spec, e.spec);
|
|
8317
8317
|
}
|
|
8318
8318
|
destroy() {
|
|
8319
8319
|
}
|
|
@@ -8367,7 +8367,7 @@ class he {
|
|
|
8367
8367
|
node, will receive the given attributes.
|
|
8368
8368
|
*/
|
|
8369
8369
|
static node(e, t, r, i) {
|
|
8370
|
-
return new he(e, t, new
|
|
8370
|
+
return new he(e, t, new Jr(r, i));
|
|
8371
8371
|
}
|
|
8372
8372
|
/**
|
|
8373
8373
|
The spec provided when creating this decoration. Can be useful
|
|
@@ -8459,13 +8459,13 @@ class z {
|
|
|
8459
8459
|
let i, s = 0;
|
|
8460
8460
|
e.forEach((l, a) => {
|
|
8461
8461
|
let c = a + r, d;
|
|
8462
|
-
if (d =
|
|
8462
|
+
if (d = Po(t, l, c)) {
|
|
8463
8463
|
for (i || (i = this.children.slice()); s < i.length && i[s] < a; )
|
|
8464
8464
|
s += 3;
|
|
8465
8465
|
i[s] == a ? i[s + 2] = i[s + 2].addInner(l, d, c + 1) : i.splice(s, 0, a, a + l.nodeSize, xn(d, l, c + 1, et)), s += 3;
|
|
8466
8466
|
}
|
|
8467
8467
|
});
|
|
8468
|
-
let o =
|
|
8468
|
+
let o = Ro(s ? Bo(t) : t, -r);
|
|
8469
8469
|
for (let l = 0; l < o.length; l++)
|
|
8470
8470
|
o[l].type.valid(e, o[l]) || o.splice(l--, 1);
|
|
8471
8471
|
return new z(o.length ? this.local.concat(o).sort(tt) : this.local, i || this.children);
|
|
@@ -8542,7 +8542,7 @@ class z {
|
|
|
8542
8542
|
@internal
|
|
8543
8543
|
*/
|
|
8544
8544
|
locals(e) {
|
|
8545
|
-
return
|
|
8545
|
+
return Ur(this.localsInner(e));
|
|
8546
8546
|
}
|
|
8547
8547
|
/**
|
|
8548
8548
|
@internal
|
|
@@ -8562,7 +8562,7 @@ class z {
|
|
|
8562
8562
|
}
|
|
8563
8563
|
}
|
|
8564
8564
|
z.empty = new z([], []);
|
|
8565
|
-
z.removeOverlap =
|
|
8565
|
+
z.removeOverlap = Ur;
|
|
8566
8566
|
const Y = z.empty;
|
|
8567
8567
|
class Re {
|
|
8568
8568
|
constructor(e) {
|
|
@@ -8603,7 +8603,7 @@ class Re {
|
|
|
8603
8603
|
t.push(s[o]);
|
|
8604
8604
|
}
|
|
8605
8605
|
}
|
|
8606
|
-
return t ?
|
|
8606
|
+
return t ? Ur(r ? t : t.sort(tt)) : ht;
|
|
8607
8607
|
}
|
|
8608
8608
|
// Create a group for the given array of decoration sets, or return
|
|
8609
8609
|
// a single set when possible.
|
|
@@ -8671,7 +8671,7 @@ function Fc(n, e, t, r, i, s, o) {
|
|
|
8671
8671
|
}
|
|
8672
8672
|
return new z(e.sort(tt), l);
|
|
8673
8673
|
}
|
|
8674
|
-
function
|
|
8674
|
+
function Ro(n, e) {
|
|
8675
8675
|
if (!e || !n.length)
|
|
8676
8676
|
return n;
|
|
8677
8677
|
let t = [];
|
|
@@ -8694,7 +8694,7 @@ function $c(n, e, t, r, i, s, o) {
|
|
|
8694
8694
|
n[a + 1] == -1 && l(n[a + 2], e[a] + s + 1);
|
|
8695
8695
|
return t;
|
|
8696
8696
|
}
|
|
8697
|
-
function
|
|
8697
|
+
function Po(n, e, t) {
|
|
8698
8698
|
if (e.isLeaf)
|
|
8699
8699
|
return null;
|
|
8700
8700
|
let r = t + e.nodeSize, i = null;
|
|
@@ -8702,7 +8702,7 @@ function Ro(n, e, t) {
|
|
|
8702
8702
|
(o = n[s]) && o.from > t && o.to < r && ((i || (i = [])).push(o), n[s] = null);
|
|
8703
8703
|
return i;
|
|
8704
8704
|
}
|
|
8705
|
-
function
|
|
8705
|
+
function Bo(n) {
|
|
8706
8706
|
let e = [];
|
|
8707
8707
|
for (let t = 0; t < n.length; t++)
|
|
8708
8708
|
n[t] != null && e.push(n[t]);
|
|
@@ -8711,14 +8711,14 @@ function Po(n) {
|
|
|
8711
8711
|
function xn(n, e, t, r) {
|
|
8712
8712
|
let i = [], s = !1;
|
|
8713
8713
|
e.forEach((l, a) => {
|
|
8714
|
-
let c =
|
|
8714
|
+
let c = Po(n, l, a + t);
|
|
8715
8715
|
if (c) {
|
|
8716
8716
|
s = !0;
|
|
8717
8717
|
let d = xn(c, l, t + a + 1, r);
|
|
8718
8718
|
d != Y && i.push(a, a + l.nodeSize, d);
|
|
8719
8719
|
}
|
|
8720
8720
|
});
|
|
8721
|
-
let o =
|
|
8721
|
+
let o = Ro(s ? Bo(n) : n, -t).sort(tt);
|
|
8722
8722
|
for (let l = 0; l < o.length; l++)
|
|
8723
8723
|
o[l].type.valid(e, o[l]) || (r.onRemove && r.onRemove(o[l].spec), o.splice(l--, 1));
|
|
8724
8724
|
return o.length || i.length ? new z(o, i) : Y;
|
|
@@ -8726,7 +8726,7 @@ function xn(n, e, t, r) {
|
|
|
8726
8726
|
function tt(n, e) {
|
|
8727
8727
|
return n.from - e.from || n.to - e.to;
|
|
8728
8728
|
}
|
|
8729
|
-
function
|
|
8729
|
+
function Ur(n) {
|
|
8730
8730
|
let e = n;
|
|
8731
8731
|
for (let t = 0; t < e.length - 1; t++) {
|
|
8732
8732
|
let r = e[t];
|
|
@@ -8734,17 +8734,17 @@ function Jr(n) {
|
|
|
8734
8734
|
for (let i = t + 1; i < e.length; i++) {
|
|
8735
8735
|
let s = e[i];
|
|
8736
8736
|
if (s.from == r.from) {
|
|
8737
|
-
s.to != r.to && (e == n && (e = n.slice()), e[i] = s.copy(s.from, r.to),
|
|
8737
|
+
s.to != r.to && (e == n && (e = n.slice()), e[i] = s.copy(s.from, r.to), Ui(e, i + 1, s.copy(r.to, s.to)));
|
|
8738
8738
|
continue;
|
|
8739
8739
|
} else {
|
|
8740
|
-
s.from < r.to && (e == n && (e = n.slice()), e[t] = r.copy(r.from, s.from),
|
|
8740
|
+
s.from < r.to && (e == n && (e = n.slice()), e[t] = r.copy(r.from, s.from), Ui(e, i, r.copy(s.from, r.to)));
|
|
8741
8741
|
break;
|
|
8742
8742
|
}
|
|
8743
8743
|
}
|
|
8744
8744
|
}
|
|
8745
8745
|
return e;
|
|
8746
8746
|
}
|
|
8747
|
-
function
|
|
8747
|
+
function Ui(n, e, t) {
|
|
8748
8748
|
for (; e < n.length && tt(t, n[e]) > 0; )
|
|
8749
8749
|
e++;
|
|
8750
8750
|
n.splice(e, 0, t);
|
|
@@ -8821,7 +8821,7 @@ class qc {
|
|
|
8821
8821
|
this.suppressingSelectionUpdates = !0, setTimeout(() => this.suppressingSelectionUpdates = !1, 50);
|
|
8822
8822
|
}
|
|
8823
8823
|
onSelectionChange() {
|
|
8824
|
-
if (
|
|
8824
|
+
if ($i(this.view)) {
|
|
8825
8825
|
if (this.suppressingSelectionUpdates)
|
|
8826
8826
|
return Ne(this.view);
|
|
8827
8827
|
if (ie && $e <= 11 && !this.view.state.selection.empty) {
|
|
@@ -8865,7 +8865,7 @@ class qc {
|
|
|
8865
8865
|
return;
|
|
8866
8866
|
let t = this.pendingRecords();
|
|
8867
8867
|
t.length && (this.queue = []);
|
|
8868
|
-
let r = e.domSelectionRange(), i = !this.suppressingSelectionUpdates && !this.currentSelection.eq(r) &&
|
|
8868
|
+
let r = e.domSelectionRange(), i = !this.suppressingSelectionUpdates && !this.currentSelection.eq(r) && $i(e) && !this.ignoreSelectionChange(r), s = -1, o = -1, l = !1, a = [];
|
|
8869
8869
|
if (e.editable)
|
|
8870
8870
|
for (let d = 0; d < t.length; d++) {
|
|
8871
8871
|
let u = this.registerMutation(t[d], a);
|
|
@@ -8897,7 +8897,7 @@ class qc {
|
|
|
8897
8897
|
}
|
|
8898
8898
|
}
|
|
8899
8899
|
let c = null;
|
|
8900
|
-
s < 0 && i && e.input.lastFocus > Date.now() - 200 && Math.max(e.input.lastTouch, e.input.lastClick.time) < Date.now() - 300 && Rn(r) && (c =
|
|
8900
|
+
s < 0 && i && e.input.lastFocus > Date.now() - 200 && Math.max(e.input.lastTouch, e.input.lastClick.time) < Date.now() - 300 && Rn(r) && (c = Vr(e)) && c.eq(E.near(e.state.doc.resolve(0), 1)) ? (e.input.lastFocus = 0, Ne(e), this.currentSelection.set(r), e.scrollToSelection()) : (s > -1 || i) && (s > -1 && (e.docView.markDirty(s, o), jc(e)), e.input.badSafariComposition && (e.input.badSafariComposition = !1, Uc(e, a)), this.handleDOMChange(s, o, l, a), e.docView && e.docView.dirty ? e.updateState(e.state) : this.currentSelection.eq(r) || Ne(e), this.currentSelection.set(r));
|
|
8901
8901
|
}
|
|
8902
8902
|
registerMutation(e, t) {
|
|
8903
8903
|
if (t.indexOf(e.target) > -1)
|
|
@@ -8932,15 +8932,15 @@ class qc {
|
|
|
8932
8932
|
});
|
|
8933
8933
|
}
|
|
8934
8934
|
}
|
|
8935
|
-
let
|
|
8935
|
+
let _i = /* @__PURE__ */ new WeakMap(), Gi = !1;
|
|
8936
8936
|
function jc(n) {
|
|
8937
|
-
if (!
|
|
8938
|
-
if (n.requiresGeckoHackNode = pe,
|
|
8937
|
+
if (!_i.has(n) && (_i.set(n, null), ["normal", "nowrap", "pre-line"].indexOf(getComputedStyle(n.dom).whiteSpace) !== -1)) {
|
|
8938
|
+
if (n.requiresGeckoHackNode = pe, Gi)
|
|
8939
8939
|
return;
|
|
8940
|
-
console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),
|
|
8940
|
+
console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."), Gi = !0;
|
|
8941
8941
|
}
|
|
8942
8942
|
}
|
|
8943
|
-
function
|
|
8943
|
+
function Yi(n, e) {
|
|
8944
8944
|
let t = e.startContainer, r = e.startOffset, i = e.endContainer, s = e.endOffset, o = n.domAtPos(n.state.selection.anchor);
|
|
8945
8945
|
return st(o.node, o.offset, i, s) && ([t, r, i, s] = [i, s, t, r]), { anchorNode: t, anchorOffset: r, focusNode: i, focusOffset: s };
|
|
8946
8946
|
}
|
|
@@ -8948,13 +8948,13 @@ function Kc(n, e) {
|
|
|
8948
8948
|
if (e.getComposedRanges) {
|
|
8949
8949
|
let i = e.getComposedRanges(n.root)[0];
|
|
8950
8950
|
if (i)
|
|
8951
|
-
return
|
|
8951
|
+
return Yi(n, i);
|
|
8952
8952
|
}
|
|
8953
8953
|
let t;
|
|
8954
8954
|
function r(i) {
|
|
8955
8955
|
i.preventDefault(), i.stopImmediatePropagation(), t = i.getTargetRanges()[0];
|
|
8956
8956
|
}
|
|
8957
|
-
return n.dom.addEventListener("beforeinput", r, !0), document.execCommand("indent"), n.dom.removeEventListener("beforeinput", r, !0), t ?
|
|
8957
|
+
return n.dom.addEventListener("beforeinput", r, !0), document.execCommand("indent"), n.dom.removeEventListener("beforeinput", r, !0), t ? Yi(n, t) : null;
|
|
8958
8958
|
}
|
|
8959
8959
|
function Jc(n, e) {
|
|
8960
8960
|
for (let t = e.parentNode; t && t != n.dom; t = t.parentNode) {
|
|
@@ -9032,7 +9032,7 @@ const Yc = /^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|df
|
|
|
9032
9032
|
function Xc(n, e, t, r, i) {
|
|
9033
9033
|
let s = n.input.compositionPendingChanges || (n.composing ? n.input.compositionID : 0);
|
|
9034
9034
|
if (n.input.compositionPendingChanges = 0, e < 0) {
|
|
9035
|
-
let C = n.input.lastSelectionTime > Date.now() - 50 ? n.input.lastSelectionOrigin : null, N =
|
|
9035
|
+
let C = n.input.lastSelectionTime > Date.now() - 50 ? n.input.lastSelectionOrigin : null, N = Vr(n, C);
|
|
9036
9036
|
if (N && !n.state.selection.eq(N)) {
|
|
9037
9037
|
if (U && Ee && n.input.lastKeyCode === 13 && Date.now() - 100 < n.input.lastKeyCodeTime && n.someProp("handleKeyDown", (yl) => yl(n, Je(13, "Enter"))))
|
|
9038
9038
|
return;
|
|
@@ -9055,7 +9055,7 @@ function Xc(n, e, t, r, i) {
|
|
|
9055
9055
|
p = { start: a.from, endA: a.to, endB: a.to };
|
|
9056
9056
|
else {
|
|
9057
9057
|
if (c.sel) {
|
|
9058
|
-
let C =
|
|
9058
|
+
let C = Xi(n, n.state.doc, c.sel);
|
|
9059
9059
|
if (C && !C.eq(n.state.selection)) {
|
|
9060
9060
|
let N = n.state.tr.setSelection(C);
|
|
9061
9061
|
s && N.setMeta("composition", s), n.dispatch(N);
|
|
@@ -9081,7 +9081,7 @@ function Xc(n, e, t, r, i) {
|
|
|
9081
9081
|
let w = p.start, I = p.endA, D = (C) => {
|
|
9082
9082
|
let N = C || n.state.tr.replace(w, I, c.doc.slice(p.start - c.from, p.endB - c.from));
|
|
9083
9083
|
if (c.sel) {
|
|
9084
|
-
let G =
|
|
9084
|
+
let G = Xi(n, N.doc, c.sel);
|
|
9085
9085
|
G && !(U && n.composing && G.empty && (p.start != p.endB || n.input.lastChromeDelete < Date.now() - 100) && (G.head == w || G.head == N.mapping.map(I) - 1) || ie && G.empty && G.head == w) && N.setSelection(G);
|
|
9086
9086
|
}
|
|
9087
9087
|
return s && N.setMeta("composition", s), N.scrollIntoView();
|
|
@@ -9105,8 +9105,8 @@ function Xc(n, e, t, r, i) {
|
|
|
9105
9105
|
else
|
|
9106
9106
|
n.dispatch(D());
|
|
9107
9107
|
}
|
|
9108
|
-
function
|
|
9109
|
-
return Math.max(t.anchor, t.head) > e.content.size ? null :
|
|
9108
|
+
function Xi(n, e, t) {
|
|
9109
|
+
return Math.max(t.anchor, t.head) > e.content.size ? null : Hr(n, e.resolve(t.anchor), e.resolve(t.head));
|
|
9110
9110
|
}
|
|
9111
9111
|
function Zc(n, e) {
|
|
9112
9112
|
let t = n.firstChild.marks, r = e.firstChild.marks, i = t, s = r, o, l, a;
|
|
@@ -9165,20 +9165,20 @@ function ed(n, e, t, r, i) {
|
|
|
9165
9165
|
}
|
|
9166
9166
|
if (o < s && n.size < e.size) {
|
|
9167
9167
|
let a = r <= s && r >= o ? s - r : 0;
|
|
9168
|
-
s -= a, s && s < e.size &&
|
|
9168
|
+
s -= a, s && s < e.size && Zi(e.textBetween(s - 1, s + 1)) && (s += a ? 1 : -1), l = s + (l - o), o = s;
|
|
9169
9169
|
} else if (l < s) {
|
|
9170
9170
|
let a = r <= s && r >= l ? s - r : 0;
|
|
9171
|
-
s -= a, s && s < n.size &&
|
|
9171
|
+
s -= a, s && s < n.size && Zi(n.textBetween(s - 1, s + 1)) && (s += a ? 1 : -1), o = s + (o - l), l = s;
|
|
9172
9172
|
}
|
|
9173
9173
|
return { start: s, endA: o, endB: l };
|
|
9174
9174
|
}
|
|
9175
|
-
function
|
|
9175
|
+
function Zi(n) {
|
|
9176
9176
|
if (n.length != 2)
|
|
9177
9177
|
return !1;
|
|
9178
9178
|
let e = n.charCodeAt(0), t = n.charCodeAt(1);
|
|
9179
9179
|
return e >= 56320 && e <= 57343 && t >= 55296 && t <= 56319;
|
|
9180
9180
|
}
|
|
9181
|
-
class
|
|
9181
|
+
class Lo {
|
|
9182
9182
|
/**
|
|
9183
9183
|
Create a view. `place` may be a DOM node that the editor should
|
|
9184
9184
|
be appended to, a function that will place it into the document,
|
|
@@ -9187,7 +9187,7 @@ class Bo {
|
|
|
9187
9187
|
added to the document.
|
|
9188
9188
|
*/
|
|
9189
9189
|
constructor(e, t) {
|
|
9190
|
-
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 gc(), this.prevDirectPlugins = [], this.pluginViews = [], this.requiresGeckoHackNode = !1, this.dragging = null, this._props = t, this.state = t.state, this.directPlugins = t.plugins || [], this.directPlugins.forEach(
|
|
9190
|
+
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 gc(), this.prevDirectPlugins = [], this.pluginViews = [], this.requiresGeckoHackNode = !1, this.dragging = null, this._props = t, this.state = t.state, this.directPlugins = t.plugins || [], this.directPlugins.forEach(rs), 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 = ts(this), es(this), this.nodeViews = ns(this), this.docView = Ri(this.state.doc, Qi(this), er(this), this.dom, this), this.domObserver = new qc(this, (r, i, s, o) => Xc(this, r, i, s, o)), this.domObserver.start(), yc(this), this.updatePluginViews();
|
|
9191
9191
|
}
|
|
9192
9192
|
/**
|
|
9193
9193
|
Holds `true` when a
|
|
@@ -9215,9 +9215,9 @@ class Bo {
|
|
|
9215
9215
|
the DOM.
|
|
9216
9216
|
*/
|
|
9217
9217
|
update(e) {
|
|
9218
|
-
e.handleDOMEvents != this._props.handleDOMEvents &&
|
|
9218
|
+
e.handleDOMEvents != this._props.handleDOMEvents && Er(this);
|
|
9219
9219
|
let t = this._props;
|
|
9220
|
-
this._props = e, e.plugins && (e.plugins.forEach(
|
|
9220
|
+
this._props = e, e.plugins && (e.plugins.forEach(rs), this.directPlugins = e.plugins), this.updateStateInner(e.state, t);
|
|
9221
9221
|
}
|
|
9222
9222
|
/**
|
|
9223
9223
|
Update the view by updating existing props object with the object
|
|
@@ -9243,14 +9243,14 @@ class Bo {
|
|
|
9243
9243
|
updateStateInner(e, t) {
|
|
9244
9244
|
var r;
|
|
9245
9245
|
let i = this.state, s = !1, o = !1;
|
|
9246
|
-
e.storedMarks && this.composing && (
|
|
9246
|
+
e.storedMarks && this.composing && (No(this), o = !0), this.state = e;
|
|
9247
9247
|
let l = i.plugins != e.plugins || this._props.plugins != t.plugins;
|
|
9248
9248
|
if (l || this._props.plugins != t.plugins || this._props.nodeViews != t.nodeViews) {
|
|
9249
|
-
let h =
|
|
9249
|
+
let h = ns(this);
|
|
9250
9250
|
nd(h, this.nodeViews) && (this.nodeViews = h, s = !0);
|
|
9251
9251
|
}
|
|
9252
|
-
(l || t.handleDOMEvents != this._props.handleDOMEvents) &&
|
|
9253
|
-
let a = er(this), c =
|
|
9252
|
+
(l || t.handleDOMEvents != this._props.handleDOMEvents) && Er(this), this.editable = ts(this), es(this);
|
|
9253
|
+
let a = er(this), c = Qi(this), d = i.plugins != e.plugins && !i.doc.eq(e.doc) ? "reset" : e.scrollToSelection > i.scrollToSelection ? "to selection" : "preserve", u = s || !this.docView.matchesNode(e.doc, c, a);
|
|
9254
9254
|
(u || !e.selection.eq(i.selection)) && (o = !0);
|
|
9255
9255
|
let f = d == "preserve" && o && this.dom.style.overflowAnchor == null && Da(this);
|
|
9256
9256
|
if (o) {
|
|
@@ -9258,9 +9258,9 @@ class Bo {
|
|
|
9258
9258
|
let h = u && (ie || U) && !this.composing && !i.selection.empty && !e.selection.empty && td(i.selection, e.selection);
|
|
9259
9259
|
if (u) {
|
|
9260
9260
|
let p = U ? this.trackWrites = this.domSelectionRange().focusNode : null;
|
|
9261
|
-
this.composing && (this.input.compositionNode = Dc(this)), (s || !this.docView.update(e.doc, c, a, this)) && (this.docView.updateOuterDeco(c), this.docView.destroy(), this.docView =
|
|
9261
|
+
this.composing && (this.input.compositionNode = Dc(this)), (s || !this.docView.update(e.doc, c, a, this)) && (this.docView.updateOuterDeco(c), this.docView.destroy(), this.docView = Ri(e.doc, c, a, this.dom, this)), p && (!this.trackWrites || !this.dom.contains(this.trackWrites)) && (h = !0);
|
|
9262
9262
|
}
|
|
9263
|
-
h || !(this.input.mouseDown && this.domObserver.currentSelection.eq(this.domSelectionRange()) && tc(this)) ? Ne(this, h) : (
|
|
9263
|
+
h || !(this.input.mouseDown && this.domObserver.currentSelection.eq(this.domSelectionRange()) && tc(this)) ? Ne(this, h) : (yo(this, e.selection), this.domObserver.setCurSelection()), this.domObserver.start();
|
|
9264
9264
|
}
|
|
9265
9265
|
this.updatePluginViews(i), !((r = this.dragging) === null || r === void 0) && r.node && !i.doc.eq(e.doc) && this.updateDraggedNode(this.dragging, i), d == "reset" ? this.dom.scrollTop = 0 : d == "to selection" ? this.scrollToSelection() : f && Ia(f);
|
|
9266
9266
|
}
|
|
@@ -9272,9 +9272,9 @@ class Bo {
|
|
|
9272
9272
|
if (!(!e || !this.dom.contains(e.nodeType == 1 ? e : e.parentNode))) {
|
|
9273
9273
|
if (!this.someProp("handleScrollToSelection", (t) => t(this))) if (this.state.selection instanceof S) {
|
|
9274
9274
|
let t = this.docView.domAfterPos(this.state.selection.from);
|
|
9275
|
-
t.nodeType == 1 &&
|
|
9275
|
+
t.nodeType == 1 && Ei(this, t.getBoundingClientRect(), e);
|
|
9276
9276
|
} else
|
|
9277
|
-
|
|
9277
|
+
Ei(this, this.coordsAtPos(this.state.selection.head, 1), e);
|
|
9278
9278
|
}
|
|
9279
9279
|
}
|
|
9280
9280
|
destroyPluginViews() {
|
|
@@ -9307,7 +9307,7 @@ class Bo {
|
|
|
9307
9307
|
let s = r.from + (this.state.doc.content.size - t.doc.content.size);
|
|
9308
9308
|
(s > 0 && s < this.state.doc.content.size && this.state.doc.nodeAt(s)) == r.node && (i = s);
|
|
9309
9309
|
}
|
|
9310
|
-
this.dragging = new
|
|
9310
|
+
this.dragging = new Do(e.slice, e.move, i < 0 ? void 0 : S.create(this.state.doc, i));
|
|
9311
9311
|
}
|
|
9312
9312
|
someProp(e, t) {
|
|
9313
9313
|
let r = this._props && this._props[e], i;
|
|
@@ -9394,7 +9394,7 @@ class Bo {
|
|
|
9394
9394
|
otherwise the element after.
|
|
9395
9395
|
*/
|
|
9396
9396
|
coordsAtPos(e, t = 1) {
|
|
9397
|
-
return
|
|
9397
|
+
return ao(this, e, t);
|
|
9398
9398
|
}
|
|
9399
9399
|
/**
|
|
9400
9400
|
Find the DOM position that corresponds to the given document
|
|
@@ -9473,7 +9473,7 @@ class Bo {
|
|
|
9473
9473
|
[`transformCopied`](https://prosemirror.net/docs/ref/#view.EditorProps.transformCopied)).
|
|
9474
9474
|
*/
|
|
9475
9475
|
serializeForClipboard(e) {
|
|
9476
|
-
return
|
|
9476
|
+
return Wr(this, e);
|
|
9477
9477
|
}
|
|
9478
9478
|
/**
|
|
9479
9479
|
Removes the editor from the DOM and destroys all [node
|
|
@@ -9510,11 +9510,11 @@ class Bo {
|
|
|
9510
9510
|
return this.root.getSelection();
|
|
9511
9511
|
}
|
|
9512
9512
|
}
|
|
9513
|
-
|
|
9513
|
+
Lo.prototype.dispatch = function(n) {
|
|
9514
9514
|
let e = this._props.dispatchTransaction;
|
|
9515
9515
|
e ? e.call(this, n) : this.updateState(this.state.apply(n));
|
|
9516
9516
|
};
|
|
9517
|
-
function
|
|
9517
|
+
function Qi(n) {
|
|
9518
9518
|
let e = /* @__PURE__ */ Object.create(null);
|
|
9519
9519
|
return e.class = "ProseMirror", e.contenteditable = String(n.editable), n.someProp("attributes", (t) => {
|
|
9520
9520
|
if (typeof t == "function" && (t = t(n.state)), t)
|
|
@@ -9522,21 +9522,21 @@ function Zi(n) {
|
|
|
9522
9522
|
r == "class" ? e.class += " " + t[r] : r == "style" ? e.style = (e.style ? e.style + ";" : "") + t[r] : !e[r] && r != "contenteditable" && r != "nodeName" && (e[r] = String(t[r]));
|
|
9523
9523
|
}), e.translate || (e.translate = "no"), [he.node(0, n.state.doc.content.size, e)];
|
|
9524
9524
|
}
|
|
9525
|
-
function
|
|
9525
|
+
function es(n) {
|
|
9526
9526
|
if (n.markCursor) {
|
|
9527
9527
|
let e = document.createElement("img");
|
|
9528
9528
|
e.className = "ProseMirror-separator", e.setAttribute("mark-placeholder", "true"), e.setAttribute("alt", ""), n.cursorWrapper = { dom: e, deco: he.widget(n.state.selection.from, e, { raw: !0, marks: n.markCursor }) };
|
|
9529
9529
|
} else
|
|
9530
9530
|
n.cursorWrapper = null;
|
|
9531
9531
|
}
|
|
9532
|
-
function
|
|
9532
|
+
function ts(n) {
|
|
9533
9533
|
return !n.someProp("editable", (e) => e(n.state) === !1);
|
|
9534
9534
|
}
|
|
9535
9535
|
function td(n, e) {
|
|
9536
9536
|
let t = Math.min(n.$anchor.sharedDepth(n.head), e.$anchor.sharedDepth(e.head));
|
|
9537
9537
|
return n.$anchor.start(t) != e.$anchor.start(t);
|
|
9538
9538
|
}
|
|
9539
|
-
function
|
|
9539
|
+
function ns(n) {
|
|
9540
9540
|
let e = /* @__PURE__ */ Object.create(null);
|
|
9541
9541
|
function t(r) {
|
|
9542
9542
|
for (let i in r)
|
|
@@ -9555,7 +9555,7 @@ function nd(n, e) {
|
|
|
9555
9555
|
r++;
|
|
9556
9556
|
return t != r;
|
|
9557
9557
|
}
|
|
9558
|
-
function
|
|
9558
|
+
function rs(n) {
|
|
9559
9559
|
if (n.spec.state || n.spec.filterTransaction || n.spec.appendTransaction)
|
|
9560
9560
|
throw new RangeError("Plugins passed directly to the view must not have a state component");
|
|
9561
9561
|
}
|
|
@@ -9679,9 +9679,9 @@ function rr(n, e, t = !0) {
|
|
|
9679
9679
|
return e.altKey && (n = "Alt-" + n), e.ctrlKey && (n = "Ctrl-" + n), e.metaKey && (n = "Meta-" + n), t && e.shiftKey && (n = "Shift-" + n), n;
|
|
9680
9680
|
}
|
|
9681
9681
|
function dd(n) {
|
|
9682
|
-
return new se({ props: { handleKeyDown:
|
|
9682
|
+
return new se({ props: { handleKeyDown: zo(n) } });
|
|
9683
9683
|
}
|
|
9684
|
-
function
|
|
9684
|
+
function zo(n) {
|
|
9685
9685
|
let e = cd(n);
|
|
9686
9686
|
return function(t, r) {
|
|
9687
9687
|
let i = sd(r), s, o = e[rr(i, r)];
|
|
@@ -9703,22 +9703,22 @@ function Lo(n) {
|
|
|
9703
9703
|
return !1;
|
|
9704
9704
|
};
|
|
9705
9705
|
}
|
|
9706
|
-
const
|
|
9707
|
-
function
|
|
9706
|
+
const _r = (n, e) => n.selection.empty ? !1 : (e && e(n.tr.deleteSelection().scrollIntoView()), !0);
|
|
9707
|
+
function Fo(n, e) {
|
|
9708
9708
|
let { $cursor: t } = n.selection;
|
|
9709
9709
|
return !t || (e ? !e.endOfTextblock("backward", n) : t.parentOffset > 0) ? null : t;
|
|
9710
9710
|
}
|
|
9711
|
-
const
|
|
9712
|
-
let r =
|
|
9711
|
+
const $o = (n, e, t) => {
|
|
9712
|
+
let r = Fo(n, t);
|
|
9713
9713
|
if (!r)
|
|
9714
9714
|
return !1;
|
|
9715
|
-
let i =
|
|
9715
|
+
let i = Gr(r);
|
|
9716
9716
|
if (!i) {
|
|
9717
9717
|
let o = r.blockRange(), l = o && Mt(o);
|
|
9718
9718
|
return l == null ? !1 : (e && e(n.tr.lift(o, l).scrollIntoView()), !0);
|
|
9719
9719
|
}
|
|
9720
9720
|
let s = i.nodeBefore;
|
|
9721
|
-
if (
|
|
9721
|
+
if (_o(n, i, e, -1))
|
|
9722
9722
|
return !0;
|
|
9723
9723
|
if (r.parent.content.size == 0 && (St(s, "end") || S.isSelectable(s)))
|
|
9724
9724
|
for (let o = r.depth; ; o--) {
|
|
@@ -9735,19 +9735,19 @@ const Fo = (n, e, t) => {
|
|
|
9735
9735
|
}
|
|
9736
9736
|
return s.isAtom && i.depth == r.depth - 1 ? (e && e(n.tr.delete(i.pos - s.nodeSize, i.pos).scrollIntoView()), !0) : !1;
|
|
9737
9737
|
}, ud = (n, e, t) => {
|
|
9738
|
-
let r =
|
|
9738
|
+
let r = Fo(n, t);
|
|
9739
9739
|
if (!r)
|
|
9740
9740
|
return !1;
|
|
9741
|
-
let i =
|
|
9742
|
-
return i ?
|
|
9741
|
+
let i = Gr(r);
|
|
9742
|
+
return i ? Vo(n, i, e) : !1;
|
|
9743
9743
|
}, fd = (n, e, t) => {
|
|
9744
|
-
let r =
|
|
9744
|
+
let r = Wo(n, t);
|
|
9745
9745
|
if (!r)
|
|
9746
9746
|
return !1;
|
|
9747
|
-
let i =
|
|
9748
|
-
return i ?
|
|
9747
|
+
let i = Yr(r);
|
|
9748
|
+
return i ? Vo(n, i, e) : !1;
|
|
9749
9749
|
};
|
|
9750
|
-
function
|
|
9750
|
+
function Vo(n, e, t) {
|
|
9751
9751
|
let r = e.nodeBefore, i = r, s = e.pos - 1;
|
|
9752
9752
|
for (; !i.isTextblock; s--) {
|
|
9753
9753
|
if (i.type.spec.isolating)
|
|
@@ -9784,19 +9784,19 @@ function St(n, e, t = !1) {
|
|
|
9784
9784
|
}
|
|
9785
9785
|
return !1;
|
|
9786
9786
|
}
|
|
9787
|
-
const
|
|
9787
|
+
const Ho = (n, e, t) => {
|
|
9788
9788
|
let { $head: r, empty: i } = n.selection, s = r;
|
|
9789
9789
|
if (!i)
|
|
9790
9790
|
return !1;
|
|
9791
9791
|
if (r.parent.isTextblock) {
|
|
9792
9792
|
if (t ? !t.endOfTextblock("backward", n) : r.parentOffset > 0)
|
|
9793
9793
|
return !1;
|
|
9794
|
-
s =
|
|
9794
|
+
s = Gr(r);
|
|
9795
9795
|
}
|
|
9796
9796
|
let o = s && s.nodeBefore;
|
|
9797
9797
|
return !o || !S.isSelectable(o) ? !1 : (e && e(n.tr.setSelection(S.create(n.doc, s.pos - o.nodeSize)).scrollIntoView()), !0);
|
|
9798
9798
|
};
|
|
9799
|
-
function
|
|
9799
|
+
function Gr(n) {
|
|
9800
9800
|
if (!n.parent.type.spec.isolating)
|
|
9801
9801
|
for (let e = n.depth - 1; e >= 0; e--) {
|
|
9802
9802
|
if (n.index(e) > 0)
|
|
@@ -9806,19 +9806,19 @@ function _r(n) {
|
|
|
9806
9806
|
}
|
|
9807
9807
|
return null;
|
|
9808
9808
|
}
|
|
9809
|
-
function
|
|
9809
|
+
function Wo(n, e) {
|
|
9810
9810
|
let { $cursor: t } = n.selection;
|
|
9811
9811
|
return !t || (e ? !e.endOfTextblock("forward", n) : t.parentOffset < t.parent.content.size) ? null : t;
|
|
9812
9812
|
}
|
|
9813
|
-
const
|
|
9814
|
-
let r =
|
|
9813
|
+
const qo = (n, e, t) => {
|
|
9814
|
+
let r = Wo(n, t);
|
|
9815
9815
|
if (!r)
|
|
9816
9816
|
return !1;
|
|
9817
|
-
let i =
|
|
9817
|
+
let i = Yr(r);
|
|
9818
9818
|
if (!i)
|
|
9819
9819
|
return !1;
|
|
9820
9820
|
let s = i.nodeAfter;
|
|
9821
|
-
if (
|
|
9821
|
+
if (_o(n, i, e, 1))
|
|
9822
9822
|
return !0;
|
|
9823
9823
|
if (r.parent.content.size == 0 && (St(s, "start") || S.isSelectable(s))) {
|
|
9824
9824
|
let o = Dn(n.doc, r.before(), r.after(), k.empty);
|
|
@@ -9831,19 +9831,19 @@ const Wo = (n, e, t) => {
|
|
|
9831
9831
|
}
|
|
9832
9832
|
}
|
|
9833
9833
|
return s.isAtom && i.depth == r.depth - 1 ? (e && e(n.tr.delete(i.pos, i.pos + s.nodeSize).scrollIntoView()), !0) : !1;
|
|
9834
|
-
},
|
|
9834
|
+
}, jo = (n, e, t) => {
|
|
9835
9835
|
let { $head: r, empty: i } = n.selection, s = r;
|
|
9836
9836
|
if (!i)
|
|
9837
9837
|
return !1;
|
|
9838
9838
|
if (r.parent.isTextblock) {
|
|
9839
9839
|
if (t ? !t.endOfTextblock("forward", n) : r.parentOffset < r.parent.content.size)
|
|
9840
9840
|
return !1;
|
|
9841
|
-
s =
|
|
9841
|
+
s = Yr(r);
|
|
9842
9842
|
}
|
|
9843
9843
|
let o = s && s.nodeAfter;
|
|
9844
9844
|
return !o || !S.isSelectable(o) ? !1 : (e && e(n.tr.setSelection(S.create(n.doc, s.pos)).scrollIntoView()), !0);
|
|
9845
9845
|
};
|
|
9846
|
-
function
|
|
9846
|
+
function Yr(n) {
|
|
9847
9847
|
if (!n.parent.type.spec.isolating)
|
|
9848
9848
|
for (let e = n.depth - 1; e >= 0; e--) {
|
|
9849
9849
|
let t = n.node(e);
|
|
@@ -9879,12 +9879,12 @@ const hd = (n, e) => {
|
|
|
9879
9879
|
}, md = (n, e) => {
|
|
9880
9880
|
let { $from: t, $to: r } = n.selection, i = t.blockRange(r), s = i && Mt(i);
|
|
9881
9881
|
return s == null ? !1 : (e && e(n.tr.lift(i, s).scrollIntoView()), !0);
|
|
9882
|
-
},
|
|
9882
|
+
}, Ko = (n, e) => {
|
|
9883
9883
|
let { $head: t, $anchor: r } = n.selection;
|
|
9884
9884
|
return !t.parent.type.spec.code || !t.sameParent(r) ? !1 : (e && e(n.tr.insertText(`
|
|
9885
9885
|
`).scrollIntoView()), !0);
|
|
9886
9886
|
};
|
|
9887
|
-
function
|
|
9887
|
+
function Xr(n) {
|
|
9888
9888
|
for (let e = 0; e < n.edgeCount; e++) {
|
|
9889
9889
|
let { type: t } = n.edge(e);
|
|
9890
9890
|
if (t.isTextblock && !t.hasRequiredAttrs())
|
|
@@ -9896,7 +9896,7 @@ const gd = (n, e) => {
|
|
|
9896
9896
|
let { $head: t, $anchor: r } = n.selection;
|
|
9897
9897
|
if (!t.parent.type.spec.code || !t.sameParent(r))
|
|
9898
9898
|
return !1;
|
|
9899
|
-
let i = t.node(-1), s = t.indexAfter(-1), o =
|
|
9899
|
+
let i = t.node(-1), s = t.indexAfter(-1), o = Xr(i.contentMatchAt(s));
|
|
9900
9900
|
if (!o || !i.canReplaceWith(s, s, o))
|
|
9901
9901
|
return !1;
|
|
9902
9902
|
if (e) {
|
|
@@ -9904,11 +9904,11 @@ const gd = (n, e) => {
|
|
|
9904
9904
|
a.setSelection(E.near(a.doc.resolve(l), 1)), e(a.scrollIntoView());
|
|
9905
9905
|
}
|
|
9906
9906
|
return !0;
|
|
9907
|
-
},
|
|
9907
|
+
}, Jo = (n, e) => {
|
|
9908
9908
|
let t = n.selection, { $from: r, $to: i } = t;
|
|
9909
9909
|
if (t instanceof ce || r.parent.inlineContent || i.parent.inlineContent)
|
|
9910
9910
|
return !1;
|
|
9911
|
-
let s =
|
|
9911
|
+
let s = Xr(i.parent.contentMatchAt(i.indexAfter()));
|
|
9912
9912
|
if (!s || !s.isTextblock)
|
|
9913
9913
|
return !1;
|
|
9914
9914
|
if (e) {
|
|
@@ -9916,7 +9916,7 @@ const gd = (n, e) => {
|
|
|
9916
9916
|
l.setSelection(M.create(l.doc, o + 1)), e(l.scrollIntoView());
|
|
9917
9917
|
}
|
|
9918
9918
|
return !0;
|
|
9919
|
-
},
|
|
9919
|
+
}, Uo = (n, e) => {
|
|
9920
9920
|
let { $cursor: t } = n.selection;
|
|
9921
9921
|
if (!t || t.parent.content.size)
|
|
9922
9922
|
return !1;
|
|
@@ -9938,7 +9938,7 @@ function yd(n) {
|
|
|
9938
9938
|
let s = [], o, l, a = !1, c = !1;
|
|
9939
9939
|
for (let h = r.depth; ; h--)
|
|
9940
9940
|
if (r.node(h).isBlock) {
|
|
9941
|
-
a = r.end(h) == r.pos + (r.depth - h), c = r.start(h) == r.pos - (r.depth - h), l =
|
|
9941
|
+
a = r.end(h) == r.pos + (r.depth - h), c = r.start(h) == r.pos - (r.depth - h), l = Xr(r.node(h - 1).contentMatchAt(r.indexAfter(h - 1))), s.unshift(a && l ? { type: l } : null), o = h;
|
|
9942
9942
|
break;
|
|
9943
9943
|
} else {
|
|
9944
9944
|
if (h == 1)
|
|
@@ -9965,7 +9965,7 @@ function xd(n, e, t) {
|
|
|
9965
9965
|
let r = e.nodeBefore, i = e.nodeAfter, s = e.index();
|
|
9966
9966
|
return !r || !i || !r.type.compatibleContent(i.type) ? !1 : !r.content.size && e.parent.canReplace(s - 1, s) ? (t && t(n.tr.delete(e.pos - r.nodeSize, e.pos).scrollIntoView()), !0) : !e.parent.canReplace(s, s + 1) || !(i.isTextblock || qe(n.doc, e.pos)) ? !1 : (t && t(n.tr.join(e.pos).scrollIntoView()), !0);
|
|
9967
9967
|
}
|
|
9968
|
-
function
|
|
9968
|
+
function _o(n, e, t, r) {
|
|
9969
9969
|
let i = e.nodeBefore, s = e.nodeAfter, o, l, a = i.type.spec.isolating || s.type.spec.isolating;
|
|
9970
9970
|
if (!a && xd(n, e, t))
|
|
9971
9971
|
return !0;
|
|
@@ -10004,7 +10004,7 @@ function Uo(n, e, t, r) {
|
|
|
10004
10004
|
}
|
|
10005
10005
|
return !1;
|
|
10006
10006
|
}
|
|
10007
|
-
function
|
|
10007
|
+
function Go(n) {
|
|
10008
10008
|
return function(e, t) {
|
|
10009
10009
|
let r = e.selection, i = n < 0 ? r.$from : r.$to, s = i.depth;
|
|
10010
10010
|
for (; i.node(s).isInline; ) {
|
|
@@ -10015,14 +10015,14 @@ function _o(n) {
|
|
|
10015
10015
|
return i.node(s).isTextblock ? (t && t(e.tr.setSelection(M.create(e.doc, n < 0 ? i.start(s) : i.end(s)))), !0) : !1;
|
|
10016
10016
|
};
|
|
10017
10017
|
}
|
|
10018
|
-
const Sd =
|
|
10018
|
+
const Sd = Go(-1), Md = Go(1);
|
|
10019
10019
|
function wd(n, e = null) {
|
|
10020
10020
|
return function(t, r) {
|
|
10021
|
-
let { $from: i, $to: s } = t.selection, o = i.blockRange(s), l = o &&
|
|
10021
|
+
let { $from: i, $to: s } = t.selection, o = i.blockRange(s), l = o && zr(o, n, e);
|
|
10022
10022
|
return l ? (r && r(t.tr.wrap(o, l).scrollIntoView()), !0) : !1;
|
|
10023
10023
|
};
|
|
10024
10024
|
}
|
|
10025
|
-
function
|
|
10025
|
+
function is(n, e = null) {
|
|
10026
10026
|
return function(t, r) {
|
|
10027
10027
|
let i = !1;
|
|
10028
10028
|
for (let s = 0; s < t.selection.ranges.length && !i; s++) {
|
|
@@ -10052,7 +10052,7 @@ function rs(n, e = null) {
|
|
|
10052
10052
|
return !0;
|
|
10053
10053
|
};
|
|
10054
10054
|
}
|
|
10055
|
-
function
|
|
10055
|
+
function Zr(...n) {
|
|
10056
10056
|
return function(e, t, r) {
|
|
10057
10057
|
for (let i = 0; i < n.length; i++)
|
|
10058
10058
|
if (n[i](e, t, r))
|
|
@@ -10060,9 +10060,9 @@ function Xr(...n) {
|
|
|
10060
10060
|
return !1;
|
|
10061
10061
|
};
|
|
10062
10062
|
}
|
|
10063
|
-
|
|
10064
|
-
|
|
10065
|
-
|
|
10063
|
+
Zr(_r, $o, Ho);
|
|
10064
|
+
Zr(_r, qo, jo);
|
|
10065
|
+
Zr(Ko, Jo, Uo, bd);
|
|
10066
10066
|
typeof navigator < "u" ? /Mac|iP(hone|[oa]d)/.test(navigator.platform) : typeof os < "u" && os.platform && os.platform() == "darwin";
|
|
10067
10067
|
function Cd(n, e = null) {
|
|
10068
10068
|
return function(t, r) {
|
|
@@ -10081,7 +10081,7 @@ function Td(n, e, t, r = null) {
|
|
|
10081
10081
|
let a = o.resolve(e.start - 2);
|
|
10082
10082
|
s = new pn(a, a, e.depth), e.endIndex < e.parent.childCount && (e = new pn(e.$from, o.resolve(e.$to.end(e.depth)), e.depth)), i = !0;
|
|
10083
10083
|
}
|
|
10084
|
-
let l =
|
|
10084
|
+
let l = zr(s, t, r, e);
|
|
10085
10085
|
return l ? (n && Od(n, e, l, i, t), !0) : !1;
|
|
10086
10086
|
}
|
|
10087
10087
|
function Od(n, e, t, r, i) {
|
|
@@ -10268,7 +10268,7 @@ function Fn(n) {
|
|
|
10268
10268
|
markExtensions: r
|
|
10269
10269
|
};
|
|
10270
10270
|
}
|
|
10271
|
-
function
|
|
10271
|
+
function Yo(n) {
|
|
10272
10272
|
const e = [], { nodeExtensions: t, markExtensions: r } = Fn(n), i = [...t, ...r], s = {
|
|
10273
10273
|
default: null,
|
|
10274
10274
|
rendered: !0,
|
|
@@ -10355,16 +10355,16 @@ function H(...n) {
|
|
|
10355
10355
|
}), r;
|
|
10356
10356
|
}, {});
|
|
10357
10357
|
}
|
|
10358
|
-
function
|
|
10358
|
+
function vr(n, e) {
|
|
10359
10359
|
return e.filter((t) => t.type === n.type.name).filter((t) => t.attribute.rendered).map((t) => t.attribute.renderHTML ? t.attribute.renderHTML(n.attrs) || {} : {
|
|
10360
10360
|
[t.name]: n.attrs[t.name]
|
|
10361
10361
|
}).reduce((t, r) => H(t, r), {});
|
|
10362
10362
|
}
|
|
10363
|
-
function
|
|
10363
|
+
function Xo(n) {
|
|
10364
10364
|
return typeof n == "function";
|
|
10365
10365
|
}
|
|
10366
10366
|
function v(n, e = void 0, ...t) {
|
|
10367
|
-
return
|
|
10367
|
+
return Xo(n) ? e ? n.bind(e)(...t) : n(...t) : n;
|
|
10368
10368
|
}
|
|
10369
10369
|
function Id(n = {}) {
|
|
10370
10370
|
return Object.keys(n).length === 0 && n.constructor === Object;
|
|
@@ -10372,7 +10372,7 @@ function Id(n = {}) {
|
|
|
10372
10372
|
function Rd(n) {
|
|
10373
10373
|
return typeof n != "string" ? n : n.match(/^[+-]?(?:\d*\.)?\d+$/) ? Number(n) : n === "true" ? !0 : n === "false" ? !1 : n;
|
|
10374
10374
|
}
|
|
10375
|
-
function
|
|
10375
|
+
function ss(n, e) {
|
|
10376
10376
|
return "style" in n ? n : {
|
|
10377
10377
|
...n,
|
|
10378
10378
|
getAttrs: (t) => {
|
|
@@ -10390,7 +10390,7 @@ function is(n, e) {
|
|
|
10390
10390
|
}
|
|
10391
10391
|
};
|
|
10392
10392
|
}
|
|
10393
|
-
function
|
|
10393
|
+
function ls(n) {
|
|
10394
10394
|
return Object.fromEntries(
|
|
10395
10395
|
// @ts-ignore
|
|
10396
10396
|
Object.entries(n).filter(([e, t]) => e === "attrs" && Id(t) ? !1 : t != null)
|
|
@@ -10398,7 +10398,7 @@ function ss(n) {
|
|
|
10398
10398
|
}
|
|
10399
10399
|
function Pd(n, e) {
|
|
10400
10400
|
var t;
|
|
10401
|
-
const r =
|
|
10401
|
+
const r = Yo(n), { nodeExtensions: i, markExtensions: s } = Fn(n), o = (t = i.find((c) => x(c, "topNode"))) === null || t === void 0 ? void 0 : t.name, l = Object.fromEntries(i.map((c) => {
|
|
10402
10402
|
const d = r.filter((y) => y.type === c.name), u = {
|
|
10403
10403
|
name: c.name,
|
|
10404
10404
|
options: c.options,
|
|
@@ -10410,7 +10410,7 @@ function Pd(n, e) {
|
|
|
10410
10410
|
...y,
|
|
10411
10411
|
...w ? w(c) : {}
|
|
10412
10412
|
};
|
|
10413
|
-
}, {}), h =
|
|
10413
|
+
}, {}), h = ls({
|
|
10414
10414
|
...f,
|
|
10415
10415
|
content: v(x(c, "content", u)),
|
|
10416
10416
|
marks: v(x(c, "marks", u)),
|
|
@@ -10429,11 +10429,11 @@ function Pd(n, e) {
|
|
|
10429
10429
|
return [y.name, { default: (T = y == null ? void 0 : y.attribute) === null || T === void 0 ? void 0 : T.default }];
|
|
10430
10430
|
}))
|
|
10431
10431
|
}), p = v(x(c, "parseHTML", u));
|
|
10432
|
-
p && (h.parseDOM = p.map((y) =>
|
|
10432
|
+
p && (h.parseDOM = p.map((y) => ss(y, d)));
|
|
10433
10433
|
const m = x(c, "renderHTML", u);
|
|
10434
10434
|
m && (h.toDOM = (y) => m({
|
|
10435
10435
|
node: y,
|
|
10436
|
-
HTMLAttributes:
|
|
10436
|
+
HTMLAttributes: vr(y, d)
|
|
10437
10437
|
}));
|
|
10438
10438
|
const g = x(c, "renderText", u);
|
|
10439
10439
|
return g && (h.toText = g), [c.name, h];
|
|
@@ -10449,7 +10449,7 @@ function Pd(n, e) {
|
|
|
10449
10449
|
...g,
|
|
10450
10450
|
...T ? T(c) : {}
|
|
10451
10451
|
};
|
|
10452
|
-
}, {}), h =
|
|
10452
|
+
}, {}), h = ls({
|
|
10453
10453
|
...f,
|
|
10454
10454
|
inclusive: v(x(c, "inclusive", u)),
|
|
10455
10455
|
excludes: v(x(c, "excludes", u)),
|
|
@@ -10461,14 +10461,14 @@ function Pd(n, e) {
|
|
|
10461
10461
|
return [g.name, { default: (y = g == null ? void 0 : g.attribute) === null || y === void 0 ? void 0 : y.default }];
|
|
10462
10462
|
}))
|
|
10463
10463
|
}), p = v(x(c, "parseHTML", u));
|
|
10464
|
-
p && (h.parseDOM = p.map((g) =>
|
|
10464
|
+
p && (h.parseDOM = p.map((g) => ss(g, d)));
|
|
10465
10465
|
const m = x(c, "renderHTML", u);
|
|
10466
10466
|
return m && (h.toDOM = (g) => m({
|
|
10467
10467
|
mark: g,
|
|
10468
|
-
HTMLAttributes:
|
|
10468
|
+
HTMLAttributes: vr(g, d)
|
|
10469
10469
|
})), [c.name, h];
|
|
10470
10470
|
}));
|
|
10471
|
-
return new
|
|
10471
|
+
return new zs({
|
|
10472
10472
|
topNode: o,
|
|
10473
10473
|
nodes: l,
|
|
10474
10474
|
marks: a
|
|
@@ -10477,10 +10477,10 @@ function Pd(n, e) {
|
|
|
10477
10477
|
function ir(n, e) {
|
|
10478
10478
|
return e.nodes[n] || e.marks[n] || null;
|
|
10479
10479
|
}
|
|
10480
|
-
function
|
|
10480
|
+
function as(n, e) {
|
|
10481
10481
|
return Array.isArray(e) ? e.some((t) => (typeof t == "string" ? t : t.name) === n.name) : e;
|
|
10482
10482
|
}
|
|
10483
|
-
function
|
|
10483
|
+
function Qr(n, e) {
|
|
10484
10484
|
const t = ct.fromSchema(e).serializeFragment(n), i = document.implementation.createHTMLDocument().createElement("div");
|
|
10485
10485
|
return i.appendChild(t), i.innerHTML;
|
|
10486
10486
|
}
|
|
@@ -10498,7 +10498,7 @@ const Bd = (n, e = 500) => {
|
|
|
10498
10498
|
t += i.isAtom && !i.isText ? d : d.slice(0, Math.max(0, r - s));
|
|
10499
10499
|
}), t;
|
|
10500
10500
|
};
|
|
10501
|
-
function
|
|
10501
|
+
function ei(n) {
|
|
10502
10502
|
return Object.prototype.toString.call(n) === "[object RegExp]";
|
|
10503
10503
|
}
|
|
10504
10504
|
class $n {
|
|
@@ -10507,7 +10507,7 @@ class $n {
|
|
|
10507
10507
|
}
|
|
10508
10508
|
}
|
|
10509
10509
|
const Ld = (n, e) => {
|
|
10510
|
-
if (
|
|
10510
|
+
if (ei(e))
|
|
10511
10511
|
return e.exec(n);
|
|
10512
10512
|
const t = e(n);
|
|
10513
10513
|
if (!t)
|
|
@@ -10572,7 +10572,7 @@ function zd(n) {
|
|
|
10572
10572
|
const a = i.getMeta("applyInputRules");
|
|
10573
10573
|
return !!a && setTimeout(() => {
|
|
10574
10574
|
let { text: d } = a;
|
|
10575
|
-
typeof d == "string" ? d = d : d =
|
|
10575
|
+
typeof d == "string" ? d = d : d = Qr(b.from(d), o.schema);
|
|
10576
10576
|
const { from: u } = a, f = u + d.length;
|
|
10577
10577
|
tn({
|
|
10578
10578
|
editor: e,
|
|
@@ -10698,7 +10698,7 @@ class Vd {
|
|
|
10698
10698
|
}
|
|
10699
10699
|
}
|
|
10700
10700
|
const Hd = (n, e, t) => {
|
|
10701
|
-
if (
|
|
10701
|
+
if (ei(e))
|
|
10702
10702
|
return [...n.matchAll(e)];
|
|
10703
10703
|
const r = e(n, t);
|
|
10704
10704
|
return r ? r.map((i) => {
|
|
@@ -10813,7 +10813,7 @@ function jd(n) {
|
|
|
10813
10813
|
return;
|
|
10814
10814
|
if (T) {
|
|
10815
10815
|
let { text: D } = y;
|
|
10816
|
-
typeof D == "string" ? D = D : D =
|
|
10816
|
+
typeof D == "string" ? D = D : D = Qr(b.from(D), h.schema);
|
|
10817
10817
|
const { from: L } = y, C = L + D.length, N = qd(D);
|
|
10818
10818
|
return a({
|
|
10819
10819
|
rule: d,
|
|
@@ -10919,9 +10919,9 @@ class mt {
|
|
|
10919
10919
|
const u = dd(d);
|
|
10920
10920
|
a.push(u);
|
|
10921
10921
|
const f = x(o, "addInputRules", l);
|
|
10922
|
-
|
|
10922
|
+
as(o, e.options.enableInputRules) && f && r.push(...f());
|
|
10923
10923
|
const h = x(o, "addPasteRules", l);
|
|
10924
|
-
|
|
10924
|
+
as(o, e.options.enablePasteRules) && h && i.push(...h());
|
|
10925
10925
|
const p = x(o, "addProseMirrorPlugins", l);
|
|
10926
10926
|
if (p) {
|
|
10927
10927
|
const m = p();
|
|
@@ -10946,7 +10946,7 @@ class mt {
|
|
|
10946
10946
|
* @returns An array of attributes
|
|
10947
10947
|
*/
|
|
10948
10948
|
get attributes() {
|
|
10949
|
-
return
|
|
10949
|
+
return Yo(this.extensions);
|
|
10950
10950
|
}
|
|
10951
10951
|
/**
|
|
10952
10952
|
* Get all node views from the extensions.
|
|
@@ -10965,7 +10965,7 @@ class mt {
|
|
|
10965
10965
|
if (!o)
|
|
10966
10966
|
return [];
|
|
10967
10967
|
const l = (a, c, d, u, f) => {
|
|
10968
|
-
const h =
|
|
10968
|
+
const h = vr(a, i);
|
|
10969
10969
|
return o()({
|
|
10970
10970
|
// pass-through
|
|
10971
10971
|
node: a,
|
|
@@ -11038,7 +11038,7 @@ class _ {
|
|
|
11038
11038
|
})), t;
|
|
11039
11039
|
}
|
|
11040
11040
|
}
|
|
11041
|
-
function
|
|
11041
|
+
function Zo(n, e, t) {
|
|
11042
11042
|
const { from: r, to: i } = e, { blockSeparator: s = `
|
|
11043
11043
|
|
|
11044
11044
|
`, textSerializers: o = {} } = t || {};
|
|
@@ -11058,7 +11058,7 @@ function Xo(n, e, t) {
|
|
|
11058
11058
|
a.isText && (l += (f = a == null ? void 0 : a.text) === null || f === void 0 ? void 0 : f.slice(Math.max(r, c) - c, i - c));
|
|
11059
11059
|
}), l;
|
|
11060
11060
|
}
|
|
11061
|
-
function
|
|
11061
|
+
function Qo(n) {
|
|
11062
11062
|
return Object.fromEntries(Object.entries(n.nodes).filter(([, e]) => e.spec.toText).map(([e, t]) => [e, t.spec.toText]));
|
|
11063
11063
|
}
|
|
11064
11064
|
const Jd = _.create({
|
|
@@ -11074,8 +11074,8 @@ const Jd = _.create({
|
|
|
11074
11074
|
key: new we("clipboardTextSerializer"),
|
|
11075
11075
|
props: {
|
|
11076
11076
|
clipboardTextSerializer: () => {
|
|
11077
|
-
const { editor: n } = this, { state: e, schema: t } = n, { doc: r, selection: i } = e, { ranges: s } = i, o = Math.min(...s.map((d) => d.$from.pos)), l = Math.max(...s.map((d) => d.$to.pos)), a =
|
|
11078
|
-
return
|
|
11077
|
+
const { editor: n } = this, { state: e, schema: t } = n, { doc: r, selection: i } = e, { ranges: s } = i, o = Math.min(...s.map((d) => d.$from.pos)), l = Math.max(...s.map((d) => d.$to.pos)), a = Qo(t);
|
|
11078
|
+
return Zo(r, { from: o, to: l }, {
|
|
11079
11079
|
...this.options.blockSeparator !== void 0 ? { blockSeparator: this.options.blockSeparator } : {},
|
|
11080
11080
|
textSerializers: a
|
|
11081
11081
|
});
|
|
@@ -11104,7 +11104,7 @@ const Jd = _.create({
|
|
|
11104
11104
|
(p || p === 0) && e.lift(h, p);
|
|
11105
11105
|
});
|
|
11106
11106
|
}), !0;
|
|
11107
|
-
}, Yd = (n) => (e) => n(e), Xd = () => ({ state: n, dispatch: e }) =>
|
|
11107
|
+
}, Yd = (n) => (e) => n(e), Xd = () => ({ state: n, dispatch: e }) => Jo(n, e), Zd = (n, e) => ({ editor: t, tr: r }) => {
|
|
11108
11108
|
const { state: i } = t, s = i.doc.slice(n.from, n.to);
|
|
11109
11109
|
r.deleteRange(n.from, n.to);
|
|
11110
11110
|
const o = r.mapping.map(e);
|
|
@@ -11137,32 +11137,32 @@ const Jd = _.create({
|
|
|
11137
11137
|
}, tu = (n) => ({ tr: e, dispatch: t }) => {
|
|
11138
11138
|
const { from: r, to: i } = n;
|
|
11139
11139
|
return t && e.delete(r, i), !0;
|
|
11140
|
-
}, nu = () => ({ state: n, dispatch: e }) =>
|
|
11140
|
+
}, nu = () => ({ state: n, dispatch: e }) => _r(n, e), ru = () => ({ commands: n }) => n.keyboardShortcut("Enter"), iu = () => ({ state: n, dispatch: e }) => gd(n, e);
|
|
11141
11141
|
function Mn(n, e, t = { strict: !0 }) {
|
|
11142
11142
|
const r = Object.keys(e);
|
|
11143
|
-
return r.length ? r.every((i) => t.strict ? e[i] === n[i] :
|
|
11143
|
+
return r.length ? r.every((i) => t.strict ? e[i] === n[i] : ei(e[i]) ? e[i].test(n[i]) : e[i] === n[i]) : !0;
|
|
11144
11144
|
}
|
|
11145
|
-
function
|
|
11145
|
+
function el(n, e, t = {}) {
|
|
11146
11146
|
return n.find((r) => r.type === e && Mn(
|
|
11147
11147
|
// Only check equality for the attributes that are provided
|
|
11148
11148
|
Object.fromEntries(Object.keys(t).map((i) => [i, r.attrs[i]])),
|
|
11149
11149
|
t
|
|
11150
11150
|
));
|
|
11151
11151
|
}
|
|
11152
|
-
function
|
|
11153
|
-
return !!
|
|
11152
|
+
function cs(n, e, t = {}) {
|
|
11153
|
+
return !!el(n, e, t);
|
|
11154
11154
|
}
|
|
11155
|
-
function
|
|
11155
|
+
function ti(n, e, t) {
|
|
11156
11156
|
var r;
|
|
11157
11157
|
if (!n || !e)
|
|
11158
11158
|
return;
|
|
11159
11159
|
let i = n.parent.childAfter(n.parentOffset);
|
|
11160
|
-
if ((!i.node || !i.node.marks.some((d) => d.type === e)) && (i = n.parent.childBefore(n.parentOffset)), !i.node || !i.node.marks.some((d) => d.type === e) || (t = t || ((r = i.node.marks[0]) === null || r === void 0 ? void 0 : r.attrs), !
|
|
11160
|
+
if ((!i.node || !i.node.marks.some((d) => d.type === e)) && (i = n.parent.childBefore(n.parentOffset)), !i.node || !i.node.marks.some((d) => d.type === e) || (t = t || ((r = i.node.marks[0]) === null || r === void 0 ? void 0 : r.attrs), !el([...i.node.marks], e, t)))
|
|
11161
11161
|
return;
|
|
11162
11162
|
let o = i.index, l = n.start() + i.offset, a = o + 1, c = l + i.node.nodeSize;
|
|
11163
|
-
for (; o > 0 &&
|
|
11163
|
+
for (; o > 0 && cs([...n.parent.child(o - 1).marks], e, t); )
|
|
11164
11164
|
o -= 1, l -= n.parent.child(o).nodeSize;
|
|
11165
|
-
for (; a < n.parent.childCount &&
|
|
11165
|
+
for (; a < n.parent.childCount && cs([...n.parent.child(a).marks], e, t); )
|
|
11166
11166
|
c += n.parent.child(a).nodeSize, a += 1;
|
|
11167
11167
|
return {
|
|
11168
11168
|
from: l,
|
|
@@ -11180,7 +11180,7 @@ function Ke(n, e) {
|
|
|
11180
11180
|
const su = (n, e = {}) => ({ tr: t, state: r, dispatch: i }) => {
|
|
11181
11181
|
const s = Ke(n, r.schema), { doc: o, selection: l } = t, { $from: a, from: c, to: d } = l;
|
|
11182
11182
|
if (i) {
|
|
11183
|
-
const u =
|
|
11183
|
+
const u = ti(a, s, e);
|
|
11184
11184
|
if (u && u.from <= c && u.to >= d) {
|
|
11185
11185
|
const f = M.create(o, u.from, u.to);
|
|
11186
11186
|
t.setSelection(f);
|
|
@@ -11194,13 +11194,13 @@ const su = (n, e = {}) => ({ tr: t, state: r, dispatch: i }) => {
|
|
|
11194
11194
|
return !0;
|
|
11195
11195
|
return !1;
|
|
11196
11196
|
};
|
|
11197
|
-
function
|
|
11197
|
+
function tl(n) {
|
|
11198
11198
|
return n instanceof M;
|
|
11199
11199
|
}
|
|
11200
11200
|
function Ye(n = 0, e = 0, t = 0) {
|
|
11201
11201
|
return Math.min(Math.max(n, e), t);
|
|
11202
11202
|
}
|
|
11203
|
-
function
|
|
11203
|
+
function nl(n, e = null) {
|
|
11204
11204
|
if (!e)
|
|
11205
11205
|
return null;
|
|
11206
11206
|
const t = E.atStart(n), r = E.atEnd(n);
|
|
@@ -11211,7 +11211,7 @@ function tl(n, e = null) {
|
|
|
11211
11211
|
const i = t.from, s = r.to;
|
|
11212
11212
|
return e === "all" ? M.create(n, Ye(0, i, s), Ye(n.content.size, i, s)) : M.create(n, Ye(e, i, s), Ye(e, i, s));
|
|
11213
11213
|
}
|
|
11214
|
-
function
|
|
11214
|
+
function ds() {
|
|
11215
11215
|
return navigator.platform === "Android" || /android/i.test(navigator.userAgent);
|
|
11216
11216
|
}
|
|
11217
11217
|
function wn() {
|
|
@@ -11233,27 +11233,27 @@ const au = (n = null, e = {}) => ({ editor: t, view: r, tr: i, dispatch: s }) =>
|
|
|
11233
11233
|
...e
|
|
11234
11234
|
};
|
|
11235
11235
|
const o = () => {
|
|
11236
|
-
(wn() ||
|
|
11237
|
-
t.isDestroyed || (r.focus(), lu() && !wn() && !
|
|
11236
|
+
(wn() || ds()) && r.dom.focus(), requestAnimationFrame(() => {
|
|
11237
|
+
t.isDestroyed || (r.focus(), lu() && !wn() && !ds() && r.dom.focus({ preventScroll: !0 }));
|
|
11238
11238
|
});
|
|
11239
11239
|
};
|
|
11240
11240
|
if (r.hasFocus() && n === null || n === !1)
|
|
11241
11241
|
return !0;
|
|
11242
|
-
if (s && n === null && !
|
|
11242
|
+
if (s && n === null && !tl(t.state.selection))
|
|
11243
11243
|
return o(), !0;
|
|
11244
|
-
const l =
|
|
11244
|
+
const l = nl(i.doc, n) || t.state.selection, a = t.state.selection.eq(l);
|
|
11245
11245
|
return s && (a || i.setSelection(l), a && i.storedMarks && i.setStoredMarks(i.storedMarks), o()), !0;
|
|
11246
|
-
}, cu = (n, e) => (t) => n.every((r, i) => e(r, { ...t, index: i })), du = (n, e) => ({ tr: t, commands: r }) => r.insertContentAt({ from: t.selection.from, to: t.selection.to }, n, e),
|
|
11246
|
+
}, cu = (n, e) => (t) => n.every((r, i) => e(r, { ...t, index: i })), du = (n, e) => ({ tr: t, commands: r }) => r.insertContentAt({ from: t.selection.from, to: t.selection.to }, n, e), rl = (n) => {
|
|
11247
11247
|
const e = n.childNodes;
|
|
11248
11248
|
for (let t = e.length - 1; t >= 0; t -= 1) {
|
|
11249
11249
|
const r = e[t];
|
|
11250
|
-
r.nodeType === 3 && r.nodeValue && /^(\n\s\s|\n)$/.test(r.nodeValue) ? n.removeChild(r) : r.nodeType === 1 &&
|
|
11250
|
+
r.nodeType === 3 && r.nodeValue && /^(\n\s\s|\n)$/.test(r.nodeValue) ? n.removeChild(r) : r.nodeType === 1 && rl(r);
|
|
11251
11251
|
}
|
|
11252
11252
|
return n;
|
|
11253
11253
|
};
|
|
11254
11254
|
function sn(n) {
|
|
11255
11255
|
const e = `<body>${n}</body>`, t = new window.DOMParser().parseFromString(e, "text/html").body;
|
|
11256
|
-
return
|
|
11256
|
+
return rl(t);
|
|
11257
11257
|
}
|
|
11258
11258
|
function Vt(n, e, t) {
|
|
11259
11259
|
if (n instanceof ze || n instanceof b)
|
|
@@ -11278,7 +11278,7 @@ function Vt(n, e, t) {
|
|
|
11278
11278
|
if (i) {
|
|
11279
11279
|
if (t.errorOnInvalidContent) {
|
|
11280
11280
|
let o = !1, l = "";
|
|
11281
|
-
const a = new
|
|
11281
|
+
const a = new zs({
|
|
11282
11282
|
topNode: e.spec.topNode,
|
|
11283
11283
|
marks: e.spec.marks,
|
|
11284
11284
|
// Prosemirror's schemas are executed such that: the last to execute, matches last
|
|
@@ -11380,7 +11380,7 @@ const fu = (n) => !("type" in n), hu = (n, e, t) => ({ tr: r, dispatch: i, edito
|
|
|
11380
11380
|
t.updateSelection && uu(r, r.steps.length - 1, -1), t.applyInputRules && r.setMeta("applyInputRules", { from: d, text: m }), t.applyPasteRules && r.setMeta("applyPasteRules", { from: d, text: m });
|
|
11381
11381
|
}
|
|
11382
11382
|
return !0;
|
|
11383
|
-
}, pu = () => ({ state: n, dispatch: e }) => hd(n, e), mu = () => ({ state: n, dispatch: e }) => pd(n, e), gu = () => ({ state: n, dispatch: e }) =>
|
|
11383
|
+
}, pu = () => ({ state: n, dispatch: e }) => hd(n, e), mu = () => ({ state: n, dispatch: e }) => pd(n, e), gu = () => ({ state: n, dispatch: e }) => $o(n, e), yu = () => ({ state: n, dispatch: e }) => qo(n, e), bu = () => ({ state: n, dispatch: e, tr: t }) => {
|
|
11384
11384
|
try {
|
|
11385
11385
|
const r = An(n.doc, n.selection.$from.pos, -1);
|
|
11386
11386
|
return r == null ? !1 : (t.join(r, 2), e && e(t), !0);
|
|
@@ -11395,7 +11395,7 @@ const fu = (n) => !("type" in n), hu = (n, e, t) => ({ tr: r, dispatch: i, edito
|
|
|
11395
11395
|
return !1;
|
|
11396
11396
|
}
|
|
11397
11397
|
}, xu = () => ({ state: n, dispatch: e }) => ud(n, e), Su = () => ({ state: n, dispatch: e }) => fd(n, e);
|
|
11398
|
-
function
|
|
11398
|
+
function il() {
|
|
11399
11399
|
return typeof navigator < "u" ? /Mac/.test(navigator.platform) : !1;
|
|
11400
11400
|
}
|
|
11401
11401
|
function Mu(n) {
|
|
@@ -11414,7 +11414,7 @@ function Mu(n) {
|
|
|
11414
11414
|
else if (/^s(hift)?$/i.test(a))
|
|
11415
11415
|
s = !0;
|
|
11416
11416
|
else if (/^mod$/i.test(a))
|
|
11417
|
-
wn() ||
|
|
11417
|
+
wn() || il() ? o = !0 : i = !0;
|
|
11418
11418
|
else
|
|
11419
11419
|
throw new Error(`Unrecognized modifier name: ${a}`);
|
|
11420
11420
|
}
|
|
@@ -11455,14 +11455,14 @@ function Ht(n, e, t = {}) {
|
|
|
11455
11455
|
const Cu = (n, e = {}) => ({ state: t, dispatch: r }) => {
|
|
11456
11456
|
const i = V(n, t.schema);
|
|
11457
11457
|
return Ht(t, i, e) ? md(t, r) : !1;
|
|
11458
|
-
}, Tu = () => ({ state: n, dispatch: e }) =>
|
|
11458
|
+
}, Tu = () => ({ state: n, dispatch: e }) => Uo(n, e), Ou = (n) => ({ state: e, dispatch: t }) => {
|
|
11459
11459
|
const r = V(n, e.schema);
|
|
11460
11460
|
return Ed(r)(e, t);
|
|
11461
|
-
}, Eu = () => ({ state: n, dispatch: e }) =>
|
|
11461
|
+
}, Eu = () => ({ state: n, dispatch: e }) => Ko(n, e);
|
|
11462
11462
|
function Hn(n, e) {
|
|
11463
11463
|
return e.nodes[n] ? "node" : e.marks[n] ? "mark" : null;
|
|
11464
11464
|
}
|
|
11465
|
-
function
|
|
11465
|
+
function us(n, e) {
|
|
11466
11466
|
const t = typeof e == "string" ? [e] : e;
|
|
11467
11467
|
return Object.keys(n).reduce((r, i) => (t.includes(i) || (r[i] = n[i]), r), {});
|
|
11468
11468
|
}
|
|
@@ -11471,8 +11471,8 @@ const vu = (n, e) => ({ tr: t, state: r, dispatch: i }) => {
|
|
|
11471
11471
|
const l = Hn(typeof n == "string" ? n : n.name, r.schema);
|
|
11472
11472
|
return l ? (l === "node" && (s = V(n, r.schema)), l === "mark" && (o = Ke(n, r.schema)), i && t.selection.ranges.forEach((a) => {
|
|
11473
11473
|
r.doc.nodesBetween(a.$from.pos, a.$to.pos, (c, d) => {
|
|
11474
|
-
s && s === c.type && t.setNodeMarkup(d, void 0,
|
|
11475
|
-
o === u.type && t.addMark(d, d + c.nodeSize, o.create(
|
|
11474
|
+
s && s === c.type && t.setNodeMarkup(d, void 0, us(c.attrs, e)), o && c.marks.length && c.marks.forEach((u) => {
|
|
11475
|
+
o === u.type && t.addMark(d, d + c.nodeSize, o.create(us(u.attrs, e)));
|
|
11476
11476
|
});
|
|
11477
11477
|
});
|
|
11478
11478
|
}), !0) : !1;
|
|
@@ -11482,8 +11482,8 @@ const vu = (n, e) => ({ tr: t, state: r, dispatch: i }) => {
|
|
|
11482
11482
|
n.setSelection(t);
|
|
11483
11483
|
}
|
|
11484
11484
|
return !0;
|
|
11485
|
-
}, Du = () => ({ state: n, dispatch: e }) =>
|
|
11486
|
-
function
|
|
11485
|
+
}, Du = () => ({ state: n, dispatch: e }) => Ho(n, e), Iu = () => ({ state: n, dispatch: e }) => jo(n, e), Ru = () => ({ state: n, dispatch: e }) => kd(n, e), Pu = () => ({ state: n, dispatch: e }) => Md(n, e), Bu = () => ({ state: n, dispatch: e }) => Sd(n, e);
|
|
11486
|
+
function Nr(n, e, t = {}, r = {}) {
|
|
11487
11487
|
return Vt(n, e, {
|
|
11488
11488
|
slice: !1,
|
|
11489
11489
|
parseOptions: t,
|
|
@@ -11494,7 +11494,7 @@ const Lu = (n, e = !1, t = {}, r = {}) => ({ editor: i, tr: s, dispatch: o, comm
|
|
|
11494
11494
|
var a, c;
|
|
11495
11495
|
const { doc: d } = s;
|
|
11496
11496
|
if (t.preserveWhitespace !== "full") {
|
|
11497
|
-
const u =
|
|
11497
|
+
const u = Nr(n, i.schema, t, {
|
|
11498
11498
|
errorOnInvalidContent: (a = r.errorOnInvalidContent) !== null && a !== void 0 ? a : i.options.enableContentCheck
|
|
11499
11499
|
});
|
|
11500
11500
|
return o && s.replaceWith(0, d.content.size, u).setMeta("preventUpdate", !e), !0;
|
|
@@ -11504,7 +11504,7 @@ const Lu = (n, e = !1, t = {}, r = {}) => ({ editor: i, tr: s, dispatch: o, comm
|
|
|
11504
11504
|
errorOnInvalidContent: (c = r.errorOnInvalidContent) !== null && c !== void 0 ? c : i.options.enableContentCheck
|
|
11505
11505
|
});
|
|
11506
11506
|
};
|
|
11507
|
-
function
|
|
11507
|
+
function sl(n, e) {
|
|
11508
11508
|
const t = Ke(e, n.schema), { from: r, to: i, empty: s } = n.selection, o = [];
|
|
11509
11509
|
s ? (n.storedMarks && o.push(...n.storedMarks), o.push(...n.selection.$head.marks())) : n.doc.nodesBetween(r, i, (a) => {
|
|
11510
11510
|
o.push(...a.marks);
|
|
@@ -11532,7 +11532,7 @@ function Fu(n, e) {
|
|
|
11532
11532
|
};
|
|
11533
11533
|
}
|
|
11534
11534
|
}
|
|
11535
|
-
function
|
|
11535
|
+
function ni(n) {
|
|
11536
11536
|
return (e) => Fu(e.$from, n);
|
|
11537
11537
|
}
|
|
11538
11538
|
function $u(n, e) {
|
|
@@ -11540,7 +11540,7 @@ function $u(n, e) {
|
|
|
11540
11540
|
from: 0,
|
|
11541
11541
|
to: n.content.size
|
|
11542
11542
|
};
|
|
11543
|
-
return
|
|
11543
|
+
return Zo(n, t, e);
|
|
11544
11544
|
}
|
|
11545
11545
|
function Vu(n, e) {
|
|
11546
11546
|
const t = V(e, n.schema), { from: r, to: i } = n.selection, s = [];
|
|
@@ -11552,12 +11552,12 @@ function Vu(n, e) {
|
|
|
11552
11552
|
}
|
|
11553
11553
|
function Hu(n, e) {
|
|
11554
11554
|
const t = Hn(typeof e == "string" ? e : e.name, n.schema);
|
|
11555
|
-
return t === "node" ? Vu(n, e) : t === "mark" ?
|
|
11555
|
+
return t === "node" ? Vu(n, e) : t === "mark" ? sl(n, e) : {};
|
|
11556
11556
|
}
|
|
11557
|
-
function
|
|
11557
|
+
function ol(n, e, t) {
|
|
11558
11558
|
const r = [];
|
|
11559
11559
|
return n === e ? t.resolve(n).marks().forEach((i) => {
|
|
11560
|
-
const s = t.resolve(n), o =
|
|
11560
|
+
const s = t.resolve(n), o = ti(s, i.type);
|
|
11561
11561
|
o && r.push({
|
|
11562
11562
|
mark: i,
|
|
11563
11563
|
...o
|
|
@@ -11576,7 +11576,7 @@ function cn(n, e, t) {
|
|
|
11576
11576
|
return i ? i.attribute.keepOnSplit : !1;
|
|
11577
11577
|
}));
|
|
11578
11578
|
}
|
|
11579
|
-
function
|
|
11579
|
+
function Ar(n, e, t = {}) {
|
|
11580
11580
|
const { empty: r, ranges: i } = n.selection, s = e ? Ke(e, n.schema) : null;
|
|
11581
11581
|
if (r)
|
|
11582
11582
|
return !!(n.storedMarks || n.selection.$from.marks()).filter((u) => s ? s.name === u.type.name : !0).find((u) => Mn(u.attrs, t, { strict: !1 }));
|
|
@@ -11601,11 +11601,11 @@ function Nr(n, e, t = {}) {
|
|
|
11601
11601
|
}
|
|
11602
11602
|
function Wu(n, e, t = {}) {
|
|
11603
11603
|
if (!e)
|
|
11604
|
-
return Ht(n, null, t) ||
|
|
11604
|
+
return Ht(n, null, t) || Ar(n, null, t);
|
|
11605
11605
|
const r = Hn(e, n.schema);
|
|
11606
|
-
return r === "node" ? Ht(n, e, t) : r === "mark" ?
|
|
11606
|
+
return r === "node" ? Ht(n, e, t) : r === "mark" ? Ar(n, e, t) : !1;
|
|
11607
11607
|
}
|
|
11608
|
-
function
|
|
11608
|
+
function fs(n, e) {
|
|
11609
11609
|
const { nodeExtensions: t } = Fn(e), r = t.find((o) => o.name === n);
|
|
11610
11610
|
if (!r)
|
|
11611
11611
|
return !1;
|
|
@@ -11616,7 +11616,7 @@ function us(n, e) {
|
|
|
11616
11616
|
}, s = v(x(r, "group", i));
|
|
11617
11617
|
return typeof s != "string" ? !1 : s.split(" ").includes("list");
|
|
11618
11618
|
}
|
|
11619
|
-
function
|
|
11619
|
+
function ri(n, { checkChildren: e = !0, ignoreWhitespace: t = !1 } = {}) {
|
|
11620
11620
|
var r;
|
|
11621
11621
|
if (t) {
|
|
11622
11622
|
if (n.type.name === "hardBreak")
|
|
@@ -11633,7 +11633,7 @@ function ni(n, { checkChildren: e = !0, ignoreWhitespace: t = !1 } = {}) {
|
|
|
11633
11633
|
if (e) {
|
|
11634
11634
|
let i = !0;
|
|
11635
11635
|
return n.content.forEach((s) => {
|
|
11636
|
-
i !== !1 && (
|
|
11636
|
+
i !== !1 && (ri(s, { ignoreWhitespace: t, checkChildren: e }) || (i = !1));
|
|
11637
11637
|
}), i;
|
|
11638
11638
|
}
|
|
11639
11639
|
return !1;
|
|
@@ -11645,7 +11645,7 @@ function ju(n, e, t) {
|
|
|
11645
11645
|
var r;
|
|
11646
11646
|
const { selection: i } = e;
|
|
11647
11647
|
let s = null;
|
|
11648
|
-
if (
|
|
11648
|
+
if (tl(i) && (s = i.$cursor), s) {
|
|
11649
11649
|
const l = (r = n.storedMarks) !== null && r !== void 0 ? r : s.marks();
|
|
11650
11650
|
return !!t.isInSet(l) || !l.some((a) => a.type.excludes(t));
|
|
11651
11651
|
}
|
|
@@ -11667,7 +11667,7 @@ const Ku = (n, e = {}) => ({ tr: t, state: r, dispatch: i }) => {
|
|
|
11667
11667
|
const { selection: s } = t, { empty: o, ranges: l } = s, a = Ke(n, r.schema);
|
|
11668
11668
|
if (i)
|
|
11669
11669
|
if (o) {
|
|
11670
|
-
const c =
|
|
11670
|
+
const c = sl(r, a);
|
|
11671
11671
|
t.addStoredMark(a.create({
|
|
11672
11672
|
...c,
|
|
11673
11673
|
...e
|
|
@@ -11689,7 +11689,7 @@ const Ku = (n, e = {}) => ({ tr: t, state: r, dispatch: i }) => {
|
|
|
11689
11689
|
}, Ju = (n, e) => ({ tr: t }) => (t.setMeta(n, e), !0), Uu = (n, e = {}) => ({ state: t, dispatch: r, chain: i }) => {
|
|
11690
11690
|
const s = V(n, t.schema);
|
|
11691
11691
|
let o;
|
|
11692
|
-
return t.selection.$anchor.sameParent(t.selection.$head) && (o = t.selection.$anchor.parent.attrs), s.isTextblock ? i().command(({ commands: l }) =>
|
|
11692
|
+
return t.selection.$anchor.sameParent(t.selection.$head) && (o = t.selection.$anchor.parent.attrs), s.isTextblock ? i().command(({ commands: l }) => is(s, { ...o, ...e })(t) ? !0 : l.clearNodes()).command(({ state: l }) => is(s, { ...o, ...e })(l, r)).run() : (console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'), !1);
|
|
11693
11693
|
}, _u = (n) => ({ tr: e, dispatch: t }) => {
|
|
11694
11694
|
if (t) {
|
|
11695
11695
|
const { doc: r } = e, i = Ye(n, 0, r.content.size), s = S.create(r, i);
|
|
@@ -11706,7 +11706,7 @@ const Ku = (n, e = {}) => ({ tr: t, state: r, dispatch: i }) => {
|
|
|
11706
11706
|
const r = V(n, e.schema);
|
|
11707
11707
|
return Ad(r)(e, t);
|
|
11708
11708
|
};
|
|
11709
|
-
function
|
|
11709
|
+
function hs(n, e) {
|
|
11710
11710
|
const t = n.storedMarks || n.selection.$to.parentOffset && n.selection.$from.marks();
|
|
11711
11711
|
if (t) {
|
|
11712
11712
|
const r = t.filter((i) => e == null ? void 0 : e.includes(i.type.name));
|
|
@@ -11716,7 +11716,7 @@ function fs(n, e) {
|
|
|
11716
11716
|
const Xu = ({ keepMarks: n = !0 } = {}) => ({ tr: e, state: t, dispatch: r, editor: i }) => {
|
|
11717
11717
|
const { selection: s, doc: o } = e, { $from: l, $to: a } = s, c = i.extensionManager.attributes, d = cn(c, l.node().type.name, l.node().attrs);
|
|
11718
11718
|
if (s instanceof S && s.node.isBlock)
|
|
11719
|
-
return !l.parentOffset || !ve(o, l.pos) ? !1 : (r && (n &&
|
|
11719
|
+
return !l.parentOffset || !ve(o, l.pos) ? !1 : (r && (n && hs(t, i.extensionManager.splittableMarks), e.split(l.pos).scrollIntoView()), !0);
|
|
11720
11720
|
if (!l.parent.isBlock)
|
|
11721
11721
|
return !1;
|
|
11722
11722
|
const u = a.parentOffset === a.parent.content.size, f = l.depth === 0 ? void 0 : zu(l.node(-1).contentMatchAt(l.indexAfter(-1)));
|
|
@@ -11736,7 +11736,7 @@ const Xu = ({ keepMarks: n = !0 } = {}) => ({ tr: e, state: t, dispatch: r, edit
|
|
|
11736
11736
|
const m = e.mapping.map(l.before()), g = e.doc.resolve(m);
|
|
11737
11737
|
l.node(-1).canReplaceWith(g.index(), g.index() + 1, f) && e.setNodeMarkup(e.mapping.map(l.before()), f);
|
|
11738
11738
|
}
|
|
11739
|
-
n &&
|
|
11739
|
+
n && hs(t, i.extensionManager.splittableMarks), e.scrollIntoView();
|
|
11740
11740
|
}
|
|
11741
11741
|
return p;
|
|
11742
11742
|
}, Zu = (n, e = {}) => ({ tr: t, state: r, dispatch: i, editor: s }) => {
|
|
@@ -11795,7 +11795,7 @@ const Xu = ({ keepMarks: n = !0 } = {}) => ({ tr: e, state: t, dispatch: r, edit
|
|
|
11795
11795
|
}
|
|
11796
11796
|
return !0;
|
|
11797
11797
|
}, sr = (n, e) => {
|
|
11798
|
-
const t =
|
|
11798
|
+
const t = ni((o) => o.type === e)(n.selection);
|
|
11799
11799
|
if (!t)
|
|
11800
11800
|
return !0;
|
|
11801
11801
|
const r = n.doc.resolve(Math.max(0, t.pos - 1)).before(t.depth);
|
|
@@ -11804,7 +11804,7 @@ const Xu = ({ keepMarks: n = !0 } = {}) => ({ tr: e, state: t, dispatch: r, edit
|
|
|
11804
11804
|
const i = n.doc.nodeAt(r);
|
|
11805
11805
|
return t.node.type === (i == null ? void 0 : i.type) && qe(n.doc, t.pos) && n.join(t.pos), !0;
|
|
11806
11806
|
}, or = (n, e) => {
|
|
11807
|
-
const t =
|
|
11807
|
+
const t = ni((o) => o.type === e)(n.selection);
|
|
11808
11808
|
if (!t)
|
|
11809
11809
|
return !0;
|
|
11810
11810
|
const r = n.doc.resolve(t.start).after(t.depth);
|
|
@@ -11816,11 +11816,11 @@ const Xu = ({ keepMarks: n = !0 } = {}) => ({ tr: e, state: t, dispatch: r, edit
|
|
|
11816
11816
|
const { extensions: u, splittableMarks: f } = i.extensionManager, h = V(n, o.schema), p = V(e, o.schema), { selection: m, storedMarks: g } = o, { $from: y, $to: T } = m, w = y.blockRange(T), I = g || m.$to.parentOffset && m.$from.marks();
|
|
11817
11817
|
if (!w)
|
|
11818
11818
|
return !1;
|
|
11819
|
-
const D =
|
|
11819
|
+
const D = ni((L) => fs(L.type.name, u))(m);
|
|
11820
11820
|
if (w.depth >= 1 && D && w.depth - D.depth <= 1) {
|
|
11821
11821
|
if (D.node.type === h)
|
|
11822
11822
|
return c.liftListItem(p);
|
|
11823
|
-
if (
|
|
11823
|
+
if (fs(D.node.type.name, u) && h.validContent(D.node.content) && l)
|
|
11824
11824
|
return a().command(() => (s.setNodeMarkup(D.pos, h), !0)).command(() => sr(s, h)).command(() => or(s, h)).run();
|
|
11825
11825
|
}
|
|
11826
11826
|
return !t || !I || !l ? a().command(() => d().wrapInList(h, r) ? !0 : c.clearNodes()).wrapInList(h, r).command(() => sr(s, h)).command(() => or(s, h)).run() : a().command(() => {
|
|
@@ -11829,7 +11829,7 @@ const Xu = ({ keepMarks: n = !0 } = {}) => ({ tr: e, state: t, dispatch: r, edit
|
|
|
11829
11829
|
}).wrapInList(h, r).command(() => sr(s, h)).command(() => or(s, h)).run();
|
|
11830
11830
|
}, ef = (n, e = {}, t = {}) => ({ state: r, commands: i }) => {
|
|
11831
11831
|
const { extendEmptyMarkRange: s = !1 } = t, o = Ke(n, r.schema);
|
|
11832
|
-
return
|
|
11832
|
+
return Ar(r, o, e) ? i.unsetMark(o, { extendEmptyMarkRange: s }) : i.setMark(o, e);
|
|
11833
11833
|
}, tf = (n, e, t = {}) => ({ state: r, commands: i }) => {
|
|
11834
11834
|
const s = V(n, r.schema), o = V(e, r.schema), l = Ht(r, s, t);
|
|
11835
11835
|
let a;
|
|
@@ -11869,7 +11869,7 @@ const Xu = ({ keepMarks: n = !0 } = {}) => ({ tr: e, state: t, dispatch: r, edit
|
|
|
11869
11869
|
return !0;
|
|
11870
11870
|
if (d && o) {
|
|
11871
11871
|
let { from: f, to: h } = l;
|
|
11872
|
-
const p = (s = c.marks().find((g) => g.type === a)) === null || s === void 0 ? void 0 : s.attrs, m =
|
|
11872
|
+
const p = (s = c.marks().find((g) => g.type === a)) === null || s === void 0 ? void 0 : s.attrs, m = ti(c, a, p);
|
|
11873
11873
|
m && (f = m.from, h = m.to), t.removeMark(f, h, a);
|
|
11874
11874
|
} else
|
|
11875
11875
|
u.forEach((f) => {
|
|
@@ -12082,7 +12082,7 @@ const uf = _.create({
|
|
|
12082
12082
|
"Ctrl-a": () => this.editor.commands.selectTextblockStart(),
|
|
12083
12083
|
"Ctrl-e": () => this.editor.commands.selectTextblockEnd()
|
|
12084
12084
|
};
|
|
12085
|
-
return wn() ||
|
|
12085
|
+
return wn() || il() ? s : i;
|
|
12086
12086
|
},
|
|
12087
12087
|
addProseMirrorPlugins() {
|
|
12088
12088
|
return [
|
|
@@ -12100,7 +12100,7 @@ const uf = _.create({
|
|
|
12100
12100
|
if (!r || i)
|
|
12101
12101
|
return;
|
|
12102
12102
|
const { empty: s, from: o, to: l } = e.selection, a = E.atStart(e.doc).from, c = E.atEnd(e.doc).to;
|
|
12103
|
-
if (s || !(o === a && l === c) || !
|
|
12103
|
+
if (s || !(o === a && l === c) || !ri(t.doc))
|
|
12104
12104
|
return;
|
|
12105
12105
|
const f = t.tr, h = Ln({
|
|
12106
12106
|
state: t,
|
|
@@ -12456,7 +12456,7 @@ class Sf extends Dd {
|
|
|
12456
12456
|
* @returns The new editor state
|
|
12457
12457
|
*/
|
|
12458
12458
|
registerPlugin(e, t) {
|
|
12459
|
-
const r =
|
|
12459
|
+
const r = Xo(t) ? t(e, [...this.state.plugins]) : [...this.state.plugins, e], i = this.state.reconfigure({ plugins: r });
|
|
12460
12460
|
return this.view.updateState(i), i;
|
|
12461
12461
|
}
|
|
12462
12462
|
/**
|
|
@@ -12520,7 +12520,7 @@ class Sf extends Dd {
|
|
|
12520
12520
|
var e;
|
|
12521
12521
|
let t;
|
|
12522
12522
|
try {
|
|
12523
|
-
t =
|
|
12523
|
+
t = Nr(this.options.content, this.schema, this.options.parseOptions, { errorOnInvalidContent: this.options.enableContentCheck });
|
|
12524
12524
|
} catch (o) {
|
|
12525
12525
|
if (!(o instanceof Error) || !["[tiptap error]: Invalid JSON content", "[tiptap error]: Invalid HTML content"].includes(o.message))
|
|
12526
12526
|
throw o;
|
|
@@ -12530,10 +12530,10 @@ class Sf extends Dd {
|
|
|
12530
12530
|
disableCollaboration: () => {
|
|
12531
12531
|
this.storage.collaboration && (this.storage.collaboration.isDisabled = !0), this.options.extensions = this.options.extensions.filter((l) => l.name !== "collaboration"), this.createExtensionManager();
|
|
12532
12532
|
}
|
|
12533
|
-
}), t =
|
|
12533
|
+
}), t = Nr(this.options.content, this.schema, this.options.parseOptions, { errorOnInvalidContent: !1 });
|
|
12534
12534
|
}
|
|
12535
|
-
const r =
|
|
12536
|
-
this.view = new
|
|
12535
|
+
const r = nl(t, this.options.autofocus);
|
|
12536
|
+
this.view = new Lo(this.options.element, {
|
|
12537
12537
|
...this.options.editorProps,
|
|
12538
12538
|
attributes: {
|
|
12539
12539
|
// add `role="textbox"` to the editor element
|
|
@@ -12637,7 +12637,7 @@ class Sf extends Dd {
|
|
|
12637
12637
|
* Get the document as HTML.
|
|
12638
12638
|
*/
|
|
12639
12639
|
getHTML() {
|
|
12640
|
-
return
|
|
12640
|
+
return Qr(this.state.doc.content, this.schema);
|
|
12641
12641
|
}
|
|
12642
12642
|
/**
|
|
12643
12643
|
* Get the document as text.
|
|
@@ -12649,7 +12649,7 @@ class Sf extends Dd {
|
|
|
12649
12649
|
return $u(this.state.doc, {
|
|
12650
12650
|
blockSeparator: t,
|
|
12651
12651
|
textSerializers: {
|
|
12652
|
-
...
|
|
12652
|
+
...Qo(this.schema),
|
|
12653
12653
|
...r
|
|
12654
12654
|
}
|
|
12655
12655
|
});
|
|
@@ -12658,7 +12658,7 @@ class Sf extends Dd {
|
|
|
12658
12658
|
* Check if there is no content.
|
|
12659
12659
|
*/
|
|
12660
12660
|
get isEmpty() {
|
|
12661
|
-
return
|
|
12661
|
+
return ri(this.state.doc);
|
|
12662
12662
|
}
|
|
12663
12663
|
/**
|
|
12664
12664
|
* Get the number of characters for the current document.
|
|
@@ -12711,7 +12711,7 @@ function lt(n) {
|
|
|
12711
12711
|
const { tr: s } = e, o = r[r.length - 1], l = r[0];
|
|
12712
12712
|
if (o) {
|
|
12713
12713
|
const a = l.search(/\S/), c = t.from + l.indexOf(o), d = c + o.length;
|
|
12714
|
-
if (
|
|
12714
|
+
if (ol(t.from, t.to, e.doc).filter((h) => h.mark.type.excluded.find((m) => m === n.type && m !== h.mark.type)).filter((h) => h.to > c).length)
|
|
12715
12715
|
return null;
|
|
12716
12716
|
d < t.to && s.delete(d, t.to), c > t.from && s.delete(t.from + a, c);
|
|
12717
12717
|
const f = t.from + a + o.length;
|
|
@@ -12720,7 +12720,7 @@ function lt(n) {
|
|
|
12720
12720
|
}
|
|
12721
12721
|
});
|
|
12722
12722
|
}
|
|
12723
|
-
function
|
|
12723
|
+
function ll(n) {
|
|
12724
12724
|
return new $n({
|
|
12725
12725
|
find: n.find,
|
|
12726
12726
|
handler: ({ state: e, range: t, match: r }) => {
|
|
@@ -12741,7 +12741,7 @@ function ol(n) {
|
|
|
12741
12741
|
}
|
|
12742
12742
|
});
|
|
12743
12743
|
}
|
|
12744
|
-
function
|
|
12744
|
+
function Dr(n) {
|
|
12745
12745
|
return new $n({
|
|
12746
12746
|
find: n.find,
|
|
12747
12747
|
handler: ({ state: e, range: t, match: r }) => {
|
|
@@ -12756,7 +12756,7 @@ function Wt(n) {
|
|
|
12756
12756
|
return new $n({
|
|
12757
12757
|
find: n.find,
|
|
12758
12758
|
handler: ({ state: e, range: t, match: r, chain: i }) => {
|
|
12759
|
-
const s = v(n.getAttributes, void 0, r) || {}, o = e.tr.delete(t.from, t.to), a = o.doc.resolve(t.from).blockRange(), c = a &&
|
|
12759
|
+
const s = v(n.getAttributes, void 0, r) || {}, o = e.tr.delete(t.from, t.to), a = o.doc.resolve(t.from).blockRange(), c = a && zr(a, n.type, s);
|
|
12760
12760
|
if (!c)
|
|
12761
12761
|
return null;
|
|
12762
12762
|
if (o.wrap(a, c), n.keepMarks && n.editor) {
|
|
@@ -12821,7 +12821,7 @@ function at(n) {
|
|
|
12821
12821
|
let c = t.to;
|
|
12822
12822
|
if (l) {
|
|
12823
12823
|
const d = a.search(/\S/), u = t.from + a.indexOf(l), f = u + l.length;
|
|
12824
|
-
if (
|
|
12824
|
+
if (ol(t.from, t.to, e.doc).filter((p) => p.mark.type.excluded.find((g) => g === n.type && g !== p.mark.type)).filter((p) => p.to > u).length)
|
|
12825
12825
|
return null;
|
|
12826
12826
|
f < t.to && o.delete(f, t.to), u > t.from && o.delete(t.from + d, u), c = t.from + d + l.length, o.addMark(t.from + d, c, n.type.create(s || {})), o.removeStoredMark(n.type);
|
|
12827
12827
|
}
|
|
@@ -12947,7 +12947,7 @@ const wf = /^\s*>\s$/, Cf = ne.create({
|
|
|
12947
12947
|
})
|
|
12948
12948
|
];
|
|
12949
12949
|
}
|
|
12950
|
-
}), Af = "listItem",
|
|
12950
|
+
}), Af = "listItem", ps = "textStyle", ms = /^\s*([-+*])\s$/, Df = ne.create({
|
|
12951
12951
|
name: "bulletList",
|
|
12952
12952
|
addOptions() {
|
|
12953
12953
|
return {
|
|
@@ -12971,7 +12971,7 @@ const wf = /^\s*>\s$/, Cf = ne.create({
|
|
|
12971
12971
|
},
|
|
12972
12972
|
addCommands() {
|
|
12973
12973
|
return {
|
|
12974
|
-
toggleBulletList: () => ({ commands: n, chain: e }) => this.options.keepAttributes ? e().toggleList(this.name, this.options.itemTypeName, this.options.keepMarks).updateAttributes(Af, this.editor.getAttributes(
|
|
12974
|
+
toggleBulletList: () => ({ commands: n, chain: e }) => this.options.keepAttributes ? e().toggleList(this.name, this.options.itemTypeName, this.options.keepMarks).updateAttributes(Af, this.editor.getAttributes(ps)).run() : n.toggleList(this.name, this.options.itemTypeName, this.options.keepMarks)
|
|
12975
12975
|
};
|
|
12976
12976
|
},
|
|
12977
12977
|
addKeyboardShortcuts() {
|
|
@@ -12981,15 +12981,15 @@ const wf = /^\s*>\s$/, Cf = ne.create({
|
|
|
12981
12981
|
},
|
|
12982
12982
|
addInputRules() {
|
|
12983
12983
|
let n = Wt({
|
|
12984
|
-
find:
|
|
12984
|
+
find: ms,
|
|
12985
12985
|
type: this.type
|
|
12986
12986
|
});
|
|
12987
12987
|
return (this.options.keepMarks || this.options.keepAttributes) && (n = Wt({
|
|
12988
|
-
find:
|
|
12988
|
+
find: ms,
|
|
12989
12989
|
type: this.type,
|
|
12990
12990
|
keepMarks: this.options.keepMarks,
|
|
12991
12991
|
keepAttributes: this.options.keepAttributes,
|
|
12992
|
-
getAttributes: () => this.editor.getAttributes(
|
|
12992
|
+
getAttributes: () => this.editor.getAttributes(ps),
|
|
12993
12993
|
editor: this.editor
|
|
12994
12994
|
})), [
|
|
12995
12995
|
n
|
|
@@ -13131,14 +13131,14 @@ const wf = /^\s*>\s$/, Cf = ne.create({
|
|
|
13131
13131
|
},
|
|
13132
13132
|
addInputRules() {
|
|
13133
13133
|
return [
|
|
13134
|
-
|
|
13134
|
+
Dr({
|
|
13135
13135
|
find: Bf,
|
|
13136
13136
|
type: this.type,
|
|
13137
13137
|
getAttributes: (n) => ({
|
|
13138
13138
|
language: n[1]
|
|
13139
13139
|
})
|
|
13140
13140
|
}),
|
|
13141
|
-
|
|
13141
|
+
Dr({
|
|
13142
13142
|
find: Lf,
|
|
13143
13143
|
type: this.type,
|
|
13144
13144
|
getAttributes: (n) => ({
|
|
@@ -13238,7 +13238,7 @@ class Vf {
|
|
|
13238
13238
|
if (t && !s) {
|
|
13239
13239
|
let o = t.pos;
|
|
13240
13240
|
if (this.editorView.dragging && this.editorView.dragging.slice) {
|
|
13241
|
-
let l =
|
|
13241
|
+
let l = _s(this.editorView.state.doc, o, this.editorView.dragging.slice);
|
|
13242
13242
|
l != null && (o = l);
|
|
13243
13243
|
}
|
|
13244
13244
|
this.setCursor(o), this.scheduleRemoval(5e3);
|
|
@@ -13301,7 +13301,7 @@ class R extends E {
|
|
|
13301
13301
|
@internal
|
|
13302
13302
|
*/
|
|
13303
13303
|
getBookmark() {
|
|
13304
|
-
return new
|
|
13304
|
+
return new ii(this.anchor);
|
|
13305
13305
|
}
|
|
13306
13306
|
/**
|
|
13307
13307
|
@internal
|
|
@@ -13357,19 +13357,19 @@ class R extends E {
|
|
|
13357
13357
|
R.prototype.visible = !1;
|
|
13358
13358
|
R.findFrom = R.findGapCursorFrom;
|
|
13359
13359
|
E.jsonID("gapcursor", R);
|
|
13360
|
-
class
|
|
13360
|
+
class ii {
|
|
13361
13361
|
constructor(e) {
|
|
13362
13362
|
this.pos = e;
|
|
13363
13363
|
}
|
|
13364
13364
|
map(e) {
|
|
13365
|
-
return new
|
|
13365
|
+
return new ii(e.map(this.pos));
|
|
13366
13366
|
}
|
|
13367
13367
|
resolve(e) {
|
|
13368
13368
|
let t = e.resolve(this.pos);
|
|
13369
13369
|
return R.valid(t) ? new R(t) : E.near(t);
|
|
13370
13370
|
}
|
|
13371
13371
|
}
|
|
13372
|
-
function
|
|
13372
|
+
function al(n) {
|
|
13373
13373
|
return n.isAtom || n.spec.isolating || n.spec.createGapCursor;
|
|
13374
13374
|
}
|
|
13375
13375
|
function Wf(n) {
|
|
@@ -13381,7 +13381,7 @@ function Wf(n) {
|
|
|
13381
13381
|
continue;
|
|
13382
13382
|
}
|
|
13383
13383
|
for (let i = r.child(t - 1); ; i = i.lastChild) {
|
|
13384
|
-
if (i.childCount == 0 && !i.inlineContent ||
|
|
13384
|
+
if (i.childCount == 0 && !i.inlineContent || al(i.type))
|
|
13385
13385
|
return !0;
|
|
13386
13386
|
if (i.inlineContent)
|
|
13387
13387
|
return !1;
|
|
@@ -13398,7 +13398,7 @@ function qf(n) {
|
|
|
13398
13398
|
continue;
|
|
13399
13399
|
}
|
|
13400
13400
|
for (let i = r.child(t); ; i = i.firstChild) {
|
|
13401
|
-
if (i.childCount == 0 && !i.inlineContent ||
|
|
13401
|
+
if (i.childCount == 0 && !i.inlineContent || al(i.type))
|
|
13402
13402
|
return !0;
|
|
13403
13403
|
if (i.inlineContent)
|
|
13404
13404
|
return !1;
|
|
@@ -13419,7 +13419,7 @@ function jf() {
|
|
|
13419
13419
|
}
|
|
13420
13420
|
});
|
|
13421
13421
|
}
|
|
13422
|
-
const Kf =
|
|
13422
|
+
const Kf = zo({
|
|
13423
13423
|
ArrowLeft: on("horiz", -1),
|
|
13424
13424
|
ArrowRight: on("horiz", 1),
|
|
13425
13425
|
ArrowUp: on("vert", -1),
|
|
@@ -13574,7 +13574,7 @@ const Gf = _.create({
|
|
|
13574
13574
|
}), {});
|
|
13575
13575
|
},
|
|
13576
13576
|
addInputRules() {
|
|
13577
|
-
return this.options.levels.map((n) =>
|
|
13577
|
+
return this.options.levels.map((n) => Dr({
|
|
13578
13578
|
find: new RegExp(`^(#{${Math.min(...this.options.levels)},${n}})\\s$`),
|
|
13579
13579
|
type: this.type,
|
|
13580
13580
|
getAttributes: {
|
|
@@ -13612,9 +13612,9 @@ $.prototype.map = function(e, t, r) {
|
|
|
13612
13612
|
}, t, r), i;
|
|
13613
13613
|
};
|
|
13614
13614
|
$.from = function(e) {
|
|
13615
|
-
return e instanceof $ ? e : e && e.length ? new
|
|
13615
|
+
return e instanceof $ ? e : e && e.length ? new cl(e) : $.empty;
|
|
13616
13616
|
};
|
|
13617
|
-
var
|
|
13617
|
+
var cl = /* @__PURE__ */ function(n) {
|
|
13618
13618
|
function e(r) {
|
|
13619
13619
|
n.call(this), this.values = r;
|
|
13620
13620
|
}
|
|
@@ -13646,7 +13646,7 @@ var al = /* @__PURE__ */ function(n) {
|
|
|
13646
13646
|
return 0;
|
|
13647
13647
|
}, Object.defineProperties(e.prototype, t), e;
|
|
13648
13648
|
}($);
|
|
13649
|
-
$.empty = new
|
|
13649
|
+
$.empty = new cl([]);
|
|
13650
13650
|
var Zf = /* @__PURE__ */ function(n) {
|
|
13651
13651
|
function e(t, r) {
|
|
13652
13652
|
n.call(this), this.left = t, this.right = r, this.length = t.length + r.length, this.depth = Math.max(t.depth, r.depth) + 1;
|
|
@@ -13828,9 +13828,9 @@ function nh(n, e, t, r) {
|
|
|
13828
13828
|
if (t.steps.length == 0)
|
|
13829
13829
|
return n;
|
|
13830
13830
|
if (o && o.getMeta(nt))
|
|
13831
|
-
return o.getMeta(nt).redo ? new Ie(n.done.addTransform(t, void 0, r, dn(e)), n.undone,
|
|
13831
|
+
return o.getMeta(nt).redo ? new Ie(n.done.addTransform(t, void 0, r, dn(e)), n.undone, gs(t.mapping.maps), n.prevTime, n.prevComposition) : new Ie(n.done, n.undone.addTransform(t, void 0, r, dn(e)), null, n.prevTime, n.prevComposition);
|
|
13832
13832
|
if (t.getMeta("addToHistory") !== !1 && !(o && o.getMeta("addToHistory") === !1)) {
|
|
13833
|
-
let l = t.getMeta("composition"), a = n.prevTime == 0 || !o && n.prevComposition != l && (n.prevTime < (t.time || 0) - r.newGroupDelay || !rh(t, n.prevRanges)), c = o ? lr(n.prevRanges, t.mapping) :
|
|
13833
|
+
let l = t.getMeta("composition"), a = n.prevTime == 0 || !o && n.prevComposition != l && (n.prevTime < (t.time || 0) - r.newGroupDelay || !rh(t, n.prevRanges)), c = o ? lr(n.prevRanges, t.mapping) : gs(t.mapping.maps);
|
|
13834
13834
|
return new Ie(n.done.addTransform(t, a ? e.selection.getBookmark() : void 0, r, dn(e)), ge.empty, c, t.time, l ?? n.prevComposition);
|
|
13835
13835
|
} else return (s = t.getMeta("rebased")) ? new Ie(n.done.rebased(t, s), n.undone.rebased(t, s), lr(n.prevRanges, t.mapping), n.prevTime, n.prevComposition) : new Ie(n.done.addMaps(t.mapping.maps), n.undone.addMaps(t.mapping.maps), lr(n.prevRanges, t.mapping), n.prevTime, n.prevComposition);
|
|
13836
13836
|
}
|
|
@@ -13845,7 +13845,7 @@ function rh(n, e) {
|
|
|
13845
13845
|
r <= e[s + 1] && i >= e[s] && (t = !0);
|
|
13846
13846
|
}), t;
|
|
13847
13847
|
}
|
|
13848
|
-
function
|
|
13848
|
+
function gs(n) {
|
|
13849
13849
|
let e = [];
|
|
13850
13850
|
for (let t = n.length - 1; t >= 0 && e.length == 0; t--)
|
|
13851
13851
|
n[t].forEach((r, i, s, o) => e.push(s, o));
|
|
@@ -13868,11 +13868,11 @@ function ih(n, e, t) {
|
|
|
13868
13868
|
let o = s.selection.resolve(s.transform.doc), l = (t ? n.done : n.undone).addTransform(s.transform, e.selection.getBookmark(), i, r), a = new Ie(t ? l : s.remaining, t ? s.remaining : l, null, 0, -1);
|
|
13869
13869
|
return s.transform.setSelection(o).setMeta(nt, { redo: t, historyState: a });
|
|
13870
13870
|
}
|
|
13871
|
-
let ar = !1,
|
|
13871
|
+
let ar = !1, ys = null;
|
|
13872
13872
|
function dn(n) {
|
|
13873
13873
|
let e = n.plugins;
|
|
13874
|
-
if (
|
|
13875
|
-
ar = !1,
|
|
13874
|
+
if (ys != e) {
|
|
13875
|
+
ar = !1, ys = e;
|
|
13876
13876
|
for (let t = 0; t < e.length; t++)
|
|
13877
13877
|
if (e[t].spec.historyPreserveItems) {
|
|
13878
13878
|
ar = !0;
|
|
@@ -13900,14 +13900,14 @@ function oh(n = {}) {
|
|
|
13900
13900
|
props: {
|
|
13901
13901
|
handleDOMEvents: {
|
|
13902
13902
|
beforeinput(e, t) {
|
|
13903
|
-
let r = t.inputType, i = r == "historyUndo" ?
|
|
13903
|
+
let r = t.inputType, i = r == "historyUndo" ? ul : r == "historyRedo" ? fl : null;
|
|
13904
13904
|
return !i || !e.editable ? !1 : (t.preventDefault(), i(e.state, e.dispatch));
|
|
13905
13905
|
}
|
|
13906
13906
|
}
|
|
13907
13907
|
}
|
|
13908
13908
|
});
|
|
13909
13909
|
}
|
|
13910
|
-
function
|
|
13910
|
+
function dl(n, e) {
|
|
13911
13911
|
return (t, r) => {
|
|
13912
13912
|
let i = nt.getState(t);
|
|
13913
13913
|
if (!i || (n ? i.undone : i.done).eventCount == 0)
|
|
@@ -13919,7 +13919,7 @@ function cl(n, e) {
|
|
|
13919
13919
|
return !0;
|
|
13920
13920
|
};
|
|
13921
13921
|
}
|
|
13922
|
-
const
|
|
13922
|
+
const ul = dl(!1, !0), fl = dl(!0, !0), lh = _.create({
|
|
13923
13923
|
name: "history",
|
|
13924
13924
|
addOptions() {
|
|
13925
13925
|
return {
|
|
@@ -13929,8 +13929,8 @@ const dl = cl(!1, !0), ul = cl(!0, !0), lh = _.create({
|
|
|
13929
13929
|
},
|
|
13930
13930
|
addCommands() {
|
|
13931
13931
|
return {
|
|
13932
|
-
undo: () => ({ state: n, dispatch: e }) =>
|
|
13933
|
-
redo: () => ({ state: n, dispatch: e }) =>
|
|
13932
|
+
undo: () => ({ state: n, dispatch: e }) => ul(n, e),
|
|
13933
|
+
redo: () => ({ state: n, dispatch: e }) => fl(n, e)
|
|
13934
13934
|
};
|
|
13935
13935
|
},
|
|
13936
13936
|
addProseMirrorPlugins() {
|
|
@@ -13994,7 +13994,7 @@ const dl = cl(!1, !0), ul = cl(!0, !0), lh = _.create({
|
|
|
13994
13994
|
},
|
|
13995
13995
|
addInputRules() {
|
|
13996
13996
|
return [
|
|
13997
|
-
|
|
13997
|
+
ll({
|
|
13998
13998
|
find: /^(?:---|—-|___\s|\*\*\*\s)$/,
|
|
13999
13999
|
type: this.type
|
|
14000
14000
|
})
|
|
@@ -14093,7 +14093,7 @@ const dl = cl(!1, !0), ul = cl(!0, !0), lh = _.create({
|
|
|
14093
14093
|
"Shift-Tab": () => this.editor.commands.liftListItem(this.name)
|
|
14094
14094
|
};
|
|
14095
14095
|
}
|
|
14096
|
-
}), mh = "listItem",
|
|
14096
|
+
}), mh = "listItem", bs = "textStyle", ks = /^(\d+)\.\s$/, gh = ne.create({
|
|
14097
14097
|
name: "orderedList",
|
|
14098
14098
|
addOptions() {
|
|
14099
14099
|
return {
|
|
@@ -14132,7 +14132,7 @@ const dl = cl(!1, !0), ul = cl(!0, !0), lh = _.create({
|
|
|
14132
14132
|
},
|
|
14133
14133
|
addCommands() {
|
|
14134
14134
|
return {
|
|
14135
|
-
toggleOrderedList: () => ({ commands: n, chain: e }) => this.options.keepAttributes ? e().toggleList(this.name, this.options.itemTypeName, this.options.keepMarks).updateAttributes(mh, this.editor.getAttributes(
|
|
14135
|
+
toggleOrderedList: () => ({ commands: n, chain: e }) => this.options.keepAttributes ? e().toggleList(this.name, this.options.itemTypeName, this.options.keepMarks).updateAttributes(mh, this.editor.getAttributes(bs)).run() : n.toggleList(this.name, this.options.itemTypeName, this.options.keepMarks)
|
|
14136
14136
|
};
|
|
14137
14137
|
},
|
|
14138
14138
|
addKeyboardShortcuts() {
|
|
@@ -14142,17 +14142,17 @@ const dl = cl(!1, !0), ul = cl(!0, !0), lh = _.create({
|
|
|
14142
14142
|
},
|
|
14143
14143
|
addInputRules() {
|
|
14144
14144
|
let n = Wt({
|
|
14145
|
-
find:
|
|
14145
|
+
find: ks,
|
|
14146
14146
|
type: this.type,
|
|
14147
14147
|
getAttributes: (e) => ({ start: +e[1] }),
|
|
14148
14148
|
joinPredicate: (e, t) => t.childCount + t.attrs.start === +e[1]
|
|
14149
14149
|
});
|
|
14150
14150
|
return (this.options.keepMarks || this.options.keepAttributes) && (n = Wt({
|
|
14151
|
-
find:
|
|
14151
|
+
find: ks,
|
|
14152
14152
|
type: this.type,
|
|
14153
14153
|
keepMarks: this.options.keepMarks,
|
|
14154
14154
|
keepAttributes: this.options.keepAttributes,
|
|
14155
|
-
getAttributes: (e) => ({ start: +e[1], ...this.editor.getAttributes(
|
|
14155
|
+
getAttributes: (e) => ({ start: +e[1], ...this.editor.getAttributes(bs) }),
|
|
14156
14156
|
joinPredicate: (e, t) => t.childCount + t.attrs.start === +e[1],
|
|
14157
14157
|
editor: this.editor
|
|
14158
14158
|
})), [
|
|
@@ -14473,7 +14473,7 @@ const dl = cl(!1, !0), ul = cl(!0, !0), lh = _.create({
|
|
|
14473
14473
|
},
|
|
14474
14474
|
addInputRules() {
|
|
14475
14475
|
return [
|
|
14476
|
-
|
|
14476
|
+
ll({
|
|
14477
14477
|
find: Ah,
|
|
14478
14478
|
type: this.type,
|
|
14479
14479
|
getAttributes: (n) => {
|
|
@@ -14484,7 +14484,7 @@ const dl = cl(!1, !0), ul = cl(!0, !0), lh = _.create({
|
|
|
14484
14484
|
];
|
|
14485
14485
|
}
|
|
14486
14486
|
});
|
|
14487
|
-
var re, Ut, _t, de,
|
|
14487
|
+
var re, Ut, _t, de, Ir, hl, pl, ml, gl;
|
|
14488
14488
|
class Ih extends Cl {
|
|
14489
14489
|
constructor() {
|
|
14490
14490
|
super();
|
|
@@ -14494,7 +14494,7 @@ class Ih extends Cl {
|
|
|
14494
14494
|
W(this, _t, null);
|
|
14495
14495
|
}
|
|
14496
14496
|
connectedCallback() {
|
|
14497
|
-
super.connectedCallback() && (Q(this, de,
|
|
14497
|
+
super.connectedCallback() && (Q(this, de, hl).call(this), Q(this, de, pl).call(this), Q(this, de, Ir).call(this));
|
|
14498
14498
|
}
|
|
14499
14499
|
get value() {
|
|
14500
14500
|
return O(this, re).getHTML();
|
|
@@ -14521,25 +14521,25 @@ class Ih extends Cl {
|
|
|
14521
14521
|
return this.hasAttribute("readonly");
|
|
14522
14522
|
}
|
|
14523
14523
|
set readonly(t) {
|
|
14524
|
-
t ? this.setAttribute("readonly", "") : this.removeAttribute("readonly"), Q(this, de,
|
|
14524
|
+
t ? this.setAttribute("readonly", "") : this.removeAttribute("readonly"), Q(this, de, Ir).call(this);
|
|
14525
14525
|
}
|
|
14526
14526
|
disconnectedCallback() {
|
|
14527
14527
|
O(this, re) && (O(this, re).destroy(), oe(this, re, null));
|
|
14528
14528
|
}
|
|
14529
14529
|
}
|
|
14530
14530
|
re = new WeakMap(), Ut = new WeakMap(), _t = new WeakMap(), de = new WeakSet(), // 2. 에디터 상태 업데이트 로직 분리
|
|
14531
|
-
|
|
14531
|
+
Ir = function() {
|
|
14532
14532
|
if (O(this, re)) {
|
|
14533
14533
|
const t = this.readonly;
|
|
14534
14534
|
O(this, re).setEditable(!t);
|
|
14535
14535
|
const r = this.shadowRoot.querySelector(".menu-bar");
|
|
14536
14536
|
r && (r.style.display = t ? "none" : "flex");
|
|
14537
14537
|
}
|
|
14538
|
-
},
|
|
14538
|
+
}, hl = function() {
|
|
14539
14539
|
const t = It.getComponentCssPath("nineEditor.css"), r = t ? `@import "${t}";` : "";
|
|
14540
14540
|
this.shadowRoot.innerHTML = `
|
|
14541
14541
|
<style>
|
|
14542
|
-
@import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-ux@0.1.
|
|
14542
|
+
@import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-ux@0.1.36/dist/css/nineEditor.css";
|
|
14543
14543
|
${r}
|
|
14544
14544
|
</style>
|
|
14545
14545
|
|
|
@@ -14578,7 +14578,7 @@ Dr = function() {
|
|
|
14578
14578
|
const s = i.target.value;
|
|
14579
14579
|
console.log(i.target, s), O(this, re).chain().focus().setMark("textStyle", { fontSize: s }).run();
|
|
14580
14580
|
};
|
|
14581
|
-
},
|
|
14581
|
+
}, pl = function() {
|
|
14582
14582
|
oe(this, re, new Sf({
|
|
14583
14583
|
element: O(this, Ut),
|
|
14584
14584
|
editable: !this.readonly,
|
|
@@ -14611,10 +14611,10 @@ Dr = function() {
|
|
|
14611
14611
|
this.dispatchEvent(new CustomEvent("change", { detail: t.getHTML() }));
|
|
14612
14612
|
},
|
|
14613
14613
|
onSelectionUpdate: ({ editor: t }) => {
|
|
14614
|
-
this.readonly || Q(this, de,
|
|
14614
|
+
this.readonly || Q(this, de, ml).call(this, t);
|
|
14615
14615
|
}
|
|
14616
|
-
})), Q(this, de,
|
|
14617
|
-
},
|
|
14616
|
+
})), Q(this, de, gl).call(this);
|
|
14617
|
+
}, ml = function(t) {
|
|
14618
14618
|
this.shadowRoot.querySelectorAll("[data-cmd]").forEach((o) => {
|
|
14619
14619
|
t.isActive(o.dataset.cmd) ? o.classList.add("is-active") : o.classList.remove("is-active");
|
|
14620
14620
|
}), this.shadowRoot.querySelectorAll("[data-align]").forEach((o) => {
|
|
@@ -14624,7 +14624,7 @@ Dr = function() {
|
|
|
14624
14624
|
i && (i.value = r.fontSize || "14px");
|
|
14625
14625
|
const s = this.shadowRoot.querySelector("#color-picker");
|
|
14626
14626
|
s && (s.value = r.color || "#000000");
|
|
14627
|
-
},
|
|
14627
|
+
}, gl = function() {
|
|
14628
14628
|
const t = O(this, re);
|
|
14629
14629
|
this.shadowRoot.querySelectorAll("[data-cmd]").forEach((r) => {
|
|
14630
14630
|
r.onclick = () => {
|
|
@@ -14640,16 +14640,21 @@ Dr = function() {
|
|
|
14640
14640
|
r && t.chain().focus().setImage({ src: r }).run();
|
|
14641
14641
|
};
|
|
14642
14642
|
};
|
|
14643
|
-
const
|
|
14644
|
-
|
|
14645
|
-
|
|
14643
|
+
const xs = {
|
|
14644
|
+
alert: window.alert,
|
|
14645
|
+
confirm: window.confirm
|
|
14646
|
+
}, Ss = () => {
|
|
14647
|
+
const { nativeOverride: n } = cr.config.ux || {}, e = Array.isArray(n) ? n : n === !0 ? ["alert", "confirm"] : [];
|
|
14648
|
+
window.alert = e.includes("alert") ? (t) => It.alert(t) : xs.alert, window.confirm = e.includes("confirm") ? async (t) => await It.confirm(t) : xs.confirm, cr.config.debug && e.length > 0 && console.log(`[nine-ux] Native API Overridden: ${e.join(", ")}`);
|
|
14649
|
+
}, Rh = () => {
|
|
14650
|
+
Ss(), xl((n) => {
|
|
14651
|
+
(n === "ux" || n === "config") && Ss();
|
|
14652
|
+
});
|
|
14646
14653
|
};
|
|
14647
|
-
|
|
14648
|
-
n === "ux" && gl();
|
|
14649
|
-
});
|
|
14650
|
-
gl();
|
|
14654
|
+
Rh();
|
|
14651
14655
|
typeof window < "u" && (customElements.get("nine-editor") || customElements.define("nine-editor", Ih));
|
|
14652
14656
|
export {
|
|
14653
|
-
Ih as nineEditor
|
|
14657
|
+
Ih as nineEditor,
|
|
14658
|
+
It as nineUx
|
|
14654
14659
|
};
|
|
14655
14660
|
//# sourceMappingURL=nine-ux.es.js.map
|