@nine-lab/nine-ux 0.1.32 → 0.1.34
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 +674 -676
- 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
|
@@ -3,9 +3,9 @@ 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),
|
|
7
|
-
var O = (n, e, t) => (
|
|
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);
|
|
@@ -319,7 +319,7 @@ const Sl = `
|
|
|
319
319
|
filter: unset;
|
|
320
320
|
}
|
|
321
321
|
`;
|
|
322
|
-
var Oe, q, On, En
|
|
322
|
+
var Oe, q, Tn, On, En;
|
|
323
323
|
class Ml extends HTMLElement {
|
|
324
324
|
constructor() {
|
|
325
325
|
super();
|
|
@@ -331,7 +331,7 @@ class Ml extends HTMLElement {
|
|
|
331
331
|
ye(this, "close", () => {
|
|
332
332
|
O(this, q).close(), this.remove();
|
|
333
333
|
});
|
|
334
|
-
W(this,
|
|
334
|
+
W(this, Tn, () => {
|
|
335
335
|
const t = this.querySelector(".head");
|
|
336
336
|
this.querySelectorAll(".close, .close2").forEach((r) => {
|
|
337
337
|
r.onclick = () => {
|
|
@@ -339,10 +339,10 @@ class Ml extends HTMLElement {
|
|
|
339
339
|
this.close();
|
|
340
340
|
}, 300);
|
|
341
341
|
};
|
|
342
|
-
}), t.addEventListener("mousedown", O(this,
|
|
342
|
+
}), t.addEventListener("mousedown", O(this, On)), t.addEventListener("touchstart", O(this, En), { passive: !1 });
|
|
343
343
|
});
|
|
344
344
|
// --- 드래그 로직 (Vanilla JS) ---
|
|
345
|
-
W(this,
|
|
345
|
+
W(this, On, (t) => {
|
|
346
346
|
if (t.target.closest("buttons") || t.button !== 0 || t.altKey || t.ctrlKey || t.shiftKey) return;
|
|
347
347
|
const r = O(this, q).getBoundingClientRect();
|
|
348
348
|
oe(this, Oe, {
|
|
@@ -356,7 +356,7 @@ class Ml extends HTMLElement {
|
|
|
356
356
|
};
|
|
357
357
|
document.addEventListener("mousemove", i), document.addEventListener("mouseup", s);
|
|
358
358
|
});
|
|
359
|
-
W(this,
|
|
359
|
+
W(this, En, (t) => {
|
|
360
360
|
if (t.target.closest("buttons")) return;
|
|
361
361
|
const r = O(this, q).getBoundingClientRect(), i = t.changedTouches[0];
|
|
362
362
|
oe(this, Oe, {
|
|
@@ -405,10 +405,10 @@ class Ml extends HTMLElement {
|
|
|
405
405
|
</div>
|
|
406
406
|
</div>
|
|
407
407
|
</dialog>
|
|
408
|
-
`, oe(this, q, this.querySelector("dialog")), O(this,
|
|
408
|
+
`, oe(this, q, this.querySelector("dialog")), O(this, Tn).call(this);
|
|
409
409
|
}
|
|
410
410
|
}
|
|
411
|
-
Oe = new WeakMap(), q = new WeakMap(),
|
|
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
413
|
class Rr extends HTMLElement {
|
|
414
414
|
constructor() {
|
|
@@ -433,7 +433,7 @@ ye(Rr, "confirm", async (e, t = "Confirm", r = {}) => {
|
|
|
433
433
|
"false-text": "No",
|
|
434
434
|
class: "",
|
|
435
435
|
animation: "",
|
|
436
|
-
...((d =
|
|
436
|
+
...((d = It.options) == null ? void 0 : d.confirm) || {},
|
|
437
437
|
...r
|
|
438
438
|
};
|
|
439
439
|
document.querySelectorAll("nine-confirm-popup").forEach((u) => u.remove());
|
|
@@ -468,7 +468,7 @@ ye(Pr, "alert", async (e, t = "Alert", r = {}) => {
|
|
|
468
468
|
const i = {
|
|
469
469
|
class: "",
|
|
470
470
|
animation: "",
|
|
471
|
-
...((c =
|
|
471
|
+
...((c = It.options) == null ? void 0 : c.alert) || {},
|
|
472
472
|
...r
|
|
473
473
|
};
|
|
474
474
|
document.querySelectorAll("nine-alert-popup").forEach((d) => d.remove());
|
|
@@ -484,18 +484,18 @@ ye(Pr, "alert", async (e, t = "Alert", r = {}) => {
|
|
|
484
484
|
});
|
|
485
485
|
customElements.get("nine-confirm-popup") || customElements.define("nine-confirm-popup", Rr);
|
|
486
486
|
customElements.get("nine-alert-popup") || customElements.define("nine-alert-popup", Pr);
|
|
487
|
-
var
|
|
487
|
+
var qt;
|
|
488
488
|
class wl {
|
|
489
489
|
constructor() {
|
|
490
|
-
W(this,
|
|
490
|
+
W(this, qt, "");
|
|
491
491
|
}
|
|
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
|
-
oe(this,
|
|
498
|
+
oe(this, qt, e);
|
|
499
499
|
}
|
|
500
500
|
// 이제 setup이나 window 교체 로직은 여기서 다 제거합니다.
|
|
501
501
|
// 오직 팝업을 실행하는 인터페이스 역할만 수행.
|
|
@@ -513,21 +513,21 @@ class wl {
|
|
|
513
513
|
return t ? `${t.endsWith("/") ? t : t + "/"}${e}` : null;
|
|
514
514
|
}
|
|
515
515
|
}
|
|
516
|
-
|
|
517
|
-
const
|
|
518
|
-
var
|
|
516
|
+
qt = new WeakMap();
|
|
517
|
+
const It = new wl();
|
|
518
|
+
var jt, Xe, Kt, ae, Ct, dr, ur, Jt, vn;
|
|
519
519
|
class Cl extends HTMLElement {
|
|
520
520
|
constructor() {
|
|
521
521
|
super();
|
|
522
522
|
W(this, ae);
|
|
523
523
|
ye(this, "originContents");
|
|
524
|
-
W(this,
|
|
525
|
-
W(this,
|
|
524
|
+
W(this, jt, !1);
|
|
525
|
+
W(this, Xe);
|
|
526
526
|
// Shadow DOM 사용 여부에 따라 shadowRoot 또는 this를 가리킴
|
|
527
|
-
W(this,
|
|
527
|
+
W(this, Kt, !1);
|
|
528
528
|
ye(this, "getData", () => {
|
|
529
529
|
const t = {};
|
|
530
|
-
return Q(this, ae,
|
|
530
|
+
return Q(this, ae, Ct).call(this).forEach((r) => {
|
|
531
531
|
const i = r.name;
|
|
532
532
|
if (!i) return;
|
|
533
533
|
let s;
|
|
@@ -540,7 +540,7 @@ class Cl extends HTMLElement {
|
|
|
540
540
|
});
|
|
541
541
|
// 파라미터가 있으면 해당 값으로, 없으면 전체 공백 초기화
|
|
542
542
|
ye(this, "clearData", (t = {}) => {
|
|
543
|
-
Q(this, ae, ur).call(this), 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] : "";
|
|
@@ -551,7 +551,7 @@ class Cl extends HTMLElement {
|
|
|
551
551
|
if (!t || typeof t != "object") return;
|
|
552
552
|
Q(this, ae, ur).call(this);
|
|
553
553
|
let r = !1;
|
|
554
|
-
Q(this, ae,
|
|
554
|
+
Q(this, ae, Ct).call(this).forEach((i) => {
|
|
555
555
|
const s = i.name;
|
|
556
556
|
!s || !t.hasOwnProperty(s) || Q(this, ae, dr).call(this, i, t[s]) && (r = !0);
|
|
557
557
|
}), r && (this.changed = !0);
|
|
@@ -559,24 +559,24 @@ class Cl extends HTMLElement {
|
|
|
559
559
|
ye(this, "initData", (t) => {
|
|
560
560
|
this.clearData(t), this.changed = !1;
|
|
561
561
|
});
|
|
562
|
-
W(this,
|
|
562
|
+
W(this, Jt, (t) => {
|
|
563
563
|
this.changed = !0;
|
|
564
564
|
});
|
|
565
|
-
W(this,
|
|
565
|
+
W(this, vn, () => {
|
|
566
566
|
for (const t of this.attributes)
|
|
567
567
|
t.name.startsWith("css-") && this.style.setProperty(t.name.substring(4), t.value);
|
|
568
568
|
this.originContents = this.innerHTML.trim(), this.innerHTML = "", this.shadowRoot && this.tagName.toLowerCase() === "nx-div" && (this.shadowRoot.innerHTML = this.originContents);
|
|
569
569
|
});
|
|
570
570
|
}
|
|
571
571
|
connectedCallback() {
|
|
572
|
-
return O(this,
|
|
572
|
+
return O(this, jt) ? !1 : (this.getAttribute("use-shadow") !== "false" && !this.shadowRoot ? (this.attachShadow({ mode: "open" }), oe(this, Xe, this.shadowRoot)) : oe(this, Xe, this), O(this, vn).call(this), oe(this, jt, !0), !0);
|
|
573
573
|
}
|
|
574
574
|
get changed() {
|
|
575
|
-
return O(this,
|
|
575
|
+
return O(this, Kt);
|
|
576
576
|
}
|
|
577
577
|
set changed(t) {
|
|
578
578
|
const r = !!t;
|
|
579
|
-
oe(this,
|
|
579
|
+
oe(this, Kt, r);
|
|
580
580
|
const i = this.closest(".detail-wrapper");
|
|
581
581
|
if (i) {
|
|
582
582
|
const s = i.querySelector("nx-title2");
|
|
@@ -585,12 +585,12 @@ class Cl extends HTMLElement {
|
|
|
585
585
|
}
|
|
586
586
|
// 자식 클래스에서 접근 가능하도록 getter 제공
|
|
587
587
|
get root() {
|
|
588
|
-
return O(this,
|
|
588
|
+
return O(this, Xe) || this;
|
|
589
589
|
}
|
|
590
590
|
}
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
return ninegrid.querySelectorAll("input[name], textarea[name], select[name], nx-editor[name]", O(this,
|
|
591
|
+
jt = new WeakMap(), Xe = new WeakMap(), Kt = new WeakMap(), ae = new WeakSet(), // 공통 쿼리 함수: 현재 root(Shadow 또는 Light DOM)에서 요소를 찾음
|
|
592
|
+
Ct = function() {
|
|
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;
|
|
@@ -609,10 +609,10 @@ dr = function(t, r) {
|
|
|
609
609
|
return o;
|
|
610
610
|
}, // [공통 로직 2] 이벤트 리스너 일괄 등록
|
|
611
611
|
ur = function() {
|
|
612
|
-
Q(this, ae,
|
|
613
|
-
t.removeEventListener("input", O(this,
|
|
612
|
+
Q(this, ae, Ct).call(this).forEach((t) => {
|
|
613
|
+
t.removeEventListener("input", O(this, Jt)), t.addEventListener("input", O(this, Jt));
|
|
614
614
|
});
|
|
615
|
-
},
|
|
615
|
+
}, Jt = new WeakMap(), vn = new WeakMap();
|
|
616
616
|
function j(n) {
|
|
617
617
|
this.content = n;
|
|
618
618
|
}
|
|
@@ -942,15 +942,15 @@ class b {
|
|
|
942
942
|
*/
|
|
943
943
|
findIndex(e) {
|
|
944
944
|
if (e == 0)
|
|
945
|
-
return
|
|
945
|
+
return Zt(0, e);
|
|
946
946
|
if (e == this.size)
|
|
947
|
-
return
|
|
947
|
+
return Zt(this.content.length, e);
|
|
948
948
|
if (e > this.size || e < 0)
|
|
949
949
|
throw new RangeError(`Position ${e} outside of fragment (${this})`);
|
|
950
950
|
for (let t = 0, r = 0; ; t++) {
|
|
951
951
|
let i = this.child(t), s = r + i.nodeSize;
|
|
952
952
|
if (s >= e)
|
|
953
|
-
return s == e ?
|
|
953
|
+
return s == e ? Zt(t + 1, s) : Zt(t, r);
|
|
954
954
|
r = s;
|
|
955
955
|
}
|
|
956
956
|
}
|
|
@@ -1015,11 +1015,11 @@ class b {
|
|
|
1015
1015
|
}
|
|
1016
1016
|
}
|
|
1017
1017
|
b.empty = new b([], 0);
|
|
1018
|
-
const
|
|
1019
|
-
function
|
|
1020
|
-
return
|
|
1018
|
+
const qn = { index: 0, offset: 0 };
|
|
1019
|
+
function Zt(n, e) {
|
|
1020
|
+
return qn.index = n, qn.offset = e, qn;
|
|
1021
1021
|
}
|
|
1022
|
-
function
|
|
1022
|
+
function un(n, e) {
|
|
1023
1023
|
if (n === e)
|
|
1024
1024
|
return !0;
|
|
1025
1025
|
if (!(n && typeof n == "object") || !(e && typeof e == "object"))
|
|
@@ -1031,11 +1031,11 @@ function fn(n, e) {
|
|
|
1031
1031
|
if (n.length != e.length)
|
|
1032
1032
|
return !1;
|
|
1033
1033
|
for (let r = 0; r < n.length; r++)
|
|
1034
|
-
if (!
|
|
1034
|
+
if (!un(n[r], e[r]))
|
|
1035
1035
|
return !1;
|
|
1036
1036
|
} else {
|
|
1037
1037
|
for (let r in n)
|
|
1038
|
-
if (!(r in e) || !
|
|
1038
|
+
if (!(r in e) || !un(n[r], e[r]))
|
|
1039
1039
|
return !1;
|
|
1040
1040
|
for (let r in e)
|
|
1041
1041
|
if (!(r in n))
|
|
@@ -1097,7 +1097,7 @@ let A = class fr {
|
|
|
1097
1097
|
another mark.
|
|
1098
1098
|
*/
|
|
1099
1099
|
eq(e) {
|
|
1100
|
-
return this == e || this.type == e.type &&
|
|
1100
|
+
return this == e || this.type == e.type && un(this.attrs, e.attrs);
|
|
1101
1101
|
}
|
|
1102
1102
|
/**
|
|
1103
1103
|
Convert this mark to a JSON-serializeable representation.
|
|
@@ -1149,7 +1149,7 @@ let A = class fr {
|
|
|
1149
1149
|
}
|
|
1150
1150
|
};
|
|
1151
1151
|
A.none = [];
|
|
1152
|
-
class
|
|
1152
|
+
class fn extends Error {
|
|
1153
1153
|
}
|
|
1154
1154
|
class k {
|
|
1155
1155
|
/**
|
|
@@ -1252,9 +1252,9 @@ function Ts(n, e, t, r) {
|
|
|
1252
1252
|
}
|
|
1253
1253
|
function Tl(n, e, t) {
|
|
1254
1254
|
if (t.openStart > n.depth)
|
|
1255
|
-
throw new
|
|
1255
|
+
throw new fn("Inserted content deeper than insertion position");
|
|
1256
1256
|
if (n.depth - t.openStart != e.depth - t.openEnd)
|
|
1257
|
-
throw new
|
|
1257
|
+
throw new fn("Inconsistent open depths");
|
|
1258
1258
|
return Os(n, e, t, 0);
|
|
1259
1259
|
}
|
|
1260
1260
|
function Os(n, e, t, r) {
|
|
@@ -1265,46 +1265,46 @@ function Os(n, e, t, r) {
|
|
|
1265
1265
|
} else if (t.content.size)
|
|
1266
1266
|
if (!t.openStart && !t.openEnd && n.depth == r && e.depth == r) {
|
|
1267
1267
|
let o = n.parent, l = o.content;
|
|
1268
|
-
return
|
|
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
|
|
1271
|
+
return Qe(s, vs(n, o, l, e, r));
|
|
1272
1272
|
}
|
|
1273
|
-
else return
|
|
1273
|
+
else return Qe(s, hn(n, e, r));
|
|
1274
1274
|
}
|
|
1275
1275
|
function Es(n, e) {
|
|
1276
1276
|
if (!e.type.compatibleContent(n.type))
|
|
1277
|
-
throw new
|
|
1277
|
+
throw new fn("Cannot join " + e.type.name + " onto " + n.type.name);
|
|
1278
1278
|
}
|
|
1279
1279
|
function hr(n, e, t) {
|
|
1280
1280
|
let r = n.node(t);
|
|
1281
1281
|
return Es(r, e.node(t)), r;
|
|
1282
1282
|
}
|
|
1283
|
-
function
|
|
1283
|
+
function Ze(n, e) {
|
|
1284
1284
|
let t = e.length - 1;
|
|
1285
1285
|
t >= 0 && n.isText && n.sameMarkup(e[t]) ? e[t] = n.withText(e[t].text + n.text) : e.push(n);
|
|
1286
1286
|
}
|
|
1287
|
-
function
|
|
1287
|
+
function vt(n, e, t, r) {
|
|
1288
1288
|
let i = (e || n).node(t), s = 0, o = e ? e.index(t) : i.childCount;
|
|
1289
|
-
n && (s = n.index(t), n.depth > t ? s++ : n.textOffset && (
|
|
1289
|
+
n && (s = n.index(t), n.depth > t ? s++ : n.textOffset && (Ze(n.nodeAfter, r), s++));
|
|
1290
1290
|
for (let l = s; l < o; l++)
|
|
1291
|
-
|
|
1292
|
-
e && e.depth == t && e.textOffset &&
|
|
1291
|
+
Ze(i.child(l), r);
|
|
1292
|
+
e && e.depth == t && e.textOffset && Ze(e.nodeBefore, r);
|
|
1293
1293
|
}
|
|
1294
|
-
function
|
|
1294
|
+
function Qe(n, e) {
|
|
1295
1295
|
return n.type.checkContent(e), n.copy(e);
|
|
1296
1296
|
}
|
|
1297
1297
|
function vs(n, e, t, r, i) {
|
|
1298
1298
|
let s = n.depth > i && hr(n, e, i + 1), o = r.depth > i && hr(t, r, i + 1), l = [];
|
|
1299
|
-
return
|
|
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
|
-
function
|
|
1301
|
+
function hn(n, e, t) {
|
|
1302
1302
|
let r = [];
|
|
1303
|
-
if (
|
|
1303
|
+
if (vt(null, n, t, r), n.depth > t) {
|
|
1304
1304
|
let i = hr(n, e, t + 1);
|
|
1305
|
-
Qe(
|
|
1305
|
+
Ze(Qe(i, hn(n, e, t + 1)), r);
|
|
1306
1306
|
}
|
|
1307
|
-
return
|
|
1307
|
+
return vt(e, null, t, r), new b(r);
|
|
1308
1308
|
}
|
|
1309
1309
|
function Ol(n, e) {
|
|
1310
1310
|
let t = e.depth - n.openStart, i = e.node(t).copy(n.content);
|
|
@@ -1315,7 +1315,7 @@ function Ol(n, e) {
|
|
|
1315
1315
|
end: i.resolveNoCache(i.content.size - n.openEnd - t)
|
|
1316
1316
|
};
|
|
1317
1317
|
}
|
|
1318
|
-
class
|
|
1318
|
+
class Rt {
|
|
1319
1319
|
/**
|
|
1320
1320
|
@internal
|
|
1321
1321
|
*/
|
|
@@ -1500,7 +1500,7 @@ class Pt {
|
|
|
1500
1500
|
return e.blockRange(this);
|
|
1501
1501
|
for (let r = this.depth - (this.parent.inlineContent || this.pos == e.pos ? 1 : 0); r >= 0; r--)
|
|
1502
1502
|
if (e.pos <= this.end(r) && (!t || t(this.node(r))))
|
|
1503
|
-
return new
|
|
1503
|
+
return new pn(this, e, r);
|
|
1504
1504
|
return null;
|
|
1505
1505
|
}
|
|
1506
1506
|
/**
|
|
@@ -1543,7 +1543,7 @@ class Pt {
|
|
|
1543
1543
|
break;
|
|
1544
1544
|
s = c - 1, i += a + 1;
|
|
1545
1545
|
}
|
|
1546
|
-
return new
|
|
1546
|
+
return new Rt(t, r, s);
|
|
1547
1547
|
}
|
|
1548
1548
|
/**
|
|
1549
1549
|
@internal
|
|
@@ -1558,7 +1558,7 @@ class Pt {
|
|
|
1558
1558
|
}
|
|
1559
1559
|
else
|
|
1560
1560
|
oi.set(e, r = new El());
|
|
1561
|
-
let i = r.elts[r.i] =
|
|
1561
|
+
let i = r.elts[r.i] = Rt.resolve(e, t);
|
|
1562
1562
|
return r.i = (r.i + 1) % vl, i;
|
|
1563
1563
|
}
|
|
1564
1564
|
}
|
|
@@ -1568,7 +1568,7 @@ class El {
|
|
|
1568
1568
|
}
|
|
1569
1569
|
}
|
|
1570
1570
|
const vl = 12, oi = /* @__PURE__ */ new WeakMap();
|
|
1571
|
-
class
|
|
1571
|
+
class pn {
|
|
1572
1572
|
/**
|
|
1573
1573
|
Construct a node range. `$from` and `$to` should point into the
|
|
1574
1574
|
same node until at least the given `depth`, since a node range
|
|
@@ -1609,7 +1609,7 @@ class mn {
|
|
|
1609
1609
|
}
|
|
1610
1610
|
}
|
|
1611
1611
|
const Nl = /* @__PURE__ */ Object.create(null);
|
|
1612
|
-
let
|
|
1612
|
+
let ze = class pr {
|
|
1613
1613
|
/**
|
|
1614
1614
|
@internal
|
|
1615
1615
|
*/
|
|
@@ -1727,7 +1727,7 @@ let Fe = class pr {
|
|
|
1727
1727
|
attributes, and marks.
|
|
1728
1728
|
*/
|
|
1729
1729
|
hasMarkup(e, t, r) {
|
|
1730
|
-
return this.type == e &&
|
|
1730
|
+
return this.type == e && un(this.attrs, t || e.defaultAttrs || Nl) && A.sameSet(this.marks, r || A.none);
|
|
1731
1731
|
}
|
|
1732
1732
|
/**
|
|
1733
1733
|
Create a new node with the same markup as this node, containing
|
|
@@ -1813,13 +1813,13 @@ let Fe = class pr {
|
|
|
1813
1813
|
[object](https://prosemirror.net/docs/ref/#model.ResolvedPos) with information about its context.
|
|
1814
1814
|
*/
|
|
1815
1815
|
resolve(e) {
|
|
1816
|
-
return
|
|
1816
|
+
return Rt.resolveCached(this, e);
|
|
1817
1817
|
}
|
|
1818
1818
|
/**
|
|
1819
1819
|
@internal
|
|
1820
1820
|
*/
|
|
1821
1821
|
resolveNoCache(e) {
|
|
1822
|
-
return
|
|
1822
|
+
return Rt.resolve(this, e);
|
|
1823
1823
|
}
|
|
1824
1824
|
/**
|
|
1825
1825
|
Test whether a given mark or mark type occurs in this document
|
|
@@ -1978,8 +1978,8 @@ let Fe = class pr {
|
|
|
1978
1978
|
return s.type.checkAttrs(s.attrs), s;
|
|
1979
1979
|
}
|
|
1980
1980
|
};
|
|
1981
|
-
|
|
1982
|
-
class
|
|
1981
|
+
ze.prototype.text = void 0;
|
|
1982
|
+
class mn extends ze {
|
|
1983
1983
|
/**
|
|
1984
1984
|
@internal
|
|
1985
1985
|
*/
|
|
@@ -2001,10 +2001,10 @@ class gn extends Fe {
|
|
|
2001
2001
|
return this.text.length;
|
|
2002
2002
|
}
|
|
2003
2003
|
mark(e) {
|
|
2004
|
-
return e == this.marks ? this : new
|
|
2004
|
+
return e == this.marks ? this : new mn(this.type, this.attrs, this.text, e);
|
|
2005
2005
|
}
|
|
2006
2006
|
withText(e) {
|
|
2007
|
-
return e == this.text ? this : new
|
|
2007
|
+
return e == this.text ? this : new mn(this.type, this.attrs, e, this.marks);
|
|
2008
2008
|
}
|
|
2009
2009
|
cut(e = 0, t = this.text.length) {
|
|
2010
2010
|
return e == 0 && t == this.text.length ? this : this.withText(this.text.slice(e, t));
|
|
@@ -2022,7 +2022,7 @@ function Ns(n, e) {
|
|
|
2022
2022
|
e = n[t].type.name + "(" + e + ")";
|
|
2023
2023
|
return e;
|
|
2024
2024
|
}
|
|
2025
|
-
class
|
|
2025
|
+
class rt {
|
|
2026
2026
|
/**
|
|
2027
2027
|
@internal
|
|
2028
2028
|
*/
|
|
@@ -2035,7 +2035,7 @@ class it {
|
|
|
2035
2035
|
static parse(e, t) {
|
|
2036
2036
|
let r = new Al(e, t);
|
|
2037
2037
|
if (r.next == null)
|
|
2038
|
-
return
|
|
2038
|
+
return rt.empty;
|
|
2039
2039
|
let i = As(r);
|
|
2040
2040
|
r.next && r.err("Unexpected trailing text");
|
|
2041
2041
|
let s = zl(Ll(i));
|
|
@@ -2184,7 +2184,7 @@ class it {
|
|
|
2184
2184
|
`);
|
|
2185
2185
|
}
|
|
2186
2186
|
}
|
|
2187
|
-
|
|
2187
|
+
rt.empty = new rt(!0);
|
|
2188
2188
|
class Al {
|
|
2189
2189
|
constructor(e, t) {
|
|
2190
2190
|
this.string = e, this.nodeTypes = t, this.inline = null, this.pos = 0, this.tokens = e.split(/\s*(?=\b|\W|$)/), this.tokens[this.tokens.length - 1] == "" && this.tokens.pop(), this.tokens[0] == "" && this.tokens.shift();
|
|
@@ -2347,7 +2347,7 @@ function zl(n) {
|
|
|
2347
2347
|
});
|
|
2348
2348
|
});
|
|
2349
2349
|
});
|
|
2350
|
-
let s = e[r.join(",")] = new
|
|
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
2352
|
let l = i[o][1].sort(Ds);
|
|
2353
2353
|
s.next.push({ type: i[o][0], next: e[l.join(",")] || t(l) });
|
|
@@ -2430,7 +2430,7 @@ let ci = class Ls {
|
|
|
2430
2430
|
True for node types that allow no content.
|
|
2431
2431
|
*/
|
|
2432
2432
|
get isLeaf() {
|
|
2433
|
-
return this.contentMatch ==
|
|
2433
|
+
return this.contentMatch == rt.empty;
|
|
2434
2434
|
}
|
|
2435
2435
|
/**
|
|
2436
2436
|
True when this node is an atom, i.e. when it does not have
|
|
@@ -2485,7 +2485,7 @@ let ci = class Ls {
|
|
|
2485
2485
|
create(e = null, t, r) {
|
|
2486
2486
|
if (this.isText)
|
|
2487
2487
|
throw new Error("NodeType.create can't construct text nodes");
|
|
2488
|
-
return new
|
|
2488
|
+
return new ze(this, this.computeAttrs(e), b.from(t), A.setFrom(r));
|
|
2489
2489
|
}
|
|
2490
2490
|
/**
|
|
2491
2491
|
Like [`create`](https://prosemirror.net/docs/ref/#model.NodeType.create), but check the given content
|
|
@@ -2493,7 +2493,7 @@ let ci = class Ls {
|
|
|
2493
2493
|
if it doesn't match.
|
|
2494
2494
|
*/
|
|
2495
2495
|
createChecked(e = null, t, r) {
|
|
2496
|
-
return t = b.from(t), this.checkContent(t), new
|
|
2496
|
+
return t = b.from(t), this.checkContent(t), new ze(this, this.computeAttrs(e), t, A.setFrom(r));
|
|
2497
2497
|
}
|
|
2498
2498
|
/**
|
|
2499
2499
|
Like [`create`](https://prosemirror.net/docs/ref/#model.NodeType.create), but see if it is
|
|
@@ -2511,7 +2511,7 @@ let ci = class Ls {
|
|
|
2511
2511
|
t = o.append(t);
|
|
2512
2512
|
}
|
|
2513
2513
|
let i = this.contentMatch.matchFragment(t), s = i && i.fillBefore(b.empty, !0);
|
|
2514
|
-
return s ? new
|
|
2514
|
+
return s ? new ze(this, e, t.append(s), A.setFrom(r)) : null;
|
|
2515
2515
|
}
|
|
2516
2516
|
/**
|
|
2517
2517
|
Returns true if the given fragment is valid content for this node
|
|
@@ -2601,7 +2601,7 @@ class Vl {
|
|
|
2601
2601
|
return !this.hasDefault;
|
|
2602
2602
|
}
|
|
2603
2603
|
}
|
|
2604
|
-
class
|
|
2604
|
+
class Nn {
|
|
2605
2605
|
/**
|
|
2606
2606
|
@internal
|
|
2607
2607
|
*/
|
|
@@ -2623,7 +2623,7 @@ class An {
|
|
|
2623
2623
|
*/
|
|
2624
2624
|
static compile(e, t) {
|
|
2625
2625
|
let r = /* @__PURE__ */ Object.create(null), i = 0;
|
|
2626
|
-
return e.forEach((s, o) => r[s] = new
|
|
2626
|
+
return e.forEach((s, o) => r[s] = new Nn(s, i++, t, o)), r;
|
|
2627
2627
|
}
|
|
2628
2628
|
/**
|
|
2629
2629
|
When there is a mark of this type in the given set, a new set
|
|
@@ -2665,13 +2665,13 @@ class zs {
|
|
|
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 = ci.compile(this.spec.nodes, this), this.marks =
|
|
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)
|
|
2672
2672
|
throw new RangeError(i + " can not be both a node and a mark");
|
|
2673
2673
|
let s = this.nodes[i], o = s.spec.content || "", l = s.spec.marks;
|
|
2674
|
-
if (s.contentMatch = r[o] || (r[o] =
|
|
2674
|
+
if (s.contentMatch = r[o] || (r[o] = rt.parse(o, this.nodes)), s.inlineContent = s.contentMatch.inlineContent, s.spec.linebreakReplacement) {
|
|
2675
2675
|
if (this.linebreakReplacement)
|
|
2676
2676
|
throw new RangeError("Multiple linebreak nodes defined");
|
|
2677
2677
|
if (!s.isInline || !s.isLeaf)
|
|
@@ -2684,7 +2684,7 @@ class zs {
|
|
|
2684
2684
|
let s = this.marks[i], o = s.spec.excludes;
|
|
2685
2685
|
s.excluded = o == null ? [s] : o == "" ? [] : di(this, o.split(" "));
|
|
2686
2686
|
}
|
|
2687
|
-
this.nodeFromJSON = (i) =>
|
|
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
|
}
|
|
2689
2689
|
/**
|
|
2690
2690
|
Create a node in this schema. The `type` may be a string or a
|
|
@@ -2707,7 +2707,7 @@ class zs {
|
|
|
2707
2707
|
*/
|
|
2708
2708
|
text(e, t) {
|
|
2709
2709
|
let r = this.nodes.text;
|
|
2710
|
-
return new
|
|
2710
|
+
return new mn(r, r.defaultAttrs, e, A.setFrom(t));
|
|
2711
2711
|
}
|
|
2712
2712
|
/**
|
|
2713
2713
|
Create a mark with the given type and attributes.
|
|
@@ -2747,7 +2747,7 @@ function Hl(n) {
|
|
|
2747
2747
|
function Wl(n) {
|
|
2748
2748
|
return n.style != null;
|
|
2749
2749
|
}
|
|
2750
|
-
class
|
|
2750
|
+
class Fe {
|
|
2751
2751
|
/**
|
|
2752
2752
|
Create a parser that targets the given schema, using the given
|
|
2753
2753
|
parsing rules.
|
|
@@ -2859,7 +2859,7 @@ class $e {
|
|
|
2859
2859
|
[priority](https://prosemirror.net/docs/ref/#model.GenericParseRule.priority).
|
|
2860
2860
|
*/
|
|
2861
2861
|
static fromSchema(e) {
|
|
2862
|
-
return e.cached.domParser || (e.cached.domParser = new
|
|
2862
|
+
return e.cached.domParser || (e.cached.domParser = new Fe(e, Fe.schemaRules(e)));
|
|
2863
2863
|
}
|
|
2864
2864
|
}
|
|
2865
2865
|
const Fs = {
|
|
@@ -2902,13 +2902,13 @@ const Fs = {
|
|
|
2902
2902
|
script: !0,
|
|
2903
2903
|
style: !0,
|
|
2904
2904
|
title: !0
|
|
2905
|
-
}, $s = { ol: !0, ul: !0 },
|
|
2905
|
+
}, $s = { ol: !0, ul: !0 }, Pt = 1, mr = 2, Nt = 4;
|
|
2906
2906
|
function ui(n, e, t) {
|
|
2907
|
-
return e != null ? (e ?
|
|
2907
|
+
return e != null ? (e ? Pt : 0) | (e === "full" ? mr : 0) : n && n.whitespace == "pre" ? Pt | mr : t & ~Nt;
|
|
2908
2908
|
}
|
|
2909
|
-
class
|
|
2909
|
+
class Qt {
|
|
2910
2910
|
constructor(e, t, r, i, s, o) {
|
|
2911
|
-
this.type = e, this.attrs = t, this.marks = r, this.solid = i, this.options = o, this.content = [], this.activeMarks = A.none, this.match = s || (o &
|
|
2911
|
+
this.type = e, this.attrs = t, this.marks = r, this.solid = i, this.options = o, this.content = [], this.activeMarks = A.none, this.match = s || (o & Nt ? null : e.contentMatch);
|
|
2912
2912
|
}
|
|
2913
2913
|
findWrapping(e) {
|
|
2914
2914
|
if (!this.match) {
|
|
@@ -2925,7 +2925,7 @@ class en {
|
|
|
2925
2925
|
return this.match.findWrapping(e.type);
|
|
2926
2926
|
}
|
|
2927
2927
|
finish(e) {
|
|
2928
|
-
if (!(this.options &
|
|
2928
|
+
if (!(this.options & Pt)) {
|
|
2929
2929
|
let r = this.content[this.content.length - 1], i;
|
|
2930
2930
|
if (r && r.isText && (i = /[ \t\r\n\u000c]+$/.exec(r.text))) {
|
|
2931
2931
|
let s = r;
|
|
@@ -2942,8 +2942,8 @@ class en {
|
|
|
2942
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 = ui(null, t.preserveWhitespace, 0) | (r ?
|
|
2946
|
-
i ? s = new
|
|
2945
|
+
let i = t.topNode, s, o = ui(null, t.preserveWhitespace, 0) | (r ? Nt : 0);
|
|
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() {
|
|
2949
2949
|
return this.nodes[this.open];
|
|
@@ -2955,7 +2955,7 @@ class fi {
|
|
|
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 & mr ? "full" : this.localPreserveWS || (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")
|
|
@@ -3125,9 +3125,9 @@ class fi {
|
|
|
3125
3125
|
let o = this.top;
|
|
3126
3126
|
o.match = o.match && o.match.matchType(e);
|
|
3127
3127
|
let l = ui(e, s, o.options);
|
|
3128
|
-
o.options &
|
|
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) : pi(c.type, e)) ? (a = c.addToSet(a), !1) : !0), this.nodes.push(new
|
|
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
|
|
@@ -3146,7 +3146,7 @@ class fi {
|
|
|
3146
3146
|
for (let t = this.open; t >= 0; t--) {
|
|
3147
3147
|
if (this.nodes[t] == e)
|
|
3148
3148
|
return this.open = t, !0;
|
|
3149
|
-
this.localPreserveWS && (this.nodes[t].options |=
|
|
3149
|
+
this.localPreserveWS && (this.nodes[t].options |= Pt);
|
|
3150
3150
|
}
|
|
3151
3151
|
return !1;
|
|
3152
3152
|
}
|
|
@@ -3254,7 +3254,7 @@ function pi(n, e) {
|
|
|
3254
3254
|
return !0;
|
|
3255
3255
|
}
|
|
3256
3256
|
}
|
|
3257
|
-
class
|
|
3257
|
+
class ct {
|
|
3258
3258
|
/**
|
|
3259
3259
|
Create a serializer. `nodes` should map node names to functions
|
|
3260
3260
|
that take a node and return a description of the corresponding
|
|
@@ -3274,7 +3274,7 @@ class dt {
|
|
|
3274
3274
|
nodes.
|
|
3275
3275
|
*/
|
|
3276
3276
|
serializeFragment(e, t = {}, r) {
|
|
3277
|
-
r || (r =
|
|
3277
|
+
r || (r = jn(t).createDocumentFragment());
|
|
3278
3278
|
let i = r, s = [];
|
|
3279
3279
|
return e.forEach((o) => {
|
|
3280
3280
|
if (s.length || o.marks.length) {
|
|
@@ -3303,7 +3303,7 @@ class dt {
|
|
|
3303
3303
|
@internal
|
|
3304
3304
|
*/
|
|
3305
3305
|
serializeNodeInner(e, t) {
|
|
3306
|
-
let { dom: r, contentDOM: i } =
|
|
3306
|
+
let { dom: r, contentDOM: i } = ln(jn(t), this.nodes[e.type.name](e), null, e.attrs);
|
|
3307
3307
|
if (i) {
|
|
3308
3308
|
if (e.isLeaf)
|
|
3309
3309
|
throw new RangeError("Content hole not allowed in a leaf node spec");
|
|
@@ -3331,17 +3331,17 @@ class dt {
|
|
|
3331
3331
|
*/
|
|
3332
3332
|
serializeMark(e, t, r = {}) {
|
|
3333
3333
|
let i = this.marks[e.type.name];
|
|
3334
|
-
return i &&
|
|
3334
|
+
return i && ln(jn(r), i(e, t), null, e.attrs);
|
|
3335
3335
|
}
|
|
3336
3336
|
static renderSpec(e, t, r = null, i) {
|
|
3337
|
-
return
|
|
3337
|
+
return ln(e, t, r, i);
|
|
3338
3338
|
}
|
|
3339
3339
|
/**
|
|
3340
3340
|
Build a serializer using the [`toDOM`](https://prosemirror.net/docs/ref/#model.NodeSpec.toDOM)
|
|
3341
3341
|
properties in a schema's node and mark specs.
|
|
3342
3342
|
*/
|
|
3343
3343
|
static fromSchema(e) {
|
|
3344
|
-
return e.cached.domSerializer || (e.cached.domSerializer = new
|
|
3344
|
+
return e.cached.domSerializer || (e.cached.domSerializer = new ct(this.nodesFromSchema(e), this.marksFromSchema(e)));
|
|
3345
3345
|
}
|
|
3346
3346
|
/**
|
|
3347
3347
|
Gather the serializers in a schema's node specs into an object.
|
|
@@ -3366,7 +3366,7 @@ function mi(n) {
|
|
|
3366
3366
|
}
|
|
3367
3367
|
return e;
|
|
3368
3368
|
}
|
|
3369
|
-
function
|
|
3369
|
+
function jn(n) {
|
|
3370
3370
|
return n.document || window.document;
|
|
3371
3371
|
}
|
|
3372
3372
|
const gi = /* @__PURE__ */ new WeakMap();
|
|
@@ -3390,7 +3390,7 @@ function Ul(n) {
|
|
|
3390
3390
|
}
|
|
3391
3391
|
return t(n), e;
|
|
3392
3392
|
}
|
|
3393
|
-
function
|
|
3393
|
+
function ln(n, e, t, r) {
|
|
3394
3394
|
if (typeof e == "string")
|
|
3395
3395
|
return { dom: n.createTextNode(e) };
|
|
3396
3396
|
if (e.nodeType != null)
|
|
@@ -3420,7 +3420,7 @@ function an(n, e, t, r) {
|
|
|
3420
3420
|
throw new RangeError("Content hole must be the only child of its parent node");
|
|
3421
3421
|
return { dom: a, contentDOM: a };
|
|
3422
3422
|
} else {
|
|
3423
|
-
let { dom: h, contentDOM: p } =
|
|
3423
|
+
let { dom: h, contentDOM: p } = ln(n, f, t, r);
|
|
3424
3424
|
if (a.appendChild(h), p) {
|
|
3425
3425
|
if (l)
|
|
3426
3426
|
throw new RangeError("Multiple content holes");
|
|
@@ -3440,7 +3440,7 @@ function yi(n) {
|
|
|
3440
3440
|
function Gl(n) {
|
|
3441
3441
|
return (n - (n & Vs)) / Hs;
|
|
3442
3442
|
}
|
|
3443
|
-
const Ws = 1, qs = 2,
|
|
3443
|
+
const Ws = 1, qs = 2, an = 4, js = 8;
|
|
3444
3444
|
class gr {
|
|
3445
3445
|
/**
|
|
3446
3446
|
@internal
|
|
@@ -3460,13 +3460,13 @@ class gr {
|
|
|
3460
3460
|
Tells you whether the token before the mapped position was deleted.
|
|
3461
3461
|
*/
|
|
3462
3462
|
get deletedBefore() {
|
|
3463
|
-
return (this.delInfo & (Ws |
|
|
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 & (qs |
|
|
3469
|
+
return (this.delInfo & (qs | an)) > 0;
|
|
3470
3470
|
}
|
|
3471
3471
|
/**
|
|
3472
3472
|
Tells whether any of the steps mapped through deletes across the
|
|
@@ -3474,7 +3474,7 @@ class gr {
|
|
|
3474
3474
|
position).
|
|
3475
3475
|
*/
|
|
3476
3476
|
get deletedAcross() {
|
|
3477
|
-
return (this.delInfo &
|
|
3477
|
+
return (this.delInfo & an) > 0;
|
|
3478
3478
|
}
|
|
3479
3479
|
}
|
|
3480
3480
|
class le {
|
|
@@ -3517,7 +3517,7 @@ 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 ? qs : e == u ? Ws :
|
|
3520
|
+
let p = e == (t < 0 ? a : u) ? null : _l(l / 3, e - a), m = e == a ? qs : e == u ? Ws : an;
|
|
3521
3521
|
return (t < 0 ? e != a : e != u) && (m |= js), new gr(h, m, p);
|
|
3522
3522
|
}
|
|
3523
3523
|
i += d - c;
|
|
@@ -3574,7 +3574,7 @@ class le {
|
|
|
3574
3574
|
}
|
|
3575
3575
|
}
|
|
3576
3576
|
le.empty = new le([]);
|
|
3577
|
-
class
|
|
3577
|
+
class Bt {
|
|
3578
3578
|
/**
|
|
3579
3579
|
Create a new mapping with the given position maps.
|
|
3580
3580
|
*/
|
|
@@ -3591,7 +3591,7 @@ class Lt {
|
|
|
3591
3591
|
Create a mapping that maps only through a part of this one.
|
|
3592
3592
|
*/
|
|
3593
3593
|
slice(e = 0, t = this.maps.length) {
|
|
3594
|
-
return new
|
|
3594
|
+
return new Bt(this._maps, this.mirror, e, t);
|
|
3595
3595
|
}
|
|
3596
3596
|
/**
|
|
3597
3597
|
Add a step map to the end of this mapping. If `mirrors` is
|
|
@@ -3642,7 +3642,7 @@ class Lt {
|
|
|
3642
3642
|
Create an inverted version of this mapping.
|
|
3643
3643
|
*/
|
|
3644
3644
|
invert() {
|
|
3645
|
-
let e = new
|
|
3645
|
+
let e = new Bt();
|
|
3646
3646
|
return e.appendMappingInverted(this), e;
|
|
3647
3647
|
}
|
|
3648
3648
|
/**
|
|
@@ -3681,7 +3681,7 @@ class Lt {
|
|
|
3681
3681
|
return r ? e : new gr(e, i, null);
|
|
3682
3682
|
}
|
|
3683
3683
|
}
|
|
3684
|
-
const
|
|
3684
|
+
const Kn = /* @__PURE__ */ Object.create(null);
|
|
3685
3685
|
class Z {
|
|
3686
3686
|
/**
|
|
3687
3687
|
Get the step map that represents the changes made by this step,
|
|
@@ -3706,7 +3706,7 @@ class Z {
|
|
|
3706
3706
|
static fromJSON(e, t) {
|
|
3707
3707
|
if (!t || !t.stepType)
|
|
3708
3708
|
throw new RangeError("Invalid input for Step.fromJSON");
|
|
3709
|
-
let r =
|
|
3709
|
+
let r = Kn[t.stepType];
|
|
3710
3710
|
if (!r)
|
|
3711
3711
|
throw new RangeError(`No step type ${t.stepType} defined`);
|
|
3712
3712
|
return r.fromJSON(e, t);
|
|
@@ -3718,9 +3718,9 @@ class Z {
|
|
|
3718
3718
|
that's unlikely to clash with steps from other modules.
|
|
3719
3719
|
*/
|
|
3720
3720
|
static jsonID(e, t) {
|
|
3721
|
-
if (e in
|
|
3721
|
+
if (e in Kn)
|
|
3722
3722
|
throw new RangeError("Duplicate use of step JSON ID " + e);
|
|
3723
|
-
return
|
|
3723
|
+
return Kn[e] = t, t.prototype.jsonID = e, t;
|
|
3724
3724
|
}
|
|
3725
3725
|
}
|
|
3726
3726
|
class B {
|
|
@@ -3751,7 +3751,7 @@ class B {
|
|
|
3751
3751
|
try {
|
|
3752
3752
|
return B.ok(e.replace(t, r, i));
|
|
3753
3753
|
} catch (s) {
|
|
3754
|
-
if (s instanceof
|
|
3754
|
+
if (s instanceof fn)
|
|
3755
3755
|
return B.fail(s.message);
|
|
3756
3756
|
throw s;
|
|
3757
3757
|
}
|
|
@@ -3765,7 +3765,7 @@ function Br(n, e, t) {
|
|
|
3765
3765
|
}
|
|
3766
3766
|
return b.fromArray(r);
|
|
3767
3767
|
}
|
|
3768
|
-
class
|
|
3768
|
+
class Pe extends Z {
|
|
3769
3769
|
/**
|
|
3770
3770
|
Create a mark step.
|
|
3771
3771
|
*/
|
|
@@ -3781,10 +3781,10 @@ class Be extends Z {
|
|
|
3781
3781
|
}
|
|
3782
3782
|
map(e) {
|
|
3783
3783
|
let t = e.mapResult(this.from, 1), r = e.mapResult(this.to, -1);
|
|
3784
|
-
return t.deleted && r.deleted || t.pos >= r.pos ? null : new
|
|
3784
|
+
return t.deleted && r.deleted || t.pos >= r.pos ? null : new Pe(t.pos, r.pos, this.mark);
|
|
3785
3785
|
}
|
|
3786
3786
|
merge(e) {
|
|
3787
|
-
return e instanceof
|
|
3787
|
+
return e instanceof Pe && e.mark.eq(this.mark) && this.from <= e.to && this.to >= e.from ? new Pe(Math.min(this.from, e.from), Math.max(this.to, e.to), this.mark) : null;
|
|
3788
3788
|
}
|
|
3789
3789
|
toJSON() {
|
|
3790
3790
|
return {
|
|
@@ -3800,10 +3800,10 @@ class Be extends Z {
|
|
|
3800
3800
|
static fromJSON(e, t) {
|
|
3801
3801
|
if (typeof t.from != "number" || typeof t.to != "number")
|
|
3802
3802
|
throw new RangeError("Invalid input for AddMarkStep.fromJSON");
|
|
3803
|
-
return new
|
|
3803
|
+
return new Pe(t.from, t.to, e.markFromJSON(t.mark));
|
|
3804
3804
|
}
|
|
3805
3805
|
}
|
|
3806
|
-
Z.jsonID("addMark",
|
|
3806
|
+
Z.jsonID("addMark", Pe);
|
|
3807
3807
|
class ke extends Z {
|
|
3808
3808
|
/**
|
|
3809
3809
|
Create a mark-removing step.
|
|
@@ -3816,7 +3816,7 @@ class ke extends Z {
|
|
|
3816
3816
|
return B.fromReplace(e, this.from, this.to, r);
|
|
3817
3817
|
}
|
|
3818
3818
|
invert() {
|
|
3819
|
-
return new
|
|
3819
|
+
return new Pe(this.from, this.to, this.mark);
|
|
3820
3820
|
}
|
|
3821
3821
|
map(e) {
|
|
3822
3822
|
let t = e.mapResult(this.from, 1), r = e.mapResult(this.to, -1);
|
|
@@ -3843,7 +3843,7 @@ class ke extends Z {
|
|
|
3843
3843
|
}
|
|
3844
3844
|
}
|
|
3845
3845
|
Z.jsonID("removeMark", ke);
|
|
3846
|
-
class
|
|
3846
|
+
class Be extends Z {
|
|
3847
3847
|
/**
|
|
3848
3848
|
Create a node mark step.
|
|
3849
3849
|
*/
|
|
@@ -3864,15 +3864,15 @@ class Le extends Z {
|
|
|
3864
3864
|
if (r.length == t.marks.length) {
|
|
3865
3865
|
for (let i = 0; i < t.marks.length; i++)
|
|
3866
3866
|
if (!t.marks[i].isInSet(r))
|
|
3867
|
-
return new
|
|
3868
|
-
return new
|
|
3867
|
+
return new Be(this.pos, t.marks[i]);
|
|
3868
|
+
return new Be(this.pos, this.mark);
|
|
3869
3869
|
}
|
|
3870
3870
|
}
|
|
3871
|
-
return new
|
|
3871
|
+
return new it(this.pos, this.mark);
|
|
3872
3872
|
}
|
|
3873
3873
|
map(e) {
|
|
3874
3874
|
let t = e.mapResult(this.pos, 1);
|
|
3875
|
-
return t.deletedAfter ? null : new
|
|
3875
|
+
return t.deletedAfter ? null : new Be(t.pos, this.mark);
|
|
3876
3876
|
}
|
|
3877
3877
|
toJSON() {
|
|
3878
3878
|
return { stepType: "addNodeMark", pos: this.pos, mark: this.mark.toJSON() };
|
|
@@ -3883,11 +3883,11 @@ class Le extends Z {
|
|
|
3883
3883
|
static fromJSON(e, t) {
|
|
3884
3884
|
if (typeof t.pos != "number")
|
|
3885
3885
|
throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");
|
|
3886
|
-
return new
|
|
3886
|
+
return new Be(t.pos, e.markFromJSON(t.mark));
|
|
3887
3887
|
}
|
|
3888
3888
|
}
|
|
3889
|
-
Z.jsonID("addNodeMark",
|
|
3890
|
-
class
|
|
3889
|
+
Z.jsonID("addNodeMark", Be);
|
|
3890
|
+
class it extends Z {
|
|
3891
3891
|
/**
|
|
3892
3892
|
Create a mark-removing step.
|
|
3893
3893
|
*/
|
|
@@ -3903,11 +3903,11 @@ class st extends Z {
|
|
|
3903
3903
|
}
|
|
3904
3904
|
invert(e) {
|
|
3905
3905
|
let t = e.nodeAt(this.pos);
|
|
3906
|
-
return !t || !this.mark.isInSet(t.marks) ? this : new
|
|
3906
|
+
return !t || !this.mark.isInSet(t.marks) ? this : new Be(this.pos, this.mark);
|
|
3907
3907
|
}
|
|
3908
3908
|
map(e) {
|
|
3909
3909
|
let t = e.mapResult(this.pos, 1);
|
|
3910
|
-
return t.deletedAfter ? null : new
|
|
3910
|
+
return t.deletedAfter ? null : new it(t.pos, this.mark);
|
|
3911
3911
|
}
|
|
3912
3912
|
toJSON() {
|
|
3913
3913
|
return { stepType: "removeNodeMark", pos: this.pos, mark: this.mark.toJSON() };
|
|
@@ -3918,10 +3918,10 @@ class st extends Z {
|
|
|
3918
3918
|
static fromJSON(e, t) {
|
|
3919
3919
|
if (typeof t.pos != "number")
|
|
3920
3920
|
throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");
|
|
3921
|
-
return new
|
|
3921
|
+
return new it(t.pos, e.markFromJSON(t.mark));
|
|
3922
3922
|
}
|
|
3923
3923
|
}
|
|
3924
|
-
Z.jsonID("removeNodeMark",
|
|
3924
|
+
Z.jsonID("removeNodeMark", it);
|
|
3925
3925
|
class P extends Z {
|
|
3926
3926
|
/**
|
|
3927
3927
|
The given `slice` should fit the 'gap' between `from` and
|
|
@@ -4057,7 +4057,7 @@ function Yl(n, e, t, r) {
|
|
|
4057
4057
|
let f = Math.max(c, e), h = Math.min(c + a.nodeSize, t), p = r.addToSet(u);
|
|
4058
4058
|
for (let m = 0; m < u.length; m++)
|
|
4059
4059
|
u[m].isInSet(p) || (o && o.to == f && o.mark.eq(u[m]) ? o.to = h : i.push(o = new ke(f, h, u[m])));
|
|
4060
|
-
l && l.to == f ? l.to = h : s.push(l = new
|
|
4060
|
+
l && l.to == f ? l.to = h : s.push(l = new Pe(f, h, r));
|
|
4061
4061
|
}
|
|
4062
4062
|
}), i.forEach((a) => n.step(a)), s.forEach((a) => n.step(a));
|
|
4063
4063
|
}
|
|
@@ -4068,7 +4068,7 @@ function Xl(n, e, t, r) {
|
|
|
4068
4068
|
return;
|
|
4069
4069
|
s++;
|
|
4070
4070
|
let a = null;
|
|
4071
|
-
if (r instanceof
|
|
4071
|
+
if (r instanceof Nn) {
|
|
4072
4072
|
let c = o.marks, d;
|
|
4073
4073
|
for (; d = r.isInSet(c); )
|
|
4074
4074
|
(a || (a = [])).push(d), c = d.removeFromSet(c);
|
|
@@ -4114,7 +4114,7 @@ function Lr(n, e, t, r = t.contentMatch, i = !0) {
|
|
|
4114
4114
|
function Zl(n, e, t) {
|
|
4115
4115
|
return (e == 0 || n.canReplace(e, n.childCount)) && (t == n.childCount || n.canReplace(0, t));
|
|
4116
4116
|
}
|
|
4117
|
-
function
|
|
4117
|
+
function Mt(n) {
|
|
4118
4118
|
let t = n.parent.content.cutByIndex(n.startIndex, n.endIndex);
|
|
4119
4119
|
for (let r = n.depth, i = 0, s = 0; ; --r) {
|
|
4120
4120
|
let o = n.$from.node(r), l = n.$from.index(r) + i, a = n.$to.indexAfter(r) - s;
|
|
@@ -4251,7 +4251,7 @@ function oa(n, e, t = 1, r) {
|
|
|
4251
4251
|
}
|
|
4252
4252
|
n.step(new P(e, e, new k(s.append(o), t, t), !0));
|
|
4253
4253
|
}
|
|
4254
|
-
function
|
|
4254
|
+
function qe(n, e) {
|
|
4255
4255
|
let t = n.resolve(e), r = t.index();
|
|
4256
4256
|
return Us(t.nodeBefore, t.nodeAfter) && t.parent.canReplace(r, r + 1);
|
|
4257
4257
|
}
|
|
@@ -4268,7 +4268,7 @@ function la(n, e) {
|
|
|
4268
4268
|
function Us(n, e) {
|
|
4269
4269
|
return !!(n && e && !n.isLeaf && la(n, e));
|
|
4270
4270
|
}
|
|
4271
|
-
function
|
|
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);
|
|
@@ -4341,7 +4341,7 @@ function _s(n, e, t) {
|
|
|
4341
4341
|
}
|
|
4342
4342
|
return null;
|
|
4343
4343
|
}
|
|
4344
|
-
function
|
|
4344
|
+
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);
|
|
@@ -4396,7 +4396,7 @@ class da {
|
|
|
4396
4396
|
for (let t = 1; t <= 2; t++)
|
|
4397
4397
|
for (let r = t == 1 ? e : this.unplaced.openStart; r >= 0; r--) {
|
|
4398
4398
|
let i, s = null;
|
|
4399
|
-
r ? (s =
|
|
4399
|
+
r ? (s = Jn(this.unplaced.content, r - 1).firstChild, i = s.content) : i = this.unplaced.content;
|
|
4400
4400
|
let o = i.firstChild;
|
|
4401
4401
|
for (let l = this.depth; l >= 0; l--) {
|
|
4402
4402
|
let { type: a, match: c } = this.frontier[l], d, u = null;
|
|
@@ -4410,16 +4410,16 @@ class da {
|
|
|
4410
4410
|
}
|
|
4411
4411
|
}
|
|
4412
4412
|
openMore() {
|
|
4413
|
-
let { content: e, openStart: t, openEnd: r } = this.unplaced, i =
|
|
4413
|
+
let { content: e, openStart: t, openEnd: r } = this.unplaced, i = Jn(e, t);
|
|
4414
4414
|
return !i.childCount || i.firstChild.isLeaf ? !1 : (this.unplaced = new k(e, t + 1, Math.max(r, i.size + t >= e.size - r ? t + 1 : 0)), !0);
|
|
4415
4415
|
}
|
|
4416
4416
|
dropNode() {
|
|
4417
|
-
let { content: e, openStart: t, openEnd: r } = this.unplaced, i =
|
|
4417
|
+
let { content: e, openStart: t, openEnd: r } = this.unplaced, i = Jn(e, t);
|
|
4418
4418
|
if (i.childCount <= 1 && t > 0) {
|
|
4419
4419
|
let s = e.size - t <= t + i.size;
|
|
4420
|
-
this.unplaced = new k(
|
|
4420
|
+
this.unplaced = new k(Tt(e, t - 1, 1), t - 1, s ? t - 1 : r);
|
|
4421
4421
|
} else
|
|
4422
|
-
this.unplaced = new k(
|
|
4422
|
+
this.unplaced = new k(Tt(e, t, 1), t, r);
|
|
4423
4423
|
}
|
|
4424
4424
|
// Move content from the unplaced slice at `sliceDepth` to the
|
|
4425
4425
|
// frontier node at `frontierDepth`. Close that frontier node when
|
|
@@ -4444,18 +4444,18 @@ class da {
|
|
|
4444
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
|
-
p || (h = -1), this.placed =
|
|
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();
|
|
4448
4448
|
for (let m = 0, g = l; m < h; m++) {
|
|
4449
4449
|
let y = g.lastChild;
|
|
4450
4450
|
this.frontier.push({ type: y.type, match: y.contentMatchAt(y.childCount) }), g = y.content;
|
|
4451
4451
|
}
|
|
4452
|
-
this.unplaced = p ? e == 0 ? k.empty : new k(
|
|
4452
|
+
this.unplaced = p ? e == 0 ? k.empty : new k(Tt(o.content, e - 1, 1), e - 1, h < 0 ? o.openEnd : e - 1) : new k(Tt(o.content, e, c), o.openStart, o.openEnd);
|
|
4453
4453
|
}
|
|
4454
4454
|
mustMoveInline() {
|
|
4455
4455
|
if (!this.$to.parent.isTextblock)
|
|
4456
4456
|
return -1;
|
|
4457
4457
|
let e = this.frontier[this.depth], t;
|
|
4458
|
-
if (!e.type.isTextblock || !
|
|
4458
|
+
if (!e.type.isTextblock || !Un(this.$to, this.$to.depth, e.type, e.match, !1) || this.$to.depth == this.depth && (t = this.findCloseLevel(this.$to)) && t.depth == this.depth)
|
|
4459
4459
|
return -1;
|
|
4460
4460
|
let { depth: r } = this.$to, i = this.$to.after(r);
|
|
4461
4461
|
for (; r > 1 && i == this.$to.end(--r); )
|
|
@@ -4464,10 +4464,10 @@ class da {
|
|
|
4464
4464
|
}
|
|
4465
4465
|
findCloseLevel(e) {
|
|
4466
4466
|
e: for (let t = Math.min(this.depth, e.depth); t >= 0; t--) {
|
|
4467
|
-
let { match: r, type: i } = this.frontier[t], s = t < e.depth && e.end(t + 1) == e.pos + (e.depth - (t + 1)), o =
|
|
4467
|
+
let { match: r, type: i } = this.frontier[t], s = t < e.depth && e.end(t + 1) == e.pos + (e.depth - (t + 1)), o = Un(e, t, i, r, s);
|
|
4468
4468
|
if (o) {
|
|
4469
4469
|
for (let l = t - 1; l >= 0; l--) {
|
|
4470
|
-
let { match: a, type: c } = this.frontier[l], d =
|
|
4470
|
+
let { match: a, type: c } = this.frontier[l], d = Un(e, l, c, a, !0);
|
|
4471
4471
|
if (!d || d.childCount)
|
|
4472
4472
|
continue e;
|
|
4473
4473
|
}
|
|
@@ -4481,7 +4481,7 @@ class da {
|
|
|
4481
4481
|
return null;
|
|
4482
4482
|
for (; this.depth > t.depth; )
|
|
4483
4483
|
this.closeFrontierNode();
|
|
4484
|
-
t.fit.childCount && (this.placed =
|
|
4484
|
+
t.fit.childCount && (this.placed = Ot(this.placed, t.depth, t.fit)), e = t.move;
|
|
4485
4485
|
for (let r = t.depth + 1; r <= e.depth; r++) {
|
|
4486
4486
|
let i = e.node(r), s = i.type.contentMatch.fillBefore(i.content, !0, e.index(r));
|
|
4487
4487
|
this.openFrontierNode(i.type, i.attrs, s);
|
|
@@ -4490,20 +4490,20 @@ class da {
|
|
|
4490
4490
|
}
|
|
4491
4491
|
openFrontierNode(e, t = null, r) {
|
|
4492
4492
|
let i = this.frontier[this.depth];
|
|
4493
|
-
i.match = i.match.matchType(e), this.placed =
|
|
4493
|
+
i.match = i.match.matchType(e), this.placed = Ot(this.placed, this.depth, b.from(e.create(t, r))), this.frontier.push({ type: e, match: e.contentMatch });
|
|
4494
4494
|
}
|
|
4495
4495
|
closeFrontierNode() {
|
|
4496
4496
|
let t = this.frontier.pop().match.fillBefore(b.empty, !0);
|
|
4497
|
-
t.childCount && (this.placed =
|
|
4497
|
+
t.childCount && (this.placed = Ot(this.placed, this.frontier.length, t));
|
|
4498
4498
|
}
|
|
4499
4499
|
}
|
|
4500
|
-
function
|
|
4501
|
-
return e == 0 ? n.cutByIndex(t, n.childCount) : n.replaceChild(0, n.firstChild.copy(
|
|
4500
|
+
function Tt(n, e, t) {
|
|
4501
|
+
return e == 0 ? n.cutByIndex(t, n.childCount) : n.replaceChild(0, n.firstChild.copy(Tt(n.firstChild.content, e - 1, t)));
|
|
4502
4502
|
}
|
|
4503
|
-
function
|
|
4504
|
-
return e == 0 ? n.append(t) : n.replaceChild(n.childCount - 1, n.lastChild.copy(
|
|
4503
|
+
function Ot(n, e, t) {
|
|
4504
|
+
return e == 0 ? n.append(t) : n.replaceChild(n.childCount - 1, n.lastChild.copy(Ot(n.lastChild.content, e - 1, t)));
|
|
4505
4505
|
}
|
|
4506
|
-
function
|
|
4506
|
+
function Jn(n, e) {
|
|
4507
4507
|
for (let t = 0; t < e; t++)
|
|
4508
4508
|
n = n.firstChild.content;
|
|
4509
4509
|
return n;
|
|
@@ -4514,7 +4514,7 @@ function Ys(n, e, t) {
|
|
|
4514
4514
|
let r = n.content;
|
|
4515
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
|
-
function
|
|
4517
|
+
function Un(n, e, t, r, i) {
|
|
4518
4518
|
let s = n.node(e), o = i ? n.indexAfter(e) : n.index(e);
|
|
4519
4519
|
if (o == s.childCount && !t.compatibleContent(s.type))
|
|
4520
4520
|
return null;
|
|
@@ -4634,7 +4634,7 @@ function Zs(n, e) {
|
|
|
4634
4634
|
}
|
|
4635
4635
|
return t;
|
|
4636
4636
|
}
|
|
4637
|
-
class
|
|
4637
|
+
class gt extends Z {
|
|
4638
4638
|
/**
|
|
4639
4639
|
Construct an attribute step.
|
|
4640
4640
|
*/
|
|
@@ -4656,11 +4656,11 @@ class yt extends Z {
|
|
|
4656
4656
|
return le.empty;
|
|
4657
4657
|
}
|
|
4658
4658
|
invert(e) {
|
|
4659
|
-
return new
|
|
4659
|
+
return new gt(this.pos, this.attr, e.nodeAt(this.pos).attrs[this.attr]);
|
|
4660
4660
|
}
|
|
4661
4661
|
map(e) {
|
|
4662
4662
|
let t = e.mapResult(this.pos, 1);
|
|
4663
|
-
return t.deletedAfter ? null : new
|
|
4663
|
+
return t.deletedAfter ? null : new gt(t.pos, this.attr, this.value);
|
|
4664
4664
|
}
|
|
4665
4665
|
toJSON() {
|
|
4666
4666
|
return { stepType: "attr", pos: this.pos, attr: this.attr, value: this.value };
|
|
@@ -4668,11 +4668,11 @@ class yt extends Z {
|
|
|
4668
4668
|
static fromJSON(e, t) {
|
|
4669
4669
|
if (typeof t.pos != "number" || typeof t.attr != "string")
|
|
4670
4670
|
throw new RangeError("Invalid input for AttrStep.fromJSON");
|
|
4671
|
-
return new
|
|
4671
|
+
return new gt(t.pos, t.attr, t.value);
|
|
4672
4672
|
}
|
|
4673
4673
|
}
|
|
4674
|
-
Z.jsonID("attr",
|
|
4675
|
-
class
|
|
4674
|
+
Z.jsonID("attr", gt);
|
|
4675
|
+
class Lt extends Z {
|
|
4676
4676
|
/**
|
|
4677
4677
|
Construct an attribute step.
|
|
4678
4678
|
*/
|
|
@@ -4691,7 +4691,7 @@ class zt extends Z {
|
|
|
4691
4691
|
return le.empty;
|
|
4692
4692
|
}
|
|
4693
4693
|
invert(e) {
|
|
4694
|
-
return new
|
|
4694
|
+
return new Lt(this.attr, e.attrs[this.attr]);
|
|
4695
4695
|
}
|
|
4696
4696
|
map(e) {
|
|
4697
4697
|
return this;
|
|
@@ -4702,25 +4702,25 @@ class zt extends Z {
|
|
|
4702
4702
|
static fromJSON(e, t) {
|
|
4703
4703
|
if (typeof t.attr != "string")
|
|
4704
4704
|
throw new RangeError("Invalid input for DocAttrStep.fromJSON");
|
|
4705
|
-
return new
|
|
4705
|
+
return new Lt(t.attr, t.value);
|
|
4706
4706
|
}
|
|
4707
4707
|
}
|
|
4708
|
-
Z.jsonID("docAttr",
|
|
4709
|
-
let
|
|
4708
|
+
Z.jsonID("docAttr", Lt);
|
|
4709
|
+
let bt = class extends Error {
|
|
4710
4710
|
};
|
|
4711
|
-
|
|
4711
|
+
bt = function n(e) {
|
|
4712
4712
|
let t = Error.call(this, e);
|
|
4713
4713
|
return t.__proto__ = n.prototype, t;
|
|
4714
4714
|
};
|
|
4715
|
-
|
|
4716
|
-
|
|
4717
|
-
|
|
4715
|
+
bt.prototype = Object.create(Error.prototype);
|
|
4716
|
+
bt.prototype.constructor = bt;
|
|
4717
|
+
bt.prototype.name = "TransformError";
|
|
4718
4718
|
class ga {
|
|
4719
4719
|
/**
|
|
4720
4720
|
Create a transform that starts with the given document.
|
|
4721
4721
|
*/
|
|
4722
4722
|
constructor(e) {
|
|
4723
|
-
this.doc = e, this.steps = [], this.docs = [], this.mapping = new
|
|
4723
|
+
this.doc = e, this.steps = [], this.docs = [], this.mapping = new Bt();
|
|
4724
4724
|
}
|
|
4725
4725
|
/**
|
|
4726
4726
|
The starting document.
|
|
@@ -4735,7 +4735,7 @@ class ga {
|
|
|
4735
4735
|
step(e) {
|
|
4736
4736
|
let t = this.maybeStep(e);
|
|
4737
4737
|
if (t.failed)
|
|
4738
|
-
throw new
|
|
4738
|
+
throw new bt(t.failed);
|
|
4739
4739
|
return this;
|
|
4740
4740
|
}
|
|
4741
4741
|
/**
|
|
@@ -4780,7 +4780,7 @@ class ga {
|
|
|
4780
4780
|
given `slice`.
|
|
4781
4781
|
*/
|
|
4782
4782
|
replace(e, t = e, r = k.empty) {
|
|
4783
|
-
let i =
|
|
4783
|
+
let i = Dn(this.doc, e, t, r);
|
|
4784
4784
|
return i && this.step(i), this;
|
|
4785
4785
|
}
|
|
4786
4786
|
/**
|
|
@@ -4888,19 +4888,19 @@ class ga {
|
|
|
4888
4888
|
to set attributes on the document itself.
|
|
4889
4889
|
*/
|
|
4890
4890
|
setNodeAttribute(e, t, r) {
|
|
4891
|
-
return this.step(new
|
|
4891
|
+
return this.step(new gt(e, t, r)), this;
|
|
4892
4892
|
}
|
|
4893
4893
|
/**
|
|
4894
4894
|
Set a single attribute on the document to a new value.
|
|
4895
4895
|
*/
|
|
4896
4896
|
setDocAttribute(e, t) {
|
|
4897
|
-
return this.step(new
|
|
4897
|
+
return this.step(new Lt(e, t)), this;
|
|
4898
4898
|
}
|
|
4899
4899
|
/**
|
|
4900
4900
|
Add a mark to the node at position `pos`.
|
|
4901
4901
|
*/
|
|
4902
4902
|
addNodeMark(e, t) {
|
|
4903
|
-
return this.step(new
|
|
4903
|
+
return this.step(new Be(e, t)), this;
|
|
4904
4904
|
}
|
|
4905
4905
|
/**
|
|
4906
4906
|
Remove a mark (or all marks of the given type) from the node at
|
|
@@ -4911,11 +4911,11 @@ class ga {
|
|
|
4911
4911
|
if (!r)
|
|
4912
4912
|
throw new RangeError("No node at position " + e);
|
|
4913
4913
|
if (t instanceof A)
|
|
4914
|
-
t.isInSet(r.marks) && this.step(new
|
|
4914
|
+
t.isInSet(r.marks) && this.step(new it(e, t));
|
|
4915
4915
|
else {
|
|
4916
4916
|
let i = r.marks, s, o = [];
|
|
4917
4917
|
for (; s = t.isInSet(i); )
|
|
4918
|
-
o.push(new
|
|
4918
|
+
o.push(new it(e, s)), i = s.removeFromSet(i);
|
|
4919
4919
|
for (let l = o.length - 1; l >= 0; l--)
|
|
4920
4920
|
this.step(o[l]);
|
|
4921
4921
|
}
|
|
@@ -4956,7 +4956,7 @@ class ga {
|
|
|
4956
4956
|
return Lr(this, e, t, r), this;
|
|
4957
4957
|
}
|
|
4958
4958
|
}
|
|
4959
|
-
const
|
|
4959
|
+
const _n = /* @__PURE__ */ Object.create(null);
|
|
4960
4960
|
class E {
|
|
4961
4961
|
/**
|
|
4962
4962
|
Initialize a selection with the head and anchor and ranges. If no
|
|
@@ -5051,11 +5051,11 @@ class E {
|
|
|
5051
5051
|
found.
|
|
5052
5052
|
*/
|
|
5053
5053
|
static findFrom(e, t, r = !1) {
|
|
5054
|
-
let i = e.parent.inlineContent ? new M(e) :
|
|
5054
|
+
let i = e.parent.inlineContent ? new M(e) : ft(e.node(0), e.parent, e.pos, e.index(), t, r);
|
|
5055
5055
|
if (i)
|
|
5056
5056
|
return i;
|
|
5057
5057
|
for (let s = e.depth - 1; s >= 0; s--) {
|
|
5058
|
-
let o = t < 0 ?
|
|
5058
|
+
let o = t < 0 ? ft(e.node(0), e.node(s), e.before(s + 1), e.index(s), t, r) : ft(e.node(0), e.node(s), e.after(s + 1), e.index(s) + 1, t, r);
|
|
5059
5059
|
if (o)
|
|
5060
5060
|
return o;
|
|
5061
5061
|
}
|
|
@@ -5076,14 +5076,14 @@ class E {
|
|
|
5076
5076
|
exists.
|
|
5077
5077
|
*/
|
|
5078
5078
|
static atStart(e) {
|
|
5079
|
-
return
|
|
5079
|
+
return ft(e, e, 0, 0, 1) || new ce(e);
|
|
5080
5080
|
}
|
|
5081
5081
|
/**
|
|
5082
5082
|
Find the cursor or leaf node selection closest to the end of the
|
|
5083
5083
|
given document.
|
|
5084
5084
|
*/
|
|
5085
5085
|
static atEnd(e) {
|
|
5086
|
-
return
|
|
5086
|
+
return ft(e, e, e.content.size, e.childCount, -1) || new ce(e);
|
|
5087
5087
|
}
|
|
5088
5088
|
/**
|
|
5089
5089
|
Deserialize the JSON representation of a selection. Must be
|
|
@@ -5092,7 +5092,7 @@ class E {
|
|
|
5092
5092
|
static fromJSON(e, t) {
|
|
5093
5093
|
if (!t || !t.type)
|
|
5094
5094
|
throw new RangeError("Invalid input for Selection.fromJSON");
|
|
5095
|
-
let r =
|
|
5095
|
+
let r = _n[t.type];
|
|
5096
5096
|
if (!r)
|
|
5097
5097
|
throw new RangeError(`No selection type ${t.type} defined`);
|
|
5098
5098
|
return r.fromJSON(e, t);
|
|
@@ -5104,9 +5104,9 @@ class E {
|
|
|
5104
5104
|
clash with classes from other modules.
|
|
5105
5105
|
*/
|
|
5106
5106
|
static jsonID(e, t) {
|
|
5107
|
-
if (e in
|
|
5107
|
+
if (e in _n)
|
|
5108
5108
|
throw new RangeError("Duplicate use of selection JSON ID " + e);
|
|
5109
|
-
return
|
|
5109
|
+
return _n[e] = t, t.prototype.jsonID = e, t;
|
|
5110
5110
|
}
|
|
5111
5111
|
/**
|
|
5112
5112
|
Get a [bookmark](https://prosemirror.net/docs/ref/#state.SelectionBookmark) for this selection,
|
|
@@ -5165,7 +5165,7 @@ class M extends E {
|
|
|
5165
5165
|
return e instanceof M && e.anchor == this.anchor && e.head == this.head;
|
|
5166
5166
|
}
|
|
5167
5167
|
getBookmark() {
|
|
5168
|
-
return new
|
|
5168
|
+
return new In(this.anchor, this.head);
|
|
5169
5169
|
}
|
|
5170
5170
|
toJSON() {
|
|
5171
5171
|
return { type: "text", anchor: this.anchor, head: this.head };
|
|
@@ -5206,12 +5206,12 @@ class M extends E {
|
|
|
5206
5206
|
}
|
|
5207
5207
|
}
|
|
5208
5208
|
E.jsonID("text", M);
|
|
5209
|
-
class
|
|
5209
|
+
class In {
|
|
5210
5210
|
constructor(e, t) {
|
|
5211
5211
|
this.anchor = e, this.head = t;
|
|
5212
5212
|
}
|
|
5213
5213
|
map(e) {
|
|
5214
|
-
return new
|
|
5214
|
+
return new In(e.map(this.anchor), e.map(this.head));
|
|
5215
5215
|
}
|
|
5216
5216
|
resolve(e) {
|
|
5217
5217
|
return M.between(e.resolve(this.anchor), e.resolve(this.head));
|
|
@@ -5272,7 +5272,7 @@ class Fr {
|
|
|
5272
5272
|
}
|
|
5273
5273
|
map(e) {
|
|
5274
5274
|
let { deleted: t, pos: r } = e.mapResult(this.anchor);
|
|
5275
|
-
return t ? 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;
|
|
@@ -5322,7 +5322,7 @@ const ba = {
|
|
|
5322
5322
|
return new ce(n);
|
|
5323
5323
|
}
|
|
5324
5324
|
};
|
|
5325
|
-
function
|
|
5325
|
+
function ft(n, e, t, r, i, s = !1) {
|
|
5326
5326
|
if (e.inlineContent)
|
|
5327
5327
|
return M.create(n, t);
|
|
5328
5328
|
for (let o = r - (i > 0 ? 0 : 1); i > 0 ? o < e.childCount : o >= 0; o += i) {
|
|
@@ -5331,7 +5331,7 @@ function ht(n, e, t, r, i, s = !1) {
|
|
|
5331
5331
|
if (!s && S.isSelectable(l))
|
|
5332
5332
|
return S.create(n, t - (i < 0 ? l.nodeSize : 0));
|
|
5333
5333
|
} else {
|
|
5334
|
-
let a =
|
|
5334
|
+
let a = ft(n, l, t + i, i < 0 ? l.childCount : 0, i, s);
|
|
5335
5335
|
if (a)
|
|
5336
5336
|
return a;
|
|
5337
5337
|
}
|
|
@@ -5351,7 +5351,7 @@ function Si(n, e, t) {
|
|
|
5351
5351
|
o == null && (o = d);
|
|
5352
5352
|
}), n.setSelection(E.near(n.doc.resolve(o), t));
|
|
5353
5353
|
}
|
|
5354
|
-
const Mi = 1,
|
|
5354
|
+
const Mi = 1, en = 2, wi = 4;
|
|
5355
5355
|
class ka extends ga {
|
|
5356
5356
|
/**
|
|
5357
5357
|
@internal
|
|
@@ -5375,7 +5375,7 @@ 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 | Mi) & ~
|
|
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.
|
|
@@ -5387,7 +5387,7 @@ class ka extends ga {
|
|
|
5387
5387
|
Set the current stored marks.
|
|
5388
5388
|
*/
|
|
5389
5389
|
setStoredMarks(e) {
|
|
5390
|
-
return this.storedMarks = e, this.updated |=
|
|
5390
|
+
return this.storedMarks = e, this.updated |= en, this;
|
|
5391
5391
|
}
|
|
5392
5392
|
/**
|
|
5393
5393
|
Make sure the current stored marks or, if that is null, the marks
|
|
@@ -5413,13 +5413,13 @@ class ka extends ga {
|
|
|
5413
5413
|
Whether the stored marks were explicitly set for this transaction.
|
|
5414
5414
|
*/
|
|
5415
5415
|
get storedMarksSet() {
|
|
5416
|
-
return (this.updated &
|
|
5416
|
+
return (this.updated & en) > 0;
|
|
5417
5417
|
}
|
|
5418
5418
|
/**
|
|
5419
5419
|
@internal
|
|
5420
5420
|
*/
|
|
5421
5421
|
addStep(e, t) {
|
|
5422
|
-
super.addStep(e, t), this.updated = this.updated & ~
|
|
5422
|
+
super.addStep(e, t), this.updated = this.updated & ~en, this.storedMarks = null;
|
|
5423
5423
|
}
|
|
5424
5424
|
/**
|
|
5425
5425
|
Update the timestamp for the transaction.
|
|
@@ -5506,13 +5506,13 @@ class ka extends ga {
|
|
|
5506
5506
|
function Ci(n, e) {
|
|
5507
5507
|
return !e || !n ? n : n.bind(e);
|
|
5508
5508
|
}
|
|
5509
|
-
class
|
|
5509
|
+
class Et {
|
|
5510
5510
|
constructor(e, t, r) {
|
|
5511
5511
|
this.name = e, this.init = Ci(t.init, r), this.apply = Ci(t.apply, r);
|
|
5512
5512
|
}
|
|
5513
5513
|
}
|
|
5514
5514
|
const xa = [
|
|
5515
|
-
new
|
|
5515
|
+
new Et("doc", {
|
|
5516
5516
|
init(n) {
|
|
5517
5517
|
return n.doc || n.schema.topNodeType.createAndFill();
|
|
5518
5518
|
},
|
|
@@ -5520,7 +5520,7 @@ const xa = [
|
|
|
5520
5520
|
return n.doc;
|
|
5521
5521
|
}
|
|
5522
5522
|
}),
|
|
5523
|
-
new
|
|
5523
|
+
new Et("selection", {
|
|
5524
5524
|
init(n, e) {
|
|
5525
5525
|
return n.selection || E.atStart(e.doc);
|
|
5526
5526
|
},
|
|
@@ -5528,7 +5528,7 @@ const xa = [
|
|
|
5528
5528
|
return n.selection;
|
|
5529
5529
|
}
|
|
5530
5530
|
}),
|
|
5531
|
-
new
|
|
5531
|
+
new Et("storedMarks", {
|
|
5532
5532
|
init(n) {
|
|
5533
5533
|
return n.storedMarks || null;
|
|
5534
5534
|
},
|
|
@@ -5536,7 +5536,7 @@ const xa = [
|
|
|
5536
5536
|
return r.selection.$cursor ? n.storedMarks : null;
|
|
5537
5537
|
}
|
|
5538
5538
|
}),
|
|
5539
|
-
new
|
|
5539
|
+
new Et("scrollToSelection", {
|
|
5540
5540
|
init() {
|
|
5541
5541
|
return 0;
|
|
5542
5542
|
},
|
|
@@ -5545,16 +5545,16 @@ const xa = [
|
|
|
5545
5545
|
}
|
|
5546
5546
|
})
|
|
5547
5547
|
];
|
|
5548
|
-
class
|
|
5548
|
+
class Gn {
|
|
5549
5549
|
constructor(e, t) {
|
|
5550
5550
|
this.schema = e, this.plugins = [], this.pluginsByKey = /* @__PURE__ */ Object.create(null), this.fields = xa.slice(), t && t.forEach((r) => {
|
|
5551
5551
|
if (this.pluginsByKey[r.key])
|
|
5552
5552
|
throw new RangeError("Adding different instances of a keyed plugin (" + r.key + ")");
|
|
5553
|
-
this.plugins.push(r), this.pluginsByKey[r.key] = r, r.spec.state && this.fields.push(new
|
|
5553
|
+
this.plugins.push(r), this.pluginsByKey[r.key] = r, r.spec.state && this.fields.push(new Et(r.key, r.spec.state, r));
|
|
5554
5554
|
});
|
|
5555
5555
|
}
|
|
5556
5556
|
}
|
|
5557
|
-
class
|
|
5557
|
+
class pt {
|
|
5558
5558
|
/**
|
|
5559
5559
|
@internal
|
|
5560
5560
|
*/
|
|
@@ -5629,7 +5629,7 @@ class mt {
|
|
|
5629
5629
|
applyInner(e) {
|
|
5630
5630
|
if (!e.before.eq(this.doc))
|
|
5631
5631
|
throw new RangeError("Applying a mismatched transaction");
|
|
5632
|
-
let t = new
|
|
5632
|
+
let t = new pt(this.config), r = this.config.fields;
|
|
5633
5633
|
for (let i = 0; i < r.length; i++) {
|
|
5634
5634
|
let s = r[i];
|
|
5635
5635
|
t[s.name] = s.apply(e, this[s.name], this, t);
|
|
@@ -5646,7 +5646,7 @@ class mt {
|
|
|
5646
5646
|
Create a new state.
|
|
5647
5647
|
*/
|
|
5648
5648
|
static create(e) {
|
|
5649
|
-
let t = new
|
|
5649
|
+
let t = new Gn(e.doc ? e.doc.type.schema : e.schema, e.plugins), r = new pt(t);
|
|
5650
5650
|
for (let i = 0; i < t.fields.length; i++)
|
|
5651
5651
|
r[t.fields[i].name] = t.fields[i].init(e, r);
|
|
5652
5652
|
return r;
|
|
@@ -5660,7 +5660,7 @@ class mt {
|
|
|
5660
5660
|
configuration object..
|
|
5661
5661
|
*/
|
|
5662
5662
|
reconfigure(e) {
|
|
5663
|
-
let t = new
|
|
5663
|
+
let t = new Gn(this.schema, e.plugins), r = t.fields, i = new pt(t);
|
|
5664
5664
|
for (let s = 0; s < r.length; s++) {
|
|
5665
5665
|
let o = r[s].name;
|
|
5666
5666
|
i[o] = this.hasOwnProperty(o) ? this[o] : r[s].init(e, i);
|
|
@@ -5697,10 +5697,10 @@ class mt {
|
|
|
5697
5697
|
throw new RangeError("Invalid input for EditorState.fromJSON");
|
|
5698
5698
|
if (!e.schema)
|
|
5699
5699
|
throw new RangeError("Required config field 'schema' missing");
|
|
5700
|
-
let i = new
|
|
5700
|
+
let i = new Gn(e.schema, e.plugins), s = new pt(i);
|
|
5701
5701
|
return i.fields.forEach((o) => {
|
|
5702
5702
|
if (o.name == "doc")
|
|
5703
|
-
s.doc =
|
|
5703
|
+
s.doc = ze.fromJSON(e.schema, t.doc);
|
|
5704
5704
|
else if (o.name == "selection")
|
|
5705
5705
|
s.selection = E.fromJSON(s.doc, t.selection);
|
|
5706
5706
|
else if (o.name == "storedMarks")
|
|
@@ -5740,9 +5740,9 @@ class se {
|
|
|
5740
5740
|
return e[this.key];
|
|
5741
5741
|
}
|
|
5742
5742
|
}
|
|
5743
|
-
const
|
|
5743
|
+
const Yn = /* @__PURE__ */ Object.create(null);
|
|
5744
5744
|
function eo(n) {
|
|
5745
|
-
return n in
|
|
5745
|
+
return n in Yn ? n + "$" + ++Yn[n] : (Yn[n] = 0, n + "$");
|
|
5746
5746
|
}
|
|
5747
5747
|
class we {
|
|
5748
5748
|
/**
|
|
@@ -5769,7 +5769,7 @@ const K = function(n) {
|
|
|
5769
5769
|
for (var e = 0; ; e++)
|
|
5770
5770
|
if (n = n.previousSibling, !n)
|
|
5771
5771
|
return e;
|
|
5772
|
-
},
|
|
5772
|
+
}, kt = function(n) {
|
|
5773
5773
|
let e = n.assignedSlot || n.parentNode;
|
|
5774
5774
|
return e && e.nodeType == 11 ? e.host : e;
|
|
5775
5775
|
};
|
|
@@ -5779,7 +5779,7 @@ const Te = function(n, e, t) {
|
|
|
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
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
5785
|
function Ti(n, e, t, r, i) {
|
|
@@ -5788,7 +5788,7 @@ function Ti(n, e, t, r, i) {
|
|
|
5788
5788
|
return !0;
|
|
5789
5789
|
if (e == (i < 0 ? 0 : fe(n))) {
|
|
5790
5790
|
let o = n.parentNode;
|
|
5791
|
-
if (!o || o.nodeType != 1 ||
|
|
5791
|
+
if (!o || o.nodeType != 1 || Gt(n) || Ma.test(n.nodeName) || n.contentEditable == "false")
|
|
5792
5792
|
return !1;
|
|
5793
5793
|
e = K(n) + (i < 0 ? 0 : 1), n = o;
|
|
5794
5794
|
} else if (n.nodeType == 1) {
|
|
@@ -5815,7 +5815,7 @@ function wa(n, e) {
|
|
|
5815
5815
|
if (n.contentEditable == "false")
|
|
5816
5816
|
return null;
|
|
5817
5817
|
n = n.childNodes[e - 1], e = fe(n);
|
|
5818
|
-
} else if (n.parentNode && !
|
|
5818
|
+
} else if (n.parentNode && !Gt(n))
|
|
5819
5819
|
e = K(n), n = n.parentNode;
|
|
5820
5820
|
else
|
|
5821
5821
|
return null;
|
|
@@ -5829,7 +5829,7 @@ function Ca(n, e) {
|
|
|
5829
5829
|
if (n.contentEditable == "false")
|
|
5830
5830
|
return null;
|
|
5831
5831
|
n = n.childNodes[e], e = 0;
|
|
5832
|
-
} else if (n.parentNode && !
|
|
5832
|
+
} else if (n.parentNode && !Gt(n))
|
|
5833
5833
|
e = K(n) + 1, n = n.parentNode;
|
|
5834
5834
|
else
|
|
5835
5835
|
return null;
|
|
@@ -5845,16 +5845,16 @@ function Ta(n, e, t) {
|
|
|
5845
5845
|
r = r && s == 0, i = i && s == fe(n);
|
|
5846
5846
|
}
|
|
5847
5847
|
}
|
|
5848
|
-
function
|
|
5848
|
+
function Gt(n) {
|
|
5849
5849
|
let e;
|
|
5850
5850
|
for (let t = n; t && !(e = t.pmViewDesc); t = t.parentNode)
|
|
5851
5851
|
;
|
|
5852
5852
|
return e && e.node && e.node.isBlock && (e.dom == n || e.contentDOM == n);
|
|
5853
5853
|
}
|
|
5854
|
-
const
|
|
5855
|
-
return n.focusNode &&
|
|
5854
|
+
const Rn = function(n) {
|
|
5855
|
+
return n.focusNode && st(n.focusNode, n.focusOffset, n.anchorNode, n.anchorOffset);
|
|
5856
5856
|
};
|
|
5857
|
-
function
|
|
5857
|
+
function Je(n, e) {
|
|
5858
5858
|
let t = document.createEvent("Event");
|
|
5859
5859
|
return t.initEvent("keydown", !0, !0), t.keyCode = n, t.key = t.code = e, t;
|
|
5860
5860
|
}
|
|
@@ -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, Oi = typeof document < "u" ? document : null,
|
|
5882
|
-
pe && +(/Firefox\/(\d+)/.exec(
|
|
5883
|
-
const Sr = !ie && /Chrome\/(\d+)/.exec(
|
|
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
|
+
pe && +(/Firefox\/(\d+)/.exec(je) || [0, 0])[1];
|
|
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 ? {
|
|
@@ -5911,7 +5911,7 @@ 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) {
|
|
5914
|
-
o =
|
|
5914
|
+
o = kt(o);
|
|
5915
5915
|
continue;
|
|
5916
5916
|
}
|
|
5917
5917
|
let l = o, a = l == s.body, c = a ? Na(s) : Aa(l), d = 0, u = 0;
|
|
@@ -5927,7 +5927,7 @@ function Ei(n, e, t) {
|
|
|
5927
5927
|
let f = a ? "fixed" : getComputedStyle(o).position;
|
|
5928
5928
|
if (/^(fixed|sticky)$/.test(f))
|
|
5929
5929
|
break;
|
|
5930
|
-
o = f == "absolute" ? o.offsetParent :
|
|
5930
|
+
o = f == "absolute" ? o.offsetParent : kt(o);
|
|
5931
5931
|
}
|
|
5932
5932
|
}
|
|
5933
5933
|
function Da(n) {
|
|
@@ -5946,7 +5946,7 @@ function Da(n) {
|
|
|
5946
5946
|
}
|
|
5947
5947
|
function io(n) {
|
|
5948
5948
|
let e = [], t = n.ownerDocument;
|
|
5949
|
-
for (let r = n; r && (e.push({ dom: r, top: r.scrollTop, left: r.scrollLeft }), n != t); r =
|
|
5949
|
+
for (let r = n; r && (e.push({ dom: r, top: r.scrollTop, left: r.scrollLeft }), n != t); r = kt(r))
|
|
5950
5950
|
;
|
|
5951
5951
|
return e;
|
|
5952
5952
|
}
|
|
@@ -5960,18 +5960,18 @@ function so(n, e) {
|
|
|
5960
5960
|
r.scrollTop != i + e && (r.scrollTop = i + e), r.scrollLeft != s && (r.scrollLeft = s);
|
|
5961
5961
|
}
|
|
5962
5962
|
}
|
|
5963
|
-
let
|
|
5963
|
+
let dt = null;
|
|
5964
5964
|
function Ra(n) {
|
|
5965
5965
|
if (n.setActive)
|
|
5966
5966
|
return n.setActive();
|
|
5967
|
-
if (
|
|
5968
|
-
return n.focus(
|
|
5967
|
+
if (dt)
|
|
5968
|
+
return n.focus(dt);
|
|
5969
5969
|
let e = io(n);
|
|
5970
|
-
n.focus(
|
|
5970
|
+
n.focus(dt == null ? {
|
|
5971
5971
|
get preventScroll() {
|
|
5972
|
-
return
|
|
5972
|
+
return dt = { preventScroll: !0 }, !0;
|
|
5973
5973
|
}
|
|
5974
|
-
} : void 0),
|
|
5974
|
+
} : void 0), dt || (dt = !1, so(e, 0));
|
|
5975
5975
|
}
|
|
5976
5976
|
function oo(n, e) {
|
|
5977
5977
|
let t, r = 2e8, i, s = 0, o = e.top, l = e.top, a, c;
|
|
@@ -6005,7 +6005,7 @@ 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
|
-
let o =
|
|
6008
|
+
let o = Ae(r, 1);
|
|
6009
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;
|
|
@@ -6069,7 +6069,7 @@ function Fa(n, e) {
|
|
|
6069
6069
|
return null;
|
|
6070
6070
|
}
|
|
6071
6071
|
if (X)
|
|
6072
|
-
for (let c = o; r && c; c =
|
|
6072
|
+
for (let c = o; r && c; c = kt(c))
|
|
6073
6073
|
c.draggable && (r = void 0);
|
|
6074
6074
|
if (o = Ba(o, e), r) {
|
|
6075
6075
|
if (pe && r.nodeType == 1 && (i = Math.min(i, r.childNodes.length), i < r.childNodes.length)) {
|
|
@@ -6077,7 +6077,7 @@ function Fa(n, e) {
|
|
|
6077
6077
|
d.nodeName == "IMG" && (u = d.getBoundingClientRect()).right <= e.left && u.bottom > e.top && i++;
|
|
6078
6078
|
}
|
|
6079
6079
|
let c;
|
|
6080
|
-
|
|
6080
|
+
Yt && i && r.nodeType == 1 && (c = r.childNodes[i - 1]).nodeType == 1 && c.contentEditable == "false" && c.getBoundingClientRect().top >= e.top && i--, r == n.dom && i == r.childNodes.length - 1 && r.lastChild.nodeType == 1 && e.top > r.lastChild.getBoundingClientRect().bottom ? l = n.state.doc.content.size : (i == 0 || r.nodeType != 1 || r.childNodes[i - 1].nodeName != "BR") && (l = za(n, r, i, e));
|
|
6081
6081
|
}
|
|
6082
6082
|
l == null && (l = La(n, o, e));
|
|
6083
6083
|
let a = n.docView.nearestDesc(o, !0);
|
|
@@ -6086,7 +6086,7 @@ function Fa(n, e) {
|
|
|
6086
6086
|
function vi(n) {
|
|
6087
6087
|
return n.top < n.bottom || n.left < n.right;
|
|
6088
6088
|
}
|
|
6089
|
-
function
|
|
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];
|
|
@@ -6097,40 +6097,40 @@ function De(n, e) {
|
|
|
6097
6097
|
}
|
|
6098
6098
|
const $a = /[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;
|
|
6099
6099
|
function ao(n, e, t) {
|
|
6100
|
-
let { node: r, offset: i, atom: s } = n.docView.domFromPos(e, t < 0 ? -1 : 1), o =
|
|
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))) {
|
|
6103
|
-
let a =
|
|
6103
|
+
let a = Ae(Te(r, i, i), t);
|
|
6104
6104
|
if (pe && i && /\s/.test(r.nodeValue[i - 1]) && i < r.nodeValue.length) {
|
|
6105
|
-
let c =
|
|
6105
|
+
let c = Ae(Te(r, i - 1, i - 1), -1);
|
|
6106
6106
|
if (c.top == a.top) {
|
|
6107
|
-
let d =
|
|
6107
|
+
let d = Ae(Te(r, i, i + 1), -1);
|
|
6108
6108
|
if (d.top != a.top)
|
|
6109
|
-
return
|
|
6109
|
+
return wt(d, d.left < c.left);
|
|
6110
6110
|
}
|
|
6111
6111
|
}
|
|
6112
6112
|
return a;
|
|
6113
6113
|
} else {
|
|
6114
6114
|
let a = i, c = i, d = t < 0 ? 1 : -1;
|
|
6115
|
-
return t < 0 && !i ? (c++, d = -1) : t >= 0 && i == r.nodeValue.length ? (a--, d = 1) : t < 0 ? a-- : c++,
|
|
6115
|
+
return t < 0 && !i ? (c++, d = -1) : t >= 0 && i == r.nodeValue.length ? (a--, d = 1) : t < 0 ? a-- : c++, wt(Ae(Te(r, a, c), d), d < 0);
|
|
6116
6116
|
}
|
|
6117
6117
|
if (!n.state.doc.resolve(e - (s || 0)).parent.inlineContent) {
|
|
6118
6118
|
if (s == null && i && (t < 0 || i == fe(r))) {
|
|
6119
6119
|
let a = r.childNodes[i - 1];
|
|
6120
6120
|
if (a.nodeType == 1)
|
|
6121
|
-
return
|
|
6121
|
+
return Xn(a.getBoundingClientRect(), !1);
|
|
6122
6122
|
}
|
|
6123
6123
|
if (s == null && i < fe(r)) {
|
|
6124
6124
|
let a = r.childNodes[i];
|
|
6125
6125
|
if (a.nodeType == 1)
|
|
6126
|
-
return
|
|
6126
|
+
return Xn(a.getBoundingClientRect(), !0);
|
|
6127
6127
|
}
|
|
6128
|
-
return
|
|
6128
|
+
return Xn(r.getBoundingClientRect(), t >= 0);
|
|
6129
6129
|
}
|
|
6130
6130
|
if (s == null && i && (t < 0 || i == fe(r))) {
|
|
6131
6131
|
let a = r.childNodes[i - 1], c = a.nodeType == 3 ? Te(a, fe(a) - (o ? 0 : 1)) : a.nodeType == 1 && (a.nodeName != "BR" || !a.nextSibling) ? a : null;
|
|
6132
6132
|
if (c)
|
|
6133
|
-
return
|
|
6133
|
+
return wt(Ae(c, 1), !1);
|
|
6134
6134
|
}
|
|
6135
6135
|
if (s == null && i < fe(r)) {
|
|
6136
6136
|
let a = r.childNodes[i];
|
|
@@ -6138,17 +6138,17 @@ function ao(n, e, t) {
|
|
|
6138
6138
|
a = a.nextSibling;
|
|
6139
6139
|
let c = a ? a.nodeType == 3 ? Te(a, 0, o ? 0 : 1) : a.nodeType == 1 ? a : null : null;
|
|
6140
6140
|
if (c)
|
|
6141
|
-
return
|
|
6141
|
+
return wt(Ae(c, -1), !0);
|
|
6142
6142
|
}
|
|
6143
|
-
return
|
|
6143
|
+
return wt(Ae(r.nodeType == 3 ? Te(r) : r, -t), t >= 0);
|
|
6144
6144
|
}
|
|
6145
|
-
function
|
|
6145
|
+
function wt(n, e) {
|
|
6146
6146
|
if (n.width == 0)
|
|
6147
6147
|
return n;
|
|
6148
6148
|
let t = e ? n.left : n.right;
|
|
6149
6149
|
return { top: n.top, bottom: n.bottom, left: t, right: t };
|
|
6150
6150
|
}
|
|
6151
|
-
function
|
|
6151
|
+
function Xn(n, e) {
|
|
6152
6152
|
if (n.height == 0)
|
|
6153
6153
|
return n;
|
|
6154
6154
|
let t = e ? n.top : n.bottom;
|
|
@@ -6216,8 +6216,8 @@ let Ni = null, Ai = null, Di = !1;
|
|
|
6216
6216
|
function qa(n, e, t) {
|
|
6217
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, Ii = 1,
|
|
6220
|
-
class
|
|
6219
|
+
const me = 0, Ii = 1, _e = 2, Se = 3;
|
|
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;
|
|
6223
6223
|
}
|
|
@@ -6499,7 +6499,7 @@ class Zt {
|
|
|
6499
6499
|
let h = d.focusNode.childNodes[d.focusOffset];
|
|
6500
6500
|
h && h.contentEditable == "false" && (i = !0);
|
|
6501
6501
|
}
|
|
6502
|
-
if (!(i || u && X) &&
|
|
6502
|
+
if (!(i || u && X) && st(l.node, l.offset, d.anchorNode, d.anchorOffset) && st(a.node, a.offset, d.focusNode, d.focusOffset))
|
|
6503
6503
|
return;
|
|
6504
6504
|
let f = !1;
|
|
6505
6505
|
if ((c.extend || e == t) && !(u && pe)) {
|
|
@@ -6532,19 +6532,19 @@ class Zt {
|
|
|
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 ?
|
|
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
|
-
s.dirty = s.dom == s.contentDOM && s.dom.parentNode == this.contentDOM && !s.children.length ?
|
|
6538
|
+
s.dirty = s.dom == s.contentDOM && s.dom.parentNode == this.contentDOM && !s.children.length ? _e : Se;
|
|
6539
6539
|
}
|
|
6540
6540
|
r = o;
|
|
6541
6541
|
}
|
|
6542
|
-
this.dirty =
|
|
6542
|
+
this.dirty = _e;
|
|
6543
6543
|
}
|
|
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 ?
|
|
6547
|
+
let r = e == 1 ? _e : Ii;
|
|
6548
6548
|
t.dirty < r && (t.dirty = r);
|
|
6549
6549
|
}
|
|
6550
6550
|
}
|
|
@@ -6561,7 +6561,7 @@ class Zt {
|
|
|
6561
6561
|
return !1;
|
|
6562
6562
|
}
|
|
6563
6563
|
}
|
|
6564
|
-
class uo extends
|
|
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, () => {
|
|
@@ -6604,7 +6604,7 @@ class uo extends Zt {
|
|
|
6604
6604
|
return this.widget.type.side;
|
|
6605
6605
|
}
|
|
6606
6606
|
}
|
|
6607
|
-
class ja extends
|
|
6607
|
+
class ja extends Xt {
|
|
6608
6608
|
constructor(e, t, r, i) {
|
|
6609
6609
|
super(e, [], t, null), this.textDOM = r, this.text = i;
|
|
6610
6610
|
}
|
|
@@ -6621,13 +6621,13 @@ class ja extends Zt {
|
|
|
6621
6621
|
return e.type === "characterData" && e.target.nodeValue == e.oldValue;
|
|
6622
6622
|
}
|
|
6623
6623
|
}
|
|
6624
|
-
class
|
|
6624
|
+
class ot extends Xt {
|
|
6625
6625
|
constructor(e, t, r, i, s) {
|
|
6626
6626
|
super(e, [], r, i), this.mark = t, this.spec = s;
|
|
6627
6627
|
}
|
|
6628
6628
|
static create(e, t, r, i) {
|
|
6629
6629
|
let s = i.nodeViews[t.type.name], o = s && s(t, i, r);
|
|
6630
|
-
return (!o || !o.dom) && (o =
|
|
6630
|
+
return (!o || !o.dom) && (o = ct.renderSpec(document, t.type.spec.toDOM(t, r), null, t.attrs)), new ot(e, t, o.dom, o.contentDOM || o.dom, o);
|
|
6631
6631
|
}
|
|
6632
6632
|
parseRule() {
|
|
6633
6633
|
return this.dirty & Se || this.mark.type.spec.reparseInView ? null : { mark: this.mark.type.name, attrs: this.mark.attrs, contentElement: this.contentDOM };
|
|
@@ -6644,7 +6644,7 @@ class lt extends Zt {
|
|
|
6644
6644
|
}
|
|
6645
6645
|
}
|
|
6646
6646
|
slice(e, t, r) {
|
|
6647
|
-
let i =
|
|
6647
|
+
let i = ot.create(this.parent, this.mark, !0, r), s = this.children, o = this.size;
|
|
6648
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;
|
|
@@ -6657,7 +6657,7 @@ class lt extends Zt {
|
|
|
6657
6657
|
this.spec.destroy && this.spec.destroy(), super.destroy();
|
|
6658
6658
|
}
|
|
6659
6659
|
}
|
|
6660
|
-
class
|
|
6660
|
+
class Ve extends Xt {
|
|
6661
6661
|
constructor(e, t, r, i, s, o, l, a, c) {
|
|
6662
6662
|
super(e, [], s, o), this.node = t, this.outerDeco = r, this.innerDeco = i, this.nodeDOM = l;
|
|
6663
6663
|
}
|
|
@@ -6682,10 +6682,10 @@ class He extends Zt {
|
|
|
6682
6682
|
d = document.createTextNode(t.text);
|
|
6683
6683
|
else if (d.nodeType != 3)
|
|
6684
6684
|
throw new RangeError("Text must be rendered as a DOM text node");
|
|
6685
|
-
} else d || ({ dom: d, contentDOM: u } =
|
|
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 = mo(d, r, t), c ? a = new Ka(e, t, r, i, d, u || null, f, c, s, o + 1) : t.isText ? new
|
|
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)
|
|
@@ -6708,7 +6708,7 @@ class He extends Zt {
|
|
|
6708
6708
|
return e;
|
|
6709
6709
|
}
|
|
6710
6710
|
matchesNode(e, t, r) {
|
|
6711
|
-
return this.dirty == me && e.eq(this.node) &&
|
|
6711
|
+
return this.dirty == me && e.eq(this.node) && gn(t, this.outerDeco) && r.eq(this.innerDeco);
|
|
6712
6712
|
}
|
|
6713
6713
|
get size() {
|
|
6714
6714
|
return this.node.nodeSize;
|
|
@@ -6728,7 +6728,7 @@ class He extends Zt {
|
|
|
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 ==
|
|
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;
|
|
@@ -6766,7 +6766,7 @@ class He extends Zt {
|
|
|
6766
6766
|
this.updateOuterDeco(t), this.node = e, this.innerDeco = r, this.contentDOM && this.updateChildren(i, this.posAtStart), this.dirty = me;
|
|
6767
6767
|
}
|
|
6768
6768
|
updateOuterDeco(e) {
|
|
6769
|
-
if (
|
|
6769
|
+
if (gn(e, this.outerDeco))
|
|
6770
6770
|
return;
|
|
6771
6771
|
let t = this.nodeDOM.nodeType != 1, r = this.dom;
|
|
6772
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;
|
|
@@ -6785,10 +6785,10 @@ class He extends Zt {
|
|
|
6785
6785
|
}
|
|
6786
6786
|
function Ri(n, e, t, r, i) {
|
|
6787
6787
|
mo(r, e, n);
|
|
6788
|
-
let s = new
|
|
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
|
}
|
|
6791
|
-
class
|
|
6791
|
+
class Pn extends Ve {
|
|
6792
6792
|
constructor(e, t, r, i, s, o, l) {
|
|
6793
6793
|
super(e, t, r, i, s, null, o, l, 0);
|
|
6794
6794
|
}
|
|
@@ -6819,7 +6819,7 @@ class Bn extends He {
|
|
|
6819
6819
|
}
|
|
6820
6820
|
slice(e, t, r) {
|
|
6821
6821
|
let i = this.node.cut(e, t), s = document.createTextNode(i.text);
|
|
6822
|
-
return new
|
|
6822
|
+
return new Pn(this.parent, i, this.outerDeco, this.innerDeco, s, s, r);
|
|
6823
6823
|
}
|
|
6824
6824
|
markDirty(e, t) {
|
|
6825
6825
|
super.markDirty(e, t), this.dom != this.nodeDOM && (e == 0 || t == this.nodeDOM.nodeValue.length) && (this.dirty = Se);
|
|
@@ -6831,7 +6831,7 @@ class Bn extends He {
|
|
|
6831
6831
|
return this.node.text == e;
|
|
6832
6832
|
}
|
|
6833
6833
|
}
|
|
6834
|
-
class fo extends
|
|
6834
|
+
class fo extends Xt {
|
|
6835
6835
|
parseRule() {
|
|
6836
6836
|
return { ignore: !0 };
|
|
6837
6837
|
}
|
|
@@ -6845,7 +6845,7 @@ class fo extends Zt {
|
|
|
6845
6845
|
return this.dom.nodeName == "IMG";
|
|
6846
6846
|
}
|
|
6847
6847
|
}
|
|
6848
|
-
class Ka extends
|
|
6848
|
+
class Ka extends Ve {
|
|
6849
6849
|
constructor(e, t, r, i, s, o, l, a, c, d) {
|
|
6850
6850
|
super(e, t, r, i, s, o, l, c, d), this.spec = a;
|
|
6851
6851
|
}
|
|
@@ -6889,7 +6889,7 @@ function ho(n, e, t) {
|
|
|
6889
6889
|
r = r.nextSibling;
|
|
6890
6890
|
} else
|
|
6891
6891
|
i = !0, n.insertBefore(l, r);
|
|
6892
|
-
if (o instanceof
|
|
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
|
}
|
|
@@ -6898,38 +6898,38 @@ function ho(n, e, t) {
|
|
|
6898
6898
|
r = Pi(r), i = !0;
|
|
6899
6899
|
i && t.trackWrites == n && (t.trackWrites = null);
|
|
6900
6900
|
}
|
|
6901
|
-
const
|
|
6901
|
+
const At = function(n) {
|
|
6902
6902
|
n && (this.nodeName = n);
|
|
6903
6903
|
};
|
|
6904
|
-
|
|
6905
|
-
const
|
|
6904
|
+
At.prototype = /* @__PURE__ */ Object.create(null);
|
|
6905
|
+
const Ge = [new At()];
|
|
6906
6906
|
function Mr(n, e, t) {
|
|
6907
6907
|
if (n.length == 0)
|
|
6908
|
-
return
|
|
6909
|
-
let r = t ?
|
|
6908
|
+
return Ge;
|
|
6909
|
+
let r = t ? Ge[0] : new At(), i = [r];
|
|
6910
6910
|
for (let s = 0; s < n.length; s++) {
|
|
6911
6911
|
let o = n[s].type.attrs;
|
|
6912
6912
|
if (o) {
|
|
6913
|
-
o.nodeName && i.push(r = new
|
|
6913
|
+
o.nodeName && i.push(r = new At(o.nodeName));
|
|
6914
6914
|
for (let l in o) {
|
|
6915
6915
|
let a = o[l];
|
|
6916
|
-
a != null && (t && i.length == 1 && i.push(r = new
|
|
6916
|
+
a != null && (t && i.length == 1 && i.push(r = new At(e.isInline ? "span" : "div")), l == "class" ? r.class = (r.class ? r.class + " " : "") + a : l == "style" ? r.style = (r.style ? r.style + ";" : "") + a : l != "nodeName" && (r[l] = a));
|
|
6917
6917
|
}
|
|
6918
6918
|
}
|
|
6919
6919
|
}
|
|
6920
6920
|
return i;
|
|
6921
6921
|
}
|
|
6922
6922
|
function po(n, e, t, r) {
|
|
6923
|
-
if (t ==
|
|
6923
|
+
if (t == Ge && r == Ge)
|
|
6924
6924
|
return e;
|
|
6925
6925
|
let i = e;
|
|
6926
6926
|
for (let s = 0; s < r.length; s++) {
|
|
6927
6927
|
let o = r[s], l = t[s];
|
|
6928
6928
|
if (s) {
|
|
6929
6929
|
let a;
|
|
6930
|
-
l && l.nodeName == o.nodeName && i != n && (a = i.parentNode) && a.nodeName.toLowerCase() == o.nodeName || (a = document.createElement(o.nodeName), a.pmIsDeco = !0, a.appendChild(i), l =
|
|
6930
|
+
l && l.nodeName == o.nodeName && i != n && (a = i.parentNode) && a.nodeName.toLowerCase() == o.nodeName || (a = document.createElement(o.nodeName), a.pmIsDeco = !0, a.appendChild(i), l = Ge[0]), i = a;
|
|
6931
6931
|
}
|
|
6932
|
-
Ja(i, l ||
|
|
6932
|
+
Ja(i, l || Ge[0], o);
|
|
6933
6933
|
}
|
|
6934
6934
|
return i;
|
|
6935
6935
|
}
|
|
@@ -6956,9 +6956,9 @@ function Ja(n, e, t) {
|
|
|
6956
6956
|
}
|
|
6957
6957
|
}
|
|
6958
6958
|
function mo(n, e, t) {
|
|
6959
|
-
return po(n, n,
|
|
6959
|
+
return po(n, n, Ge, Mr(e, t, n.nodeType != 1));
|
|
6960
6960
|
}
|
|
6961
|
-
function
|
|
6961
|
+
function gn(n, e) {
|
|
6962
6962
|
if (n.length != e.length)
|
|
6963
6963
|
return !1;
|
|
6964
6964
|
for (let t = 0; t < n.length; t++)
|
|
@@ -7009,7 +7009,7 @@ class Ua {
|
|
|
7009
7009
|
if (a > -1)
|
|
7010
7010
|
a > this.index && (this.changed = !0, this.destroyBetween(this.index, a)), this.top = this.top.children[this.index];
|
|
7011
7011
|
else {
|
|
7012
|
-
let d =
|
|
7012
|
+
let d = ot.create(this.top, e[o], t, r);
|
|
7013
7013
|
this.top.children.splice(this.index, 0, d), this.top = d, this.changed = !0;
|
|
7014
7014
|
}
|
|
7015
7015
|
this.index = 0, o++;
|
|
@@ -7033,7 +7033,7 @@ class Ua {
|
|
|
7033
7033
|
}
|
|
7034
7034
|
updateNodeAt(e, t, r, i, s) {
|
|
7035
7035
|
let o = this.top.children[i];
|
|
7036
|
-
return o.dirty == Se && o.dom == o.contentDOM && (o.dirty =
|
|
7036
|
+
return o.dirty == Se && o.dom == o.contentDOM && (o.dirty = _e), o.update(e, t, r, s) ? (this.destroyBetween(this.index, i), this.index++, !0) : !1;
|
|
7037
7037
|
}
|
|
7038
7038
|
findIndexWithChild(e) {
|
|
7039
7039
|
for (; ; ) {
|
|
@@ -7057,15 +7057,15 @@ class Ua {
|
|
|
7057
7057
|
updateNextNode(e, t, r, i, s, o) {
|
|
7058
7058
|
for (let l = this.index; l < this.top.children.length; l++) {
|
|
7059
7059
|
let a = this.top.children[l];
|
|
7060
|
-
if (a instanceof
|
|
7060
|
+
if (a instanceof Ve) {
|
|
7061
7061
|
let c = this.preMatch.matched.get(a);
|
|
7062
7062
|
if (c != null && c != s)
|
|
7063
7063
|
return !1;
|
|
7064
|
-
let d = a.dom, u, f = this.isLocked(d) && !(e.isText && a.node && a.node.isText && a.nodeDOM.nodeValue == e.text && a.dirty != Se &&
|
|
7064
|
+
let d = a.dom, u, f = this.isLocked(d) && !(e.isText && a.node && a.node.isText && a.nodeDOM.nodeValue == e.text && a.dirty != Se && gn(t, a.outerDeco));
|
|
7065
7065
|
if (!f && a.update(e, t, r, i))
|
|
7066
7066
|
return this.destroyBetween(this.index, l), a.dom != d && (this.changed = !0), this.index++, !0;
|
|
7067
7067
|
if (!f && (u = this.recreateWrapper(a, e, t, r, i, o)))
|
|
7068
|
-
return this.destroyBetween(this.index, l), this.top.children[this.index] = u, u.contentDOM && (u.dirty =
|
|
7068
|
+
return this.destroyBetween(this.index, l), this.top.children[this.index] = u, u.contentDOM && (u.dirty = _e, u.updateChildren(i, o + 1), u.dirty = me), this.changed = !0, this.index++, !0;
|
|
7069
7069
|
break;
|
|
7070
7070
|
}
|
|
7071
7071
|
}
|
|
@@ -7074,9 +7074,9 @@ class Ua {
|
|
|
7074
7074
|
// When a node with content is replaced by a different node with
|
|
7075
7075
|
// identical content, move over its children.
|
|
7076
7076
|
recreateWrapper(e, t, r, i, s, o) {
|
|
7077
|
-
if (e.dirty || t.isAtom || !e.children.length || !e.node.content.eq(t.content) || !
|
|
7077
|
+
if (e.dirty || t.isAtom || !e.children.length || !e.node.content.eq(t.content) || !gn(r, e.outerDeco) || !i.eq(e.innerDeco))
|
|
7078
7078
|
return null;
|
|
7079
|
-
let l =
|
|
7079
|
+
let l = Ve.create(this.top, t, r, i, s, o);
|
|
7080
7080
|
if (l.contentDOM) {
|
|
7081
7081
|
l.children = e.children, e.children = [];
|
|
7082
7082
|
for (let a of l.children)
|
|
@@ -7086,7 +7086,7 @@ class Ua {
|
|
|
7086
7086
|
}
|
|
7087
7087
|
// Insert the node as a newly created node desc.
|
|
7088
7088
|
addNode(e, t, r, i, s) {
|
|
7089
|
-
let o =
|
|
7089
|
+
let o = Ve.create(this.top, e, t, r, i, s);
|
|
7090
7090
|
o.contentDOM && o.updateChildren(i, s + 1), this.top.children.splice(this.index++, 0, o), this.changed = !0;
|
|
7091
7091
|
}
|
|
7092
7092
|
placeWidget(e, t, r) {
|
|
@@ -7102,10 +7102,10 @@ class Ua {
|
|
|
7102
7102
|
// contentEditable.
|
|
7103
7103
|
addTextblockHacks() {
|
|
7104
7104
|
let e = this.top.children[this.index - 1], t = this.top;
|
|
7105
|
-
for (; e instanceof
|
|
7105
|
+
for (; e instanceof ot; )
|
|
7106
7106
|
t = e, e = t.children[t.children.length - 1];
|
|
7107
7107
|
(!e || // Empty textblock
|
|
7108
|
-
!(e instanceof
|
|
7108
|
+
!(e instanceof Pn) || /\n$/.test(e.node.text) || this.view.requiresGeckoHackNode && /\s$/.test(e.node.text)) && ((X || U) && e && e.dom.contentEditable == "false" && this.addHackNode("IMG", t), this.addHackNode("BR", this.top));
|
|
7109
7109
|
}
|
|
7110
7110
|
addHackNode(e, t) {
|
|
7111
7111
|
if (t == this.top && this.index < t.children.length && t.children[this.index].matchesHack(e))
|
|
@@ -7128,7 +7128,7 @@ function _a(n, e) {
|
|
|
7128
7128
|
for (; ; )
|
|
7129
7129
|
if (r) {
|
|
7130
7130
|
let c = t.children[r - 1];
|
|
7131
|
-
if (c instanceof
|
|
7131
|
+
if (c instanceof ot)
|
|
7132
7132
|
t = c, r = c.children.length;
|
|
7133
7133
|
else {
|
|
7134
7134
|
l = c, r--;
|
|
@@ -7245,7 +7245,7 @@ function Vr(n, e = null) {
|
|
|
7245
7245
|
if (o < 0)
|
|
7246
7246
|
return null;
|
|
7247
7247
|
let l = r.resolve(o), a, c;
|
|
7248
|
-
if (
|
|
7248
|
+
if (Rn(t)) {
|
|
7249
7249
|
for (a = o; i && !i.node; )
|
|
7250
7250
|
i = i.parent;
|
|
7251
7251
|
let u = i.node;
|
|
@@ -7283,7 +7283,7 @@ function Ne(n, e = !1) {
|
|
|
7283
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
|
-
if (r.anchorNode && i.anchorNode &&
|
|
7286
|
+
if (r.anchorNode && i.anchorNode && st(r.anchorNode, r.anchorOffset, i.anchorNode, i.anchorOffset)) {
|
|
7287
7287
|
n.input.mouseDown.delayedSelectionSync = !0, n.domObserver.setCurSelection();
|
|
7288
7288
|
return;
|
|
7289
7289
|
}
|
|
@@ -7301,15 +7301,15 @@ const Bi = X || U && no < 63;
|
|
|
7301
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
|
-
return
|
|
7304
|
+
return Zn(i);
|
|
7305
7305
|
if ((!i || i.contentEditable == "false") && (!s || s.contentEditable == "false")) {
|
|
7306
7306
|
if (i)
|
|
7307
|
-
return
|
|
7307
|
+
return Zn(i);
|
|
7308
7308
|
if (s)
|
|
7309
|
-
return
|
|
7309
|
+
return Zn(s);
|
|
7310
7310
|
}
|
|
7311
7311
|
}
|
|
7312
|
-
function
|
|
7312
|
+
function Zn(n) {
|
|
7313
7313
|
return n.contentEditable = "true", X && n.draggable && (n.draggable = !1, n.wasDraggable = !0), n;
|
|
7314
7314
|
}
|
|
7315
7315
|
function zi(n) {
|
|
@@ -7330,7 +7330,7 @@ function ec(n) {
|
|
|
7330
7330
|
if (!e)
|
|
7331
7331
|
return;
|
|
7332
7332
|
let t = n.cursorWrapper.dom, r = t.nodeName == "IMG";
|
|
7333
|
-
r ? e.collapse(t.parentNode, K(t) + 1) : e.collapse(t, 0), !r && !n.state.selection.visible && ie &&
|
|
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
7335
|
function yo(n, e) {
|
|
7336
7336
|
if (e instanceof S) {
|
|
@@ -7360,13 +7360,13 @@ function bo(n) {
|
|
|
7360
7360
|
}
|
|
7361
7361
|
function tc(n) {
|
|
7362
7362
|
let e = n.docView.domFromPos(n.state.selection.anchor, 0), t = n.domSelectionRange();
|
|
7363
|
-
return
|
|
7363
|
+
return st(e.node, e.offset, t.anchorNode, t.anchorOffset);
|
|
7364
7364
|
}
|
|
7365
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
|
-
function
|
|
7369
|
+
function De(n, e) {
|
|
7370
7370
|
return n.dispatch(n.state.tr.setSelection(e).scrollIntoView()), !0;
|
|
7371
7371
|
}
|
|
7372
7372
|
function Vi(n, e, t) {
|
|
@@ -7377,36 +7377,36 @@ function Vi(n, e, t) {
|
|
|
7377
7377
|
if (!s || s.isText || !s.isLeaf)
|
|
7378
7378
|
return !1;
|
|
7379
7379
|
let o = n.state.doc.resolve(i.pos + s.nodeSize * (e < 0 ? -1 : 1));
|
|
7380
|
-
return
|
|
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
7383
|
let i = Cr(n.state, e);
|
|
7384
|
-
return i && i instanceof S ?
|
|
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;
|
|
7387
7387
|
if (!s || s.isText)
|
|
7388
7388
|
return !1;
|
|
7389
7389
|
let l = e < 0 ? i.pos - s.nodeSize : i.pos;
|
|
7390
|
-
return s.isAtom || (o = n.docView.descAt(l)) && !o.contentDOM ? S.isSelectable(s) ?
|
|
7390
|
+
return s.isAtom || (o = n.docView.descAt(l)) && !o.contentDOM ? S.isSelectable(s) ? De(n, new S(e < 0 ? n.state.doc.resolve(i.pos - s.nodeSize) : i)) : Yt ? De(n, new M(n.state.doc.resolve(e < 0 ? l : l + s.nodeSize))) : !1 : !1;
|
|
7391
7391
|
}
|
|
7392
7392
|
} else return !1;
|
|
7393
7393
|
else {
|
|
7394
7394
|
if (r instanceof S && r.node.isInline)
|
|
7395
|
-
return
|
|
7395
|
+
return De(n, new M(e > 0 ? r.$to : r.$from));
|
|
7396
7396
|
{
|
|
7397
7397
|
let i = Cr(n.state, e);
|
|
7398
|
-
return i ?
|
|
7398
|
+
return i ? De(n, i) : !1;
|
|
7399
7399
|
}
|
|
7400
7400
|
}
|
|
7401
7401
|
}
|
|
7402
|
-
function
|
|
7402
|
+
function yn(n) {
|
|
7403
7403
|
return n.nodeType == 3 ? n.nodeValue.length : n.childNodes.length;
|
|
7404
7404
|
}
|
|
7405
|
-
function
|
|
7405
|
+
function Dt(n, e) {
|
|
7406
7406
|
let t = n.pmViewDesc;
|
|
7407
7407
|
return t && t.size == 0 && (e < 0 || n.nextSibling || n.nodeName != "BR");
|
|
7408
7408
|
}
|
|
7409
|
-
function
|
|
7409
|
+
function ut(n, e) {
|
|
7410
7410
|
return e < 0 ? nc(n) : rc(n);
|
|
7411
7411
|
}
|
|
7412
7412
|
function nc(n) {
|
|
@@ -7414,13 +7414,13 @@ function nc(n) {
|
|
|
7414
7414
|
if (!t)
|
|
7415
7415
|
return;
|
|
7416
7416
|
let i, s, o = !1;
|
|
7417
|
-
for (pe && t.nodeType == 1 && r <
|
|
7417
|
+
for (pe && t.nodeType == 1 && r < yn(t) && Dt(t.childNodes[r], -1) && (o = !0); ; )
|
|
7418
7418
|
if (r > 0) {
|
|
7419
7419
|
if (t.nodeType != 1)
|
|
7420
7420
|
break;
|
|
7421
7421
|
{
|
|
7422
7422
|
let l = t.childNodes[r - 1];
|
|
7423
|
-
if (
|
|
7423
|
+
if (Dt(l, -1))
|
|
7424
7424
|
i = t, s = --r;
|
|
7425
7425
|
else if (l.nodeType == 3)
|
|
7426
7426
|
t = l, r = t.nodeValue.length;
|
|
@@ -7432,10 +7432,10 @@ function nc(n) {
|
|
|
7432
7432
|
break;
|
|
7433
7433
|
{
|
|
7434
7434
|
let l = t.previousSibling;
|
|
7435
|
-
for (; l &&
|
|
7435
|
+
for (; l && Dt(l, -1); )
|
|
7436
7436
|
i = t.parentNode, s = K(l), l = l.previousSibling;
|
|
7437
7437
|
if (l)
|
|
7438
|
-
t = l, r =
|
|
7438
|
+
t = l, r = yn(t);
|
|
7439
7439
|
else {
|
|
7440
7440
|
if (t = t.parentNode, t == n.dom)
|
|
7441
7441
|
break;
|
|
@@ -7449,13 +7449,13 @@ function rc(n) {
|
|
|
7449
7449
|
let e = n.domSelectionRange(), t = e.focusNode, r = e.focusOffset;
|
|
7450
7450
|
if (!t)
|
|
7451
7451
|
return;
|
|
7452
|
-
let i =
|
|
7452
|
+
let i = yn(t), s, o;
|
|
7453
7453
|
for (; ; )
|
|
7454
7454
|
if (r < i) {
|
|
7455
7455
|
if (t.nodeType != 1)
|
|
7456
7456
|
break;
|
|
7457
7457
|
let l = t.childNodes[r];
|
|
7458
|
-
if (
|
|
7458
|
+
if (Dt(l, 1))
|
|
7459
7459
|
s = t, o = ++r;
|
|
7460
7460
|
else
|
|
7461
7461
|
break;
|
|
@@ -7464,10 +7464,10 @@ function rc(n) {
|
|
|
7464
7464
|
break;
|
|
7465
7465
|
{
|
|
7466
7466
|
let l = t.nextSibling;
|
|
7467
|
-
for (; l &&
|
|
7467
|
+
for (; l && Dt(l, 1); )
|
|
7468
7468
|
s = l.parentNode, o = K(l) + 1, l = l.nextSibling;
|
|
7469
7469
|
if (l)
|
|
7470
|
-
t = l, r = 0, i =
|
|
7470
|
+
t = l, r = 0, i = yn(t);
|
|
7471
7471
|
else {
|
|
7472
7472
|
if (t = t.parentNode, t == n.dom)
|
|
7473
7473
|
break;
|
|
@@ -7482,7 +7482,7 @@ function ko(n) {
|
|
|
7482
7482
|
return e && e.node && e.node.isBlock;
|
|
7483
7483
|
}
|
|
7484
7484
|
function ic(n, e) {
|
|
7485
|
-
for (; n && e == n.childNodes.length && !
|
|
7485
|
+
for (; n && e == n.childNodes.length && !Gt(n); )
|
|
7486
7486
|
e = K(n) + 1, n = n.parentNode;
|
|
7487
7487
|
for (; n && e < n.childNodes.length; ) {
|
|
7488
7488
|
let t = n.childNodes[e];
|
|
@@ -7494,7 +7494,7 @@ function ic(n, e) {
|
|
|
7494
7494
|
}
|
|
7495
7495
|
}
|
|
7496
7496
|
function sc(n, e) {
|
|
7497
|
-
for (; n && !e && !
|
|
7497
|
+
for (; n && !e && !Gt(n); )
|
|
7498
7498
|
e = K(n), n = n.parentNode;
|
|
7499
7499
|
for (; n && e; ) {
|
|
7500
7500
|
let t = n.childNodes[e - 1];
|
|
@@ -7513,7 +7513,7 @@ function Tr(n, e, t) {
|
|
|
7513
7513
|
let r = n.domSelection();
|
|
7514
7514
|
if (!r)
|
|
7515
7515
|
return;
|
|
7516
|
-
if (
|
|
7516
|
+
if (Rn(r)) {
|
|
7517
7517
|
let s = document.createRange();
|
|
7518
7518
|
s.setEnd(e, t), s.setStart(e, t), r.removeAllRanges(), r.addRange(s);
|
|
7519
7519
|
} else r.extend && r.extend(e, t);
|
|
@@ -7548,11 +7548,11 @@ function Wi(n, e, t) {
|
|
|
7548
7548
|
if (!i.parent.inlineContent || n.endOfTextblock(e < 0 ? "up" : "down")) {
|
|
7549
7549
|
let o = Cr(n.state, e);
|
|
7550
7550
|
if (o && o instanceof S)
|
|
7551
|
-
return
|
|
7551
|
+
return De(n, o);
|
|
7552
7552
|
}
|
|
7553
7553
|
if (!i.parent.inlineContent) {
|
|
7554
7554
|
let o = e < 0 ? i : s, l = r instanceof ce ? E.near(o, e) : E.findFrom(o, e);
|
|
7555
|
-
return l ?
|
|
7555
|
+
return l ? De(n, l) : !1;
|
|
7556
7556
|
}
|
|
7557
7557
|
return !1;
|
|
7558
7558
|
}
|
|
@@ -7593,22 +7593,22 @@ 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 qi(n, -1) ||
|
|
7596
|
+
return qi(n, -1) || ut(n, -1);
|
|
7597
7597
|
if (t == 46 && !e.shiftKey || ue && t == 68 && r == "c")
|
|
7598
|
-
return qi(n, 1) ||
|
|
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
7602
|
let i = t == 37 ? Hi(n, n.state.selection.from) == "ltr" ? -1 : 1 : -1;
|
|
7603
|
-
return Vi(n, i, r) ||
|
|
7603
|
+
return Vi(n, i, r) || ut(n, i);
|
|
7604
7604
|
} else if (t == 39 || ue && t == 70 && r == "c") {
|
|
7605
7605
|
let i = t == 39 ? Hi(n, n.state.selection.from) == "ltr" ? 1 : -1 : 1;
|
|
7606
|
-
return Vi(n, i, r) ||
|
|
7606
|
+
return Vi(n, i, r) || ut(n, i);
|
|
7607
7607
|
} else {
|
|
7608
7608
|
if (t == 38 || ue && t == 80 && r == "c")
|
|
7609
|
-
return Wi(n, -1, r) ||
|
|
7609
|
+
return Wi(n, -1, r) || ut(n, -1);
|
|
7610
7610
|
if (t == 40 || ue && t == 78 && r == "c")
|
|
7611
|
-
return oc(n) || Wi(n, 1, r) ||
|
|
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
|
}
|
|
@@ -7624,7 +7624,7 @@ function Wr(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") ||
|
|
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
7630
|
for (; c && c.nodeType == 1 && (d = Co[c.nodeName.toLowerCase()]); ) {
|
|
@@ -7659,7 +7659,7 @@ function xo(n, e, t, r, i) {
|
|
|
7659
7659
|
if (u)
|
|
7660
7660
|
l = u;
|
|
7661
7661
|
else {
|
|
7662
|
-
let f = i.marks(), { schema: h } = n.state, p =
|
|
7662
|
+
let f = i.marks(), { schema: h } = n.state, p = ct.fromSchema(h);
|
|
7663
7663
|
o = document.createElement("div"), e.split(/(?:\r\n?|\n)+/).forEach((m) => {
|
|
7664
7664
|
let g = o.appendChild(document.createElement("p"));
|
|
7665
7665
|
m && g.appendChild(p.serializeNode(h.text(m, f)));
|
|
@@ -7668,7 +7668,7 @@ function xo(n, e, t, r, i) {
|
|
|
7668
7668
|
} else
|
|
7669
7669
|
n.someProp("transformPastedHTML", (u) => {
|
|
7670
7670
|
t = u(t, n);
|
|
7671
|
-
}), o = fc(t),
|
|
7671
|
+
}), o = fc(t), Yt && hc(o);
|
|
7672
7672
|
let c = o && o.querySelector("[data-pm-slice]"), d = c && /^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice") || "");
|
|
7673
7673
|
if (d && d[3])
|
|
7674
7674
|
for (let u = +d[3]; u > 0; u--) {
|
|
@@ -7679,7 +7679,7 @@ function xo(n, e, t, r, i) {
|
|
|
7679
7679
|
break;
|
|
7680
7680
|
o = f;
|
|
7681
7681
|
}
|
|
7682
|
-
if (l || (l = (n.someProp("clipboardParser") || n.someProp("domParser") ||
|
|
7682
|
+
if (l || (l = (n.someProp("clipboardParser") || n.someProp("domParser") || Fe.fromSchema(n.state.schema)).parseSlice(o, {
|
|
7683
7683
|
preserveWhitespace: !!(a || d),
|
|
7684
7684
|
context: i,
|
|
7685
7685
|
ruleFromNode(f) {
|
|
@@ -7765,10 +7765,10 @@ let Ji = null;
|
|
|
7765
7765
|
function To() {
|
|
7766
7766
|
return Ji || (Ji = document.implementation.createHTMLDocument("title"));
|
|
7767
7767
|
}
|
|
7768
|
-
let
|
|
7768
|
+
let Qn = null;
|
|
7769
7769
|
function uc(n) {
|
|
7770
7770
|
let e = window.trustedTypes;
|
|
7771
|
-
return e ? (
|
|
7771
|
+
return e ? (Qn || (Qn = e.defaultPolicy || e.createPolicy("ProseMirrorClipboard", { createHTML: (t) => t })), Qn.createHTML(n)) : n;
|
|
7772
7772
|
}
|
|
7773
7773
|
function fc(n) {
|
|
7774
7774
|
let e = /^(\s*<meta [^>]*>)*/.exec(n);
|
|
@@ -7819,7 +7819,7 @@ function yc(n) {
|
|
|
7819
7819
|
}
|
|
7820
7820
|
X && n.dom.addEventListener("input", () => null), Er(n);
|
|
7821
7821
|
}
|
|
7822
|
-
function
|
|
7822
|
+
function Le(n, e) {
|
|
7823
7823
|
n.input.lastSelectionOrigin = e, n.input.lastSelectionTime = Date.now();
|
|
7824
7824
|
}
|
|
7825
7825
|
function bc(n) {
|
|
@@ -7856,12 +7856,12 @@ function xc(n, e) {
|
|
|
7856
7856
|
te.keydown = (n, e) => {
|
|
7857
7857
|
let t = e;
|
|
7858
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
|
-
if (t.keyCode != 229 && n.domObserver.forceFlush(),
|
|
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(() => {
|
|
7862
|
-
n.input.lastIOSEnter == r && (n.someProp("handleKeyDown", (i) => i(n,
|
|
7862
|
+
n.input.lastIOSEnter == r && (n.someProp("handleKeyDown", (i) => i(n, Je(13, "Enter"))), n.input.lastIOSEnter = 0);
|
|
7863
7863
|
}, 200);
|
|
7864
|
-
} else n.someProp("handleKeyDown", (r) => r(n, t)) || ac(n, t) ? t.preventDefault() :
|
|
7864
|
+
} else n.someProp("handleKeyDown", (r) => r(n, t)) || ac(n, t) ? t.preventDefault() : Le(n, "key");
|
|
7865
7865
|
};
|
|
7866
7866
|
te.keyup = (n, e) => {
|
|
7867
7867
|
e.keyCode == 16 && (n.input.shiftKey = !1);
|
|
@@ -7880,7 +7880,7 @@ te.keypress = (n, e) => {
|
|
|
7880
7880
|
!/[\r\n]/.test(i) && !n.someProp("handleTextInput", (o) => o(n, r.$from.pos, r.$to.pos, i, s)) && n.dispatch(s()), t.preventDefault();
|
|
7881
7881
|
}
|
|
7882
7882
|
};
|
|
7883
|
-
function
|
|
7883
|
+
function Bn(n) {
|
|
7884
7884
|
return { left: n.clientX, top: n.clientY };
|
|
7885
7885
|
}
|
|
7886
7886
|
function Sc(n, e) {
|
|
@@ -7896,7 +7896,7 @@ function jr(n, e, t, r, i) {
|
|
|
7896
7896
|
return !0;
|
|
7897
7897
|
return !1;
|
|
7898
7898
|
}
|
|
7899
|
-
function
|
|
7899
|
+
function yt(n, e, t) {
|
|
7900
7900
|
if (n.focused || n.focus(), n.state.selection.eq(e))
|
|
7901
7901
|
return;
|
|
7902
7902
|
let r = n.state.tr.setSelection(e);
|
|
@@ -7906,7 +7906,7 @@ function Mc(n, e) {
|
|
|
7906
7906
|
if (e == -1)
|
|
7907
7907
|
return !1;
|
|
7908
7908
|
let t = n.state.doc.resolve(e), r = t.nodeAfter;
|
|
7909
|
-
return r && r.isAtom && S.isSelectable(r) ? (
|
|
7909
|
+
return r && r.isAtom && S.isSelectable(r) ? (yt(n, new S(t)), !0) : !1;
|
|
7910
7910
|
}
|
|
7911
7911
|
function wc(n, e) {
|
|
7912
7912
|
if (e == -1)
|
|
@@ -7921,7 +7921,7 @@ function wc(n, e) {
|
|
|
7921
7921
|
break;
|
|
7922
7922
|
}
|
|
7923
7923
|
}
|
|
7924
|
-
return i != null ? (
|
|
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
7927
|
return jr(n, "handleClickOn", e, t, r) || n.someProp("handleClick", (s) => s(n, e, r)) || (i ? wc(n, t) : Mc(n, t));
|
|
@@ -7937,21 +7937,21 @@ function Ec(n, e, t) {
|
|
|
7937
7937
|
return !1;
|
|
7938
7938
|
let r = n.state.doc;
|
|
7939
7939
|
if (e == -1)
|
|
7940
|
-
return r.inlineContent ? (
|
|
7940
|
+
return r.inlineContent ? (yt(n, M.create(r, 0, r.content.size)), !0) : !1;
|
|
7941
7941
|
let i = r.resolve(e);
|
|
7942
7942
|
for (let s = i.depth + 1; s > 0; s--) {
|
|
7943
7943
|
let o = s > i.depth ? i.nodeAfter : i.node(s), l = i.before(s);
|
|
7944
7944
|
if (o.inlineContent)
|
|
7945
|
-
|
|
7945
|
+
yt(n, M.create(r, l + 1, l + 1 + o.content.size));
|
|
7946
7946
|
else if (S.isSelectable(o))
|
|
7947
|
-
|
|
7947
|
+
yt(n, S.create(r, l));
|
|
7948
7948
|
else
|
|
7949
7949
|
continue;
|
|
7950
7950
|
return !0;
|
|
7951
7951
|
}
|
|
7952
7952
|
}
|
|
7953
7953
|
function Kr(n) {
|
|
7954
|
-
return
|
|
7954
|
+
return bn(n);
|
|
7955
7955
|
}
|
|
7956
7956
|
const Oo = ue ? "metaKey" : "ctrlKey";
|
|
7957
7957
|
ee.mousedown = (n, e) => {
|
|
@@ -7959,8 +7959,8 @@ ee.mousedown = (n, e) => {
|
|
|
7959
7959
|
n.input.shiftKey = t.shiftKey;
|
|
7960
7960
|
let r = Kr(n), i = Date.now(), s = "singleClick";
|
|
7961
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
|
-
let o = n.posAtCoords(
|
|
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() :
|
|
7962
|
+
let o = n.posAtCoords(Bn(t));
|
|
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) {
|
|
@@ -7982,7 +7982,7 @@ class vc {
|
|
|
7982
7982
|
setUneditable: !!(this.target && pe && !this.target.hasAttribute("contentEditable"))
|
|
7983
7983
|
}), this.target && this.mightDrag && (this.mightDrag.addAttr || this.mightDrag.setUneditable) && (this.view.domObserver.stop(), this.mightDrag.addAttr && (this.target.draggable = !0), this.mightDrag.setUneditable && setTimeout(() => {
|
|
7984
7984
|
this.view.input.mouseDown == this && this.target.setAttribute("contentEditable", "false");
|
|
7985
|
-
}, 20), this.view.domObserver.start()), e.root.addEventListener("mouseup", this.up = this.up.bind(this)), e.root.addEventListener("mousemove", this.move = this.move.bind(this)),
|
|
7985
|
+
}, 20), this.view.domObserver.start()), e.root.addEventListener("mouseup", this.up = this.up.bind(this)), e.root.addEventListener("mousemove", this.move = this.move.bind(this)), Le(e, "pointer");
|
|
7986
7986
|
}
|
|
7987
7987
|
done() {
|
|
7988
7988
|
this.view.root.removeEventListener("mouseup", this.up), this.view.root.removeEventListener("mousemove", this.move), this.mightDrag && this.target && (this.view.domObserver.stop(), this.mightDrag.addAttr && this.target.removeAttribute("draggable"), this.mightDrag.setUneditable && this.target.removeAttribute("contentEditable"), this.view.domObserver.start()), this.delayedSelectionSync && setTimeout(() => Ne(this.view)), this.view.input.mouseDown = null;
|
|
@@ -7991,7 +7991,7 @@ class vc {
|
|
|
7991
7991
|
if (this.done(), !this.view.dom.contains(e.target))
|
|
7992
7992
|
return;
|
|
7993
7993
|
let t = this.pos;
|
|
7994
|
-
this.view.state.doc != this.startDoc && (t = this.view.posAtCoords(
|
|
7994
|
+
this.view.state.doc != this.startDoc && (t = this.view.posAtCoords(Bn(e))), this.updateAllowDefault(e), this.allowDefault || !t ? Le(this.view, "pointer") : Cc(this.view, t.pos, t.inside, e, this.selectNode) ? e.preventDefault() : e.button == 0 && (this.flushed || // Safari ignores clicks on draggable elements
|
|
7995
7995
|
X && this.mightDrag && !this.mightDrag.node.isAtom || // Chrome will sometimes treat a node selection as a
|
|
7996
7996
|
// cursor, but still report that the node is selected
|
|
7997
7997
|
// when asked through getSelection. You'll then get a
|
|
@@ -7999,20 +7999,20 @@ class vc {
|
|
|
7999
7999
|
// (hidden) cursor is doesn't change the selection, and
|
|
8000
8000
|
// thus doesn't get a reaction from ProseMirror. This
|
|
8001
8001
|
// works around that.
|
|
8002
|
-
U && !this.view.state.selection.visible && Math.min(Math.abs(t.pos - this.view.state.selection.from), Math.abs(t.pos - this.view.state.selection.to)) <= 2) ? (
|
|
8002
|
+
U && !this.view.state.selection.visible && Math.min(Math.abs(t.pos - this.view.state.selection.from), Math.abs(t.pos - this.view.state.selection.to)) <= 2) ? (yt(this.view, E.near(this.view.state.doc.resolve(t.pos))), e.preventDefault()) : Le(this.view, "pointer");
|
|
8003
8003
|
}
|
|
8004
8004
|
move(e) {
|
|
8005
|
-
this.updateAllowDefault(e),
|
|
8005
|
+
this.updateAllowDefault(e), Le(this.view, "pointer"), e.buttons == 0 && this.done();
|
|
8006
8006
|
}
|
|
8007
8007
|
updateAllowDefault(e) {
|
|
8008
8008
|
!this.allowDefault && (Math.abs(this.event.x - e.clientX) > 4 || Math.abs(this.event.y - e.clientY) > 4) && (this.allowDefault = !0);
|
|
8009
8009
|
}
|
|
8010
8010
|
}
|
|
8011
8011
|
ee.touchstart = (n) => {
|
|
8012
|
-
n.input.lastTouch = Date.now(), Kr(n),
|
|
8012
|
+
n.input.lastTouch = Date.now(), Kr(n), Le(n, "pointer");
|
|
8013
8013
|
};
|
|
8014
8014
|
ee.touchmove = (n) => {
|
|
8015
|
-
n.input.lastTouch = Date.now(),
|
|
8015
|
+
n.input.lastTouch = Date.now(), Le(n, "pointer");
|
|
8016
8016
|
};
|
|
8017
8017
|
ee.contextmenu = (n) => Kr(n);
|
|
8018
8018
|
function Eo(n, e) {
|
|
@@ -8024,8 +8024,8 @@ te.compositionstart = te.compositionupdate = (n) => {
|
|
|
8024
8024
|
n.domObserver.flush();
|
|
8025
8025
|
let { state: e } = n, t = e.selection.$to;
|
|
8026
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
|
-
n.markCursor = n.state.storedMarks || t.marks(),
|
|
8028
|
-
else if (
|
|
8027
|
+
n.markCursor = n.state.storedMarks || t.marks(), bn(n, !0), n.markCursor = null;
|
|
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();
|
|
8030
8030
|
for (let i = r.focusNode, s = r.focusOffset; i && i.nodeType == 1 && s != 0; ) {
|
|
8031
8031
|
let o = s < 0 ? i.lastChild : i.childNodes[s - 1];
|
|
@@ -8054,7 +8054,7 @@ te.compositionend = (n, e) => {
|
|
|
8054
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
8056
|
function vo(n, e) {
|
|
8057
|
-
clearTimeout(n.input.composingTimeout), e > -1 && (n.input.composingTimeout = setTimeout(() =>
|
|
8057
|
+
clearTimeout(n.input.composingTimeout), e > -1 && (n.input.composingTimeout = setTimeout(() => bn(n), e));
|
|
8058
8058
|
}
|
|
8059
8059
|
function No(n) {
|
|
8060
8060
|
for (n.composing && (n.input.composing = !1, n.input.compositionEndedAt = Ic()); n.input.compositionNodes.length > 0; )
|
|
@@ -8083,7 +8083,7 @@ function Ic() {
|
|
|
8083
8083
|
let n = document.createEvent("Event");
|
|
8084
8084
|
return n.initEvent("event", !0, !0), n.timeStamp;
|
|
8085
8085
|
}
|
|
8086
|
-
function
|
|
8086
|
+
function bn(n, e = !1) {
|
|
8087
8087
|
if (!(Ee && n.domObserver.flushingSoon >= 0)) {
|
|
8088
8088
|
if (n.domObserver.forceFlush(), No(n), e || n.docView && n.docView.dirty) {
|
|
8089
8089
|
let t = Vr(n), r = n.state.selection;
|
|
@@ -8102,12 +8102,12 @@ function Rc(n, e) {
|
|
|
8102
8102
|
t.parentNode && t.parentNode.removeChild(t), n.focus();
|
|
8103
8103
|
}, 50);
|
|
8104
8104
|
}
|
|
8105
|
-
const
|
|
8105
|
+
const zt = ie && $e < 15 || xt && va < 604;
|
|
8106
8106
|
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 =
|
|
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) {
|
|
@@ -8120,10 +8120,10 @@ function Bc(n, e) {
|
|
|
8120
8120
|
t || (r.contentEditable = "true"), r.style.cssText = "position: fixed; left: -10000px; top: 10px", r.focus();
|
|
8121
8121
|
let i = n.input.shiftKey && n.input.lastKeyCode != 45;
|
|
8122
8122
|
setTimeout(() => {
|
|
8123
|
-
n.focus(), r.parentNode && r.parentNode.removeChild(r), t ?
|
|
8123
|
+
n.focus(), r.parentNode && r.parentNode.removeChild(r), t ? Ft(n, r.value, null, i, e) : Ft(n, r.textContent, r.innerHTML, i, e);
|
|
8124
8124
|
}, 50);
|
|
8125
8125
|
}
|
|
8126
|
-
function
|
|
8126
|
+
function Ft(n, e, t, r, i) {
|
|
8127
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;
|
|
@@ -8143,8 +8143,8 @@ te.paste = (n, e) => {
|
|
|
8143
8143
|
let t = e;
|
|
8144
8144
|
if (n.composing && !Ee)
|
|
8145
8145
|
return;
|
|
8146
|
-
let r =
|
|
8147
|
-
r &&
|
|
8146
|
+
let r = zt ? null : t.clipboardData, i = n.input.shiftKey && n.input.lastKeyCode != 45;
|
|
8147
|
+
r && Ft(n, Ao(r), r.getData("text/html"), i, t) ? t.preventDefault() : Bc(n, t);
|
|
8148
8148
|
};
|
|
8149
8149
|
class Do {
|
|
8150
8150
|
constructor(e, t, r) {
|
|
@@ -8162,7 +8162,7 @@ ee.dragstart = (n, e) => {
|
|
|
8162
8162
|
let t = e, r = n.input.mouseDown;
|
|
8163
8163
|
if (r && r.done(), !t.dataTransfer)
|
|
8164
8164
|
return;
|
|
8165
|
-
let i = n.state.selection, s = i.empty ? null : n.posAtCoords(
|
|
8165
|
+
let i = n.state.selection, s = i.empty ? null : n.posAtCoords(Bn(t)), o;
|
|
8166
8166
|
if (!(s && s.pos >= i.from && s.pos <= (i instanceof S ? i.to - 1 : i.to))) {
|
|
8167
8167
|
if (r && r.mightDrag)
|
|
8168
8168
|
o = S.create(n.state.doc, r.mightDrag.pos);
|
|
@@ -8172,7 +8172,7 @@ ee.dragstart = (n, e) => {
|
|
|
8172
8172
|
}
|
|
8173
8173
|
}
|
|
8174
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(
|
|
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;
|
|
@@ -8191,13 +8191,13 @@ te.drop = (n, e) => {
|
|
|
8191
8191
|
function zc(n, e, t) {
|
|
8192
8192
|
if (!e.dataTransfer)
|
|
8193
8193
|
return;
|
|
8194
|
-
let r = n.posAtCoords(
|
|
8194
|
+
let r = n.posAtCoords(Bn(e));
|
|
8195
8195
|
if (!r)
|
|
8196
8196
|
return;
|
|
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 = xo(n, Ao(e.dataTransfer),
|
|
8200
|
+
}) : s = xo(n, Ao(e.dataTransfer), zt ? null : e.dataTransfer.getData("text/html"), !1, i);
|
|
8201
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();
|
|
@@ -8239,7 +8239,7 @@ ee.beforeinput = (n, e) => {
|
|
|
8239
8239
|
n.domObserver.flushSoon();
|
|
8240
8240
|
let { domChangeCount: r } = n.input;
|
|
8241
8241
|
setTimeout(() => {
|
|
8242
|
-
if (n.input.domChangeCount != r || (n.dom.blur(), n.focus(), n.someProp("handleKeyDown", (s) => s(n,
|
|
8242
|
+
if (n.input.domChangeCount != r || (n.dom.blur(), n.focus(), n.someProp("handleKeyDown", (s) => s(n, Je(8, "Backspace")))))
|
|
8243
8243
|
return;
|
|
8244
8244
|
let { $cursor: i } = n.state.selection;
|
|
8245
8245
|
i && i.pos > 0 && n.dispatch(n.state.tr.delete(i.pos - 1, i.pos).scrollIntoView());
|
|
@@ -8248,7 +8248,7 @@ ee.beforeinput = (n, e) => {
|
|
|
8248
8248
|
};
|
|
8249
8249
|
for (let n in te)
|
|
8250
8250
|
ee[n] = te[n];
|
|
8251
|
-
function
|
|
8251
|
+
function $t(n, e) {
|
|
8252
8252
|
if (n == e)
|
|
8253
8253
|
return !0;
|
|
8254
8254
|
for (let t in n)
|
|
@@ -8259,9 +8259,9 @@ function Vt(n, e) {
|
|
|
8259
8259
|
return !1;
|
|
8260
8260
|
return !0;
|
|
8261
8261
|
}
|
|
8262
|
-
class
|
|
8262
|
+
class kn {
|
|
8263
8263
|
constructor(e, t) {
|
|
8264
|
-
this.toDOM = e, this.spec = t ||
|
|
8264
|
+
this.toDOM = e, this.spec = t || et, this.side = this.spec.side || 0;
|
|
8265
8265
|
}
|
|
8266
8266
|
map(e, t, r, i) {
|
|
8267
8267
|
let { pos: s, deleted: o } = e.mapResult(t.from + i, this.side < 0 ? -1 : 1);
|
|
@@ -8271,15 +8271,15 @@ class xn {
|
|
|
8271
8271
|
return !0;
|
|
8272
8272
|
}
|
|
8273
8273
|
eq(e) {
|
|
8274
|
-
return this == e || e instanceof
|
|
8274
|
+
return this == e || e instanceof kn && (this.spec.key && this.spec.key == e.spec.key || this.toDOM == e.toDOM && $t(this.spec, e.spec));
|
|
8275
8275
|
}
|
|
8276
8276
|
destroy(e) {
|
|
8277
8277
|
this.spec.destroy && this.spec.destroy(e);
|
|
8278
8278
|
}
|
|
8279
8279
|
}
|
|
8280
|
-
class
|
|
8280
|
+
class He {
|
|
8281
8281
|
constructor(e, t) {
|
|
8282
|
-
this.attrs = e, this.spec = t ||
|
|
8282
|
+
this.attrs = e, this.spec = t || et;
|
|
8283
8283
|
}
|
|
8284
8284
|
map(e, t, r, i) {
|
|
8285
8285
|
let s = e.map(t.from + i, this.spec.inclusiveStart ? -1 : 1) - r, o = e.map(t.to + i, this.spec.inclusiveEnd ? 1 : -1) - r;
|
|
@@ -8289,17 +8289,17 @@ class We {
|
|
|
8289
8289
|
return t.from < t.to;
|
|
8290
8290
|
}
|
|
8291
8291
|
eq(e) {
|
|
8292
|
-
return this == e || e instanceof
|
|
8292
|
+
return this == e || e instanceof He && $t(this.attrs, e.attrs) && $t(this.spec, e.spec);
|
|
8293
8293
|
}
|
|
8294
8294
|
static is(e) {
|
|
8295
|
-
return e.type instanceof
|
|
8295
|
+
return e.type instanceof He;
|
|
8296
8296
|
}
|
|
8297
8297
|
destroy() {
|
|
8298
8298
|
}
|
|
8299
8299
|
}
|
|
8300
8300
|
class Jr {
|
|
8301
8301
|
constructor(e, t) {
|
|
8302
|
-
this.attrs = e, this.spec = t ||
|
|
8302
|
+
this.attrs = e, this.spec = t || et;
|
|
8303
8303
|
}
|
|
8304
8304
|
map(e, t, r, i) {
|
|
8305
8305
|
let s = e.mapResult(t.from + i, 1);
|
|
@@ -8313,7 +8313,7 @@ class Jr {
|
|
|
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 Jr &&
|
|
8316
|
+
return this == e || e instanceof Jr && $t(this.attrs, e.attrs) && $t(this.spec, e.spec);
|
|
8317
8317
|
}
|
|
8318
8318
|
destroy() {
|
|
8319
8319
|
}
|
|
@@ -8352,14 +8352,14 @@ class he {
|
|
|
8352
8352
|
widget's current document position.
|
|
8353
8353
|
*/
|
|
8354
8354
|
static widget(e, t, r) {
|
|
8355
|
-
return new he(e, e, new
|
|
8355
|
+
return new he(e, e, new kn(t, r));
|
|
8356
8356
|
}
|
|
8357
8357
|
/**
|
|
8358
8358
|
Creates an inline decoration, which adds the given attributes to
|
|
8359
8359
|
each inline node between `from` and `to`.
|
|
8360
8360
|
*/
|
|
8361
8361
|
static inline(e, t, r, i) {
|
|
8362
|
-
return new he(e, t, new
|
|
8362
|
+
return new he(e, t, new He(r, i));
|
|
8363
8363
|
}
|
|
8364
8364
|
/**
|
|
8365
8365
|
Creates a node decoration. `from` and `to` should point precisely
|
|
@@ -8380,22 +8380,22 @@ class he {
|
|
|
8380
8380
|
@internal
|
|
8381
8381
|
*/
|
|
8382
8382
|
get inline() {
|
|
8383
|
-
return this.type instanceof
|
|
8383
|
+
return this.type instanceof He;
|
|
8384
8384
|
}
|
|
8385
8385
|
/**
|
|
8386
8386
|
@internal
|
|
8387
8387
|
*/
|
|
8388
8388
|
get widget() {
|
|
8389
|
-
return this.type instanceof
|
|
8389
|
+
return this.type instanceof kn;
|
|
8390
8390
|
}
|
|
8391
8391
|
}
|
|
8392
|
-
const
|
|
8392
|
+
const ht = [], et = {};
|
|
8393
8393
|
class z {
|
|
8394
8394
|
/**
|
|
8395
8395
|
@internal
|
|
8396
8396
|
*/
|
|
8397
8397
|
constructor(e, t) {
|
|
8398
|
-
this.local = e.length ? e :
|
|
8398
|
+
this.local = e.length ? e : ht, this.children = t.length ? t : ht;
|
|
8399
8399
|
}
|
|
8400
8400
|
/**
|
|
8401
8401
|
Create a set of decorations, using the structure of the given
|
|
@@ -8403,7 +8403,7 @@ class z {
|
|
|
8403
8403
|
you must make a copy if you want need to preserve that.
|
|
8404
8404
|
*/
|
|
8405
8405
|
static create(e, t) {
|
|
8406
|
-
return t.length ?
|
|
8406
|
+
return t.length ? xn(t, e, 0, et) : Y;
|
|
8407
8407
|
}
|
|
8408
8408
|
/**
|
|
8409
8409
|
Find all decorations in this set which touch the given range
|
|
@@ -8433,7 +8433,7 @@ class z {
|
|
|
8433
8433
|
document.
|
|
8434
8434
|
*/
|
|
8435
8435
|
map(e, t, r) {
|
|
8436
|
-
return this == Y || e.maps.length == 0 ? this : this.mapInner(e, t, 0, 0, r ||
|
|
8436
|
+
return this == Y || e.maps.length == 0 ? this : this.mapInner(e, t, 0, 0, r || et);
|
|
8437
8437
|
}
|
|
8438
8438
|
/**
|
|
8439
8439
|
@internal
|
|
@@ -8444,7 +8444,7 @@ class z {
|
|
|
8444
8444
|
let a = this.local[l].map(e, r, i);
|
|
8445
8445
|
a && a.type.valid(t, a) ? (o || (o = [])).push(a) : s.onRemove && s.onRemove(this.local[l].spec);
|
|
8446
8446
|
}
|
|
8447
|
-
return this.children.length ? Fc(this.children, o || [], e, t, r, i, s) : o ? new z(o.sort(
|
|
8447
|
+
return this.children.length ? Fc(this.children, o || [], e, t, r, i, s) : o ? new z(o.sort(tt), ht) : Y;
|
|
8448
8448
|
}
|
|
8449
8449
|
/**
|
|
8450
8450
|
Add the given array of decorations to the ones in the set,
|
|
@@ -8462,13 +8462,13 @@ class z {
|
|
|
8462
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
|
-
i[s] == a ? i[s + 2] = i[s + 2].addInner(l, d, c + 1) : i.splice(s, 0, a, a + l.nodeSize,
|
|
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
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
|
-
return new z(o.length ? this.local.concat(o).sort(
|
|
8471
|
+
return new z(o.length ? this.local.concat(o).sort(tt) : this.local, i || this.children);
|
|
8472
8472
|
}
|
|
8473
8473
|
/**
|
|
8474
8474
|
Create a new set that contains the decorations in this set, minus
|
|
@@ -8511,14 +8511,14 @@ class z {
|
|
|
8511
8511
|
let s = e + 1, o = s + t.content.size;
|
|
8512
8512
|
for (let l = 0; l < this.local.length; l++) {
|
|
8513
8513
|
let a = this.local[l];
|
|
8514
|
-
if (a.from < o && a.to > s && a.type instanceof
|
|
8514
|
+
if (a.from < o && a.to > s && a.type instanceof He) {
|
|
8515
8515
|
let c = Math.max(s, a.from) - s, d = Math.min(o, a.to) - s;
|
|
8516
8516
|
c < d && (i || (i = [])).push(a.copy(c, d));
|
|
8517
8517
|
}
|
|
8518
8518
|
}
|
|
8519
8519
|
if (i) {
|
|
8520
|
-
let l = new z(i.sort(
|
|
8521
|
-
return r ? new
|
|
8520
|
+
let l = new z(i.sort(tt), ht);
|
|
8521
|
+
return r ? new Re([l, r]) : l;
|
|
8522
8522
|
}
|
|
8523
8523
|
return r || Y;
|
|
8524
8524
|
}
|
|
@@ -8549,12 +8549,12 @@ class z {
|
|
|
8549
8549
|
*/
|
|
8550
8550
|
localsInner(e) {
|
|
8551
8551
|
if (this == Y)
|
|
8552
|
-
return
|
|
8553
|
-
if (e.inlineContent || !this.local.some(
|
|
8552
|
+
return ht;
|
|
8553
|
+
if (e.inlineContent || !this.local.some(He.is))
|
|
8554
8554
|
return this.local;
|
|
8555
8555
|
let t = [];
|
|
8556
8556
|
for (let r = 0; r < this.local.length; r++)
|
|
8557
|
-
this.local[r].type instanceof
|
|
8557
|
+
this.local[r].type instanceof He || t.push(this.local[r]);
|
|
8558
8558
|
return t;
|
|
8559
8559
|
}
|
|
8560
8560
|
forEachSet(e) {
|
|
@@ -8564,13 +8564,13 @@ class z {
|
|
|
8564
8564
|
z.empty = new z([], []);
|
|
8565
8565
|
z.removeOverlap = Ur;
|
|
8566
8566
|
const Y = z.empty;
|
|
8567
|
-
class
|
|
8567
|
+
class Re {
|
|
8568
8568
|
constructor(e) {
|
|
8569
8569
|
this.members = e;
|
|
8570
8570
|
}
|
|
8571
8571
|
map(e, t) {
|
|
8572
|
-
const r = this.members.map((i) => i.map(e, t,
|
|
8573
|
-
return
|
|
8572
|
+
const r = this.members.map((i) => i.map(e, t, et));
|
|
8573
|
+
return Re.from(r);
|
|
8574
8574
|
}
|
|
8575
8575
|
forChild(e, t) {
|
|
8576
8576
|
if (t.isLeaf)
|
|
@@ -8578,12 +8578,12 @@ class Pe {
|
|
|
8578
8578
|
let r = [];
|
|
8579
8579
|
for (let i = 0; i < this.members.length; i++) {
|
|
8580
8580
|
let s = this.members[i].forChild(e, t);
|
|
8581
|
-
s != Y && (s instanceof
|
|
8581
|
+
s != Y && (s instanceof Re ? r = r.concat(s.members) : r.push(s));
|
|
8582
8582
|
}
|
|
8583
|
-
return
|
|
8583
|
+
return Re.from(r);
|
|
8584
8584
|
}
|
|
8585
8585
|
eq(e) {
|
|
8586
|
-
if (!(e instanceof
|
|
8586
|
+
if (!(e instanceof Re) || e.members.length != this.members.length)
|
|
8587
8587
|
return !1;
|
|
8588
8588
|
for (let t = 0; t < this.members.length; t++)
|
|
8589
8589
|
if (!this.members[t].eq(e.members[t]))
|
|
@@ -8603,7 +8603,7 @@ class Pe {
|
|
|
8603
8603
|
t.push(s[o]);
|
|
8604
8604
|
}
|
|
8605
8605
|
}
|
|
8606
|
-
return t ? Ur(r ? t : t.sort(
|
|
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.
|
|
@@ -8614,7 +8614,7 @@ class Pe {
|
|
|
8614
8614
|
case 1:
|
|
8615
8615
|
return e[0];
|
|
8616
8616
|
default:
|
|
8617
|
-
return new
|
|
8617
|
+
return new Re(e.every((t) => t instanceof z) ? e : e.reduce((t, r) => t.concat(r instanceof z ? r : r.members), []));
|
|
8618
8618
|
}
|
|
8619
8619
|
}
|
|
8620
8620
|
forEachSet(e) {
|
|
@@ -8658,7 +8658,7 @@ function Fc(n, e, t, r, i, s, o) {
|
|
|
8658
8658
|
a = !0;
|
|
8659
8659
|
}
|
|
8660
8660
|
if (a) {
|
|
8661
|
-
let c = $c(l, n, e, t, i, s, o), d =
|
|
8661
|
+
let c = $c(l, n, e, t, i, s, o), d = xn(c, r, 0, o);
|
|
8662
8662
|
e = d.local;
|
|
8663
8663
|
for (let u = 0; u < l.length; u += 3)
|
|
8664
8664
|
l[u + 1] < 0 && (l.splice(u, 3), u -= 3);
|
|
@@ -8669,7 +8669,7 @@ function Fc(n, e, t, r, i, s, o) {
|
|
|
8669
8669
|
l.splice(f, 0, d.children[u], d.children[u + 1], d.children[u + 2]);
|
|
8670
8670
|
}
|
|
8671
8671
|
}
|
|
8672
|
-
return new z(e.sort(
|
|
8672
|
+
return new z(e.sort(tt), l);
|
|
8673
8673
|
}
|
|
8674
8674
|
function Ro(n, e) {
|
|
8675
8675
|
if (!e || !n.length)
|
|
@@ -8708,22 +8708,22 @@ function Bo(n) {
|
|
|
8708
8708
|
n[t] != null && e.push(n[t]);
|
|
8709
8709
|
return e;
|
|
8710
8710
|
}
|
|
8711
|
-
function
|
|
8711
|
+
function xn(n, e, t, r) {
|
|
8712
8712
|
let i = [], s = !1;
|
|
8713
8713
|
e.forEach((l, a) => {
|
|
8714
8714
|
let c = Po(n, l, a + t);
|
|
8715
8715
|
if (c) {
|
|
8716
8716
|
s = !0;
|
|
8717
|
-
let d =
|
|
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 = Ro(s ? Bo(n) : n, -t).sort(
|
|
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;
|
|
8725
8725
|
}
|
|
8726
|
-
function
|
|
8726
|
+
function tt(n, e) {
|
|
8727
8727
|
return n.from - e.from || n.to - e.to;
|
|
8728
8728
|
}
|
|
8729
8729
|
function Ur(n) {
|
|
@@ -8745,16 +8745,16 @@ function Ur(n) {
|
|
|
8745
8745
|
return e;
|
|
8746
8746
|
}
|
|
8747
8747
|
function Ui(n, e, t) {
|
|
8748
|
-
for (; e < n.length &&
|
|
8748
|
+
for (; e < n.length && tt(t, n[e]) > 0; )
|
|
8749
8749
|
e++;
|
|
8750
8750
|
n.splice(e, 0, t);
|
|
8751
8751
|
}
|
|
8752
|
-
function
|
|
8752
|
+
function er(n) {
|
|
8753
8753
|
let e = [];
|
|
8754
8754
|
return n.someProp("decorations", (t) => {
|
|
8755
8755
|
let r = t(n.state);
|
|
8756
8756
|
r && r != Y && e.push(r);
|
|
8757
|
-
}), n.cursorWrapper && e.push(z.create(n.state.doc, [n.cursorWrapper.deco])),
|
|
8757
|
+
}), n.cursorWrapper && e.push(z.create(n.state.doc, [n.cursorWrapper.deco])), Re.from(e);
|
|
8758
8758
|
}
|
|
8759
8759
|
const Vc = {
|
|
8760
8760
|
childList: !0,
|
|
@@ -8763,7 +8763,7 @@ const Vc = {
|
|
|
8763
8763
|
attributes: !0,
|
|
8764
8764
|
attributeOldValue: !0,
|
|
8765
8765
|
subtree: !0
|
|
8766
|
-
}, Hc = ie &&
|
|
8766
|
+
}, Hc = ie && $e <= 11;
|
|
8767
8767
|
class Wc {
|
|
8768
8768
|
constructor() {
|
|
8769
8769
|
this.anchorNode = null, this.anchorOffset = 0, this.focusNode = null, this.focusOffset = 0;
|
|
@@ -8783,7 +8783,7 @@ class qc {
|
|
|
8783
8783
|
this.view = e, this.handleDOMChange = t, this.queue = [], this.flushingSoon = -1, this.observer = null, this.currentSelection = new Wc(), this.onCharData = null, this.suppressingSelectionUpdates = !1, this.lastChangedTextNode = null, this.observer = window.MutationObserver && new window.MutationObserver((r) => {
|
|
8784
8784
|
for (let i = 0; i < r.length; i++)
|
|
8785
8785
|
this.queue.push(r[i]);
|
|
8786
|
-
ie &&
|
|
8786
|
+
ie && $e <= 11 && r.some((i) => i.type == "childList" && i.removedNodes.length || i.type == "characterData" && i.oldValue.length > i.target.nodeValue.length) ? this.flushSoon() : X && e.composing && r.some((i) => i.type == "childList" && i.target.nodeName == "TR") ? (e.input.badSafariComposition = !0, this.flushSoon()) : this.flush();
|
|
8787
8787
|
}), Hc && (this.onCharData = (r) => {
|
|
8788
8788
|
this.queue.push({ target: r.target, type: "characterData", oldValue: r.prevValue }), this.flushSoon();
|
|
8789
8789
|
}), this.onSelectionChange = this.onSelectionChange.bind(this);
|
|
@@ -8824,9 +8824,9 @@ class qc {
|
|
|
8824
8824
|
if ($i(this.view)) {
|
|
8825
8825
|
if (this.suppressingSelectionUpdates)
|
|
8826
8826
|
return Ne(this.view);
|
|
8827
|
-
if (ie &&
|
|
8827
|
+
if (ie && $e <= 11 && !this.view.state.selection.empty) {
|
|
8828
8828
|
let e = this.view.domSelectionRange();
|
|
8829
|
-
if (e.focusNode &&
|
|
8829
|
+
if (e.focusNode && st(e.focusNode, e.focusOffset, e.anchorNode, e.anchorOffset))
|
|
8830
8830
|
return this.flushSoon();
|
|
8831
8831
|
}
|
|
8832
8832
|
this.flush();
|
|
@@ -8839,9 +8839,9 @@ class qc {
|
|
|
8839
8839
|
if (!e.focusNode)
|
|
8840
8840
|
return !0;
|
|
8841
8841
|
let t = /* @__PURE__ */ new Set(), r;
|
|
8842
|
-
for (let s = e.focusNode; s; s =
|
|
8842
|
+
for (let s = e.focusNode; s; s = kt(s))
|
|
8843
8843
|
t.add(s);
|
|
8844
|
-
for (let s = e.anchorNode; s; s =
|
|
8844
|
+
for (let s = e.anchorNode; s; s = kt(s))
|
|
8845
8845
|
if (t.has(s)) {
|
|
8846
8846
|
r = s;
|
|
8847
8847
|
break;
|
|
@@ -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 &&
|
|
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)
|
|
@@ -8914,7 +8914,7 @@ class qc {
|
|
|
8914
8914
|
if (r.contentDOM && r.contentDOM != r.dom && !r.contentDOM.contains(e.target))
|
|
8915
8915
|
return { from: r.posBefore, to: r.posAfter };
|
|
8916
8916
|
let i = e.previousSibling, s = e.nextSibling;
|
|
8917
|
-
if (ie &&
|
|
8917
|
+
if (ie && $e <= 11 && e.addedNodes.length)
|
|
8918
8918
|
for (let d = 0; d < e.addedNodes.length; d++) {
|
|
8919
8919
|
let { previousSibling: u, nextSibling: f } = e.addedNodes[d];
|
|
8920
8920
|
(!u || Array.prototype.indexOf.call(e.addedNodes, u) < 0) && (i = u), (!f || Array.prototype.indexOf.call(e.addedNodes, f) < 0) && (s = f);
|
|
@@ -8942,7 +8942,7 @@ function jc(n) {
|
|
|
8942
8942
|
}
|
|
8943
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
|
-
return
|
|
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
|
}
|
|
8947
8947
|
function Kc(n, e) {
|
|
8948
8948
|
if (e.getComposedRanges) {
|
|
@@ -8987,7 +8987,7 @@ function Uc(n, e) {
|
|
|
8987
8987
|
}
|
|
8988
8988
|
function _c(n, e, t) {
|
|
8989
8989
|
let { node: r, fromOffset: i, toOffset: s, from: o, to: l } = n.docView.parseRange(e, t), a = n.domSelectionRange(), c, d = a.anchorNode;
|
|
8990
|
-
if (d && n.dom.contains(d.nodeType == 1 ? d : d.parentNode) && (c = [{ node: d, offset: a.anchorOffset }],
|
|
8990
|
+
if (d && n.dom.contains(d.nodeType == 1 ? d : d.parentNode) && (c = [{ node: d, offset: a.anchorOffset }], Rn(a) || c.push({ node: a.focusNode, offset: a.focusOffset })), U && n.input.lastKeyCode === 8)
|
|
8991
8991
|
for (let g = s; g > i; g--) {
|
|
8992
8992
|
let y = r.childNodes[g - 1], T = y.pmViewDesc;
|
|
8993
8993
|
if (y.nodeName == "BR" && !T) {
|
|
@@ -8997,7 +8997,7 @@ function _c(n, e, t) {
|
|
|
8997
8997
|
if (!T || T.size)
|
|
8998
8998
|
break;
|
|
8999
8999
|
}
|
|
9000
|
-
let u = n.state.doc, f = n.someProp("domParser") ||
|
|
9000
|
+
let u = n.state.doc, f = n.someProp("domParser") || Fe.fromSchema(n.state.schema), h = u.resolve(o), p = null, m = f.parse(r, {
|
|
9001
9001
|
topNode: h.parent,
|
|
9002
9002
|
topMatch: h.parent.contentMatchAt(h.index()),
|
|
9003
9003
|
topOpen: !0,
|
|
@@ -9034,7 +9034,7 @@ function Xc(n, e, t, r, i) {
|
|
|
9034
9034
|
if (n.input.compositionPendingChanges = 0, e < 0) {
|
|
9035
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
|
-
if (U && Ee && n.input.lastKeyCode === 13 && Date.now() - 100 < n.input.lastKeyCodeTime && n.someProp("handleKeyDown", (yl) => yl(n,
|
|
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;
|
|
9039
9039
|
let G = n.state.tr.setSelection(N);
|
|
9040
9040
|
C == "pointer" ? G.setMeta("pointer", !0) : C == "key" && G.scrollIntoView(), s && G.setMeta("composition", s), n.dispatch(G);
|
|
@@ -9046,7 +9046,7 @@ function Xc(n, e, t, r, i) {
|
|
|
9046
9046
|
let a = n.state.selection, c = _c(n, e, t), d = n.state.doc, u = d.slice(c.from, c.to), f, h;
|
|
9047
9047
|
n.input.lastKeyCode === 8 && Date.now() - 100 < n.input.lastKeyCodeTime ? (f = n.state.selection.to, h = "end") : (f = n.state.selection.from, h = "start"), n.input.lastKeyCode = null;
|
|
9048
9048
|
let p = ed(u.content, c.doc.content, c.from, f, h);
|
|
9049
|
-
if (p && n.input.domChangeCount++, (
|
|
9049
|
+
if (p && n.input.domChangeCount++, (xt && n.input.lastIOSEnter > Date.now() - 225 || Ee) && i.some((C) => C.nodeType == 1 && !Yc.test(C.nodeName)) && (!p || p.endA >= p.endB) && n.someProp("handleKeyDown", (C) => C(n, Je(13, "Enter")))) {
|
|
9050
9050
|
n.input.lastIOSEnter = 0;
|
|
9051
9051
|
return;
|
|
9052
9052
|
}
|
|
@@ -9063,19 +9063,19 @@ function Xc(n, e, t, r, i) {
|
|
|
9063
9063
|
}
|
|
9064
9064
|
return;
|
|
9065
9065
|
}
|
|
9066
|
-
n.state.selection.from < n.state.selection.to && p.start == p.endB && n.state.selection instanceof M && (p.start > n.state.selection.from && p.start <= n.state.selection.from + 2 && n.state.selection.from >= c.from ? p.start = n.state.selection.from : p.endA < n.state.selection.to && p.endA >= n.state.selection.to - 2 && n.state.selection.to <= c.to && (p.endB += n.state.selection.to - p.endA, p.endA = n.state.selection.to)), ie &&
|
|
9066
|
+
n.state.selection.from < n.state.selection.to && p.start == p.endB && n.state.selection instanceof M && (p.start > n.state.selection.from && p.start <= n.state.selection.from + 2 && n.state.selection.from >= c.from ? p.start = n.state.selection.from : p.endA < n.state.selection.to && p.endA >= n.state.selection.to - 2 && n.state.selection.to <= c.to && (p.endB += n.state.selection.to - p.endA, p.endA = n.state.selection.to)), ie && $e <= 11 && p.endB == p.start + 1 && p.endA == p.start && p.start > c.from && c.doc.textBetween(p.start - c.from - 1, p.start - c.from + 1) == " " && (p.start--, p.endA--, p.endB--);
|
|
9067
9067
|
let m = c.doc.resolveNoCache(p.start - c.from), g = c.doc.resolveNoCache(p.endB - c.from), y = d.resolve(p.start), T = m.sameParent(g) && m.parent.inlineContent && y.end() >= p.endA;
|
|
9068
|
-
if ((
|
|
9068
|
+
if ((xt && n.input.lastIOSEnter > Date.now() - 225 && (!T || i.some((C) => C.nodeName == "DIV" || C.nodeName == "P")) || !T && m.pos < c.doc.content.size && (!m.sameParent(g) || !m.parent.inlineContent) && m.pos < g.pos && !/\S/.test(c.doc.textBetween(m.pos, g.pos, "", ""))) && n.someProp("handleKeyDown", (C) => C(n, Je(13, "Enter")))) {
|
|
9069
9069
|
n.input.lastIOSEnter = 0;
|
|
9070
9070
|
return;
|
|
9071
9071
|
}
|
|
9072
|
-
if (n.state.selection.anchor > p.start && Qc(d, p.start, p.endA, m, g) && n.someProp("handleKeyDown", (C) => C(n,
|
|
9072
|
+
if (n.state.selection.anchor > p.start && Qc(d, p.start, p.endA, m, g) && n.someProp("handleKeyDown", (C) => C(n, Je(8, "Backspace")))) {
|
|
9073
9073
|
Ee && U && n.domObserver.suppressSelectionUpdates();
|
|
9074
9074
|
return;
|
|
9075
9075
|
}
|
|
9076
9076
|
U && p.endB == p.start && (n.input.lastChromeDelete = Date.now()), Ee && !T && m.start() != g.start() && g.parentOffset == 0 && m.depth == g.depth && c.sel && c.sel.anchor == c.sel.head && c.sel.head == p.endA && (p.endB -= 2, g = c.doc.resolveNoCache(p.endB - c.from), setTimeout(() => {
|
|
9077
9077
|
n.someProp("handleKeyDown", function(C) {
|
|
9078
|
-
return C(n,
|
|
9078
|
+
return C(n, Je(13, "Enter"));
|
|
9079
9079
|
});
|
|
9080
9080
|
}, 20));
|
|
9081
9081
|
let w = p.start, I = p.endA, D = (C) => {
|
|
@@ -9088,7 +9088,7 @@ function Xc(n, e, t, r, i) {
|
|
|
9088
9088
|
}, L;
|
|
9089
9089
|
if (T)
|
|
9090
9090
|
if (m.pos == g.pos) {
|
|
9091
|
-
ie &&
|
|
9091
|
+
ie && $e <= 11 && m.parentOffset == 0 && (n.domObserver.suppressSelectionUpdates(), setTimeout(() => Ne(n), 20));
|
|
9092
9092
|
let C = D(n.state.tr.delete(w, I)), N = d.resolve(p.start).marksAcross(d.resolve(p.endA));
|
|
9093
9093
|
N && C.ensureMarks(N), n.dispatch(C);
|
|
9094
9094
|
} else if (
|
|
@@ -9130,7 +9130,7 @@ function Qc(n, e, t, r, i) {
|
|
|
9130
9130
|
if (
|
|
9131
9131
|
// The content must have shrunk
|
|
9132
9132
|
t - e <= i.pos - r.pos || // newEnd must point directly at or after the end of the block that newStart points into
|
|
9133
|
-
|
|
9133
|
+
tr(r, !0, !1) < i.pos
|
|
9134
9134
|
)
|
|
9135
9135
|
return !1;
|
|
9136
9136
|
let s = n.resolve(e);
|
|
@@ -9140,10 +9140,10 @@ function Qc(n, e, t, r, i) {
|
|
|
9140
9140
|
}
|
|
9141
9141
|
if (s.parentOffset < s.parent.content.size || !s.parent.isTextblock)
|
|
9142
9142
|
return !1;
|
|
9143
|
-
let o = n.resolve(
|
|
9144
|
-
return !o.parent.isTextblock || o.pos > t ||
|
|
9143
|
+
let o = n.resolve(tr(s, !0, !0));
|
|
9144
|
+
return !o.parent.isTextblock || o.pos > t || tr(o, !0, !1) < t ? !1 : r.parent.content.cut(r.parentOffset).eq(o.parent.content);
|
|
9145
9145
|
}
|
|
9146
|
-
function
|
|
9146
|
+
function tr(n, e, t) {
|
|
9147
9147
|
let r = n.depth, i = e ? n.end() : n.pos;
|
|
9148
9148
|
for (; r > 0 && (e || n.indexAfter(r) == n.node(r).childCount); )
|
|
9149
9149
|
r--, i++, e = !1;
|
|
@@ -9187,7 +9187,7 @@ class Lo {
|
|
|
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(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),
|
|
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
|
|
@@ -9250,7 +9250,7 @@ class Lo {
|
|
|
9250
9250
|
nd(h, this.nodeViews) && (this.nodeViews = h, s = !0);
|
|
9251
9251
|
}
|
|
9252
9252
|
(l || t.handleDOMEvents != this._props.handleDOMEvents) && Er(this), this.editable = ts(this), es(this);
|
|
9253
|
-
let a =
|
|
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) {
|
|
@@ -9456,13 +9456,13 @@ class Lo {
|
|
|
9456
9456
|
[`handlePaste`](https://prosemirror.net/docs/ref/#view.EditorProps.handlePaste) hook.
|
|
9457
9457
|
*/
|
|
9458
9458
|
pasteHTML(e, t) {
|
|
9459
|
-
return
|
|
9459
|
+
return Ft(this, "", e, !1, t || new ClipboardEvent("paste"));
|
|
9460
9460
|
}
|
|
9461
9461
|
/**
|
|
9462
9462
|
Run the editor's paste logic with the given plain-text input.
|
|
9463
9463
|
*/
|
|
9464
9464
|
pasteText(e, t) {
|
|
9465
|
-
return
|
|
9465
|
+
return Ft(this, e, null, !0, t || new ClipboardEvent("paste"));
|
|
9466
9466
|
}
|
|
9467
9467
|
/**
|
|
9468
9468
|
Serialize the given slice as it would be if it was copied from
|
|
@@ -9480,7 +9480,7 @@ class Lo {
|
|
|
9480
9480
|
views](https://prosemirror.net/docs/ref/#view.NodeView).
|
|
9481
9481
|
*/
|
|
9482
9482
|
destroy() {
|
|
9483
|
-
this.docView && (bc(this), this.destroyPluginViews(), this.mounted ? (this.docView.update(this.state.doc, [],
|
|
9483
|
+
this.docView && (bc(this), this.destroyPluginViews(), this.mounted ? (this.docView.update(this.state.doc, [], er(this), this), this.dom.textContent = "") : this.dom.parentNode && this.dom.parentNode.removeChild(this.dom), this.docView.destroy(), this.docView = null, Sa());
|
|
9484
9484
|
}
|
|
9485
9485
|
/**
|
|
9486
9486
|
This is true when the view has been
|
|
@@ -9559,7 +9559,7 @@ 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
|
}
|
|
9562
|
-
var
|
|
9562
|
+
var We = {
|
|
9563
9563
|
8: "Backspace",
|
|
9564
9564
|
9: "Tab",
|
|
9565
9565
|
10: "Enter",
|
|
@@ -9612,7 +9612,7 @@ var qe = {
|
|
|
9612
9612
|
220: "\\",
|
|
9613
9613
|
221: "]",
|
|
9614
9614
|
222: "'"
|
|
9615
|
-
},
|
|
9615
|
+
}, Sn = {
|
|
9616
9616
|
48: ")",
|
|
9617
9617
|
49: "!",
|
|
9618
9618
|
50: "@",
|
|
@@ -9638,13 +9638,13 @@ var qe = {
|
|
|
9638
9638
|
221: "}",
|
|
9639
9639
|
222: '"'
|
|
9640
9640
|
}, rd = typeof navigator < "u" && /Mac/.test(navigator.platform), id = typeof navigator < "u" && /MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);
|
|
9641
|
-
for (var J = 0; J < 10; J++)
|
|
9642
|
-
for (var J = 1; J <= 24; J++)
|
|
9641
|
+
for (var J = 0; J < 10; J++) We[48 + J] = We[96 + J] = String(J);
|
|
9642
|
+
for (var J = 1; J <= 24; J++) We[J + 111] = "F" + J;
|
|
9643
9643
|
for (var J = 65; J <= 90; J++)
|
|
9644
|
-
|
|
9645
|
-
for (var
|
|
9644
|
+
We[J] = String.fromCharCode(J + 32), Sn[J] = String.fromCharCode(J);
|
|
9645
|
+
for (var nr in We) Sn.hasOwnProperty(nr) || (Sn[nr] = We[nr]);
|
|
9646
9646
|
function sd(n) {
|
|
9647
|
-
var e = rd && n.metaKey && n.shiftKey && !n.ctrlKey && !n.altKey || id && n.shiftKey && n.key && n.key.length == 1 || n.key == "Unidentified", t = !e && n.key || (n.shiftKey ?
|
|
9647
|
+
var e = rd && n.metaKey && n.shiftKey && !n.ctrlKey && !n.altKey || id && n.shiftKey && n.key && n.key.length == 1 || n.key == "Unidentified", t = !e && n.key || (n.shiftKey ? Sn : We)[n.keyCode] || n.key || "Unidentified";
|
|
9648
9648
|
return t == "Esc" && (t = "Escape"), t == "Del" && (t = "Delete"), t == "Left" && (t = "ArrowLeft"), t == "Up" && (t = "ArrowUp"), t == "Right" && (t = "ArrowRight"), t == "Down" && (t = "ArrowDown"), t;
|
|
9649
9649
|
}
|
|
9650
9650
|
const od = typeof navigator < "u" && /Mac|iP(hone|[oa]d)/.test(navigator.platform), ld = typeof navigator < "u" && /Win/.test(navigator.platform);
|
|
@@ -9675,7 +9675,7 @@ function cd(n) {
|
|
|
9675
9675
|
e[ad(t)] = n[t];
|
|
9676
9676
|
return e;
|
|
9677
9677
|
}
|
|
9678
|
-
function
|
|
9678
|
+
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) {
|
|
@@ -9684,18 +9684,18 @@ function dd(n) {
|
|
|
9684
9684
|
function zo(n) {
|
|
9685
9685
|
let e = cd(n);
|
|
9686
9686
|
return function(t, r) {
|
|
9687
|
-
let i = sd(r), s, o = e[
|
|
9687
|
+
let i = sd(r), s, o = e[rr(i, r)];
|
|
9688
9688
|
if (o && o(t.state, t.dispatch, t))
|
|
9689
9689
|
return !0;
|
|
9690
9690
|
if (i.length == 1 && i != " ") {
|
|
9691
9691
|
if (r.shiftKey) {
|
|
9692
|
-
let l = e[
|
|
9692
|
+
let l = e[rr(i, r, !1)];
|
|
9693
9693
|
if (l && l(t.state, t.dispatch, t))
|
|
9694
9694
|
return !0;
|
|
9695
9695
|
}
|
|
9696
9696
|
if ((r.altKey || r.metaKey || r.ctrlKey) && // Ctrl-Alt may be used for AltGr on Windows
|
|
9697
|
-
!(ld && r.ctrlKey && r.altKey) && (s =
|
|
9698
|
-
let l = e[
|
|
9697
|
+
!(ld && r.ctrlKey && r.altKey) && (s = We[r.keyCode]) && s != i) {
|
|
9698
|
+
let l = e[rr(s, r)];
|
|
9699
9699
|
if (l && l(t.state, t.dispatch, t))
|
|
9700
9700
|
return !0;
|
|
9701
9701
|
}
|
|
@@ -9714,19 +9714,19 @@ const $o = (n, e, t) => {
|
|
|
9714
9714
|
return !1;
|
|
9715
9715
|
let i = Gr(r);
|
|
9716
9716
|
if (!i) {
|
|
9717
|
-
let o = r.blockRange(), l = o &&
|
|
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
9721
|
if (_o(n, i, e, -1))
|
|
9722
9722
|
return !0;
|
|
9723
|
-
if (r.parent.content.size == 0 && (
|
|
9723
|
+
if (r.parent.content.size == 0 && (St(s, "end") || S.isSelectable(s)))
|
|
9724
9724
|
for (let o = r.depth; ; o--) {
|
|
9725
|
-
let l =
|
|
9725
|
+
let l = Dn(n.doc, r.before(o), r.after(o), k.empty);
|
|
9726
9726
|
if (l && l.slice.size < l.to - l.from) {
|
|
9727
9727
|
if (e) {
|
|
9728
9728
|
let a = n.tr.step(l);
|
|
9729
|
-
a.setSelection(
|
|
9729
|
+
a.setSelection(St(s, "end") ? E.findFrom(a.doc.resolve(a.mapping.map(i.pos, -1)), -1) : S.create(a.doc, i.pos - s.nodeSize)), e(a.scrollIntoView());
|
|
9730
9730
|
}
|
|
9731
9731
|
return !0;
|
|
9732
9732
|
}
|
|
@@ -9766,7 +9766,7 @@ function Vo(n, e, t) {
|
|
|
9766
9766
|
return !1;
|
|
9767
9767
|
l = d;
|
|
9768
9768
|
}
|
|
9769
|
-
let c =
|
|
9769
|
+
let c = Dn(n.doc, s, a, k.empty);
|
|
9770
9770
|
if (!c || c.from != s || c instanceof P && c.slice.size >= a - s)
|
|
9771
9771
|
return !1;
|
|
9772
9772
|
if (t) {
|
|
@@ -9775,7 +9775,7 @@ function Vo(n, e, t) {
|
|
|
9775
9775
|
}
|
|
9776
9776
|
return !0;
|
|
9777
9777
|
}
|
|
9778
|
-
function
|
|
9778
|
+
function St(n, e, t = !1) {
|
|
9779
9779
|
for (let r = n; r; r = e == "start" ? r.firstChild : r.lastChild) {
|
|
9780
9780
|
if (r.isTextblock)
|
|
9781
9781
|
return !0;
|
|
@@ -9820,12 +9820,12 @@ const qo = (n, e, t) => {
|
|
|
9820
9820
|
let s = i.nodeAfter;
|
|
9821
9821
|
if (_o(n, i, e, 1))
|
|
9822
9822
|
return !0;
|
|
9823
|
-
if (r.parent.content.size == 0 && (
|
|
9824
|
-
let o =
|
|
9823
|
+
if (r.parent.content.size == 0 && (St(s, "start") || S.isSelectable(s))) {
|
|
9824
|
+
let o = Dn(n.doc, r.before(), r.after(), k.empty);
|
|
9825
9825
|
if (o && o.slice.size < o.to - o.from) {
|
|
9826
9826
|
if (e) {
|
|
9827
9827
|
let l = n.tr.step(o);
|
|
9828
|
-
l.setSelection(
|
|
9828
|
+
l.setSelection(St(s, "start") ? E.findFrom(l.doc.resolve(l.mapping.map(i.pos)), 1) : S.create(l.doc, l.mapping.map(i.pos))), e(l.scrollIntoView());
|
|
9829
9829
|
}
|
|
9830
9830
|
return !0;
|
|
9831
9831
|
}
|
|
@@ -9857,10 +9857,10 @@ function Yr(n) {
|
|
|
9857
9857
|
const hd = (n, e) => {
|
|
9858
9858
|
let t = n.selection, r = t instanceof S, i;
|
|
9859
9859
|
if (r) {
|
|
9860
|
-
if (t.node.isTextblock || !
|
|
9860
|
+
if (t.node.isTextblock || !qe(n.doc, t.from))
|
|
9861
9861
|
return !1;
|
|
9862
9862
|
i = t.from;
|
|
9863
|
-
} else if (i =
|
|
9863
|
+
} else if (i = An(n.doc, t.from, -1), i == null)
|
|
9864
9864
|
return !1;
|
|
9865
9865
|
if (e) {
|
|
9866
9866
|
let s = n.tr.join(i);
|
|
@@ -9870,14 +9870,14 @@ const hd = (n, e) => {
|
|
|
9870
9870
|
}, pd = (n, e) => {
|
|
9871
9871
|
let t = n.selection, r;
|
|
9872
9872
|
if (t instanceof S) {
|
|
9873
|
-
if (t.node.isTextblock || !
|
|
9873
|
+
if (t.node.isTextblock || !qe(n.doc, t.to))
|
|
9874
9874
|
return !1;
|
|
9875
9875
|
r = t.to;
|
|
9876
|
-
} else if (r =
|
|
9876
|
+
} else if (r = An(n.doc, t.to, 1), r == null)
|
|
9877
9877
|
return !1;
|
|
9878
9878
|
return e && e(n.tr.join(r).scrollIntoView()), !0;
|
|
9879
9879
|
}, md = (n, e) => {
|
|
9880
|
-
let { $from: t, $to: r } = n.selection, i = t.blockRange(r), s = i &&
|
|
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;
|
|
@@ -9925,7 +9925,7 @@ const gd = (n, e) => {
|
|
|
9925
9925
|
if (ve(n.doc, s))
|
|
9926
9926
|
return e && e(n.tr.split(s).scrollIntoView()), !0;
|
|
9927
9927
|
}
|
|
9928
|
-
let r = t.blockRange(), i = r &&
|
|
9928
|
+
let r = t.blockRange(), i = r && Mt(r);
|
|
9929
9929
|
return i == null ? !1 : (e && e(n.tr.lift(r, i).scrollIntoView()), !0);
|
|
9930
9930
|
};
|
|
9931
9931
|
function yd(n) {
|
|
@@ -9963,7 +9963,7 @@ const bd = yd(), kd = (n, e) => {
|
|
|
9963
9963
|
};
|
|
9964
9964
|
function xd(n, e, t) {
|
|
9965
9965
|
let r = e.nodeBefore, i = e.nodeAfter, s = e.index();
|
|
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 ||
|
|
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
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;
|
|
@@ -9977,14 +9977,14 @@ function _o(n, e, t, r) {
|
|
|
9977
9977
|
p = b.from(o[y].create(null, p));
|
|
9978
9978
|
p = b.from(i.copy(p));
|
|
9979
9979
|
let m = n.tr.step(new F(e.pos - 1, h, e.pos, h, new k(p, 1, 0), o.length, !0)), g = m.doc.resolve(h + 2 * o.length);
|
|
9980
|
-
g.nodeAfter && g.nodeAfter.type == i.type &&
|
|
9980
|
+
g.nodeAfter && g.nodeAfter.type == i.type && qe(m.doc, g.pos) && m.join(g.pos), t(m.scrollIntoView());
|
|
9981
9981
|
}
|
|
9982
9982
|
return !0;
|
|
9983
9983
|
}
|
|
9984
|
-
let d = s.type.spec.isolating || r > 0 && a ? null : E.findFrom(e, 1), u = d && d.$from.blockRange(d.$to), f = u &&
|
|
9984
|
+
let d = s.type.spec.isolating || r > 0 && a ? null : E.findFrom(e, 1), u = d && d.$from.blockRange(d.$to), f = u && Mt(u);
|
|
9985
9985
|
if (f != null && f >= e.depth)
|
|
9986
9986
|
return t && t(n.tr.lift(u, f).scrollIntoView()), !0;
|
|
9987
|
-
if (c &&
|
|
9987
|
+
if (c && St(s, "start", !0) && St(i, "end")) {
|
|
9988
9988
|
let h = i, p = [];
|
|
9989
9989
|
for (; p.push(h), !h.isTextblock; )
|
|
9990
9990
|
h = h.lastChild;
|
|
@@ -10079,7 +10079,7 @@ function Td(n, e, t, r = null) {
|
|
|
10079
10079
|
if (e.$from.index(e.depth - 1) == 0)
|
|
10080
10080
|
return !1;
|
|
10081
10081
|
let a = o.resolve(e.start - 2);
|
|
10082
|
-
s = new
|
|
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
10084
|
let l = zr(s, t, r, e);
|
|
10085
10085
|
return l ? (n && Od(n, e, l, i, t), !0) : !1;
|
|
@@ -10105,13 +10105,13 @@ function Ed(n) {
|
|
|
10105
10105
|
}
|
|
10106
10106
|
function vd(n, e, t, r) {
|
|
10107
10107
|
let i = n.tr, s = r.end, o = r.$to.end(r.depth);
|
|
10108
|
-
s < o && (i.step(new F(s - 1, o, s, o, new k(b.from(t.create(null, r.parent.copy())), 1, 0), 1, !0)), r = new
|
|
10109
|
-
const l =
|
|
10108
|
+
s < o && (i.step(new F(s - 1, o, s, o, new k(b.from(t.create(null, r.parent.copy())), 1, 0), 1, !0)), r = new pn(i.doc.resolve(r.$from.pos), i.doc.resolve(o), r.depth));
|
|
10109
|
+
const l = Mt(r);
|
|
10110
10110
|
if (l == null)
|
|
10111
10111
|
return !1;
|
|
10112
10112
|
i.lift(r, l);
|
|
10113
10113
|
let a = i.doc.resolve(i.mapping.map(s, -1) - 1);
|
|
10114
|
-
return
|
|
10114
|
+
return qe(i.doc, a.pos) && a.nodeBefore.type == a.nodeAfter.type && i.join(a.pos), e(i.scrollIntoView()), !0;
|
|
10115
10115
|
}
|
|
10116
10116
|
function Nd(n, e, t) {
|
|
10117
10117
|
let r = n.tr, i = t.parent;
|
|
@@ -10144,7 +10144,7 @@ function Ad(n) {
|
|
|
10144
10144
|
return !0;
|
|
10145
10145
|
};
|
|
10146
10146
|
}
|
|
10147
|
-
function
|
|
10147
|
+
function Ln(n) {
|
|
10148
10148
|
const { state: e, transaction: t } = n;
|
|
10149
10149
|
let { selection: r } = t, { doc: i } = t, { storedMarks: s } = t;
|
|
10150
10150
|
return {
|
|
@@ -10169,7 +10169,7 @@ function zn(n) {
|
|
|
10169
10169
|
}
|
|
10170
10170
|
};
|
|
10171
10171
|
}
|
|
10172
|
-
class
|
|
10172
|
+
class zn {
|
|
10173
10173
|
constructor(e) {
|
|
10174
10174
|
this.editor = e.editor, this.rawCommands = this.editor.extensionManager.commands, this.customState = e.state;
|
|
10175
10175
|
}
|
|
@@ -10214,7 +10214,7 @@ class Fn {
|
|
|
10214
10214
|
tr: e,
|
|
10215
10215
|
editor: i,
|
|
10216
10216
|
view: o,
|
|
10217
|
-
state:
|
|
10217
|
+
state: Ln({
|
|
10218
10218
|
state: s,
|
|
10219
10219
|
transaction: e
|
|
10220
10220
|
}),
|
|
@@ -10260,7 +10260,7 @@ function x(n, e, t) {
|
|
|
10260
10260
|
parent: n.parent ? x(n.parent, e, t) : null
|
|
10261
10261
|
}) : n.config[e];
|
|
10262
10262
|
}
|
|
10263
|
-
function
|
|
10263
|
+
function Fn(n) {
|
|
10264
10264
|
const e = n.filter((i) => i.type === "extension"), t = n.filter((i) => i.type === "node"), r = n.filter((i) => i.type === "mark");
|
|
10265
10265
|
return {
|
|
10266
10266
|
baseExtensions: e,
|
|
@@ -10269,7 +10269,7 @@ function $n(n) {
|
|
|
10269
10269
|
};
|
|
10270
10270
|
}
|
|
10271
10271
|
function Yo(n) {
|
|
10272
|
-
const e = [], { nodeExtensions: t, markExtensions: r } =
|
|
10272
|
+
const e = [], { nodeExtensions: t, markExtensions: r } = Fn(n), i = [...t, ...r], s = {
|
|
10273
10273
|
default: null,
|
|
10274
10274
|
rendered: !0,
|
|
10275
10275
|
renderHTML: null,
|
|
@@ -10398,7 +10398,7 @@ function ls(n) {
|
|
|
10398
10398
|
}
|
|
10399
10399
|
function Pd(n, e) {
|
|
10400
10400
|
var t;
|
|
10401
|
-
const r = Yo(n), { nodeExtensions: i, markExtensions: s } =
|
|
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,
|
|
@@ -10474,14 +10474,14 @@ function Pd(n, e) {
|
|
|
10474
10474
|
marks: a
|
|
10475
10475
|
});
|
|
10476
10476
|
}
|
|
10477
|
-
function
|
|
10477
|
+
function ir(n, e) {
|
|
10478
10478
|
return e.nodes[n] || e.marks[n] || null;
|
|
10479
10479
|
}
|
|
10480
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
10483
|
function Qr(n, e) {
|
|
10484
|
-
const t =
|
|
10484
|
+
const t = ct.fromSchema(e).serializeFragment(n), i = document.implementation.createHTMLDocument().createElement("div");
|
|
10485
10485
|
return i.appendChild(t), i.innerHTML;
|
|
10486
10486
|
}
|
|
10487
10487
|
const Bd = (n, e = 500) => {
|
|
@@ -10501,7 +10501,7 @@ const Bd = (n, e = 500) => {
|
|
|
10501
10501
|
function ei(n) {
|
|
10502
10502
|
return Object.prototype.toString.call(n) === "[object RegExp]";
|
|
10503
10503
|
}
|
|
10504
|
-
class
|
|
10504
|
+
class $n {
|
|
10505
10505
|
constructor(e) {
|
|
10506
10506
|
this.find = e.find, this.handler = e.handler;
|
|
10507
10507
|
}
|
|
@@ -10515,7 +10515,7 @@ const Ld = (n, e) => {
|
|
|
10515
10515
|
const r = [t.text];
|
|
10516
10516
|
return r.index = t.index, r.input = n, r.data = t.data, t.replaceWith && (t.text.includes(t.replaceWith) || console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'), r.push(t.replaceWith)), r;
|
|
10517
10517
|
};
|
|
10518
|
-
function
|
|
10518
|
+
function tn(n) {
|
|
10519
10519
|
var e;
|
|
10520
10520
|
const { editor: t, from: r, to: i, text: s, rules: o, plugin: l } = n, { view: a } = t;
|
|
10521
10521
|
if (a.composing)
|
|
@@ -10534,13 +10534,13 @@ function nn(n) {
|
|
|
10534
10534
|
const h = Ld(u, f.find);
|
|
10535
10535
|
if (!h)
|
|
10536
10536
|
return;
|
|
10537
|
-
const p = a.state.tr, m =
|
|
10537
|
+
const p = a.state.tr, m = Ln({
|
|
10538
10538
|
state: a.state,
|
|
10539
10539
|
transaction: p
|
|
10540
10540
|
}), g = {
|
|
10541
10541
|
from: r - (h[0].length - s.length),
|
|
10542
10542
|
to: i
|
|
10543
|
-
}, { commands: y, chain: T, can: w } = new
|
|
10543
|
+
}, { commands: y, chain: T, can: w } = new zn({
|
|
10544
10544
|
editor: t,
|
|
10545
10545
|
state: m
|
|
10546
10546
|
});
|
|
@@ -10574,7 +10574,7 @@ function zd(n) {
|
|
|
10574
10574
|
let { text: d } = a;
|
|
10575
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,
|
|
10579
10579
|
from: u,
|
|
10580
10580
|
to: f,
|
|
@@ -10587,7 +10587,7 @@ function zd(n) {
|
|
|
10587
10587
|
},
|
|
10588
10588
|
props: {
|
|
10589
10589
|
handleTextInput(i, s, o, l) {
|
|
10590
|
-
return
|
|
10590
|
+
return tn({
|
|
10591
10591
|
editor: e,
|
|
10592
10592
|
from: s,
|
|
10593
10593
|
to: o,
|
|
@@ -10599,7 +10599,7 @@ function zd(n) {
|
|
|
10599
10599
|
handleDOMEvents: {
|
|
10600
10600
|
compositionend: (i) => (setTimeout(() => {
|
|
10601
10601
|
const { $cursor: s } = i.state.selection;
|
|
10602
|
-
s &&
|
|
10602
|
+
s && tn({
|
|
10603
10603
|
editor: e,
|
|
10604
10604
|
from: s.pos,
|
|
10605
10605
|
to: s.pos,
|
|
@@ -10615,7 +10615,7 @@ function zd(n) {
|
|
|
10615
10615
|
if (s.key !== "Enter")
|
|
10616
10616
|
return !1;
|
|
10617
10617
|
const { $cursor: o } = i.state.selection;
|
|
10618
|
-
return o ?
|
|
10618
|
+
return o ? tn({
|
|
10619
10619
|
editor: e,
|
|
10620
10620
|
from: o.pos,
|
|
10621
10621
|
to: o.pos,
|
|
@@ -10634,13 +10634,13 @@ function zd(n) {
|
|
|
10634
10634
|
function Fd(n) {
|
|
10635
10635
|
return Object.prototype.toString.call(n).slice(8, -1);
|
|
10636
10636
|
}
|
|
10637
|
-
function
|
|
10637
|
+
function nn(n) {
|
|
10638
10638
|
return Fd(n) !== "Object" ? !1 : n.constructor === Object && Object.getPrototypeOf(n) === Object.prototype;
|
|
10639
10639
|
}
|
|
10640
|
-
function
|
|
10640
|
+
function Vn(n, e) {
|
|
10641
10641
|
const t = { ...n };
|
|
10642
|
-
return
|
|
10643
|
-
|
|
10642
|
+
return nn(n) && nn(e) && Object.keys(e).forEach((r) => {
|
|
10643
|
+
nn(e[r]) && nn(n[r]) ? t[r] = Vn(n[r], e[r]) : t[r] = e[r];
|
|
10644
10644
|
}), t;
|
|
10645
10645
|
}
|
|
10646
10646
|
class Me {
|
|
@@ -10664,7 +10664,7 @@ class Me {
|
|
|
10664
10664
|
configure(e = {}) {
|
|
10665
10665
|
const t = this.extend({
|
|
10666
10666
|
...this.config,
|
|
10667
|
-
addOptions: () =>
|
|
10667
|
+
addOptions: () => Vn(this.options, e)
|
|
10668
10668
|
});
|
|
10669
10669
|
return t.name = this.name, t.parent = this.parent, t;
|
|
10670
10670
|
}
|
|
@@ -10707,7 +10707,7 @@ const Hd = (n, e, t) => {
|
|
|
10707
10707
|
}) : [];
|
|
10708
10708
|
};
|
|
10709
10709
|
function Wd(n) {
|
|
10710
|
-
const { editor: e, state: t, from: r, to: i, rule: s, pasteEvent: o, dropEvent: l } = n, { commands: a, chain: c, can: d } = new
|
|
10710
|
+
const { editor: e, state: t, from: r, to: i, rule: s, pasteEvent: o, dropEvent: l } = n, { commands: a, chain: c, can: d } = new zn({
|
|
10711
10711
|
editor: e,
|
|
10712
10712
|
state: t
|
|
10713
10713
|
}), u = [];
|
|
@@ -10735,7 +10735,7 @@ function Wd(n) {
|
|
|
10735
10735
|
});
|
|
10736
10736
|
}), u.every((h) => h !== null);
|
|
10737
10737
|
}
|
|
10738
|
-
let
|
|
10738
|
+
let rn = null;
|
|
10739
10739
|
const qd = (n) => {
|
|
10740
10740
|
var e;
|
|
10741
10741
|
const t = new ClipboardEvent("paste", {
|
|
@@ -10752,7 +10752,7 @@ function jd(n) {
|
|
|
10752
10752
|
l = null;
|
|
10753
10753
|
}
|
|
10754
10754
|
const a = ({ state: d, from: u, to: f, rule: h, pasteEvt: p }) => {
|
|
10755
|
-
const m = d.tr, g =
|
|
10755
|
+
const m = d.tr, g = Ln({
|
|
10756
10756
|
state: d,
|
|
10757
10757
|
transaction: m
|
|
10758
10758
|
});
|
|
@@ -10778,9 +10778,9 @@ function jd(n) {
|
|
|
10778
10778
|
view(u) {
|
|
10779
10779
|
const f = (p) => {
|
|
10780
10780
|
var m;
|
|
10781
|
-
r = !((m = u.dom.parentElement) === null || m === void 0) && m.contains(p.target) ? u.dom.parentElement : null, r && (
|
|
10781
|
+
r = !((m = u.dom.parentElement) === null || m === void 0) && m.contains(p.target) ? u.dom.parentElement : null, r && (rn = e);
|
|
10782
10782
|
}, h = () => {
|
|
10783
|
-
|
|
10783
|
+
rn && (rn = null);
|
|
10784
10784
|
};
|
|
10785
10785
|
return window.addEventListener("dragstart", f), window.addEventListener("dragend", h), {
|
|
10786
10786
|
destroy() {
|
|
@@ -10792,7 +10792,7 @@ function jd(n) {
|
|
|
10792
10792
|
handleDOMEvents: {
|
|
10793
10793
|
drop: (u, f) => {
|
|
10794
10794
|
if (s = r === u.dom.parentElement, l = f, !s) {
|
|
10795
|
-
const h =
|
|
10795
|
+
const h = rn;
|
|
10796
10796
|
h != null && h.isEditable && setTimeout(() => {
|
|
10797
10797
|
const p = h.state.selection;
|
|
10798
10798
|
p && h.commands.deleteRange({ from: p.from, to: p.to });
|
|
@@ -10839,9 +10839,9 @@ function Kd(n) {
|
|
|
10839
10839
|
const e = n.filter((t, r) => n.indexOf(t) !== r);
|
|
10840
10840
|
return Array.from(new Set(e));
|
|
10841
10841
|
}
|
|
10842
|
-
class
|
|
10842
|
+
class mt {
|
|
10843
10843
|
constructor(e, t) {
|
|
10844
|
-
this.splittableMarks = [], this.editor = t, this.extensions =
|
|
10844
|
+
this.splittableMarks = [], this.editor = t, this.extensions = mt.resolve(e), this.schema = Pd(this.extensions, t), this.setupExtensions();
|
|
10845
10845
|
}
|
|
10846
10846
|
/**
|
|
10847
10847
|
* Returns a flattened and sorted extension list while
|
|
@@ -10850,7 +10850,7 @@ class gt {
|
|
|
10850
10850
|
* @returns An flattened and sorted array of Tiptap extensions
|
|
10851
10851
|
*/
|
|
10852
10852
|
static resolve(e) {
|
|
10853
|
-
const t =
|
|
10853
|
+
const t = mt.sort(mt.flatten(e)), r = Kd(t.map((i) => i.name));
|
|
10854
10854
|
return r.length && console.warn(`[tiptap warn]: Duplicate extension names found: [${r.map((i) => `'${i}'`).join(", ")}]. This can lead to issues.`), t;
|
|
10855
10855
|
}
|
|
10856
10856
|
/**
|
|
@@ -10890,7 +10890,7 @@ class gt {
|
|
|
10890
10890
|
options: t.options,
|
|
10891
10891
|
storage: t.storage,
|
|
10892
10892
|
editor: this.editor,
|
|
10893
|
-
type:
|
|
10893
|
+
type: ir(t.name, this.schema)
|
|
10894
10894
|
}, i = x(t, "addCommands", r);
|
|
10895
10895
|
return i ? {
|
|
10896
10896
|
...e,
|
|
@@ -10903,13 +10903,13 @@ class gt {
|
|
|
10903
10903
|
* @returns An array of Prosemirror plugins
|
|
10904
10904
|
*/
|
|
10905
10905
|
get plugins() {
|
|
10906
|
-
const { editor: e } = this, t =
|
|
10906
|
+
const { editor: e } = this, t = mt.sort([...this.extensions].reverse()), r = [], i = [], s = t.map((o) => {
|
|
10907
10907
|
const l = {
|
|
10908
10908
|
name: o.name,
|
|
10909
10909
|
options: o.options,
|
|
10910
10910
|
storage: o.storage,
|
|
10911
10911
|
editor: e,
|
|
10912
|
-
type:
|
|
10912
|
+
type: ir(o.name, this.schema)
|
|
10913
10913
|
}, a = [], c = x(o, "addKeyboardShortcuts", l);
|
|
10914
10914
|
let d = {};
|
|
10915
10915
|
if (o.type === "mark" && x(o, "exitable", l) && (d.ArrowRight = () => Me.handleExit({ editor: e, mark: o })), c) {
|
|
@@ -10953,7 +10953,7 @@ class gt {
|
|
|
10953
10953
|
* @returns An object with all node views where the key is the node name and the value is the node view function
|
|
10954
10954
|
*/
|
|
10955
10955
|
get nodeViews() {
|
|
10956
|
-
const { editor: e } = this, { nodeExtensions: t } =
|
|
10956
|
+
const { editor: e } = this, { nodeExtensions: t } = Fn(this.extensions);
|
|
10957
10957
|
return Object.fromEntries(t.filter((r) => !!x(r, "addNodeView")).map((r) => {
|
|
10958
10958
|
const i = this.attributes.filter((a) => a.type === r.name), s = {
|
|
10959
10959
|
name: r.name,
|
|
@@ -10995,7 +10995,7 @@ class gt {
|
|
|
10995
10995
|
options: e.options,
|
|
10996
10996
|
storage: e.storage,
|
|
10997
10997
|
editor: this.editor,
|
|
10998
|
-
type:
|
|
10998
|
+
type: ir(e.name, this.schema)
|
|
10999
10999
|
};
|
|
11000
11000
|
e.type === "mark" && (!((t = v(x(e, "keepOnSplit", r))) !== null && t !== void 0) || t) && this.splittableMarks.push(e.name);
|
|
11001
11001
|
const i = x(e, "onBeforeCreate", r), s = x(e, "onCreate", r), o = x(e, "onUpdate", r), l = x(e, "onSelectionUpdate", r), a = x(e, "onTransaction", r), c = x(e, "onFocus", r), d = x(e, "onBlur", r), u = x(e, "onDestroy", r);
|
|
@@ -11024,7 +11024,7 @@ class _ {
|
|
|
11024
11024
|
configure(e = {}) {
|
|
11025
11025
|
const t = this.extend({
|
|
11026
11026
|
...this.config,
|
|
11027
|
-
addOptions: () =>
|
|
11027
|
+
addOptions: () => Vn(this.options, e)
|
|
11028
11028
|
});
|
|
11029
11029
|
return t.name = this.name, t.parent = this.parent, t;
|
|
11030
11030
|
}
|
|
@@ -11096,7 +11096,7 @@ const Jd = _.create({
|
|
|
11096
11096
|
const { doc: c, mapping: d } = e, u = c.resolve(d.map(a)), f = c.resolve(d.map(a + l.nodeSize)), h = u.blockRange(f);
|
|
11097
11097
|
if (!h)
|
|
11098
11098
|
return;
|
|
11099
|
-
const p =
|
|
11099
|
+
const p = Mt(h);
|
|
11100
11100
|
if (l.type.isTextblock) {
|
|
11101
11101
|
const { defaultType: m } = u.parent.contentMatchAt(u.index());
|
|
11102
11102
|
e.setNodeMarkup(h.start, m);
|
|
@@ -11138,12 +11138,12 @@ const Jd = _.create({
|
|
|
11138
11138
|
const { from: r, to: i } = n;
|
|
11139
11139
|
return t && e.delete(r, i), !0;
|
|
11140
11140
|
}, nu = () => ({ state: n, dispatch: e }) => _r(n, e), ru = () => ({ commands: n }) => n.keyboardShortcut("Enter"), iu = () => ({ state: n, dispatch: e }) => gd(n, e);
|
|
11141
|
-
function
|
|
11141
|
+
function Mn(n, e, t = { strict: !0 }) {
|
|
11142
11142
|
const r = Object.keys(e);
|
|
11143
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
11145
|
function el(n, e, t = {}) {
|
|
11146
|
-
return n.find((r) => r.type === e &&
|
|
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
|
|
@@ -11169,7 +11169,7 @@ function ti(n, e, t) {
|
|
|
11169
11169
|
to: c
|
|
11170
11170
|
};
|
|
11171
11171
|
}
|
|
11172
|
-
function
|
|
11172
|
+
function Ke(n, e) {
|
|
11173
11173
|
if (typeof n == "string") {
|
|
11174
11174
|
if (!e.marks[n])
|
|
11175
11175
|
throw Error(`There is no mark type named '${n}'. Maybe you forgot to add the extension?`);
|
|
@@ -11178,7 +11178,7 @@ function Je(n, e) {
|
|
|
11178
11178
|
return n;
|
|
11179
11179
|
}
|
|
11180
11180
|
const su = (n, e = {}) => ({ tr: t, state: r, dispatch: i }) => {
|
|
11181
|
-
const s =
|
|
11181
|
+
const s = Ke(n, r.schema), { doc: o, selection: l } = t, { $from: a, from: c, to: d } = l;
|
|
11182
11182
|
if (i) {
|
|
11183
11183
|
const u = ti(a, s, e);
|
|
11184
11184
|
if (u && u.from <= c && u.to >= d) {
|
|
@@ -11197,7 +11197,7 @@ const su = (n, e = {}) => ({ tr: t, state: r, dispatch: i }) => {
|
|
|
11197
11197
|
function tl(n) {
|
|
11198
11198
|
return n instanceof M;
|
|
11199
11199
|
}
|
|
11200
|
-
function
|
|
11200
|
+
function Ye(n = 0, e = 0, t = 0) {
|
|
11201
11201
|
return Math.min(Math.max(n, e), t);
|
|
11202
11202
|
}
|
|
11203
11203
|
function nl(n, e = null) {
|
|
@@ -11209,12 +11209,12 @@ function nl(n, e = null) {
|
|
|
11209
11209
|
if (e === "end")
|
|
11210
11210
|
return r;
|
|
11211
11211
|
const i = t.from, s = r.to;
|
|
11212
|
-
return e === "all" ? M.create(n,
|
|
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
11214
|
function ds() {
|
|
11215
11215
|
return navigator.platform === "Android" || /android/i.test(navigator.userAgent);
|
|
11216
11216
|
}
|
|
11217
|
-
function
|
|
11217
|
+
function wn() {
|
|
11218
11218
|
return [
|
|
11219
11219
|
"iPad Simulator",
|
|
11220
11220
|
"iPhone Simulator",
|
|
@@ -11233,8 +11233,8 @@ const au = (n = null, e = {}) => ({ editor: t, view: r, tr: i, dispatch: s }) =>
|
|
|
11233
11233
|
...e
|
|
11234
11234
|
};
|
|
11235
11235
|
const o = () => {
|
|
11236
|
-
(
|
|
11237
|
-
t.isDestroyed || (r.focus(), lu() && !
|
|
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)
|
|
@@ -11251,12 +11251,12 @@ const au = (n = null, e = {}) => ({ editor: t, view: r, tr: i, dispatch: s }) =>
|
|
|
11251
11251
|
}
|
|
11252
11252
|
return n;
|
|
11253
11253
|
};
|
|
11254
|
-
function
|
|
11254
|
+
function sn(n) {
|
|
11255
11255
|
const e = `<body>${n}</body>`, t = new window.DOMParser().parseFromString(e, "text/html").body;
|
|
11256
11256
|
return rl(t);
|
|
11257
11257
|
}
|
|
11258
|
-
function
|
|
11259
|
-
if (n instanceof
|
|
11258
|
+
function Vt(n, e, t) {
|
|
11259
|
+
if (n instanceof ze || n instanceof b)
|
|
11260
11260
|
return n;
|
|
11261
11261
|
t = {
|
|
11262
11262
|
slice: !0,
|
|
@@ -11273,7 +11273,7 @@ function Ht(n, e, t) {
|
|
|
11273
11273
|
} catch (s) {
|
|
11274
11274
|
if (t.errorOnInvalidContent)
|
|
11275
11275
|
throw new Error("[tiptap error]: Invalid JSON content", { cause: s });
|
|
11276
|
-
return console.warn("[tiptap warn]: Invalid content.", "Passed value:", n, "Error:", s),
|
|
11276
|
+
return console.warn("[tiptap warn]: Invalid content.", "Passed value:", n, "Error:", s), Vt("", e, t);
|
|
11277
11277
|
}
|
|
11278
11278
|
if (i) {
|
|
11279
11279
|
if (t.errorOnInvalidContent) {
|
|
@@ -11296,13 +11296,13 @@ function Ht(n, e, t) {
|
|
|
11296
11296
|
}
|
|
11297
11297
|
})
|
|
11298
11298
|
});
|
|
11299
|
-
if (t.slice ?
|
|
11299
|
+
if (t.slice ? Fe.fromSchema(a).parseSlice(sn(n), t.parseOptions) : Fe.fromSchema(a).parse(sn(n), t.parseOptions), t.errorOnInvalidContent && o)
|
|
11300
11300
|
throw new Error("[tiptap error]: Invalid HTML content", { cause: new Error(`Invalid element found: ${l}`) });
|
|
11301
11301
|
}
|
|
11302
|
-
const s =
|
|
11303
|
-
return t.slice ? s.parseSlice(
|
|
11302
|
+
const s = Fe.fromSchema(e);
|
|
11303
|
+
return t.slice ? s.parseSlice(sn(n), t.parseOptions).content : s.parse(sn(n), t.parseOptions);
|
|
11304
11304
|
}
|
|
11305
|
-
return
|
|
11305
|
+
return Vt("", e, t);
|
|
11306
11306
|
}
|
|
11307
11307
|
function uu(n, e, t) {
|
|
11308
11308
|
const r = n.steps.length - 1;
|
|
@@ -11342,7 +11342,7 @@ const fu = (n) => !("type" in n), hu = (n, e, t) => ({ tr: r, dispatch: i, edito
|
|
|
11342
11342
|
};
|
|
11343
11343
|
if (!t.errorOnInvalidContent && !s.options.enableContentCheck && s.options.emitContentError)
|
|
11344
11344
|
try {
|
|
11345
|
-
|
|
11345
|
+
Vt(e, s.schema, {
|
|
11346
11346
|
parseOptions: c,
|
|
11347
11347
|
errorOnInvalidContent: !0
|
|
11348
11348
|
});
|
|
@@ -11350,7 +11350,7 @@ const fu = (n) => !("type" in n), hu = (n, e, t) => ({ tr: r, dispatch: i, edito
|
|
|
11350
11350
|
a(g);
|
|
11351
11351
|
}
|
|
11352
11352
|
try {
|
|
11353
|
-
l =
|
|
11353
|
+
l = Vt(e, s.schema, {
|
|
11354
11354
|
parseOptions: c,
|
|
11355
11355
|
errorOnInvalidContent: (o = t.errorOnInvalidContent) !== null && o !== void 0 ? o : s.options.enableContentCheck
|
|
11356
11356
|
});
|
|
@@ -11382,14 +11382,14 @@ const fu = (n) => !("type" in n), hu = (n, e, t) => ({ tr: r, dispatch: i, edito
|
|
|
11382
11382
|
return !0;
|
|
11383
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
|
-
const r =
|
|
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);
|
|
11387
11387
|
} catch {
|
|
11388
11388
|
return !1;
|
|
11389
11389
|
}
|
|
11390
11390
|
}, ku = () => ({ state: n, dispatch: e, tr: t }) => {
|
|
11391
11391
|
try {
|
|
11392
|
-
const r =
|
|
11392
|
+
const r = An(n.doc, n.selection.$from.pos, 1);
|
|
11393
11393
|
return r == null ? !1 : (t.join(r, 2), e && e(t), !0);
|
|
11394
11394
|
} catch {
|
|
11395
11395
|
return !1;
|
|
@@ -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
|
-
|
|
11417
|
+
wn() || il() ? o = !0 : i = !0;
|
|
11418
11418
|
else
|
|
11419
11419
|
throw new Error(`Unrecognized modifier name: ${a}`);
|
|
11420
11420
|
}
|
|
@@ -11437,7 +11437,7 @@ const wu = (n) => ({ editor: e, view: t, tr: r, dispatch: i }) => {
|
|
|
11437
11437
|
d && i && r.maybeStep(d);
|
|
11438
11438
|
}), !0;
|
|
11439
11439
|
};
|
|
11440
|
-
function
|
|
11440
|
+
function Ht(n, e, t = {}) {
|
|
11441
11441
|
const { from: r, to: i, empty: s } = n.selection, o = e ? V(e, n.schema) : null, l = [];
|
|
11442
11442
|
n.doc.nodesBetween(r, i, (u, f) => {
|
|
11443
11443
|
if (u.isText)
|
|
@@ -11449,17 +11449,17 @@ function Wt(n, e, t = {}) {
|
|
|
11449
11449
|
to: p
|
|
11450
11450
|
});
|
|
11451
11451
|
});
|
|
11452
|
-
const a = i - r, c = l.filter((u) => o ? o.name === u.node.type.name : !0).filter((u) =>
|
|
11452
|
+
const a = i - r, c = l.filter((u) => o ? o.name === u.node.type.name : !0).filter((u) => Mn(u.node.attrs, t, { strict: !1 }));
|
|
11453
11453
|
return s ? !!c.length : c.reduce((u, f) => u + f.to - f.from, 0) >= a;
|
|
11454
11454
|
}
|
|
11455
11455
|
const Cu = (n, e = {}) => ({ state: t, dispatch: r }) => {
|
|
11456
11456
|
const i = V(n, t.schema);
|
|
11457
|
-
return
|
|
11457
|
+
return Ht(t, i, e) ? md(t, r) : !1;
|
|
11458
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
11461
|
}, Eu = () => ({ state: n, dispatch: e }) => Ko(n, e);
|
|
11462
|
-
function
|
|
11462
|
+
function Hn(n, e) {
|
|
11463
11463
|
return e.nodes[n] ? "node" : e.marks[n] ? "mark" : null;
|
|
11464
11464
|
}
|
|
11465
11465
|
function us(n, e) {
|
|
@@ -11468,8 +11468,8 @@ function us(n, e) {
|
|
|
11468
11468
|
}
|
|
11469
11469
|
const vu = (n, e) => ({ tr: t, state: r, dispatch: i }) => {
|
|
11470
11470
|
let s = null, o = null;
|
|
11471
|
-
const l =
|
|
11472
|
-
return l ? (l === "node" && (s = V(n, r.schema)), l === "mark" && (o =
|
|
11471
|
+
const l = Hn(typeof n == "string" ? n : n.name, r.schema);
|
|
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
11474
|
s && s === c.type && t.setNodeMarkup(d, void 0, us(c.attrs, e)), o && c.marks.length && c.marks.forEach((u) => {
|
|
11475
11475
|
o === u.type && t.addMark(d, d + c.nodeSize, o.create(us(u.attrs, e)));
|
|
@@ -11484,7 +11484,7 @@ const vu = (n, e) => ({ tr: t, state: r, dispatch: i }) => {
|
|
|
11484
11484
|
return !0;
|
|
11485
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
11486
|
function Nr(n, e, t = {}, r = {}) {
|
|
11487
|
-
return
|
|
11487
|
+
return Vt(n, e, {
|
|
11488
11488
|
slice: !1,
|
|
11489
11489
|
parseOptions: t,
|
|
11490
11490
|
errorOnInvalidContent: r.errorOnInvalidContent
|
|
@@ -11505,7 +11505,7 @@ const Lu = (n, e = !1, t = {}, r = {}) => ({ editor: i, tr: s, dispatch: o, comm
|
|
|
11505
11505
|
});
|
|
11506
11506
|
};
|
|
11507
11507
|
function sl(n, e) {
|
|
11508
|
-
const t =
|
|
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);
|
|
11511
11511
|
});
|
|
@@ -11551,7 +11551,7 @@ function Vu(n, e) {
|
|
|
11551
11551
|
return o ? { ...o.attrs } : {};
|
|
11552
11552
|
}
|
|
11553
11553
|
function Hu(n, e) {
|
|
11554
|
-
const t =
|
|
11554
|
+
const t = Hn(typeof e == "string" ? e : e.name, n.schema);
|
|
11555
11555
|
return t === "node" ? Vu(n, e) : t === "mark" ? sl(n, e) : {};
|
|
11556
11556
|
}
|
|
11557
11557
|
function ol(n, e, t) {
|
|
@@ -11570,16 +11570,16 @@ function ol(n, e, t) {
|
|
|
11570
11570
|
})));
|
|
11571
11571
|
}), r;
|
|
11572
11572
|
}
|
|
11573
|
-
function
|
|
11573
|
+
function cn(n, e, t) {
|
|
11574
11574
|
return Object.fromEntries(Object.entries(t).filter(([r]) => {
|
|
11575
11575
|
const i = n.find((s) => s.type === e && s.name === r);
|
|
11576
11576
|
return i ? i.attribute.keepOnSplit : !1;
|
|
11577
11577
|
}));
|
|
11578
11578
|
}
|
|
11579
11579
|
function Ar(n, e, t = {}) {
|
|
11580
|
-
const { empty: r, ranges: i } = n.selection, s = e ?
|
|
11580
|
+
const { empty: r, ranges: i } = n.selection, s = e ? Ke(e, n.schema) : null;
|
|
11581
11581
|
if (r)
|
|
11582
|
-
return !!(n.storedMarks || n.selection.$from.marks()).filter((u) => s ? s.name === u.type.name : !0).find((u) =>
|
|
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 }));
|
|
11583
11583
|
let o = 0;
|
|
11584
11584
|
const l = [];
|
|
11585
11585
|
if (i.forEach(({ $from: u, $to: f }) => {
|
|
@@ -11596,17 +11596,17 @@ function Ar(n, e, t = {}) {
|
|
|
11596
11596
|
});
|
|
11597
11597
|
}), o === 0)
|
|
11598
11598
|
return !1;
|
|
11599
|
-
const a = l.filter((u) => s ? s.name === u.mark.type.name : !0).filter((u) =>
|
|
11599
|
+
const a = l.filter((u) => s ? s.name === u.mark.type.name : !0).filter((u) => Mn(u.mark.attrs, t, { strict: !1 })).reduce((u, f) => u + f.to - f.from, 0), c = l.filter((u) => s ? u.mark.type !== s && u.mark.type.excludes(s) : !0).reduce((u, f) => u + f.to - f.from, 0);
|
|
11600
11600
|
return (a > 0 ? a + c : a) >= o;
|
|
11601
11601
|
}
|
|
11602
11602
|
function Wu(n, e, t = {}) {
|
|
11603
11603
|
if (!e)
|
|
11604
|
-
return
|
|
11605
|
-
const r =
|
|
11606
|
-
return r === "node" ?
|
|
11604
|
+
return Ht(n, null, t) || Ar(n, null, t);
|
|
11605
|
+
const r = Hn(e, n.schema);
|
|
11606
|
+
return r === "node" ? Ht(n, e, t) : r === "mark" ? Ar(n, e, t) : !1;
|
|
11607
11607
|
}
|
|
11608
11608
|
function fs(n, e) {
|
|
11609
|
-
const { nodeExtensions: t } =
|
|
11609
|
+
const { nodeExtensions: t } = Fn(e), r = t.find((o) => o.name === n);
|
|
11610
11610
|
if (!r)
|
|
11611
11611
|
return !1;
|
|
11612
11612
|
const i = {
|
|
@@ -11664,7 +11664,7 @@ function ju(n, e, t) {
|
|
|
11664
11664
|
});
|
|
11665
11665
|
}
|
|
11666
11666
|
const Ku = (n, e = {}) => ({ tr: t, state: r, dispatch: i }) => {
|
|
11667
|
-
const { selection: s } = t, { empty: o, ranges: l } = s, a =
|
|
11667
|
+
const { selection: s } = t, { empty: o, ranges: l } = s, a = Ke(n, r.schema);
|
|
11668
11668
|
if (i)
|
|
11669
11669
|
if (o) {
|
|
11670
11670
|
const c = sl(r, a);
|
|
@@ -11692,13 +11692,13 @@ const Ku = (n, e = {}) => ({ tr: t, state: r, dispatch: i }) => {
|
|
|
11692
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
|
-
const { doc: r } = e, i =
|
|
11695
|
+
const { doc: r } = e, i = Ye(n, 0, r.content.size), s = S.create(r, i);
|
|
11696
11696
|
e.setSelection(s);
|
|
11697
11697
|
}
|
|
11698
11698
|
return !0;
|
|
11699
11699
|
}, Gu = (n) => ({ tr: e, dispatch: t }) => {
|
|
11700
11700
|
if (t) {
|
|
11701
|
-
const { doc: r } = e, { from: i, to: s } = typeof n == "number" ? { from: n, to: n } : n, o = M.atStart(r).from, l = M.atEnd(r).to, a =
|
|
11701
|
+
const { doc: r } = e, { from: i, to: s } = typeof n == "number" ? { from: n, to: n } : n, o = M.atStart(r).from, l = M.atEnd(r).to, a = Ye(i, o, l), c = Ye(s, o, l), d = M.create(r, a, c);
|
|
11702
11702
|
e.setSelection(d);
|
|
11703
11703
|
}
|
|
11704
11704
|
return !0;
|
|
@@ -11714,7 +11714,7 @@ function hs(n, e) {
|
|
|
11714
11714
|
}
|
|
11715
11715
|
}
|
|
11716
11716
|
const Xu = ({ keepMarks: n = !0 } = {}) => ({ tr: e, state: t, dispatch: r, editor: i }) => {
|
|
11717
|
-
const { selection: s, doc: o } = e, { $from: l, $to: a } = s, c = i.extensionManager.attributes, d =
|
|
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
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)
|
|
@@ -11757,7 +11757,7 @@ const Xu = ({ keepMarks: n = !0 } = {}) => ({ tr: e, state: t, dispatch: r, edit
|
|
|
11757
11757
|
for (let N = a.depth - T; N >= a.depth - 3; N -= 1)
|
|
11758
11758
|
y = b.from(a.node(N).copy(y));
|
|
11759
11759
|
const w = a.indexAfter(-1) < a.node(-2).childCount ? 1 : a.indexAfter(-2) < a.node(-3).childCount ? 2 : 3, I = {
|
|
11760
|
-
...
|
|
11760
|
+
...cn(f, a.node().type.name, a.node().attrs),
|
|
11761
11761
|
...e
|
|
11762
11762
|
}, D = ((o = l.contentMatch.defaultType) === null || o === void 0 ? void 0 : o.createAndFill(I)) || void 0;
|
|
11763
11763
|
y = y.append(b.from(l.createAndFill(null, D) || void 0));
|
|
@@ -11773,10 +11773,10 @@ const Xu = ({ keepMarks: n = !0 } = {}) => ({ tr: e, state: t, dispatch: r, edit
|
|
|
11773
11773
|
return !0;
|
|
11774
11774
|
}
|
|
11775
11775
|
const h = c.pos === a.end() ? u.contentMatchAt(0).defaultType : null, p = {
|
|
11776
|
-
...
|
|
11776
|
+
...cn(f, u.type.name, u.attrs),
|
|
11777
11777
|
...e
|
|
11778
11778
|
}, m = {
|
|
11779
|
-
...
|
|
11779
|
+
...cn(f, a.node().type.name, a.node().attrs),
|
|
11780
11780
|
...e
|
|
11781
11781
|
};
|
|
11782
11782
|
t.delete(a.pos, c.pos);
|
|
@@ -11794,7 +11794,7 @@ const Xu = ({ keepMarks: n = !0 } = {}) => ({ tr: e, state: t, dispatch: r, edit
|
|
|
11794
11794
|
t.ensureMarks(D);
|
|
11795
11795
|
}
|
|
11796
11796
|
return !0;
|
|
11797
|
-
},
|
|
11797
|
+
}, sr = (n, e) => {
|
|
11798
11798
|
const t = ni((o) => o.type === e)(n.selection);
|
|
11799
11799
|
if (!t)
|
|
11800
11800
|
return !0;
|
|
@@ -11802,8 +11802,8 @@ const Xu = ({ keepMarks: n = !0 } = {}) => ({ tr: e, state: t, dispatch: r, edit
|
|
|
11802
11802
|
if (r === void 0)
|
|
11803
11803
|
return !0;
|
|
11804
11804
|
const i = n.doc.nodeAt(r);
|
|
11805
|
-
return t.node.type === (i == null ? void 0 : i.type) &&
|
|
11806
|
-
},
|
|
11805
|
+
return t.node.type === (i == null ? void 0 : i.type) && qe(n.doc, t.pos) && n.join(t.pos), !0;
|
|
11806
|
+
}, or = (n, e) => {
|
|
11807
11807
|
const t = ni((o) => o.type === e)(n.selection);
|
|
11808
11808
|
if (!t)
|
|
11809
11809
|
return !0;
|
|
@@ -11811,7 +11811,7 @@ const Xu = ({ keepMarks: n = !0 } = {}) => ({ tr: e, state: t, dispatch: r, edit
|
|
|
11811
11811
|
if (r === void 0)
|
|
11812
11812
|
return !0;
|
|
11813
11813
|
const i = n.doc.nodeAt(r);
|
|
11814
|
-
return t.node.type === (i == null ? void 0 : i.type) &&
|
|
11814
|
+
return t.node.type === (i == null ? void 0 : i.type) && qe(n.doc, r) && n.join(r), !0;
|
|
11815
11815
|
}, Qu = (n, e, t, r = {}) => ({ editor: i, tr: s, state: o, dispatch: l, chain: a, commands: c, can: d }) => {
|
|
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)
|
|
@@ -11821,22 +11821,22 @@ const Xu = ({ keepMarks: n = !0 } = {}) => ({ tr: e, state: t, dispatch: r, edit
|
|
|
11821
11821
|
if (D.node.type === h)
|
|
11822
11822
|
return c.liftListItem(p);
|
|
11823
11823
|
if (fs(D.node.type.name, u) && h.validContent(D.node.content) && l)
|
|
11824
|
-
return a().command(() => (s.setNodeMarkup(D.pos, h), !0)).command(() =>
|
|
11824
|
+
return a().command(() => (s.setNodeMarkup(D.pos, h), !0)).command(() => sr(s, h)).command(() => or(s, h)).run();
|
|
11825
11825
|
}
|
|
11826
|
-
return !t || !I || !l ? a().command(() => d().wrapInList(h, r) ? !0 : c.clearNodes()).wrapInList(h, r).command(() =>
|
|
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(() => {
|
|
11827
11827
|
const L = d().wrapInList(h, r), C = I.filter((N) => f.includes(N.type.name));
|
|
11828
11828
|
return s.ensureMarks(C), L ? !0 : c.clearNodes();
|
|
11829
|
-
}).wrapInList(h, r).command(() =>
|
|
11829
|
+
}).wrapInList(h, r).command(() => sr(s, h)).command(() => or(s, h)).run();
|
|
11830
11830
|
}, ef = (n, e = {}, t = {}) => ({ state: r, commands: i }) => {
|
|
11831
|
-
const { extendEmptyMarkRange: s = !1 } = t, o =
|
|
11831
|
+
const { extendEmptyMarkRange: s = !1 } = t, o = Ke(n, r.schema);
|
|
11832
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
|
-
const s = V(n, r.schema), o = V(e, r.schema), l =
|
|
11834
|
+
const s = V(n, r.schema), o = V(e, r.schema), l = Ht(r, s, t);
|
|
11835
11835
|
let a;
|
|
11836
11836
|
return r.selection.$anchor.sameParent(r.selection.$head) && (a = r.selection.$anchor.parent.attrs), l ? i.setNode(o, a) : i.setNode(s, { ...a, ...t });
|
|
11837
11837
|
}, nf = (n, e = {}) => ({ state: t, commands: r }) => {
|
|
11838
11838
|
const i = V(n, t.schema);
|
|
11839
|
-
return
|
|
11839
|
+
return Ht(t, i, e) ? r.lift(i) : r.wrapIn(i, e);
|
|
11840
11840
|
}, rf = () => ({ state: n, dispatch: e }) => {
|
|
11841
11841
|
const t = n.plugins;
|
|
11842
11842
|
for (let r = 0; r < t.length; r += 1) {
|
|
@@ -11864,7 +11864,7 @@ const Xu = ({ keepMarks: n = !0 } = {}) => ({ tr: e, state: t, dispatch: r, edit
|
|
|
11864
11864
|
}), !0;
|
|
11865
11865
|
}, of = (n, e = {}) => ({ tr: t, state: r, dispatch: i }) => {
|
|
11866
11866
|
var s;
|
|
11867
|
-
const { extendEmptyMarkRange: o = !1 } = e, { selection: l } = t, a =
|
|
11867
|
+
const { extendEmptyMarkRange: o = !1 } = e, { selection: l } = t, a = Ke(n, r.schema), { $from: c, empty: d, ranges: u } = l;
|
|
11868
11868
|
if (!i)
|
|
11869
11869
|
return !0;
|
|
11870
11870
|
if (d && o) {
|
|
@@ -11878,8 +11878,8 @@ const Xu = ({ keepMarks: n = !0 } = {}) => ({ tr: e, state: t, dispatch: r, edit
|
|
|
11878
11878
|
return t.removeStoredMark(a), !0;
|
|
11879
11879
|
}, lf = (n, e = {}) => ({ tr: t, state: r, dispatch: i }) => {
|
|
11880
11880
|
let s = null, o = null;
|
|
11881
|
-
const l =
|
|
11882
|
-
return l ? (l === "node" && (s = V(n, r.schema)), l === "mark" && (o =
|
|
11881
|
+
const l = Hn(typeof n == "string" ? n : n.name, r.schema);
|
|
11882
|
+
return l ? (l === "node" && (s = V(n, r.schema)), l === "mark" && (o = Ke(n, r.schema)), i && t.selection.ranges.forEach((a) => {
|
|
11883
11883
|
const c = a.$from.pos, d = a.$to.pos;
|
|
11884
11884
|
let u, f, h, p;
|
|
11885
11885
|
t.selection.empty ? r.doc.nodesBetween(c, d, (m, g) => {
|
|
@@ -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
|
|
12085
|
+
return wn() || il() ? s : i;
|
|
12086
12086
|
},
|
|
12087
12087
|
addProseMirrorPlugins() {
|
|
12088
12088
|
return [
|
|
@@ -12102,10 +12102,10 @@ const uf = _.create({
|
|
|
12102
12102
|
const { empty: s, from: o, to: l } = e.selection, a = E.atStart(e.doc).from, c = E.atEnd(e.doc).to;
|
|
12103
12103
|
if (s || !(o === a && l === c) || !ri(t.doc))
|
|
12104
12104
|
return;
|
|
12105
|
-
const f = t.tr, h =
|
|
12105
|
+
const f = t.tr, h = Ln({
|
|
12106
12106
|
state: t,
|
|
12107
12107
|
transaction: f
|
|
12108
|
-
}), { commands: p } = new
|
|
12108
|
+
}), { commands: p } = new zn({
|
|
12109
12109
|
editor: this.editor,
|
|
12110
12110
|
state: h
|
|
12111
12111
|
});
|
|
@@ -12146,7 +12146,7 @@ const uf = _.create({
|
|
|
12146
12146
|
];
|
|
12147
12147
|
}
|
|
12148
12148
|
});
|
|
12149
|
-
class
|
|
12149
|
+
class Ue {
|
|
12150
12150
|
get name() {
|
|
12151
12151
|
return this.node.type.name;
|
|
12152
12152
|
}
|
|
@@ -12205,15 +12205,15 @@ class _e {
|
|
|
12205
12205
|
if (this.depth === 0)
|
|
12206
12206
|
return null;
|
|
12207
12207
|
const e = this.resolvedPos.start(this.resolvedPos.depth - 1), t = this.resolvedPos.doc.resolve(e);
|
|
12208
|
-
return new
|
|
12208
|
+
return new Ue(t, this.editor);
|
|
12209
12209
|
}
|
|
12210
12210
|
get before() {
|
|
12211
12211
|
let e = this.resolvedPos.doc.resolve(this.from - (this.isBlock ? 1 : 2));
|
|
12212
|
-
return e.depth !== this.depth && (e = this.resolvedPos.doc.resolve(this.from - 3)), new
|
|
12212
|
+
return e.depth !== this.depth && (e = this.resolvedPos.doc.resolve(this.from - 3)), new Ue(e, this.editor);
|
|
12213
12213
|
}
|
|
12214
12214
|
get after() {
|
|
12215
12215
|
let e = this.resolvedPos.doc.resolve(this.to + (this.isBlock ? 2 : 1));
|
|
12216
|
-
return e.depth !== this.depth && (e = this.resolvedPos.doc.resolve(this.to + 3)), new
|
|
12216
|
+
return e.depth !== this.depth && (e = this.resolvedPos.doc.resolve(this.to + 3)), new Ue(e, this.editor);
|
|
12217
12217
|
}
|
|
12218
12218
|
get children() {
|
|
12219
12219
|
const e = [];
|
|
@@ -12224,8 +12224,8 @@ class _e {
|
|
|
12224
12224
|
const l = this.resolvedPos.doc.resolve(o);
|
|
12225
12225
|
if (!i && l.depth <= this.depth)
|
|
12226
12226
|
return;
|
|
12227
|
-
const a = new
|
|
12228
|
-
i && (a.actualDepth = this.depth + 1), e.push(new
|
|
12227
|
+
const a = new Ue(l, this.editor, i, i ? t : null);
|
|
12228
|
+
i && (a.actualDepth = this.depth + 1), e.push(new Ue(l, this.editor, i, i ? t : null));
|
|
12229
12229
|
}), e;
|
|
12230
12230
|
}
|
|
12231
12231
|
get firstChild() {
|
|
@@ -12497,13 +12497,13 @@ class Sf extends Dd {
|
|
|
12497
12497
|
ff,
|
|
12498
12498
|
yf
|
|
12499
12499
|
].filter((s) => typeof this.options.enableCoreExtensions == "object" ? this.options.enableCoreExtensions[s.name] !== !1 : !0) : [], ...this.options.extensions].filter((s) => ["extension", "node", "mark"].includes(s == null ? void 0 : s.type));
|
|
12500
|
-
this.extensionManager = new
|
|
12500
|
+
this.extensionManager = new mt(i, this);
|
|
12501
12501
|
}
|
|
12502
12502
|
/**
|
|
12503
12503
|
* Creates an command manager.
|
|
12504
12504
|
*/
|
|
12505
12505
|
createCommandManager() {
|
|
12506
|
-
this.commandManager = new
|
|
12506
|
+
this.commandManager = new zn({
|
|
12507
12507
|
editor: this
|
|
12508
12508
|
});
|
|
12509
12509
|
}
|
|
@@ -12541,7 +12541,7 @@ class Sf extends Dd {
|
|
|
12541
12541
|
...(e = this.options.editorProps) === null || e === void 0 ? void 0 : e.attributes
|
|
12542
12542
|
},
|
|
12543
12543
|
dispatchTransaction: this.dispatchTransaction.bind(this),
|
|
12544
|
-
state:
|
|
12544
|
+
state: pt.create({
|
|
12545
12545
|
doc: t,
|
|
12546
12546
|
selection: r || void 0
|
|
12547
12547
|
})
|
|
@@ -12695,14 +12695,14 @@ class Sf extends Dd {
|
|
|
12695
12695
|
}
|
|
12696
12696
|
$pos(e) {
|
|
12697
12697
|
const t = this.state.doc.resolve(e);
|
|
12698
|
-
return new
|
|
12698
|
+
return new Ue(t, this);
|
|
12699
12699
|
}
|
|
12700
12700
|
get $doc() {
|
|
12701
12701
|
return this.$pos(0);
|
|
12702
12702
|
}
|
|
12703
12703
|
}
|
|
12704
|
-
function
|
|
12705
|
-
return new
|
|
12704
|
+
function lt(n) {
|
|
12705
|
+
return new $n({
|
|
12706
12706
|
find: n.find,
|
|
12707
12707
|
handler: ({ state: e, range: t, match: r }) => {
|
|
12708
12708
|
const i = v(n.getAttributes, void 0, r);
|
|
@@ -12721,7 +12721,7 @@ function at(n) {
|
|
|
12721
12721
|
});
|
|
12722
12722
|
}
|
|
12723
12723
|
function ll(n) {
|
|
12724
|
-
return new
|
|
12724
|
+
return new $n({
|
|
12725
12725
|
find: n.find,
|
|
12726
12726
|
handler: ({ state: e, range: t, match: r }) => {
|
|
12727
12727
|
const i = v(n.getAttributes, void 0, r) || {}, { tr: s } = e, o = t.from;
|
|
@@ -12742,7 +12742,7 @@ function ll(n) {
|
|
|
12742
12742
|
});
|
|
12743
12743
|
}
|
|
12744
12744
|
function Dr(n) {
|
|
12745
|
-
return new
|
|
12745
|
+
return new $n({
|
|
12746
12746
|
find: n.find,
|
|
12747
12747
|
handler: ({ state: e, range: t, match: r }) => {
|
|
12748
12748
|
const i = e.doc.resolve(t.from), s = v(n.getAttributes, void 0, r) || {};
|
|
@@ -12752,8 +12752,8 @@ function Dr(n) {
|
|
|
12752
12752
|
}
|
|
12753
12753
|
});
|
|
12754
12754
|
}
|
|
12755
|
-
function
|
|
12756
|
-
return new
|
|
12755
|
+
function Wt(n) {
|
|
12756
|
+
return new $n({
|
|
12757
12757
|
find: n.find,
|
|
12758
12758
|
handler: ({ state: e, range: t, match: r, chain: i }) => {
|
|
12759
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);
|
|
@@ -12771,7 +12771,7 @@ function qt(n) {
|
|
|
12771
12771
|
i().updateAttributes(u, s).run();
|
|
12772
12772
|
}
|
|
12773
12773
|
const d = o.doc.resolve(t.from - 1).nodeBefore;
|
|
12774
|
-
d && d.type === n.type &&
|
|
12774
|
+
d && d.type === n.type && qe(o.doc, t.from - 1) && (!n.joinPredicate || n.joinPredicate(r, d)) && o.join(t.from - 1);
|
|
12775
12775
|
}
|
|
12776
12776
|
});
|
|
12777
12777
|
}
|
|
@@ -12796,7 +12796,7 @@ class ne {
|
|
|
12796
12796
|
configure(e = {}) {
|
|
12797
12797
|
const t = this.extend({
|
|
12798
12798
|
...this.config,
|
|
12799
|
-
addOptions: () =>
|
|
12799
|
+
addOptions: () => Vn(this.options, e)
|
|
12800
12800
|
});
|
|
12801
12801
|
return t.name = this.name, t.parent = this.parent, t;
|
|
12802
12802
|
}
|
|
@@ -12810,7 +12810,7 @@ class ne {
|
|
|
12810
12810
|
})), t;
|
|
12811
12811
|
}
|
|
12812
12812
|
}
|
|
12813
|
-
function
|
|
12813
|
+
function at(n) {
|
|
12814
12814
|
return new Vd({
|
|
12815
12815
|
find: n.find,
|
|
12816
12816
|
handler: ({ state: e, range: t, match: r, pasteEvent: i }) => {
|
|
@@ -12875,7 +12875,7 @@ const wf = /^\s*>\s$/, Cf = ne.create({
|
|
|
12875
12875
|
},
|
|
12876
12876
|
addInputRules() {
|
|
12877
12877
|
return [
|
|
12878
|
-
|
|
12878
|
+
Wt({
|
|
12879
12879
|
find: wf,
|
|
12880
12880
|
type: this.type
|
|
12881
12881
|
})
|
|
@@ -12925,11 +12925,11 @@ const wf = /^\s*>\s$/, Cf = ne.create({
|
|
|
12925
12925
|
},
|
|
12926
12926
|
addInputRules() {
|
|
12927
12927
|
return [
|
|
12928
|
-
|
|
12928
|
+
lt({
|
|
12929
12929
|
find: Tf,
|
|
12930
12930
|
type: this.type
|
|
12931
12931
|
}),
|
|
12932
|
-
|
|
12932
|
+
lt({
|
|
12933
12933
|
find: Ef,
|
|
12934
12934
|
type: this.type
|
|
12935
12935
|
})
|
|
@@ -12937,11 +12937,11 @@ const wf = /^\s*>\s$/, Cf = ne.create({
|
|
|
12937
12937
|
},
|
|
12938
12938
|
addPasteRules() {
|
|
12939
12939
|
return [
|
|
12940
|
-
|
|
12940
|
+
at({
|
|
12941
12941
|
find: Of,
|
|
12942
12942
|
type: this.type
|
|
12943
12943
|
}),
|
|
12944
|
-
|
|
12944
|
+
at({
|
|
12945
12945
|
find: vf,
|
|
12946
12946
|
type: this.type
|
|
12947
12947
|
})
|
|
@@ -12980,11 +12980,11 @@ const wf = /^\s*>\s$/, Cf = ne.create({
|
|
|
12980
12980
|
};
|
|
12981
12981
|
},
|
|
12982
12982
|
addInputRules() {
|
|
12983
|
-
let n =
|
|
12983
|
+
let n = Wt({
|
|
12984
12984
|
find: ms,
|
|
12985
12985
|
type: this.type
|
|
12986
12986
|
});
|
|
12987
|
-
return (this.options.keepMarks || this.options.keepAttributes) && (n =
|
|
12987
|
+
return (this.options.keepMarks || this.options.keepAttributes) && (n = Wt({
|
|
12988
12988
|
find: ms,
|
|
12989
12989
|
type: this.type,
|
|
12990
12990
|
keepMarks: this.options.keepMarks,
|
|
@@ -13027,7 +13027,7 @@ const wf = /^\s*>\s$/, Cf = ne.create({
|
|
|
13027
13027
|
},
|
|
13028
13028
|
addInputRules() {
|
|
13029
13029
|
return [
|
|
13030
|
-
|
|
13030
|
+
lt({
|
|
13031
13031
|
find: If,
|
|
13032
13032
|
type: this.type
|
|
13033
13033
|
})
|
|
@@ -13035,7 +13035,7 @@ const wf = /^\s*>\s$/, Cf = ne.create({
|
|
|
13035
13035
|
},
|
|
13036
13036
|
addPasteRules() {
|
|
13037
13037
|
return [
|
|
13038
|
-
|
|
13038
|
+
at({
|
|
13039
13039
|
find: Rf,
|
|
13040
13040
|
type: this.type
|
|
13041
13041
|
})
|
|
@@ -13420,12 +13420,12 @@ function jf() {
|
|
|
13420
13420
|
});
|
|
13421
13421
|
}
|
|
13422
13422
|
const Kf = zo({
|
|
13423
|
-
ArrowLeft:
|
|
13424
|
-
ArrowRight:
|
|
13425
|
-
ArrowUp:
|
|
13426
|
-
ArrowDown:
|
|
13423
|
+
ArrowLeft: on("horiz", -1),
|
|
13424
|
+
ArrowRight: on("horiz", 1),
|
|
13425
|
+
ArrowUp: on("vert", -1),
|
|
13426
|
+
ArrowDown: on("vert", 1)
|
|
13427
13427
|
});
|
|
13428
|
-
function
|
|
13428
|
+
function on(n, e) {
|
|
13429
13429
|
const t = n == "vert" ? e > 0 ? "down" : "up" : e > 0 ? "right" : "left";
|
|
13430
13430
|
return function(r, i, s) {
|
|
13431
13431
|
let o = r.selection, l = e > 0 ? o.$to : o.$from, a = o.empty;
|
|
@@ -13583,10 +13583,10 @@ const Gf = _.create({
|
|
|
13583
13583
|
}));
|
|
13584
13584
|
}
|
|
13585
13585
|
});
|
|
13586
|
-
var
|
|
13586
|
+
var Cn = 200, $ = function() {
|
|
13587
13587
|
};
|
|
13588
13588
|
$.prototype.append = function(e) {
|
|
13589
|
-
return e.length ? (e = $.from(e), !this.length && e || e.length <
|
|
13589
|
+
return e.length ? (e = $.from(e), !this.length && e || e.length < Cn && this.leafAppend(e) || this.length < Cn && e.leafPrepend(this) || this.appendInner(e)) : this;
|
|
13590
13590
|
};
|
|
13591
13591
|
$.prototype.prepend = function(e) {
|
|
13592
13592
|
return e.length ? $.from(e).append(this) : this;
|
|
@@ -13635,10 +13635,10 @@ var cl = /* @__PURE__ */ function(n) {
|
|
|
13635
13635
|
if (i(this.values[a], l + a) === !1)
|
|
13636
13636
|
return !1;
|
|
13637
13637
|
}, e.prototype.leafAppend = function(i) {
|
|
13638
|
-
if (this.length + i.length <=
|
|
13638
|
+
if (this.length + i.length <= Cn)
|
|
13639
13639
|
return new e(this.values.concat(i.flatten()));
|
|
13640
13640
|
}, e.prototype.leafPrepend = function(i) {
|
|
13641
|
-
if (this.length + i.length <=
|
|
13641
|
+
if (this.length + i.length <= Cn)
|
|
13642
13642
|
return new e(i.flatten().concat(this.values));
|
|
13643
13643
|
}, t.length.get = function() {
|
|
13644
13644
|
return this.values.length;
|
|
@@ -13725,7 +13725,7 @@ class ge {
|
|
|
13725
13725
|
return c > th && (l = eh(l, c), o -= c), new ge(l.append(s), o);
|
|
13726
13726
|
}
|
|
13727
13727
|
remapping(e, t) {
|
|
13728
|
-
let r = new
|
|
13728
|
+
let r = new Bt();
|
|
13729
13729
|
return this.items.forEach((i, s) => {
|
|
13730
13730
|
let o = i.mirrorOffset != null && s - i.mirrorOffset >= e ? r.maps.length - i.mirrorOffset : void 0;
|
|
13731
13731
|
r.appendMap(i.map, o);
|
|
@@ -13813,26 +13813,26 @@ class be {
|
|
|
13813
13813
|
}
|
|
13814
13814
|
}
|
|
13815
13815
|
}
|
|
13816
|
-
class
|
|
13816
|
+
class Ie {
|
|
13817
13817
|
constructor(e, t, r, i, s) {
|
|
13818
13818
|
this.done = e, this.undone = t, this.prevRanges = r, this.prevTime = i, this.prevComposition = s;
|
|
13819
13819
|
}
|
|
13820
13820
|
}
|
|
13821
13821
|
const th = 20;
|
|
13822
13822
|
function nh(n, e, t, r) {
|
|
13823
|
-
let i = t.getMeta(
|
|
13823
|
+
let i = t.getMeta(nt), s;
|
|
13824
13824
|
if (i)
|
|
13825
13825
|
return i.historyState;
|
|
13826
|
-
t.getMeta(sh) && (n = new
|
|
13826
|
+
t.getMeta(sh) && (n = new Ie(n.done, n.undone, null, 0, -1));
|
|
13827
13827
|
let o = t.getMeta("appendedTransaction");
|
|
13828
13828
|
if (t.steps.length == 0)
|
|
13829
13829
|
return n;
|
|
13830
|
-
if (o && o.getMeta(
|
|
13831
|
-
return o.getMeta(
|
|
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, 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 ?
|
|
13834
|
-
return new
|
|
13835
|
-
} else return (s = t.getMeta("rebased")) ? new
|
|
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
|
+
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
|
+
} 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
|
}
|
|
13837
13837
|
function rh(n, e) {
|
|
13838
13838
|
if (!e)
|
|
@@ -13851,7 +13851,7 @@ function gs(n) {
|
|
|
13851
13851
|
n[t].forEach((r, i, s, o) => e.push(s, o));
|
|
13852
13852
|
return e;
|
|
13853
13853
|
}
|
|
13854
|
-
function
|
|
13854
|
+
function lr(n, e) {
|
|
13855
13855
|
if (!n)
|
|
13856
13856
|
return null;
|
|
13857
13857
|
let t = [];
|
|
@@ -13862,35 +13862,35 @@ function ar(n, e) {
|
|
|
13862
13862
|
return t;
|
|
13863
13863
|
}
|
|
13864
13864
|
function ih(n, e, t) {
|
|
13865
|
-
let r =
|
|
13865
|
+
let r = dn(e), i = nt.get(e).spec.config, s = (t ? n.undone : n.done).popEvent(e, r);
|
|
13866
13866
|
if (!s)
|
|
13867
13867
|
return null;
|
|
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
|
|
13869
|
-
return s.transform.setSelection(o).setMeta(
|
|
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
|
+
return s.transform.setSelection(o).setMeta(nt, { redo: t, historyState: a });
|
|
13870
13870
|
}
|
|
13871
|
-
let
|
|
13872
|
-
function
|
|
13871
|
+
let ar = !1, ys = null;
|
|
13872
|
+
function dn(n) {
|
|
13873
13873
|
let e = n.plugins;
|
|
13874
13874
|
if (ys != e) {
|
|
13875
|
-
|
|
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;
|
|
13879
13879
|
break;
|
|
13880
13880
|
}
|
|
13881
13881
|
}
|
|
13882
|
-
return
|
|
13882
|
+
return ar;
|
|
13883
13883
|
}
|
|
13884
|
-
const
|
|
13884
|
+
const nt = new we("history"), sh = new we("closeHistory");
|
|
13885
13885
|
function oh(n = {}) {
|
|
13886
13886
|
return n = {
|
|
13887
13887
|
depth: n.depth || 100,
|
|
13888
13888
|
newGroupDelay: n.newGroupDelay || 500
|
|
13889
13889
|
}, new se({
|
|
13890
|
-
key:
|
|
13890
|
+
key: nt,
|
|
13891
13891
|
state: {
|
|
13892
13892
|
init() {
|
|
13893
|
-
return new
|
|
13893
|
+
return new Ie(ge.empty, ge.empty, null, 0, -1);
|
|
13894
13894
|
},
|
|
13895
13895
|
apply(e, t, r) {
|
|
13896
13896
|
return nh(t, r, e, n);
|
|
@@ -13909,7 +13909,7 @@ function oh(n = {}) {
|
|
|
13909
13909
|
}
|
|
13910
13910
|
function dl(n, e) {
|
|
13911
13911
|
return (t, r) => {
|
|
13912
|
-
let i =
|
|
13912
|
+
let i = nt.getState(t);
|
|
13913
13913
|
if (!i || (n ? i.undone : i.done).eventCount == 0)
|
|
13914
13914
|
return !1;
|
|
13915
13915
|
if (r) {
|
|
@@ -14043,11 +14043,11 @@ const ul = dl(!1, !0), fl = dl(!0, !0), lh = _.create({
|
|
|
14043
14043
|
},
|
|
14044
14044
|
addInputRules() {
|
|
14045
14045
|
return [
|
|
14046
|
-
|
|
14046
|
+
lt({
|
|
14047
14047
|
find: ch,
|
|
14048
14048
|
type: this.type
|
|
14049
14049
|
}),
|
|
14050
|
-
|
|
14050
|
+
lt({
|
|
14051
14051
|
find: uh,
|
|
14052
14052
|
type: this.type
|
|
14053
14053
|
})
|
|
@@ -14055,11 +14055,11 @@ const ul = dl(!1, !0), fl = dl(!0, !0), lh = _.create({
|
|
|
14055
14055
|
},
|
|
14056
14056
|
addPasteRules() {
|
|
14057
14057
|
return [
|
|
14058
|
-
|
|
14058
|
+
at({
|
|
14059
14059
|
find: dh,
|
|
14060
14060
|
type: this.type
|
|
14061
14061
|
}),
|
|
14062
|
-
|
|
14062
|
+
at({
|
|
14063
14063
|
find: fh,
|
|
14064
14064
|
type: this.type
|
|
14065
14065
|
})
|
|
@@ -14141,13 +14141,13 @@ const ul = dl(!1, !0), fl = dl(!0, !0), lh = _.create({
|
|
|
14141
14141
|
};
|
|
14142
14142
|
},
|
|
14143
14143
|
addInputRules() {
|
|
14144
|
-
let n =
|
|
14144
|
+
let n = Wt({
|
|
14145
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
|
-
return (this.options.keepMarks || this.options.keepAttributes) && (n =
|
|
14150
|
+
return (this.options.keepMarks || this.options.keepAttributes) && (n = Wt({
|
|
14151
14151
|
find: ks,
|
|
14152
14152
|
type: this.type,
|
|
14153
14153
|
keepMarks: this.options.keepMarks,
|
|
@@ -14229,7 +14229,7 @@ const ul = dl(!1, !0), fl = dl(!0, !0), lh = _.create({
|
|
|
14229
14229
|
},
|
|
14230
14230
|
addInputRules() {
|
|
14231
14231
|
return [
|
|
14232
|
-
|
|
14232
|
+
lt({
|
|
14233
14233
|
find: bh,
|
|
14234
14234
|
type: this.type
|
|
14235
14235
|
})
|
|
@@ -14237,7 +14237,7 @@ const ul = dl(!1, !0), fl = dl(!0, !0), lh = _.create({
|
|
|
14237
14237
|
},
|
|
14238
14238
|
addPasteRules() {
|
|
14239
14239
|
return [
|
|
14240
|
-
|
|
14240
|
+
at({
|
|
14241
14241
|
find: kh,
|
|
14242
14242
|
type: this.type
|
|
14243
14243
|
})
|
|
@@ -14369,7 +14369,7 @@ const ul = dl(!1, !0), fl = dl(!0, !0), lh = _.create({
|
|
|
14369
14369
|
},
|
|
14370
14370
|
addInputRules() {
|
|
14371
14371
|
return [
|
|
14372
|
-
|
|
14372
|
+
lt({
|
|
14373
14373
|
find: Oh,
|
|
14374
14374
|
type: this.type
|
|
14375
14375
|
})
|
|
@@ -14377,7 +14377,7 @@ const ul = dl(!1, !0), fl = dl(!0, !0), lh = _.create({
|
|
|
14377
14377
|
},
|
|
14378
14378
|
addPasteRules() {
|
|
14379
14379
|
return [
|
|
14380
|
-
|
|
14380
|
+
at({
|
|
14381
14381
|
find: Eh,
|
|
14382
14382
|
type: this.type
|
|
14383
14383
|
})
|
|
@@ -14484,14 +14484,14 @@ const ul = dl(!1, !0), fl = dl(!0, !0), lh = _.create({
|
|
|
14484
14484
|
];
|
|
14485
14485
|
}
|
|
14486
14486
|
});
|
|
14487
|
-
var re,
|
|
14487
|
+
var re, Ut, _t, de, Ir, hl, pl, ml, gl;
|
|
14488
14488
|
class Ih extends Cl {
|
|
14489
14489
|
constructor() {
|
|
14490
14490
|
super();
|
|
14491
14491
|
W(this, de);
|
|
14492
14492
|
W(this, re, null);
|
|
14493
|
+
W(this, Ut, null);
|
|
14493
14494
|
W(this, _t, null);
|
|
14494
|
-
W(this, Gt, null);
|
|
14495
14495
|
}
|
|
14496
14496
|
connectedCallback() {
|
|
14497
14497
|
super.connectedCallback() && (Q(this, de, hl).call(this), Q(this, de, pl).call(this), Q(this, de, Ir).call(this));
|
|
@@ -14502,7 +14502,7 @@ class Ih extends Cl {
|
|
|
14502
14502
|
set value(t) {
|
|
14503
14503
|
let r = t || "";
|
|
14504
14504
|
r && !/<\/?[a-z][^>]*>/i.test(r) && (r = r.split(`
|
|
14505
|
-
`).map((i) => `<p>${i}</p>`).join("")), O(this, re) ? O(this, re).commands.setContent(r, !1) : oe(this,
|
|
14505
|
+
`).map((i) => `<p>${i}</p>`).join("")), O(this, re) ? O(this, re).commands.setContent(r, !1) : oe(this, _t, r);
|
|
14506
14506
|
}
|
|
14507
14507
|
get id() {
|
|
14508
14508
|
return this.getAttribute("id");
|
|
@@ -14527,7 +14527,7 @@ class Ih extends Cl {
|
|
|
14527
14527
|
O(this, re) && (O(this, re).destroy(), oe(this, re, null));
|
|
14528
14528
|
}
|
|
14529
14529
|
}
|
|
14530
|
-
re = new WeakMap(),
|
|
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;
|
|
@@ -14536,10 +14536,10 @@ Ir = function() {
|
|
|
14536
14536
|
r && (r.style.display = t ? "none" : "flex");
|
|
14537
14537
|
}
|
|
14538
14538
|
}, hl = function() {
|
|
14539
|
-
const t =
|
|
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.34/dist/css/nineEditor.css";
|
|
14543
14543
|
${r}
|
|
14544
14544
|
</style>
|
|
14545
14545
|
|
|
@@ -14574,13 +14574,13 @@ Ir = function() {
|
|
|
14574
14574
|
<button type="button" data-cmd="redo" title="다시 실행(Ctrl+Y)"><i class="icon-redo"></i></button>
|
|
14575
14575
|
</div>
|
|
14576
14576
|
<div id="editor-container"></div>
|
|
14577
|
-
`, oe(this,
|
|
14577
|
+
`, oe(this, Ut, this.shadowRoot.querySelector("#editor-container")), this.shadowRoot.querySelector("#font-size").onchange = (i) => {
|
|
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
|
-
element: O(this,
|
|
14583
|
+
element: O(this, Ut),
|
|
14584
14584
|
editable: !this.readonly,
|
|
14585
14585
|
// 4. 생성 시 readonly 여부 반영
|
|
14586
14586
|
extensions: [
|
|
@@ -14606,7 +14606,7 @@ Ir = function() {
|
|
|
14606
14606
|
}
|
|
14607
14607
|
})
|
|
14608
14608
|
],
|
|
14609
|
-
content: O(this,
|
|
14609
|
+
content: O(this, _t) || this.originContents || "",
|
|
14610
14610
|
onUpdate: ({ editor: t }) => {
|
|
14611
14611
|
this.dispatchEvent(new CustomEvent("change", { detail: t.getHTML() }));
|
|
14612
14612
|
},
|
|
@@ -14644,16 +14644,14 @@ const xs = {
|
|
|
14644
14644
|
alert: window.alert,
|
|
14645
14645
|
confirm: window.confirm
|
|
14646
14646
|
}, Ss = () => {
|
|
14647
|
-
const { nativeOverride: n } =
|
|
14648
|
-
window.alert = e.includes("alert") ? (t) =>
|
|
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
14649
|
}, Rh = () => {
|
|
14650
14650
|
Ss(), xl((n) => {
|
|
14651
14651
|
(n === "ux" || n === "config") && Ss();
|
|
14652
14652
|
});
|
|
14653
14653
|
};
|
|
14654
14654
|
Rh();
|
|
14655
|
-
Rt.alert = Ae.alert.bind(Ae);
|
|
14656
|
-
Rt.confirm = Ae.confirm.bind(Ae);
|
|
14657
14655
|
typeof window < "u" && (customElements.get("nine-editor") || customElements.define("nine-editor", Ih));
|
|
14658
14656
|
export {
|
|
14659
14657
|
Ih as nineEditor
|