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