@kerebron/legacy-compat 0.7.7 → 0.7.9
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/kerebron-light.css +1 -1
- package/dist/kerebron.cjs +41 -41
- package/dist/kerebron.css +1 -1
- package/dist/kerebron.js +982 -931
- package/dist/kerebron3.cjs.map +1 -1
- package/dist/kerebron3.js.map +1 -1
- package/package.json +1 -1
package/dist/kerebron.js
CHANGED
|
@@ -2894,8 +2894,8 @@ class StepMap {
|
|
|
2894
2894
|
let d = g ? e == l ? -1 : e == I ? 1 : A : A, h = l + r + (d < 0 ? 0 : c);
|
|
2895
2895
|
if (n)
|
|
2896
2896
|
return h;
|
|
2897
|
-
let u = e == (A < 0 ? l : I) ? null : makeRecover(a / 3, e - l),
|
|
2898
|
-
return (A < 0 ? e != l : e != I) && (
|
|
2897
|
+
let u = e == (A < 0 ? l : I) ? null : makeRecover(a / 3, e - l), E = e == l ? DEL_AFTER : e == I ? DEL_BEFORE : DEL_ACROSS;
|
|
2898
|
+
return (A < 0 ? e != l : e != I) && (E |= DEL_SIDE), new MapResult(h, E, u);
|
|
2899
2899
|
}
|
|
2900
2900
|
r += c - g;
|
|
2901
2901
|
}
|
|
@@ -3431,8 +3431,8 @@ function addMark(t, e, A, n) {
|
|
|
3431
3431
|
let I = l.marks;
|
|
3432
3432
|
if (!n.isInSet(I) && c.type.allowsMarkType(n.type)) {
|
|
3433
3433
|
let d = Math.max(g, e), h = Math.min(g + l.nodeSize, A), u = n.addToSet(I);
|
|
3434
|
-
for (let
|
|
3435
|
-
I[
|
|
3434
|
+
for (let E = 0; E < I.length; E++)
|
|
3435
|
+
I[E].isInSet(u) || (s && s.to == d && s.mark.eq(I[E]) ? s.to = h : r.push(s = new RemoveMarkStep(d, h, I[E])));
|
|
3436
3436
|
a && a.to == d ? a.to = h : o.push(a = new AddMarkStep(d, h, n));
|
|
3437
3437
|
}
|
|
3438
3438
|
}), r.forEach((l) => t.step(l)), o.forEach((l) => t.step(l));
|
|
@@ -3503,11 +3503,11 @@ function liftTarget(t) {
|
|
|
3503
3503
|
}
|
|
3504
3504
|
function lift$1(t, e, A) {
|
|
3505
3505
|
let { $from: n, $to: r, depth: o } = e, s = n.before(o + 1), a = r.after(o + 1), l = s, g = a, c = Fragment.empty, I = 0;
|
|
3506
|
-
for (let u = o,
|
|
3507
|
-
|
|
3506
|
+
for (let u = o, E = !1; u > A; u--)
|
|
3507
|
+
E || n.index(u) > 0 ? (E = !0, c = Fragment.from(n.node(u).copy(c)), I++) : l--;
|
|
3508
3508
|
let d = Fragment.empty, h = 0;
|
|
3509
|
-
for (let u = o,
|
|
3510
|
-
|
|
3509
|
+
for (let u = o, E = !1; u > A; u--)
|
|
3510
|
+
E || r.after(u + 1) < r.end(u) ? (E = !0, d = Fragment.from(r.node(u).copy(d)), h++) : g++;
|
|
3511
3511
|
t.step(new ReplaceAroundStep(l, g, s, a, new Slice(c.append(d), I, h), c.size - I, !0));
|
|
3512
3512
|
}
|
|
3513
3513
|
function findWrapping(t, e, A = null, n = t) {
|
|
@@ -3610,8 +3610,8 @@ function canSplit(t, e, A = 1, n) {
|
|
|
3610
3610
|
return !1;
|
|
3611
3611
|
let h = I.content.cutByIndex(d, I.childCount), u = n && n[c + 1];
|
|
3612
3612
|
u && (h = h.replaceChild(0, u.type.create(u.attrs)));
|
|
3613
|
-
let
|
|
3614
|
-
if (!I.canReplace(d + 1, I.childCount) || !
|
|
3613
|
+
let E = n && n[c] || I;
|
|
3614
|
+
if (!I.canReplace(d + 1, I.childCount) || !E.type.validContent(h))
|
|
3615
3615
|
return !1;
|
|
3616
3616
|
}
|
|
3617
3617
|
let a = r.indexAfter(o), l = n && n[0];
|
|
@@ -3803,26 +3803,26 @@ class Fitter {
|
|
|
3803
3803
|
for (; this.depth > A; )
|
|
3804
3804
|
this.closeFrontierNode();
|
|
3805
3805
|
if (o)
|
|
3806
|
-
for (let
|
|
3807
|
-
this.openFrontierNode(o[
|
|
3806
|
+
for (let E = 0; E < o.length; E++)
|
|
3807
|
+
this.openFrontierNode(o[E]);
|
|
3808
3808
|
let s = this.unplaced, a = n ? n.content : s.content, l = s.openStart - e, g = 0, c = [], { match: I, type: d } = this.frontier[A];
|
|
3809
3809
|
if (r) {
|
|
3810
|
-
for (let
|
|
3811
|
-
c.push(r.child(
|
|
3810
|
+
for (let E = 0; E < r.childCount; E++)
|
|
3811
|
+
c.push(r.child(E));
|
|
3812
3812
|
I = I.matchFragment(r);
|
|
3813
3813
|
}
|
|
3814
3814
|
let h = a.size + e - (s.content.size - s.openEnd);
|
|
3815
3815
|
for (; g < a.childCount; ) {
|
|
3816
|
-
let
|
|
3817
|
-
if (!
|
|
3816
|
+
let E = a.child(g), B = I.matchType(E.type);
|
|
3817
|
+
if (!B)
|
|
3818
3818
|
break;
|
|
3819
|
-
g++, (g > 1 || l == 0 ||
|
|
3819
|
+
g++, (g > 1 || l == 0 || E.content.size) && (I = B, c.push(closeNodeStart(E.mark(d.allowedMarks(E.marks)), g == 1 ? l : 0, g == a.childCount ? h : -1)));
|
|
3820
3820
|
}
|
|
3821
3821
|
let u = g == a.childCount;
|
|
3822
3822
|
u || (h = -1), this.placed = addToFragment(this.placed, A, Fragment.from(c)), this.frontier[A].match = I, u && h < 0 && n && n.type == this.frontier[this.depth].type && this.frontier.length > 1 && this.closeFrontierNode();
|
|
3823
|
-
for (let
|
|
3824
|
-
let f =
|
|
3825
|
-
this.frontier.push({ type: f.type, match: f.contentMatchAt(f.childCount) }),
|
|
3823
|
+
for (let E = 0, B = a; E < h; E++) {
|
|
3824
|
+
let f = B.lastChild;
|
|
3825
|
+
this.frontier.push({ type: f.type, match: f.contentMatchAt(f.childCount) }), B = f.content;
|
|
3826
3826
|
}
|
|
3827
3827
|
this.unplaced = u ? e == 0 ? Slice.empty : new Slice(dropFromFragment(s.content, e - 1, 1), e - 1, h < 0 ? s.openEnd : e - 1) : new Slice(dropFromFragment(s.content, e, g), s.openStart, s.openEnd);
|
|
3828
3828
|
}
|
|
@@ -3938,12 +3938,12 @@ function replaceRange(t, e, A, n) {
|
|
|
3938
3938
|
for (let d = n.openStart; d >= 0; d--) {
|
|
3939
3939
|
let h = (d + c + 1) % (n.openStart + 1), u = g[h];
|
|
3940
3940
|
if (u)
|
|
3941
|
-
for (let
|
|
3942
|
-
let
|
|
3943
|
-
|
|
3944
|
-
let Q = r.node(
|
|
3941
|
+
for (let E = 0; E < s.length; E++) {
|
|
3942
|
+
let B = s[(E + l) % s.length], f = !0;
|
|
3943
|
+
B < 0 && (f = !1, B = -B);
|
|
3944
|
+
let Q = r.node(B - 1), p = r.index(B - 1);
|
|
3945
3945
|
if (Q.canReplaceWith(p, p, u.type, u.marks))
|
|
3946
|
-
return t.replace(r.before(
|
|
3946
|
+
return t.replace(r.before(B), f ? o.after(B) : A, new Slice(closeFragment(n.content, 0, n.openStart, h), h, n.openEnd));
|
|
3947
3947
|
}
|
|
3948
3948
|
}
|
|
3949
3949
|
let I = t.steps.length;
|
|
@@ -5265,8 +5265,8 @@ function scrollRectIntoView(t, e, A) {
|
|
|
5265
5265
|
else {
|
|
5266
5266
|
let h = a.scrollLeft, u = a.scrollTop;
|
|
5267
5267
|
I && (a.scrollTop += I), c && (a.scrollLeft += c);
|
|
5268
|
-
let
|
|
5269
|
-
e = { left: e.left -
|
|
5268
|
+
let E = a.scrollLeft - h, B = a.scrollTop - u;
|
|
5269
|
+
e = { left: e.left - E, top: e.top - B, right: e.right - E, bottom: e.bottom - B };
|
|
5270
5270
|
}
|
|
5271
5271
|
let d = l ? "fixed" : getComputedStyle(s).position;
|
|
5272
5272
|
if (/^(fixed|sticky)$/.test(d))
|
|
@@ -5331,12 +5331,12 @@ function findOffsetInNode(t, e) {
|
|
|
5331
5331
|
let u = d[h];
|
|
5332
5332
|
if (u.top <= s && u.bottom >= a) {
|
|
5333
5333
|
s = Math.max(u.bottom, s), a = Math.min(u.top, a);
|
|
5334
|
-
let
|
|
5335
|
-
if (
|
|
5336
|
-
A = c, n =
|
|
5334
|
+
let E = u.left > e.left ? u.left - e.left : u.right < e.left ? e.left - u.right : 0;
|
|
5335
|
+
if (E < n) {
|
|
5336
|
+
A = c, n = E, r = E && A.nodeType == 3 ? {
|
|
5337
5337
|
left: u.right < e.left ? u.right : u.left,
|
|
5338
5338
|
top: e.top
|
|
5339
|
-
} : e, c.nodeType == 1 &&
|
|
5339
|
+
} : e, c.nodeType == 1 && E && (o = I + (e.left >= (u.left + u.right) / 2 ? 1 : 0));
|
|
5340
5340
|
continue;
|
|
5341
5341
|
}
|
|
5342
5342
|
} else u.top > e.top && !l && u.left <= e.left && u.right >= e.left && (l = c, g = { left: Math.max(u.left, Math.min(u.right, e.left)), top: u.top });
|
|
@@ -5546,12 +5546,12 @@ function endOfTextblockHorizontal(t, e, A) {
|
|
|
5546
5546
|
return a ? !maybeRTL.test(n.parent.textContent) || !a.modify ? A == "left" || A == "backward" ? o : s : withFlushedState(t, e, () => {
|
|
5547
5547
|
let { focusNode: l, focusOffset: g, anchorNode: c, anchorOffset: I } = t.domSelectionRange(), d = a.caretBidiLevel;
|
|
5548
5548
|
a.modify("move", A, "character");
|
|
5549
|
-
let h = n.depth ? t.docView.domAfterPos(n.before()) : t.dom, { focusNode: u, focusOffset:
|
|
5549
|
+
let h = n.depth ? t.docView.domAfterPos(n.before()) : t.dom, { focusNode: u, focusOffset: E } = t.domSelectionRange(), B = u && !h.contains(u.nodeType == 1 ? u : u.parentNode) || l == u && g == E;
|
|
5550
5550
|
try {
|
|
5551
5551
|
a.collapse(c, I), l && (l != c || g != I) && a.extend && a.extend(l, g);
|
|
5552
5552
|
} catch {
|
|
5553
5553
|
}
|
|
5554
|
-
return d != null && (a.caretBidiLevel = d),
|
|
5554
|
+
return d != null && (a.caretBidiLevel = d), B;
|
|
5555
5555
|
}) : n.pos == n.start() || n.pos == n.end();
|
|
5556
5556
|
}
|
|
5557
5557
|
let cachedState = null, cachedDir = null, cachedResult = !1;
|
|
@@ -5812,10 +5812,10 @@ class ViewDesc {
|
|
|
5812
5812
|
setSelection(e, A, n, r = !1) {
|
|
5813
5813
|
let o = Math.min(e, A), s = Math.max(e, A);
|
|
5814
5814
|
for (let h = 0, u = 0; h < this.children.length; h++) {
|
|
5815
|
-
let
|
|
5816
|
-
if (o > u && s <
|
|
5817
|
-
return
|
|
5818
|
-
u =
|
|
5815
|
+
let E = this.children[h], B = u + E.size;
|
|
5816
|
+
if (o > u && s < B)
|
|
5817
|
+
return E.setSelection(e - u - E.border, A - u - E.border, n, r);
|
|
5818
|
+
u = B;
|
|
5819
5819
|
}
|
|
5820
5820
|
let a = this.domFromPos(e, e ? -1 : 1), l = A == e ? a : this.domFromPos(A, A ? -1 : 1), g = n.root.getSelection(), c = n.domSelectionRange(), I = !1;
|
|
5821
5821
|
if ((gecko || safari) && e == A) {
|
|
@@ -5823,18 +5823,18 @@ class ViewDesc {
|
|
|
5823
5823
|
if (h.nodeType == 3) {
|
|
5824
5824
|
if (I = !!(u && h.nodeValue[u - 1] == `
|
|
5825
5825
|
`), I && u == h.nodeValue.length)
|
|
5826
|
-
for (let
|
|
5827
|
-
if (
|
|
5828
|
-
|
|
5826
|
+
for (let E = h, B; E; E = E.parentNode) {
|
|
5827
|
+
if (B = E.nextSibling) {
|
|
5828
|
+
B.nodeName == "BR" && (a = l = { node: B.parentNode, offset: domIndex(B) + 1 });
|
|
5829
5829
|
break;
|
|
5830
5830
|
}
|
|
5831
|
-
let f =
|
|
5831
|
+
let f = E.pmViewDesc;
|
|
5832
5832
|
if (f && f.node && f.node.isBlock)
|
|
5833
5833
|
break;
|
|
5834
5834
|
}
|
|
5835
5835
|
} else {
|
|
5836
|
-
let
|
|
5837
|
-
I =
|
|
5836
|
+
let E = h.childNodes[u - 1];
|
|
5837
|
+
I = E && (E.nodeName == "BR" || E.contentEditable == "false");
|
|
5838
5838
|
}
|
|
5839
5839
|
}
|
|
5840
5840
|
if (gecko && c.focusNode && c.focusNode != l.node && c.focusNode.nodeType == 1) {
|
|
@@ -6505,14 +6505,14 @@ function iterDeco(t, e, A, n) {
|
|
|
6505
6505
|
for (let g = 0; ; ) {
|
|
6506
6506
|
let c, I;
|
|
6507
6507
|
for (; s < r.length && r[s].to == o; ) {
|
|
6508
|
-
let
|
|
6509
|
-
|
|
6508
|
+
let B = r[s++];
|
|
6509
|
+
B.widget && (c ? (I || (I = [c])).push(B) : c = B);
|
|
6510
6510
|
}
|
|
6511
6511
|
if (c)
|
|
6512
6512
|
if (I) {
|
|
6513
6513
|
I.sort(compareSide);
|
|
6514
|
-
for (let
|
|
6515
|
-
A(I[
|
|
6514
|
+
for (let B = 0; B < I.length; B++)
|
|
6515
|
+
A(I[B], g, !!l);
|
|
6516
6516
|
} else
|
|
6517
6517
|
A(c, g, !!l);
|
|
6518
6518
|
let d, h;
|
|
@@ -6522,22 +6522,22 @@ function iterDeco(t, e, A, n) {
|
|
|
6522
6522
|
h = g, d = t.child(g++);
|
|
6523
6523
|
else
|
|
6524
6524
|
break;
|
|
6525
|
-
for (let
|
|
6526
|
-
a[
|
|
6525
|
+
for (let B = 0; B < a.length; B++)
|
|
6526
|
+
a[B].to <= o && a.splice(B--, 1);
|
|
6527
6527
|
for (; s < r.length && r[s].from <= o && r[s].to > o; )
|
|
6528
6528
|
a.push(r[s++]);
|
|
6529
6529
|
let u = o + d.nodeSize;
|
|
6530
6530
|
if (d.isText) {
|
|
6531
|
-
let
|
|
6532
|
-
s < r.length && r[s].from <
|
|
6531
|
+
let B = u;
|
|
6532
|
+
s < r.length && r[s].from < B && (B = r[s].from);
|
|
6533
6533
|
for (let f = 0; f < a.length; f++)
|
|
6534
|
-
a[f].to <
|
|
6535
|
-
|
|
6534
|
+
a[f].to < B && (B = a[f].to);
|
|
6535
|
+
B < u && (l = d.cut(B - o), d = d.cut(0, B - o), u = B, h = -1);
|
|
6536
6536
|
} else
|
|
6537
6537
|
for (; s < r.length && r[s].to < u; )
|
|
6538
6538
|
s++;
|
|
6539
|
-
let
|
|
6540
|
-
n(d,
|
|
6539
|
+
let E = d.isInline && !d.isLeaf ? a.filter((B) => !B.inline) : a.slice();
|
|
6540
|
+
n(d, E, e.forChild(o, d), h), o = u;
|
|
6541
6541
|
}
|
|
6542
6542
|
}
|
|
6543
6543
|
function iosHacks(t) {
|
|
@@ -6999,9 +6999,9 @@ function parseFromClipboard(t, e, A, n, r) {
|
|
|
6999
6999
|
a = I;
|
|
7000
7000
|
else {
|
|
7001
7001
|
let d = r.marks(), { schema: h } = t.state, u = DOMSerializer.fromSchema(h);
|
|
7002
|
-
s = document.createElement("div"), e.split(/(?:\r\n?|\n)+/).forEach((
|
|
7003
|
-
let
|
|
7004
|
-
|
|
7002
|
+
s = document.createElement("div"), e.split(/(?:\r\n?|\n)+/).forEach((E) => {
|
|
7003
|
+
let B = s.appendChild(document.createElement("p"));
|
|
7004
|
+
E && B.appendChild(u.serializeNode(h.text(E, d)));
|
|
7005
7005
|
});
|
|
7006
7006
|
}
|
|
7007
7007
|
} else
|
|
@@ -7545,7 +7545,7 @@ editHandlers.drop = (t, e) => {
|
|
|
7545
7545
|
g.setSelection(new NodeSelection(h));
|
|
7546
7546
|
else {
|
|
7547
7547
|
let u = g.mapping.map(l);
|
|
7548
|
-
g.mapping.maps[g.mapping.maps.length - 1].forEach((
|
|
7548
|
+
g.mapping.maps[g.mapping.maps.length - 1].forEach((E, B, f, Q) => u = Q), g.setSelection(selectionBetween(t, h, g.doc.resolve(u)));
|
|
7549
7549
|
}
|
|
7550
7550
|
t.focus(), t.dispatch(g.setMeta("uiEvent", "drop"));
|
|
7551
7551
|
};
|
|
@@ -7950,16 +7950,16 @@ function mapChildren(t, e, A, n, r, o, s) {
|
|
|
7950
7950
|
let a = t.slice();
|
|
7951
7951
|
for (let g = 0, c = o; g < A.maps.length; g++) {
|
|
7952
7952
|
let I = 0;
|
|
7953
|
-
A.maps[g].forEach((d, h, u,
|
|
7954
|
-
let
|
|
7953
|
+
A.maps[g].forEach((d, h, u, E) => {
|
|
7954
|
+
let B = E - u - (h - d);
|
|
7955
7955
|
for (let f = 0; f < a.length; f += 3) {
|
|
7956
7956
|
let Q = a[f + 1];
|
|
7957
7957
|
if (Q < 0 || d > Q + c - I)
|
|
7958
7958
|
continue;
|
|
7959
7959
|
let p = a[f] + c - I;
|
|
7960
|
-
h >= p ? a[f + 1] = d <= p ? -2 : -1 : d >= c &&
|
|
7960
|
+
h >= p ? a[f + 1] = d <= p ? -2 : -1 : d >= c && B && (a[f] += B, a[f + 1] += B);
|
|
7961
7961
|
}
|
|
7962
|
-
I +=
|
|
7962
|
+
I += B;
|
|
7963
7963
|
}), c = A.maps[g].map(c, -1);
|
|
7964
7964
|
}
|
|
7965
7965
|
let l = !1;
|
|
@@ -7974,9 +7974,9 @@ function mapChildren(t, e, A, n, r, o, s) {
|
|
|
7974
7974
|
l = !0;
|
|
7975
7975
|
continue;
|
|
7976
7976
|
}
|
|
7977
|
-
let d = A.map(t[g + 1] + o, -1), h = d - r, { index: u, offset:
|
|
7978
|
-
if (
|
|
7979
|
-
let f = a[g + 2].mapInner(A,
|
|
7977
|
+
let d = A.map(t[g + 1] + o, -1), h = d - r, { index: u, offset: E } = n.content.findIndex(I), B = n.maybeChild(u);
|
|
7978
|
+
if (B && E == I && E + B.nodeSize == h) {
|
|
7979
|
+
let f = a[g + 2].mapInner(A, B, c + 1, t[g] + o + 1, s);
|
|
7980
7980
|
f != empty$1 ? (a[g] = I, a[g + 1] = h, a[g + 2] = f) : (a[g + 1] = -2, l = !0);
|
|
7981
7981
|
} else
|
|
7982
7982
|
l = !0;
|
|
@@ -8279,16 +8279,16 @@ function blockParent(t, e) {
|
|
|
8279
8279
|
function parseBetween(t, e, A) {
|
|
8280
8280
|
let { node: n, fromOffset: r, toOffset: o, from: s, to: a } = t.docView.parseRange(e, A), l = t.domSelectionRange(), g, c = l.anchorNode;
|
|
8281
8281
|
if (c && t.dom.contains(c.nodeType == 1 ? c : c.parentNode) && (g = [{ node: c, offset: l.anchorOffset }], selectionCollapsed(l) || g.push({ node: l.focusNode, offset: l.focusOffset })), chrome && t.input.lastKeyCode === 8)
|
|
8282
|
-
for (let
|
|
8283
|
-
let f = n.childNodes[
|
|
8282
|
+
for (let B = o; B > r; B--) {
|
|
8283
|
+
let f = n.childNodes[B - 1], Q = f.pmViewDesc;
|
|
8284
8284
|
if (f.nodeName == "BR" && !Q) {
|
|
8285
|
-
o =
|
|
8285
|
+
o = B;
|
|
8286
8286
|
break;
|
|
8287
8287
|
}
|
|
8288
8288
|
if (!Q || Q.size)
|
|
8289
8289
|
break;
|
|
8290
8290
|
}
|
|
8291
|
-
let I = t.state.doc, d = t.someProp("domParser") || DOMParser$1.fromSchema(t.state.schema), h = I.resolve(s), u = null,
|
|
8291
|
+
let I = t.state.doc, d = t.someProp("domParser") || DOMParser$1.fromSchema(t.state.schema), h = I.resolve(s), u = null, E = d.parse(n, {
|
|
8292
8292
|
topNode: h.parent,
|
|
8293
8293
|
topMatch: h.parent.contentMatchAt(h.index()),
|
|
8294
8294
|
topOpen: !0,
|
|
@@ -8300,10 +8300,10 @@ function parseBetween(t, e, A) {
|
|
|
8300
8300
|
context: h
|
|
8301
8301
|
});
|
|
8302
8302
|
if (g && g[0].pos != null) {
|
|
8303
|
-
let
|
|
8304
|
-
f == null && (f =
|
|
8303
|
+
let B = g[0].pos, f = g[1] && g[1].pos;
|
|
8304
|
+
f == null && (f = B), u = { anchor: B + s, head: f + s };
|
|
8305
8305
|
}
|
|
8306
|
-
return { doc:
|
|
8306
|
+
return { doc: E, sel: u, from: s, to: a };
|
|
8307
8307
|
}
|
|
8308
8308
|
function ruleFromNode(t) {
|
|
8309
8309
|
let e = t.pmViewDesc;
|
|
@@ -8355,16 +8355,16 @@ function readDOMChange(t, e, A, n, r) {
|
|
|
8355
8355
|
return;
|
|
8356
8356
|
}
|
|
8357
8357
|
t.state.selection.from < t.state.selection.to && u.start == u.endB && t.state.selection instanceof TextSelection && (u.start > t.state.selection.from && u.start <= t.state.selection.from + 2 && t.state.selection.from >= g.from ? u.start = t.state.selection.from : u.endA < t.state.selection.to && u.endA >= t.state.selection.to - 2 && t.state.selection.to <= g.to && (u.endB += t.state.selection.to - u.endA, u.endA = t.state.selection.to)), ie$1 && ie_version <= 11 && u.endB == u.start + 1 && u.endA == u.start && u.start > g.from && g.doc.textBetween(u.start - g.from - 1, u.start - g.from + 1) == " " && (u.start--, u.endA--, u.endB--);
|
|
8358
|
-
let
|
|
8359
|
-
if ((ios && t.input.lastIOSEnter > Date.now() - 225 && (!Q || r.some((_) => _.nodeName == "DIV" || _.nodeName == "P")) || !Q &&
|
|
8358
|
+
let E = g.doc.resolveNoCache(u.start - g.from), B = g.doc.resolveNoCache(u.endB - g.from), f = c.resolve(u.start), Q = E.sameParent(B) && E.parent.inlineContent && f.end() >= u.endA, p;
|
|
8359
|
+
if ((ios && t.input.lastIOSEnter > Date.now() - 225 && (!Q || r.some((_) => _.nodeName == "DIV" || _.nodeName == "P")) || !Q && E.pos < g.doc.content.size && (!E.sameParent(B) || !E.parent.inlineContent) && !/\S/.test(g.doc.textBetween(E.pos, B.pos, "", "")) && (p = Selection.findFrom(g.doc.resolve(E.pos + 1), 1, !0)) && p.head > E.pos) && t.someProp("handleKeyDown", (_) => _(t, keyEvent(13, "Enter")))) {
|
|
8360
8360
|
t.input.lastIOSEnter = 0;
|
|
8361
8361
|
return;
|
|
8362
8362
|
}
|
|
8363
|
-
if (t.state.selection.anchor > u.start && looksLikeBackspace(c, u.start, u.endA,
|
|
8363
|
+
if (t.state.selection.anchor > u.start && looksLikeBackspace(c, u.start, u.endA, E, B) && t.someProp("handleKeyDown", (_) => _(t, keyEvent(8, "Backspace")))) {
|
|
8364
8364
|
android && chrome && t.domObserver.suppressSelectionUpdates();
|
|
8365
8365
|
return;
|
|
8366
8366
|
}
|
|
8367
|
-
chrome && u.endB == u.start && (t.input.lastChromeDelete = Date.now()), android && !Q &&
|
|
8367
|
+
chrome && u.endB == u.start && (t.input.lastChromeDelete = Date.now()), android && !Q && E.start() != B.start() && B.parentOffset == 0 && E.depth == B.depth && g.sel && g.sel.anchor == g.sel.head && g.sel.head == u.endA && (u.endB -= 2, B = g.doc.resolveNoCache(u.endB - g.from), setTimeout(() => {
|
|
8368
8368
|
t.someProp("handleKeyDown", function(_) {
|
|
8369
8369
|
return _(t, keyEvent(13, "Enter"));
|
|
8370
8370
|
});
|
|
@@ -8378,18 +8378,18 @@ function readDOMChange(t, e, A, n, r) {
|
|
|
8378
8378
|
return o && k.setMeta("composition", o), k.scrollIntoView();
|
|
8379
8379
|
}, D;
|
|
8380
8380
|
if (Q) {
|
|
8381
|
-
if (
|
|
8382
|
-
ie$1 && ie_version <= 11 &&
|
|
8381
|
+
if (E.pos == B.pos) {
|
|
8382
|
+
ie$1 && ie_version <= 11 && E.parentOffset == 0 && (t.domObserver.suppressSelectionUpdates(), setTimeout(() => selectionToDOM(t), 20));
|
|
8383
8383
|
let _ = w(t.state.tr.delete(m, y)), k = c.resolve(u.start).marksAcross(c.resolve(u.endA));
|
|
8384
8384
|
k && _.ensureMarks(k), t.dispatch(_);
|
|
8385
8385
|
} else if (
|
|
8386
8386
|
// Adding or removing a mark
|
|
8387
|
-
u.endA == u.endB && (D = isMarkChange(
|
|
8387
|
+
u.endA == u.endB && (D = isMarkChange(E.parent.content.cut(E.parentOffset, B.parentOffset), f.parent.content.cut(f.parentOffset, u.endA - f.start())))
|
|
8388
8388
|
) {
|
|
8389
8389
|
let _ = w(t.state.tr);
|
|
8390
8390
|
D.type == "add" ? _.addMark(m, y, D.mark) : _.removeMark(m, y, D.mark), t.dispatch(_);
|
|
8391
|
-
} else if (
|
|
8392
|
-
let _ =
|
|
8391
|
+
} else if (E.parent.child(E.index()).isText && E.index() == B.index() - (B.textOffset ? 0 : 1)) {
|
|
8392
|
+
let _ = E.parent.textBetween(E.parentOffset, B.parentOffset), k = () => w(t.state.tr.insertText(_, m, y));
|
|
8393
8393
|
t.someProp("handleTextInput", (S) => S(t, m, y, _, k)) || t.dispatch(k());
|
|
8394
8394
|
}
|
|
8395
8395
|
} else
|
|
@@ -8941,23 +8941,23 @@ const runInputRulesTexts = () => {
|
|
|
8941
8941
|
for (let d = I.length - 1; d >= 0; d--) {
|
|
8942
8942
|
const { pos: h, node: u } = I[d];
|
|
8943
8943
|
if (!u.isText || !u.text) continue;
|
|
8944
|
-
let
|
|
8944
|
+
let E = u.text;
|
|
8945
8945
|
if (u.type.spec.code) {
|
|
8946
8946
|
if (!c.inCode) continue;
|
|
8947
8947
|
} else if (c.inCode === "only")
|
|
8948
8948
|
continue;
|
|
8949
|
-
const
|
|
8950
|
-
if (!
|
|
8949
|
+
const B = c.regex.exec(E);
|
|
8950
|
+
if (!B)
|
|
8951
8951
|
continue;
|
|
8952
|
-
const f =
|
|
8952
|
+
const f = B.index, Q = h + f, p = h + f + B[0].length;
|
|
8953
8953
|
let m = c.handler(
|
|
8954
8954
|
l,
|
|
8955
8955
|
e,
|
|
8956
|
-
|
|
8956
|
+
B,
|
|
8957
8957
|
Q,
|
|
8958
8958
|
p
|
|
8959
8959
|
);
|
|
8960
|
-
m && (l = m, a = l.doc, c.undoable && l.setMeta(o, { transform: l, from: Q, to: p, text:
|
|
8960
|
+
m && (l = m, a = l.doc, c.undoable && l.setMeta(o, { transform: l, from: Q, to: p, text: E }));
|
|
8961
8961
|
}
|
|
8962
8962
|
}
|
|
8963
8963
|
return A && A(l), l.docChanged;
|
|
@@ -8985,18 +8985,18 @@ const runInputRulesTexts = () => {
|
|
|
8985
8985
|
if (!u.inCode) continue;
|
|
8986
8986
|
} else if (u.inCode === "only")
|
|
8987
8987
|
continue;
|
|
8988
|
-
const
|
|
8989
|
-
if (!
|
|
8988
|
+
const E = u.regex.exec(I);
|
|
8989
|
+
if (!E)
|
|
8990
8990
|
continue;
|
|
8991
|
-
const
|
|
8991
|
+
const B = u.handler(
|
|
8992
8992
|
d,
|
|
8993
8993
|
r,
|
|
8994
|
-
|
|
8995
|
-
d.mapping.map(t - (
|
|
8994
|
+
E,
|
|
8995
|
+
d.mapping.map(t - (E[0].length - A.length)),
|
|
8996
8996
|
d.mapping.map(e)
|
|
8997
8997
|
);
|
|
8998
|
-
if (
|
|
8999
|
-
d =
|
|
8998
|
+
if (B) {
|
|
8999
|
+
d = B, u.undoable && d.setMeta(l, { transform: d, from: t, to: e, text: A });
|
|
9000
9000
|
break;
|
|
9001
9001
|
}
|
|
9002
9002
|
}
|
|
@@ -9726,8 +9726,8 @@ const exitCode = () => (t, e) => {
|
|
|
9726
9726
|
g = r.end(u) == r.pos + (r.depth - u), c = r.start(u) == r.pos - (r.depth - u), l = defaultBlockAt(
|
|
9727
9727
|
r.node(u - 1).contentMatchAt(r.indexAfter(u - 1))
|
|
9728
9728
|
);
|
|
9729
|
-
let
|
|
9730
|
-
s.unshift(
|
|
9729
|
+
let B = t && t(o.parent, g, r);
|
|
9730
|
+
s.unshift(B || (g && l ? { type: l } : null)), a = u;
|
|
9731
9731
|
break;
|
|
9732
9732
|
} else {
|
|
9733
9733
|
if (u == 1) return !1;
|
|
@@ -9737,10 +9737,10 @@ const exitCode = () => (t, e) => {
|
|
|
9737
9737
|
(A.selection instanceof TextSelection || A.selection instanceof AllSelection) && I.deleteSelection();
|
|
9738
9738
|
let d = I.mapping.map(r.pos), h = canSplit(I.doc, d, s.length, s);
|
|
9739
9739
|
if (h || (s[0] = l ? { type: l } : null, h = canSplit(I.doc, d, s.length, s)), I.split(d, s.length, s), !g && c && r.node(a).type != l) {
|
|
9740
|
-
let u = I.mapping.map(r.before(a)),
|
|
9740
|
+
let u = I.mapping.map(r.before(a)), E = I.doc.resolve(u);
|
|
9741
9741
|
l && r.node(a - 1).canReplaceWith(
|
|
9742
|
-
|
|
9743
|
-
|
|
9742
|
+
E.index(),
|
|
9743
|
+
E.index() + 1,
|
|
9744
9744
|
l
|
|
9745
9745
|
) && I.setNodeMarkup(I.mapping.map(r.before(a)), l);
|
|
9746
9746
|
}
|
|
@@ -9775,7 +9775,7 @@ function deleteBarrier(t, e, A, n) {
|
|
|
9775
9775
|
for (let f = s.length - 1; f >= 0; f--)
|
|
9776
9776
|
u = Fragment.from(s[f].create(null, u));
|
|
9777
9777
|
u = Fragment.from(r.copy(u));
|
|
9778
|
-
let
|
|
9778
|
+
let E = t.tr.step(
|
|
9779
9779
|
new ReplaceAroundStep(
|
|
9780
9780
|
e.pos - 1,
|
|
9781
9781
|
h,
|
|
@@ -9785,8 +9785,8 @@ function deleteBarrier(t, e, A, n) {
|
|
|
9785
9785
|
s.length,
|
|
9786
9786
|
!0
|
|
9787
9787
|
)
|
|
9788
|
-
),
|
|
9789
|
-
|
|
9788
|
+
), B = E.doc.resolve(h + 2 * s.length);
|
|
9789
|
+
B.nodeAfter && B.nodeAfter.type == r.type && canJoin(E.doc, B.pos) && E.join(B.pos), A(E.scrollIntoView());
|
|
9790
9790
|
}
|
|
9791
9791
|
return !0;
|
|
9792
9792
|
}
|
|
@@ -9797,10 +9797,10 @@ function deleteBarrier(t, e, A, n) {
|
|
|
9797
9797
|
let h = r, u = [];
|
|
9798
9798
|
for (; u.push(h), !h.isTextblock; )
|
|
9799
9799
|
h = h.lastChild;
|
|
9800
|
-
let
|
|
9801
|
-
for (; !
|
|
9802
|
-
|
|
9803
|
-
if (h.canReplace(h.childCount, h.childCount,
|
|
9800
|
+
let E = o, B = 1;
|
|
9801
|
+
for (; !E.isTextblock; E = E.firstChild)
|
|
9802
|
+
B++;
|
|
9803
|
+
if (h.canReplace(h.childCount, h.childCount, E.content)) {
|
|
9804
9804
|
if (A) {
|
|
9805
9805
|
let f = Fragment.empty;
|
|
9806
9806
|
for (let p = u.length - 1; p >= 0; p--)
|
|
@@ -9809,8 +9809,8 @@ function deleteBarrier(t, e, A, n) {
|
|
|
9809
9809
|
new ReplaceAroundStep(
|
|
9810
9810
|
e.pos - u.length,
|
|
9811
9811
|
e.pos + o.nodeSize,
|
|
9812
|
-
e.pos +
|
|
9813
|
-
e.pos + o.nodeSize -
|
|
9812
|
+
e.pos + B,
|
|
9813
|
+
e.pos + o.nodeSize - B,
|
|
9814
9814
|
new Slice(f, u.length, 0),
|
|
9815
9815
|
0,
|
|
9816
9816
|
!0
|
|
@@ -9901,23 +9901,23 @@ function toggleMark(t, e = null, A) {
|
|
|
9901
9901
|
(h) => s.doc.rangeHasMark(h.$from.pos, h.$to.pos, t)
|
|
9902
9902
|
) : I = !c.every((h) => {
|
|
9903
9903
|
let u = !1;
|
|
9904
|
-
return d.doc.nodesBetween(h.$from.pos, h.$to.pos, (
|
|
9904
|
+
return d.doc.nodesBetween(h.$from.pos, h.$to.pos, (E, B, f) => {
|
|
9905
9905
|
if (u) return !1;
|
|
9906
|
-
u = !t.isInSet(
|
|
9907
|
-
|
|
9908
|
-
Math.max(0, h.$from.pos -
|
|
9909
|
-
Math.min(
|
|
9906
|
+
u = !t.isInSet(E.marks) && !!f && f.type.allowsMarkType(t) && !(E.isText && /^\s*$/.test(
|
|
9907
|
+
E.textBetween(
|
|
9908
|
+
Math.max(0, h.$from.pos - B),
|
|
9909
|
+
Math.min(E.nodeSize, h.$to.pos - B)
|
|
9910
9910
|
)
|
|
9911
9911
|
));
|
|
9912
9912
|
}), !u;
|
|
9913
9913
|
});
|
|
9914
9914
|
for (let h = 0; h < c.length; h++) {
|
|
9915
|
-
let { $from: u, $to:
|
|
9915
|
+
let { $from: u, $to: E } = c[h];
|
|
9916
9916
|
if (!I)
|
|
9917
|
-
d.removeMark(u.pos,
|
|
9917
|
+
d.removeMark(u.pos, E.pos, t);
|
|
9918
9918
|
else {
|
|
9919
|
-
let
|
|
9920
|
-
|
|
9919
|
+
let B = u.pos, f = E.pos, Q = u.nodeAfter, p = E.nodeBefore, m = o && Q && Q.isText ? /^\s*/.exec(Q.text)[0].length : 0, y = o && p && p.isText ? /\s*$/.exec(p.text)[0].length : 0;
|
|
9920
|
+
B + m < f && (B += m, f -= y), d.addMark(B, f, t.create(e));
|
|
9921
9921
|
}
|
|
9922
9922
|
}
|
|
9923
9923
|
a(d.scrollIntoView());
|
|
@@ -10064,11 +10064,13 @@ class CommandManager {
|
|
|
10064
10064
|
return () => this.createCan();
|
|
10065
10065
|
}
|
|
10066
10066
|
createChain(e, A = !0) {
|
|
10067
|
-
const { commandFactories: n, editor: r } = this, o = this.editor.state, { view: s } = r, a = [], l = !!e, g = e || o.tr
|
|
10067
|
+
const { commandFactories: n, editor: r } = this, o = this.editor.state, { view: s } = r, a = [], l = !!e, g = e || o.tr;
|
|
10068
|
+
g.setMeta("isCommand", !0);
|
|
10069
|
+
const c = createChainableState(g, o), I = () => {
|
|
10068
10070
|
}, d = {
|
|
10069
10071
|
...Object.fromEntries(
|
|
10070
|
-
Object.entries(n).map(([h, u]) => [h, (...
|
|
10071
|
-
const Q = u(...
|
|
10072
|
+
Object.entries(n).map(([h, u]) => [h, (...B) => {
|
|
10073
|
+
const Q = u(...B).apply({ editor: this.editor }, [
|
|
10072
10074
|
c,
|
|
10073
10075
|
A ? I : void 0
|
|
10074
10076
|
]);
|
|
@@ -10900,8 +10902,8 @@ function textPositionsToResolvedPos(t, e, A) {
|
|
|
10900
10902
|
function a(l, g = 0, c = 0, I = 0) {
|
|
10901
10903
|
g === 1 && c === A && (o = !0);
|
|
10902
10904
|
let d = 0;
|
|
10903
|
-
l.isText && l.text ? d = l.text?.length : l.isLeaf && (d = 1), d > 0 && s(I, g, c, d), l.forEach((h, u,
|
|
10904
|
-
a(h, g + 1,
|
|
10905
|
+
l.isText && l.text ? d = l.text?.length : l.isLeaf && (d = 1), d > 0 && s(I, g, c, d), l.forEach((h, u, E) => {
|
|
10906
|
+
a(h, g + 1, E, I + u + 1);
|
|
10905
10907
|
});
|
|
10906
10908
|
}
|
|
10907
10909
|
if (a(e), o)
|
|
@@ -11029,14 +11031,14 @@ class DropCursorView {
|
|
|
11029
11031
|
this.cursorPos - (I ? I.nodeSize : 0)
|
|
11030
11032
|
);
|
|
11031
11033
|
if (h) {
|
|
11032
|
-
let u = h.getBoundingClientRect(),
|
|
11033
|
-
I && d && (
|
|
11034
|
-
let
|
|
11034
|
+
let u = h.getBoundingClientRect(), E = I ? u.bottom : u.top;
|
|
11035
|
+
I && d && (E = (E + this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top) / 2);
|
|
11036
|
+
let B = this.width / 2 * a;
|
|
11035
11037
|
n = {
|
|
11036
11038
|
left: u.left,
|
|
11037
11039
|
right: u.right,
|
|
11038
|
-
top:
|
|
11039
|
-
bottom:
|
|
11040
|
+
top: E - B,
|
|
11041
|
+
bottom: E + B
|
|
11040
11042
|
};
|
|
11041
11043
|
}
|
|
11042
11044
|
}
|
|
@@ -11681,15 +11683,15 @@ function buildPairingTransaction(t, e, A) {
|
|
|
11681
11683
|
else {
|
|
11682
11684
|
const h = r.get(d);
|
|
11683
11685
|
if (h && h.length > 0) {
|
|
11684
|
-
const u = h.pop(),
|
|
11686
|
+
const u = h.pop(), E = generateId();
|
|
11685
11687
|
A.setNodeMarkup(u.pos, void 0, {
|
|
11686
11688
|
...u.node.attrs,
|
|
11687
|
-
id:
|
|
11689
|
+
id: E,
|
|
11688
11690
|
nesting: NESTING_OPENING$1,
|
|
11689
11691
|
error: void 0
|
|
11690
11692
|
}), A.setNodeMarkup(l, void 0, {
|
|
11691
11693
|
...a.attrs,
|
|
11692
|
-
id:
|
|
11694
|
+
id: E,
|
|
11693
11695
|
nesting: NESTING_CLOSING$1,
|
|
11694
11696
|
error: void 0
|
|
11695
11697
|
});
|
|
@@ -12351,13 +12353,13 @@ class NodeImage extends Node$2 {
|
|
|
12351
12353
|
p.className = `kb-image-resize-handle kb-image-resize-handle-${Q}`, p.dataset.position = Q, o.appendChild(p);
|
|
12352
12354
|
}
|
|
12353
12355
|
let l = !1, g = 0, c = 0, I = 0, d = 0, h = 1, u = null;
|
|
12354
|
-
const
|
|
12356
|
+
const E = (Q) => {
|
|
12355
12357
|
const p = Q.target;
|
|
12356
12358
|
if (!p.classList.contains("kb-image-resize-handle")) return;
|
|
12357
12359
|
Q.preventDefault(), Q.stopPropagation(), l = !0, u = p.dataset.position || null, g = Q.clientX, c = Q.clientY;
|
|
12358
12360
|
const m = s.getBoundingClientRect();
|
|
12359
|
-
I = m.width, d = m.height, h = I / d, o.classList.add("kb-image-resizing"), document.addEventListener("mousemove",
|
|
12360
|
-
},
|
|
12361
|
+
I = m.width, d = m.height, h = I / d, o.classList.add("kb-image-resizing"), document.addEventListener("mousemove", B), document.addEventListener("mouseup", f);
|
|
12362
|
+
}, B = (Q) => {
|
|
12361
12363
|
if (!l) return;
|
|
12362
12364
|
const p = Q.clientX - g, m = Q.clientY - c;
|
|
12363
12365
|
let y = I, w = d;
|
|
@@ -12378,7 +12380,7 @@ class NodeImage extends Node$2 {
|
|
|
12378
12380
|
y = Math.max(50, y), w = Math.max(50, w), s.style.width = `${Math.round(y)}px`, s.style.height = `${Math.round(w)}px`;
|
|
12379
12381
|
}, f = () => {
|
|
12380
12382
|
if (!l) return;
|
|
12381
|
-
l = !1, u = null, o.classList.remove("kb-image-resizing"), document.removeEventListener("mousemove",
|
|
12383
|
+
l = !1, u = null, o.classList.remove("kb-image-resizing"), document.removeEventListener("mousemove", B), document.removeEventListener("mouseup", f);
|
|
12382
12384
|
const Q = Math.round(s.getBoundingClientRect().width), p = Math.round(s.getBoundingClientRect().height), m = r();
|
|
12383
12385
|
if (typeof m == "number") {
|
|
12384
12386
|
const y = n.state.tr.setNodeMarkup(m, void 0, {
|
|
@@ -12389,7 +12391,7 @@ class NodeImage extends Node$2 {
|
|
|
12389
12391
|
n.dispatch(y);
|
|
12390
12392
|
}
|
|
12391
12393
|
};
|
|
12392
|
-
return o.addEventListener("mousedown",
|
|
12394
|
+
return o.addEventListener("mousedown", E), o.addEventListener("click", (Q) => {
|
|
12393
12395
|
Q.preventDefault();
|
|
12394
12396
|
const p = r();
|
|
12395
12397
|
if (typeof p == "number") {
|
|
@@ -12400,7 +12402,7 @@ class NodeImage extends Node$2 {
|
|
|
12400
12402
|
dom: o,
|
|
12401
12403
|
update: (Q) => Q.type.name !== "image" ? !1 : (s.src = Q.attrs.src, Q.attrs.alt && (s.alt = Q.attrs.alt), Q.attrs.title && (s.title = Q.attrs.title), Q.attrs.width ? s.style.width = typeof Q.attrs.width == "number" ? `${Q.attrs.width}px` : Q.attrs.width : s.style.width = "", Q.attrs.height ? s.style.height = typeof Q.attrs.height == "number" ? `${Q.attrs.height}px` : Q.attrs.height : s.style.height = "", !0),
|
|
12402
12404
|
destroy: () => {
|
|
12403
|
-
o.removeEventListener("mousedown",
|
|
12405
|
+
o.removeEventListener("mousedown", E), document.removeEventListener("mousemove", B), document.removeEventListener("mouseup", f);
|
|
12404
12406
|
},
|
|
12405
12407
|
stopEvent: (Q) => Q.type === "mousedown" && Q.target.classList.contains(
|
|
12406
12408
|
"kb-image-resize-handle"
|
|
@@ -12890,15 +12892,15 @@ function splitListItem(t, e) {
|
|
|
12890
12892
|
d = Fragment.from(o.node(Q).copy(d));
|
|
12891
12893
|
let u = o.indexAfter(-1) < o.node(-2).childCount ? 1 : o.indexAfter(-2) < o.node(-3).childCount ? 2 : 3;
|
|
12892
12894
|
d = d.append(Fragment.from(t.createAndFill()));
|
|
12893
|
-
let
|
|
12894
|
-
|
|
12895
|
+
let E = o.before(o.depth - (h - 1)), B = n.tr.replace(
|
|
12896
|
+
E,
|
|
12895
12897
|
o.after(-u),
|
|
12896
12898
|
new Slice(d, 4 - h, 0)
|
|
12897
12899
|
), f = -1;
|
|
12898
|
-
|
|
12900
|
+
B.doc.nodesBetween(E, B.doc.content.size, (Q, p) => {
|
|
12899
12901
|
if (f > -1) return !1;
|
|
12900
12902
|
Q.isTextblock && Q.content.size == 0 && (f = p + 1);
|
|
12901
|
-
}), f > -1 &&
|
|
12903
|
+
}), f > -1 && B.setSelection(Selection.near(B.doc.resolve(f))), r(B.scrollIntoView());
|
|
12902
12904
|
}
|
|
12903
12905
|
return !0;
|
|
12904
12906
|
}
|
|
@@ -12947,7 +12949,7 @@ function liftToOuterList(t, e, A, n) {
|
|
|
12947
12949
|
}
|
|
12948
12950
|
function liftOutOfList(t, e, A) {
|
|
12949
12951
|
let n = t.tr, r = A.parent;
|
|
12950
|
-
for (let h = A.end, u = A.endIndex - 1,
|
|
12952
|
+
for (let h = A.end, u = A.endIndex - 1, E = A.startIndex; u > E; u--)
|
|
12951
12953
|
h -= r.child(u).nodeSize, n.delete(h - 1, h + 1);
|
|
12952
12954
|
let o = n.doc.resolve(A.start), s = o.nodeAfter;
|
|
12953
12955
|
if (n.mapping.map(A.end) != A.start + o.nodeAfter.nodeSize)
|
|
@@ -13024,10 +13026,10 @@ const isList = (t) => t.endsWith("_list"), clearNodes = () => (t, e) => {
|
|
|
13024
13026
|
return;
|
|
13025
13027
|
const u = liftTarget(h);
|
|
13026
13028
|
if (a.type.isTextblock) {
|
|
13027
|
-
const { defaultType:
|
|
13029
|
+
const { defaultType: E } = I.parent.contentMatchAt(
|
|
13028
13030
|
I.index()
|
|
13029
13031
|
);
|
|
13030
|
-
A.setNodeMarkup(h.start,
|
|
13032
|
+
A.setNodeMarkup(h.start, E);
|
|
13031
13033
|
}
|
|
13032
13034
|
(u || u === 0) && A.lift(h, u);
|
|
13033
13035
|
});
|
|
@@ -13071,20 +13073,20 @@ const joinListBackwards = (t, e) => {
|
|
|
13071
13073
|
throw new Error("Call this with Function.apply");
|
|
13072
13074
|
const a = this.editor, l = Object.keys(r.schema.marks).filter(
|
|
13073
13075
|
(p) => p !== "link"
|
|
13074
|
-
), g = r.schema.nodes[t], c = r.schema.nodes[e], { selection: I, storedMarks: d } = r, { $from: h, $to: u } = I,
|
|
13075
|
-
if (!
|
|
13076
|
+
), g = r.schema.nodes[t], c = r.schema.nodes[e], { selection: I, storedMarks: d } = r, { $from: h, $to: u } = I, E = h.blockRange(u), B = d || (I.$to.parentOffset ? I.$from.marks() : []);
|
|
13077
|
+
if (!E)
|
|
13076
13078
|
return !1;
|
|
13077
13079
|
const f = findParentNode((p) => isList(p.type.name))(
|
|
13078
13080
|
I
|
|
13079
13081
|
), Q = r.tr;
|
|
13080
|
-
if (
|
|
13082
|
+
if (E.depth >= 1 && f && E.depth - f.depth <= 1) {
|
|
13081
13083
|
if (f.node.type === g)
|
|
13082
13084
|
return liftListItem(c).apply(this, [r, o, s]);
|
|
13083
13085
|
if (isList(f.node.type.name) && g.validContent(f.node.content) && o)
|
|
13084
13086
|
return a.chain(Q).command(() => (Q.setNodeMarkup(f.pos, g), !0)).command(() => joinListBackwards(Q, g)).command(() => joinListForwards(Q, g)).command(() => o(Q)).run();
|
|
13085
13087
|
}
|
|
13086
|
-
return !A || !
|
|
13087
|
-
const p = a.can().wrapInList(g, n).run(), m =
|
|
13088
|
+
return !A || !B || !o ? a.chain(Q).command(() => a.can().wrapInList(g, n).run() ? !0 : a.chain(Q).lift().run()).wrapInList(g, n).command(() => joinListBackwards(Q, g)).command(() => joinListForwards(Q, g)).command(() => (o && o(Q), !0)).run() : a.chain(Q).command(() => {
|
|
13089
|
+
const p = a.can().wrapInList(g, n).run(), m = B.filter(
|
|
13088
13090
|
(y) => l.includes(y.type.name)
|
|
13089
13091
|
);
|
|
13090
13092
|
return Q.ensureMarks(m), p ? !0 : (f && Q.setSelection(NodeSelection.create(r.doc, f.pos)), clearNodes().apply(this, [r, o, s]));
|
|
@@ -13770,7 +13772,7 @@ class CodeJar extends EventTarget {
|
|
|
13770
13772
|
this.listeners.push([D, _]), this.editor.addEventListener(D, _);
|
|
13771
13773
|
};
|
|
13772
13774
|
h("keydown", (D) => {
|
|
13773
|
-
D.defaultPrevented || (this.prev = this.toString(), this.options.preserveIdent ?
|
|
13775
|
+
D.defaultPrevented || (this.prev = this.toString(), this.options.preserveIdent ? B(D) : f(D), this.options.catchTab && p(D), this.options.addClosing && Q(D), this.options.history && (m(D), I(D) && !c && (this.recordHistory(), c = !0)), l && !isCopy(D) && this.restore(this.save()));
|
|
13774
13776
|
}), h("keyup", (D) => {
|
|
13775
13777
|
D.defaultPrevented || D.isComposing || (this.prev !== this.toString() && g(), d(D), this.onUpdateCbk(this.toString()));
|
|
13776
13778
|
}), h("focus", (D) => {
|
|
@@ -13785,12 +13787,12 @@ class CodeJar extends EventTarget {
|
|
|
13785
13787
|
const u = () => {
|
|
13786
13788
|
const _ = this.getSelection().getRangeAt(0), k = o.createRange();
|
|
13787
13789
|
return k.selectNodeContents(e), k.setEnd(_.startContainer, _.startOffset), k.toString();
|
|
13788
|
-
},
|
|
13790
|
+
}, E = () => {
|
|
13789
13791
|
const _ = this.getSelection().getRangeAt(0), k = o.createRange();
|
|
13790
13792
|
return k.selectNodeContents(e), k.setStart(_.endContainer, _.endOffset), k.toString();
|
|
13791
|
-
},
|
|
13793
|
+
}, B = (D) => {
|
|
13792
13794
|
if (D.key === "Enter") {
|
|
13793
|
-
const _ = u(), k =
|
|
13795
|
+
const _ = u(), k = E();
|
|
13794
13796
|
let [S] = findPadding(_), F = S;
|
|
13795
13797
|
if (this.options.indentOn.test(_) && (F += this.options.tab), F.length > 0 ? (D.preventDefault(), D.stopPropagation(), insert$1(`
|
|
13796
13798
|
` + F)) : f(D), F !== S && this.options.moveToNewLine.test(k)) {
|
|
@@ -13801,7 +13803,7 @@ class CodeJar extends EventTarget {
|
|
|
13801
13803
|
}
|
|
13802
13804
|
}, f = (D) => {
|
|
13803
13805
|
if (l && D.key === "Enter")
|
|
13804
|
-
if (D.preventDefault(), D.stopPropagation(),
|
|
13806
|
+
if (D.preventDefault(), D.stopPropagation(), E() == "") {
|
|
13805
13807
|
insert$1(`
|
|
13806
13808
|
`);
|
|
13807
13809
|
const _ = this.save();
|
|
@@ -15474,13 +15476,13 @@ async function Module2(moduleArg = {}) {
|
|
|
15474
15476
|
tlsExports: /* @__PURE__ */ new Set(),
|
|
15475
15477
|
weakImports: /* @__PURE__ */ new Set(),
|
|
15476
15478
|
runtimePaths: []
|
|
15477
|
-
}, u = 1,
|
|
15479
|
+
}, u = 1, E = 2, B = 3, f = 4, Q = 5, p = 256, m = 3, y = 1; e < A; ) {
|
|
15478
15480
|
var w = n(), D = r();
|
|
15479
15481
|
if (w === u)
|
|
15480
15482
|
h.memorySize = r(), h.memoryAlign = r(), h.tableSize = r(), h.tableAlign = r();
|
|
15481
|
-
else if (w === B)
|
|
15482
|
-
h.neededDynlibs = s();
|
|
15483
15483
|
else if (w === E)
|
|
15484
|
+
h.neededDynlibs = s();
|
|
15485
|
+
else if (w === B)
|
|
15484
15486
|
for (var _ = r(); _--; ) {
|
|
15485
15487
|
var k = o(), S = r();
|
|
15486
15488
|
S & p && h.tlsExports.add(k);
|
|
@@ -16491,50 +16493,50 @@ var Query = class {
|
|
|
16491
16493
|
TRANSFER_BUFFER + SIZE_OF_INT
|
|
16492
16494
|
);
|
|
16493
16495
|
if (!r) {
|
|
16494
|
-
const
|
|
16496
|
+
const B = C.getValue(TRANSFER_BUFFER + SIZE_OF_INT, "i32"), f = C.getValue(TRANSFER_BUFFER, "i32"), Q = C.UTF8ToString(n, f).length, p = e.slice(Q, Q + 100).split(`
|
|
16495
16497
|
`)[0], m = p.match(QUERY_WORD_REGEX)?.[0] ?? "";
|
|
16496
|
-
switch (C._free(n),
|
|
16498
|
+
switch (C._free(n), B) {
|
|
16497
16499
|
case QueryErrorKind.Syntax:
|
|
16498
16500
|
throw new QueryError(QueryErrorKind.Syntax, { suffix: `${Q}: '${p}'...` }, Q, 0);
|
|
16499
16501
|
case QueryErrorKind.NodeName:
|
|
16500
|
-
throw new QueryError(
|
|
16502
|
+
throw new QueryError(B, { word: m }, Q, m.length);
|
|
16501
16503
|
case QueryErrorKind.FieldName:
|
|
16502
|
-
throw new QueryError(
|
|
16504
|
+
throw new QueryError(B, { word: m }, Q, m.length);
|
|
16503
16505
|
case QueryErrorKind.CaptureName:
|
|
16504
|
-
throw new QueryError(
|
|
16506
|
+
throw new QueryError(B, { word: m }, Q, m.length);
|
|
16505
16507
|
case QueryErrorKind.PatternStructure:
|
|
16506
|
-
throw new QueryError(
|
|
16508
|
+
throw new QueryError(B, { suffix: `${Q}: '${p}'...` }, Q, 0);
|
|
16507
16509
|
}
|
|
16508
16510
|
}
|
|
16509
16511
|
const o = C._ts_query_string_count(r), s = C._ts_query_capture_count(r), a = C._ts_query_pattern_count(r), l = new Array(s), g = new Array(a), c = new Array(o);
|
|
16510
|
-
for (let
|
|
16512
|
+
for (let B = 0; B < s; B++) {
|
|
16511
16513
|
const f = C._ts_query_capture_name_for_id(
|
|
16512
16514
|
r,
|
|
16513
|
-
|
|
16515
|
+
B,
|
|
16514
16516
|
TRANSFER_BUFFER
|
|
16515
16517
|
), Q = C.getValue(TRANSFER_BUFFER, "i32");
|
|
16516
|
-
l[
|
|
16518
|
+
l[B] = C.UTF8ToString(f, Q);
|
|
16517
16519
|
}
|
|
16518
|
-
for (let
|
|
16520
|
+
for (let B = 0; B < a; B++) {
|
|
16519
16521
|
const f = new Array(s);
|
|
16520
16522
|
for (let Q = 0; Q < s; Q++) {
|
|
16521
|
-
const p = C._ts_query_capture_quantifier_for_id(r,
|
|
16523
|
+
const p = C._ts_query_capture_quantifier_for_id(r, B, Q);
|
|
16522
16524
|
f[Q] = p;
|
|
16523
16525
|
}
|
|
16524
|
-
g[
|
|
16526
|
+
g[B] = f;
|
|
16525
16527
|
}
|
|
16526
|
-
for (let
|
|
16528
|
+
for (let B = 0; B < o; B++) {
|
|
16527
16529
|
const f = C._ts_query_string_value_for_id(
|
|
16528
16530
|
r,
|
|
16529
|
-
|
|
16531
|
+
B,
|
|
16530
16532
|
TRANSFER_BUFFER
|
|
16531
16533
|
), Q = C.getValue(TRANSFER_BUFFER, "i32");
|
|
16532
|
-
c[
|
|
16534
|
+
c[B] = C.UTF8ToString(f, Q);
|
|
16533
16535
|
}
|
|
16534
|
-
const I = new Array(a), d = new Array(a), h = new Array(a), u = new Array(a),
|
|
16535
|
-
for (let
|
|
16536
|
-
const f = C._ts_query_predicates_for_pattern(r,
|
|
16537
|
-
u[
|
|
16536
|
+
const I = new Array(a), d = new Array(a), h = new Array(a), u = new Array(a), E = new Array(a);
|
|
16537
|
+
for (let B = 0; B < a; B++) {
|
|
16538
|
+
const f = C._ts_query_predicates_for_pattern(r, B, TRANSFER_BUFFER), Q = C.getValue(TRANSFER_BUFFER, "i32");
|
|
16539
|
+
u[B] = [], E[B] = [];
|
|
16538
16540
|
const p = new Array();
|
|
16539
16541
|
let m = f;
|
|
16540
16542
|
for (let y = 0; y < Q; y++) {
|
|
@@ -16542,22 +16544,22 @@ var Query = class {
|
|
|
16542
16544
|
m += SIZE_OF_INT;
|
|
16543
16545
|
const D = C.getValue(m, "i32");
|
|
16544
16546
|
m += SIZE_OF_INT, parsePattern(
|
|
16545
|
-
|
|
16547
|
+
B,
|
|
16546
16548
|
w,
|
|
16547
16549
|
D,
|
|
16548
16550
|
l,
|
|
16549
16551
|
c,
|
|
16550
16552
|
p,
|
|
16551
|
-
|
|
16553
|
+
E,
|
|
16552
16554
|
u,
|
|
16553
16555
|
I,
|
|
16554
16556
|
d,
|
|
16555
16557
|
h
|
|
16556
16558
|
);
|
|
16557
16559
|
}
|
|
16558
|
-
Object.freeze(B
|
|
16560
|
+
Object.freeze(E[B]), Object.freeze(u[B]), Object.freeze(I[B]), Object.freeze(d[B]), Object.freeze(h[B]);
|
|
16559
16561
|
}
|
|
16560
|
-
C._free(n), this[0] = r, this.captureNames = l, this.captureQuantifiers = g, this.textPredicates =
|
|
16562
|
+
C._free(n), this[0] = r, this.captureNames = l, this.captureQuantifiers = g, this.textPredicates = E, this.predicates = u, this.setProperties = I, this.assertedProperties = d, this.refutedProperties = h, this.exceededMatchLimit = !1;
|
|
16561
16563
|
}
|
|
16562
16564
|
/** Delete the query, freeing its resources. */
|
|
16563
16565
|
delete() {
|
|
@@ -16605,8 +16607,8 @@ var Query = class {
|
|
|
16605
16607
|
c,
|
|
16606
16608
|
I
|
|
16607
16609
|
);
|
|
16608
|
-
const h = C.getValue(TRANSFER_BUFFER, "i32"), u = C.getValue(TRANSFER_BUFFER + SIZE_OF_INT, "i32"),
|
|
16609
|
-
this.exceededMatchLimit = !!
|
|
16610
|
+
const h = C.getValue(TRANSFER_BUFFER, "i32"), u = C.getValue(TRANSFER_BUFFER + SIZE_OF_INT, "i32"), E = C.getValue(TRANSFER_BUFFER + 2 * SIZE_OF_INT, "i32"), B = new Array(h);
|
|
16611
|
+
this.exceededMatchLimit = !!E;
|
|
16610
16612
|
let f = 0, Q = u;
|
|
16611
16613
|
for (let p = 0; p < h; p++) {
|
|
16612
16614
|
const m = C.getValue(Q, "i32");
|
|
@@ -16615,16 +16617,16 @@ var Query = class {
|
|
|
16615
16617
|
Q += SIZE_OF_INT;
|
|
16616
16618
|
const w = new Array(y);
|
|
16617
16619
|
if (Q = unmarshalCaptures(this, t.tree, Q, m, w), this.textPredicates[m].every((D) => D(w))) {
|
|
16618
|
-
|
|
16620
|
+
B[f] = { patternIndex: m, captures: w };
|
|
16619
16621
|
const D = this.setProperties[m];
|
|
16620
|
-
|
|
16622
|
+
B[f].setProperties = D;
|
|
16621
16623
|
const _ = this.assertedProperties[m];
|
|
16622
|
-
|
|
16624
|
+
B[f].assertedProperties = _;
|
|
16623
16625
|
const k = this.refutedProperties[m];
|
|
16624
|
-
|
|
16626
|
+
B[f].refutedProperties = k, f++;
|
|
16625
16627
|
}
|
|
16626
16628
|
}
|
|
16627
|
-
return
|
|
16629
|
+
return B.length = f, C._free(u), C.currentQueryProgressCallback = null, B;
|
|
16628
16630
|
}
|
|
16629
16631
|
/**
|
|
16630
16632
|
* Iterate over all of the individual captures in the order that they
|
|
@@ -16667,8 +16669,8 @@ var Query = class {
|
|
|
16667
16669
|
c,
|
|
16668
16670
|
I
|
|
16669
16671
|
);
|
|
16670
|
-
const h = C.getValue(TRANSFER_BUFFER, "i32"), u = C.getValue(TRANSFER_BUFFER + SIZE_OF_INT, "i32"),
|
|
16671
|
-
this.exceededMatchLimit = !!
|
|
16672
|
+
const h = C.getValue(TRANSFER_BUFFER, "i32"), u = C.getValue(TRANSFER_BUFFER + SIZE_OF_INT, "i32"), E = C.getValue(TRANSFER_BUFFER + 2 * SIZE_OF_INT, "i32"), B = new Array();
|
|
16673
|
+
this.exceededMatchLimit = !!E;
|
|
16672
16674
|
const f = new Array();
|
|
16673
16675
|
let Q = u;
|
|
16674
16676
|
for (let p = 0; p < h; p++) {
|
|
@@ -16683,10 +16685,10 @@ var Query = class {
|
|
|
16683
16685
|
const k = this.assertedProperties[m];
|
|
16684
16686
|
D.assertedProperties = k;
|
|
16685
16687
|
const S = this.refutedProperties[m];
|
|
16686
|
-
D.refutedProperties = S,
|
|
16688
|
+
D.refutedProperties = S, B.push(D);
|
|
16687
16689
|
}
|
|
16688
16690
|
}
|
|
16689
|
-
return C._free(u), C.currentQueryProgressCallback = null,
|
|
16691
|
+
return C._free(u), C.currentQueryProgressCallback = null, B;
|
|
16690
16692
|
}
|
|
16691
16693
|
/** Get the predicates for a given pattern. */
|
|
16692
16694
|
predicatesForPattern(t) {
|
|
@@ -17289,16 +17291,16 @@ const _childrenWithSoftNodes = (t, e, A) => {
|
|
|
17289
17291
|
const s = (l, g, c) => {
|
|
17290
17292
|
const { index: I, position: d } = g();
|
|
17291
17293
|
let h = I, u = d;
|
|
17292
|
-
const
|
|
17293
|
-
let
|
|
17294
|
-
for (const Q of
|
|
17294
|
+
const E = l.split(/(?<!\s)(?=\s+)/g);
|
|
17295
|
+
let B = u.column, f = u.row;
|
|
17296
|
+
for (const Q of E) {
|
|
17295
17297
|
if (Q.length == 0)
|
|
17296
17298
|
continue;
|
|
17297
17299
|
const p = h + Q.length;
|
|
17298
17300
|
if (Q.match(/^\s/)) {
|
|
17299
|
-
const m = f, y =
|
|
17300
|
-
f += (Q.match(/\n/g) || []).length, m != f ?
|
|
17301
|
-
`).slice(-1)[0].length :
|
|
17301
|
+
const m = f, y = B;
|
|
17302
|
+
f += (Q.match(/\n/g) || []).length, m != f ? B = Q.split(`
|
|
17303
|
+
`).slice(-1)[0].length : B += Q.length, n.push(
|
|
17302
17304
|
new WhitespaceNode({
|
|
17303
17305
|
tree: t.tree,
|
|
17304
17306
|
parent: c,
|
|
@@ -17309,13 +17311,13 @@ const _childrenWithSoftNodes = (t, e, A) => {
|
|
|
17309
17311
|
_startColOffset: y - d.column,
|
|
17310
17312
|
_endIndexOffset: p - I,
|
|
17311
17313
|
_endRowOffset: f - d.row,
|
|
17312
|
-
_endColOffset:
|
|
17314
|
+
_endColOffset: B - d.column,
|
|
17313
17315
|
children: []
|
|
17314
17316
|
})
|
|
17315
17317
|
);
|
|
17316
17318
|
} else {
|
|
17317
|
-
const m =
|
|
17318
|
-
|
|
17319
|
+
const m = B;
|
|
17320
|
+
B += Q.length, n.push(
|
|
17319
17321
|
new SoftTextNode({
|
|
17320
17322
|
tree: t.tree,
|
|
17321
17323
|
parent: c,
|
|
@@ -17326,7 +17328,7 @@ const _childrenWithSoftNodes = (t, e, A) => {
|
|
|
17326
17328
|
_startColOffset: m - d.column,
|
|
17327
17329
|
_endIndexOffset: p - I,
|
|
17328
17330
|
_endRowOffset: f - d.row,
|
|
17329
|
-
_endColOffset:
|
|
17331
|
+
_endColOffset: B - d.column,
|
|
17330
17332
|
children: []
|
|
17331
17333
|
})
|
|
17332
17334
|
);
|
|
@@ -17565,16 +17567,16 @@ class CodeJarBlockNodeView {
|
|
|
17565
17567
|
});
|
|
17566
17568
|
const d = l.params.diagnostics, h = [];
|
|
17567
17569
|
for (const u of d) {
|
|
17568
|
-
const
|
|
17570
|
+
const E = I.fromLineChar(
|
|
17569
17571
|
u.range.start.line,
|
|
17570
17572
|
u.range.start.character
|
|
17571
|
-
),
|
|
17573
|
+
), B = I.fromLineChar(
|
|
17572
17574
|
u.range.end.line,
|
|
17573
17575
|
u.range.end.character
|
|
17574
17576
|
);
|
|
17575
17577
|
h.push({
|
|
17576
|
-
startIndex:
|
|
17577
|
-
endIndex:
|
|
17578
|
+
startIndex: E,
|
|
17579
|
+
endIndex: B,
|
|
17578
17580
|
className: "kb-lsp__error",
|
|
17579
17581
|
title: u.message || ""
|
|
17580
17582
|
});
|
|
@@ -17950,20 +17952,20 @@ function requireHtml() {
|
|
|
17950
17952
|
`);
|
|
17951
17953
|
var u = n.token_text;
|
|
17952
17954
|
if (n.token_type == "TK_SCRIPT")
|
|
17953
|
-
var
|
|
17955
|
+
var E = typeof js_beautify == "function" && js_beautify;
|
|
17954
17956
|
else if (n.token_type == "TK_STYLE")
|
|
17955
|
-
var
|
|
17957
|
+
var E = typeof css_beautify == "function" && css_beautify;
|
|
17956
17958
|
if (A.indent_scripts == "keep")
|
|
17957
|
-
var
|
|
17959
|
+
var B = 0;
|
|
17958
17960
|
else if (A.indent_scripts == "separate")
|
|
17959
|
-
var
|
|
17961
|
+
var B = -n.indent_level;
|
|
17960
17962
|
else
|
|
17961
|
-
var
|
|
17962
|
-
var f = n.get_full_indent(
|
|
17963
|
-
if (
|
|
17964
|
-
u =
|
|
17963
|
+
var B = 1;
|
|
17964
|
+
var f = n.get_full_indent(B);
|
|
17965
|
+
if (E)
|
|
17966
|
+
u = E(u.replace(/^\s*/, f), A);
|
|
17965
17967
|
else {
|
|
17966
|
-
var Q = u.match(/^\s*/)[0], p = Q.match(/[^\n\r]*$/)[0].split(n.indent_string).length - 1, m = n.get_full_indent(
|
|
17968
|
+
var Q = u.match(/^\s*/)[0], p = Q.match(/[^\n\r]*$/)[0].split(n.indent_string).length - 1, m = n.get_full_indent(B - p);
|
|
17967
17969
|
u = u.replace(/^\s*/, f).replace(/\r\n|\r|\n/g, `
|
|
17968
17970
|
` + m).replace(/\s*$/, "");
|
|
17969
17971
|
}
|
|
@@ -18305,28 +18307,28 @@ function destroy_block(t, e) {
|
|
|
18305
18307
|
}
|
|
18306
18308
|
function update_keyed_each(t, e, A, n, r, o, s, a, l, g, c, I) {
|
|
18307
18309
|
let d = t.length, h = o.length, u = d;
|
|
18308
|
-
const
|
|
18309
|
-
for (; u--; )
|
|
18310
|
-
const
|
|
18310
|
+
const E = {};
|
|
18311
|
+
for (; u--; ) E[t[u].key] = u;
|
|
18312
|
+
const B = [], f = /* @__PURE__ */ new Map(), Q = /* @__PURE__ */ new Map(), p = [];
|
|
18311
18313
|
for (u = h; u--; ) {
|
|
18312
18314
|
const D = I(r, o, u), _ = A(D);
|
|
18313
18315
|
let k = s.get(_);
|
|
18314
|
-
k ? p.push(() => k.p(D, e)) : (k = g(_, D), k.c()), f.set(_,
|
|
18316
|
+
k ? p.push(() => k.p(D, e)) : (k = g(_, D), k.c()), f.set(_, B[u] = k), _ in E && Q.set(_, Math.abs(u - E[_]));
|
|
18315
18317
|
}
|
|
18316
18318
|
const m = /* @__PURE__ */ new Set(), y = /* @__PURE__ */ new Set();
|
|
18317
18319
|
function w(D) {
|
|
18318
18320
|
transition_in(D, 1), D.m(a, c), s.set(D.key, D), c = D.first, h--;
|
|
18319
18321
|
}
|
|
18320
18322
|
for (; d && h; ) {
|
|
18321
|
-
const D =
|
|
18323
|
+
const D = B[h - 1], _ = t[d - 1], k = D.key, S = _.key;
|
|
18322
18324
|
D === _ ? (c = D.first, d--, h--) : f.has(S) ? !s.has(k) || m.has(k) ? w(D) : y.has(S) ? d-- : Q.get(k) > Q.get(S) ? (y.add(k), w(D)) : (m.add(S), d--) : (l(_, s), d--);
|
|
18323
18325
|
}
|
|
18324
18326
|
for (; d--; ) {
|
|
18325
18327
|
const D = t[d];
|
|
18326
18328
|
f.has(D.key) || l(D, s);
|
|
18327
18329
|
}
|
|
18328
|
-
for (; h; ) w(
|
|
18329
|
-
return run_all(p),
|
|
18330
|
+
for (; h; ) w(B[h - 1]);
|
|
18331
|
+
return run_all(p), B;
|
|
18330
18332
|
}
|
|
18331
18333
|
function create_component(t) {
|
|
18332
18334
|
t && t.c();
|
|
@@ -18428,11 +18430,11 @@ function add_css$k(t) {
|
|
|
18428
18430
|
append_styles(t, "svelte-1lt2k10", ".floating-btn.svelte-1lt2k10.svelte-1lt2k10{background:#363755;border:0;border-radius:50%;box-shadow:0 0 30px rgba(34, 34, 34, 0.3);cursor:pointer;position:fixed;padding:6px;transition:opacity 0.3s;-webkit-transition:opacity 0.3s;z-index:99999}.floating-btn.bottom-right.svelte-1lt2k10.svelte-1lt2k10{bottom:16px;right:16px}.floating-btn.bottom-left.svelte-1lt2k10.svelte-1lt2k10{bottom:16px;left:16px}.floating-btn.top-right.svelte-1lt2k10.svelte-1lt2k10{top:16px;right:16px}.floating-btn.top-left.svelte-1lt2k10.svelte-1lt2k10{top:16px;left:16px}.floating-btn.svelte-1lt2k10.svelte-1lt2k10:hover{opacity:0.7}.floating-btn.svelte-1lt2k10>svg.svelte-1lt2k10{display:block;width:34px;height:34px;position:relative}");
|
|
18429
18431
|
}
|
|
18430
18432
|
function create_fragment$k(t) {
|
|
18431
|
-
let e, A, n, r, o, s, a, l, g, c, I, d, h, u,
|
|
18433
|
+
let e, A, n, r, o, s, a, l, g, c, I, d, h, u, E, B, f, Q, p, m, y, w, D, _;
|
|
18432
18434
|
return {
|
|
18433
18435
|
c() {
|
|
18434
|
-
e = element("button"), A = svg_element("svg"), n = svg_element("title"), r = text("prosemirror"), o = svg_element("desc"), s = text("Created using Figma"), a = svg_element("use"), l = svg_element("use"), g = svg_element("use"), c = svg_element("use"), I = svg_element("use"), d = svg_element("use"), h = svg_element("use"), u = svg_element("defs"),
|
|
18435
|
-
0z`), attr(
|
|
18436
|
+
e = element("button"), A = svg_element("svg"), n = svg_element("title"), r = text("prosemirror"), o = svg_element("desc"), s = text("Created using Figma"), a = svg_element("use"), l = svg_element("use"), g = svg_element("use"), c = svg_element("use"), I = svg_element("use"), d = svg_element("use"), h = svg_element("use"), u = svg_element("defs"), E = svg_element("path"), B = svg_element("path"), f = svg_element("path"), Q = svg_element("path"), p = svg_element("path"), m = svg_element("path"), y = svg_element("path"), xlink_attr(a, "xlink:href", "#a"), attr(a, "transform", "matrix(2 0 0 2 118 116)"), attr(a, "fill", "#FFF"), xlink_attr(l, "xlink:href", "#b"), attr(l, "transform", "rotate(16 59.054 420.192) scale(2)"), attr(l, "fill", "#FFF"), xlink_attr(g, "xlink:href", "#c"), attr(g, "transform", "matrix(2 0 0 2 154.024 141.58)"), attr(g, "fill", "#363755"), xlink_attr(c, "xlink:href", "#d"), attr(c, "transform", "matrix(2 0 0 2 220 334.8)"), attr(c, "fill", "#FFF"), xlink_attr(I, "xlink:href", "#e"), attr(I, "transform", "matrix(2 0 0 2 218.826 262.052)"), attr(I, "fill", "#363755"), xlink_attr(d, "xlink:href", "#f"), attr(d, "transform", "matrix(2 0 0 2 197.108 184.998)"), attr(d, "fill", "#FFF"), xlink_attr(h, "xlink:href", "#g"), attr(h, "transform", "matrix(2 0 0 2 221.8 216)"), attr(h, "fill", "#363755"), attr(E, "id", "a"), attr(E, "d", `M73.5 0C32.859 0 0 32.859 0 73.5S32.859 147 73.5 147 147 114.141 147 73.5 114.069 0 73.5
|
|
18437
|
+
0z`), attr(B, "id", "b"), attr(B, "d", `M193.601 107.116c0-13.376 8.238-23.91
|
|
18436
18438
|
20.619-31.153-2.244-7.447-5.19-14.6-8.824-21.32-13.886
|
|
18437
18439
|
3.633-25.12-1.799-34.568-11.26-9.449-9.437-12.344-20.672-8.709-34.571A111.362 111.362 0 0 0
|
|
18438
18440
|
140.799 0c-7.243 12.37-20.339 20.594-33.689 20.594-13.363
|
|
@@ -18457,7 +18459,7 @@ function create_fragment$k(t) {
|
|
|
18457
18459
|
)) + " svelte-1lt2k10");
|
|
18458
18460
|
},
|
|
18459
18461
|
m(k, S) {
|
|
18460
|
-
insert(k, e, S), append(e, A), append(A, n), append(n, r), append(A, o), append(o, s), append(A, a), append(A, l), append(A, g), append(A, c), append(A, I), append(A, d), append(A, h), append(A, u), append(u,
|
|
18462
|
+
insert(k, e, S), append(e, A), append(A, n), append(n, r), append(A, o), append(o, s), append(A, a), append(A, l), append(A, g), append(A, c), append(A, I), append(A, d), append(A, h), append(A, u), append(u, E), append(u, B), append(u, f), append(u, Q), append(u, p), append(u, m), append(u, y), D || (_ = listen(
|
|
18461
18463
|
e,
|
|
18462
18464
|
"click",
|
|
18463
18465
|
/*click_handler*/
|
|
@@ -18549,10 +18551,10 @@ function derived(t, e, A) {
|
|
|
18549
18551
|
I();
|
|
18550
18552
|
const u = e(n ? g[0] : g, s, a);
|
|
18551
18553
|
o ? s(u) : I = is_function(u) ? u : noop;
|
|
18552
|
-
}, h = r.map((u,
|
|
18553
|
-
g[
|
|
18554
|
+
}, h = r.map((u, E) => subscribe(u, (B) => {
|
|
18555
|
+
g[E] = B, c &= ~(1 << E), l && d();
|
|
18554
18556
|
}, () => {
|
|
18555
|
-
c |= 1 <<
|
|
18557
|
+
c |= 1 << E;
|
|
18556
18558
|
}));
|
|
18557
18559
|
return l = !0, d(), function() {
|
|
18558
18560
|
run_all(h), I(), l = !1;
|
|
@@ -18665,13 +18667,13 @@ function create_fragment$j(t) {
|
|
|
18665
18667
|
))], I = !0);
|
|
18666
18668
|
},
|
|
18667
18669
|
p(h, u) {
|
|
18668
|
-
let [
|
|
18669
|
-
|
|
18670
|
+
let [E] = u;
|
|
18671
|
+
E & /*doc*/
|
|
18670
18672
|
2 && set_input_value(
|
|
18671
18673
|
c,
|
|
18672
18674
|
/*doc*/
|
|
18673
18675
|
h[1]
|
|
18674
|
-
),
|
|
18676
|
+
), E & /*isOpen*/
|
|
18675
18677
|
1 && toggle_class(e, "hidden", !/*isOpen*/
|
|
18676
18678
|
h[0]);
|
|
18677
18679
|
},
|
|
@@ -18716,10 +18718,10 @@ function add_css$i(t) {
|
|
|
18716
18718
|
append_styles(t, "svelte-10notzq", "ul.svelte-10notzq{display:flex;list-style:none;margin:0;overflow-x:scroll;padding:0}button.svelte-10notzq{background:transparent;border:0;border-bottom:2px solid transparent;color:#fff;cursor:pointer;height:100%;font-size:var(--font-medium);font-weight:400;padding:1em}button.svelte-10notzq:hover{background:rgba(255, 255, 255, 0.05)}button.active.svelte-10notzq{border-bottom:2px solid rgb(255, 162, 177)}");
|
|
18717
18719
|
}
|
|
18718
18720
|
function create_fragment$i(t) {
|
|
18719
|
-
let e, A, n, r, o, s, a, l, g, c, I, d, h, u,
|
|
18721
|
+
let e, A, n, r, o, s, a, l, g, c, I, d, h, u, E, B, f, Q, p, m;
|
|
18720
18722
|
return {
|
|
18721
18723
|
c() {
|
|
18722
|
-
e = element("ul"), A = element("li"), n = element("button"), n.textContent = "STATE", r = space(), o = element("li"), s = element("button"), s.textContent = "HISTORY", a = space(), l = element("li"), g = element("button"), g.textContent = "PLUGINS", c = space(), I = element("li"), d = element("button"), d.textContent = "SCHEMA", h = space(), u = element("li"),
|
|
18724
|
+
e = element("ul"), A = element("li"), n = element("button"), n.textContent = "STATE", r = space(), o = element("li"), s = element("button"), s.textContent = "HISTORY", a = space(), l = element("li"), g = element("button"), g.textContent = "PLUGINS", c = space(), I = element("li"), d = element("button"), d.textContent = "SCHEMA", h = space(), u = element("li"), E = element("button"), E.textContent = "STRUCTURE", B = space(), f = element("li"), Q = element("button"), Q.textContent = "SNAPSHOTS", attr(n, "class", "svelte-10notzq"), toggle_class(
|
|
18723
18725
|
n,
|
|
18724
18726
|
"active",
|
|
18725
18727
|
/*active*/
|
|
@@ -18739,8 +18741,8 @@ function create_fragment$i(t) {
|
|
|
18739
18741
|
"active",
|
|
18740
18742
|
/*active*/
|
|
18741
18743
|
t[0] === "schema"
|
|
18742
|
-
), attr(
|
|
18743
|
-
|
|
18744
|
+
), attr(E, "class", "svelte-10notzq"), toggle_class(
|
|
18745
|
+
E,
|
|
18744
18746
|
"active",
|
|
18745
18747
|
/*active*/
|
|
18746
18748
|
t[0] === "structure"
|
|
@@ -18752,7 +18754,7 @@ function create_fragment$i(t) {
|
|
|
18752
18754
|
), attr(e, "class", "tabs-menu svelte-10notzq");
|
|
18753
18755
|
},
|
|
18754
18756
|
m(y, w) {
|
|
18755
|
-
insert(y, e, w), append(e, A), append(A, n), append(e, r), append(e, o), append(o, s), append(e, a), append(e, l), append(l, g), append(e, c), append(e, I), append(I, d), append(e, h), append(e, u), append(u,
|
|
18757
|
+
insert(y, e, w), append(e, A), append(A, n), append(e, r), append(e, o), append(o, s), append(e, a), append(e, l), append(l, g), append(e, c), append(e, I), append(I, d), append(e, h), append(e, u), append(u, E), append(e, B), append(e, f), append(f, Q), p || (m = [listen(
|
|
18756
18758
|
n,
|
|
18757
18759
|
"click",
|
|
18758
18760
|
/*click_handler*/
|
|
@@ -18773,7 +18775,7 @@ function create_fragment$i(t) {
|
|
|
18773
18775
|
/*click_handler_3*/
|
|
18774
18776
|
t[5]
|
|
18775
18777
|
), listen(
|
|
18776
|
-
|
|
18778
|
+
E,
|
|
18777
18779
|
"click",
|
|
18778
18780
|
/*click_handler_4*/
|
|
18779
18781
|
t[6]
|
|
@@ -18812,7 +18814,7 @@ function create_fragment$i(t) {
|
|
|
18812
18814
|
y[0] === "schema"
|
|
18813
18815
|
), D & /*active*/
|
|
18814
18816
|
1 && toggle_class(
|
|
18815
|
-
|
|
18817
|
+
E,
|
|
18816
18818
|
"active",
|
|
18817
18819
|
/*active*/
|
|
18818
18820
|
y[0] === "structure"
|
|
@@ -18886,7 +18888,7 @@ var diffMatchPatch = { exports: {} };
|
|
|
18886
18888
|
return [new e.Diff(A, o), new e.Diff(n, s)];
|
|
18887
18889
|
var h = this.diff_halfMatch_(o, s);
|
|
18888
18890
|
if (h) {
|
|
18889
|
-
var u = h[0],
|
|
18891
|
+
var u = h[0], E = h[1], B = h[2], f = h[3], Q = h[4], p = this.diff_main(u, B, a, l), m = this.diff_main(E, f, a, l);
|
|
18890
18892
|
return p.concat([new e.Diff(r, Q)], m);
|
|
18891
18893
|
}
|
|
18892
18894
|
return a && o.length > 100 && s.length > 100 ? this.diff_lineMode_(o, s, l) : this.diff_bisect_(o, s, l);
|
|
@@ -18895,10 +18897,10 @@ var diffMatchPatch = { exports: {} };
|
|
|
18895
18897
|
o = l.chars1, s = l.chars2;
|
|
18896
18898
|
var g = l.lineArray, c = this.diff_main(o, s, !1, a);
|
|
18897
18899
|
this.diff_charsToLines_(c, g), this.diff_cleanupSemantic(c), c.push(new e.Diff(r, ""));
|
|
18898
|
-
for (var I = 0, d = 0, h = 0, u = "",
|
|
18900
|
+
for (var I = 0, d = 0, h = 0, u = "", E = ""; I < c.length; ) {
|
|
18899
18901
|
switch (c[I][0]) {
|
|
18900
18902
|
case n:
|
|
18901
|
-
h++,
|
|
18903
|
+
h++, E += c[I][1];
|
|
18902
18904
|
break;
|
|
18903
18905
|
case A:
|
|
18904
18906
|
d++, u += c[I][1];
|
|
@@ -18906,21 +18908,21 @@ var diffMatchPatch = { exports: {} };
|
|
|
18906
18908
|
case r:
|
|
18907
18909
|
if (d >= 1 && h >= 1) {
|
|
18908
18910
|
c.splice(I - d - h, d + h), I = I - d - h;
|
|
18909
|
-
for (var
|
|
18910
|
-
c.splice(I, 0,
|
|
18911
|
-
I = I +
|
|
18911
|
+
for (var B = this.diff_main(u, E, !1, a), f = B.length - 1; f >= 0; f--)
|
|
18912
|
+
c.splice(I, 0, B[f]);
|
|
18913
|
+
I = I + B.length;
|
|
18912
18914
|
}
|
|
18913
|
-
h = 0, d = 0, u = "",
|
|
18915
|
+
h = 0, d = 0, u = "", E = "";
|
|
18914
18916
|
break;
|
|
18915
18917
|
}
|
|
18916
18918
|
I++;
|
|
18917
18919
|
}
|
|
18918
18920
|
return c.pop(), c;
|
|
18919
18921
|
}, e.prototype.diff_bisect_ = function(o, s, a) {
|
|
18920
|
-
for (var l = o.length, g = s.length, c = Math.ceil((l + g) / 2), I = c, d = 2 * c, h = new Array(d), u = new Array(d),
|
|
18921
|
-
h[
|
|
18922
|
+
for (var l = o.length, g = s.length, c = Math.ceil((l + g) / 2), I = c, d = 2 * c, h = new Array(d), u = new Array(d), E = 0; E < d; E++)
|
|
18923
|
+
h[E] = -1, u[E] = -1;
|
|
18922
18924
|
h[I + 1] = 0, u[I + 1] = 0;
|
|
18923
|
-
for (var
|
|
18925
|
+
for (var B = l - g, f = B % 2 != 0, Q = 0, p = 0, m = 0, y = 0, w = 0; w < c && !((/* @__PURE__ */ new Date()).getTime() > a); w++) {
|
|
18924
18926
|
for (var D = -w + Q; D <= w - p; D += 2) {
|
|
18925
18927
|
var _ = I + D, k;
|
|
18926
18928
|
D == -w || D != w && h[_ - 1] < h[_ + 1] ? k = h[_ + 1] : k = h[_ - 1] + 1;
|
|
@@ -18931,7 +18933,7 @@ var diffMatchPatch = { exports: {} };
|
|
|
18931
18933
|
else if (S > g)
|
|
18932
18934
|
Q += 2;
|
|
18933
18935
|
else if (f) {
|
|
18934
|
-
var F = I +
|
|
18936
|
+
var F = I + B - D;
|
|
18935
18937
|
if (F >= 0 && F < d && u[F] != -1) {
|
|
18936
18938
|
var N = l - u[F];
|
|
18937
18939
|
if (k >= N)
|
|
@@ -18949,7 +18951,7 @@ var diffMatchPatch = { exports: {} };
|
|
|
18949
18951
|
else if (R > g)
|
|
18950
18952
|
m += 2;
|
|
18951
18953
|
else if (!f) {
|
|
18952
|
-
var _ = I +
|
|
18954
|
+
var _ = I + B - b;
|
|
18953
18955
|
if (_ >= 0 && _ < d && h[_] != -1) {
|
|
18954
18956
|
var k = h[_], S = I + k - _;
|
|
18955
18957
|
if (N = l - N, k >= N)
|
|
@@ -18960,17 +18962,17 @@ var diffMatchPatch = { exports: {} };
|
|
|
18960
18962
|
}
|
|
18961
18963
|
return [new e.Diff(A, o), new e.Diff(n, s)];
|
|
18962
18964
|
}, e.prototype.diff_bisectSplit_ = function(o, s, a, l, g) {
|
|
18963
|
-
var c = o.substring(0, a), I = s.substring(0, l), d = o.substring(a), h = s.substring(l), u = this.diff_main(c, I, !1, g),
|
|
18964
|
-
return u.concat(
|
|
18965
|
+
var c = o.substring(0, a), I = s.substring(0, l), d = o.substring(a), h = s.substring(l), u = this.diff_main(c, I, !1, g), E = this.diff_main(d, h, !1, g);
|
|
18966
|
+
return u.concat(E);
|
|
18965
18967
|
}, e.prototype.diff_linesToChars_ = function(o, s) {
|
|
18966
18968
|
var a = [], l = {};
|
|
18967
18969
|
a[0] = "";
|
|
18968
18970
|
function g(h) {
|
|
18969
|
-
for (var u = "",
|
|
18970
|
-
|
|
18971
|
-
`,
|
|
18972
|
-
var Q = h.substring(
|
|
18973
|
-
(l.hasOwnProperty ? l.hasOwnProperty(Q) : l[Q] !== void 0) ? u += String.fromCharCode(l[Q]) : (f == c && (Q = h.substring(
|
|
18971
|
+
for (var u = "", E = 0, B = -1, f = a.length; B < h.length - 1; ) {
|
|
18972
|
+
B = h.indexOf(`
|
|
18973
|
+
`, E), B == -1 && (B = h.length - 1);
|
|
18974
|
+
var Q = h.substring(E, B + 1);
|
|
18975
|
+
(l.hasOwnProperty ? l.hasOwnProperty(Q) : l[Q] !== void 0) ? u += String.fromCharCode(l[Q]) : (f == c && (Q = h.substring(E), B = h.length), u += String.fromCharCode(f), l[Q] = f, a[f++] = Q), E = B + 1;
|
|
18974
18976
|
}
|
|
18975
18977
|
return u;
|
|
18976
18978
|
}
|
|
@@ -19032,17 +19034,17 @@ var diffMatchPatch = { exports: {} };
|
|
|
19032
19034
|
if (!I && !d)
|
|
19033
19035
|
return null;
|
|
19034
19036
|
d ? I ? h = I[4].length > d[4].length ? I : d : h = d : h = I;
|
|
19035
|
-
var u,
|
|
19036
|
-
o.length > s.length ? (u = h[0],
|
|
19037
|
+
var u, E, B, f;
|
|
19038
|
+
o.length > s.length ? (u = h[0], E = h[1], B = h[2], f = h[3]) : (B = h[0], f = h[1], u = h[2], E = h[3]);
|
|
19037
19039
|
var Q = h[4];
|
|
19038
|
-
return [u,
|
|
19040
|
+
return [u, E, B, f, Q];
|
|
19039
19041
|
}, e.prototype.diff_cleanupSemantic = function(o) {
|
|
19040
19042
|
for (var s = !1, a = [], l = 0, g = null, c = 0, I = 0, d = 0, h = 0, u = 0; c < o.length; )
|
|
19041
19043
|
o[c][0] == r ? (a[l++] = c, I = h, d = u, h = 0, u = 0, g = o[c][1]) : (o[c][0] == n ? h += o[c][1].length : u += o[c][1].length, g && g.length <= Math.max(I, d) && g.length <= Math.max(h, u) && (o.splice(a[l - 1], 0, new e.Diff(A, g)), o[a[l - 1] + 1][0] = n, l--, l--, c = l > 0 ? a[l - 1] : -1, I = 0, d = 0, h = 0, u = 0, g = null, s = !0)), c++;
|
|
19042
19044
|
for (s && this.diff_cleanupMerge(o), this.diff_cleanupSemanticLossless(o), c = 1; c < o.length; ) {
|
|
19043
19045
|
if (o[c - 1][0] == A && o[c][0] == n) {
|
|
19044
|
-
var
|
|
19045
|
-
f >= Q ? (f >=
|
|
19046
|
+
var E = o[c - 1][1], B = o[c][1], f = this.diff_commonOverlap_(E, B), Q = this.diff_commonOverlap_(B, E);
|
|
19047
|
+
f >= Q ? (f >= E.length / 2 || f >= B.length / 2) && (o.splice(c, 0, new e.Diff(r, B.substring(0, f))), o[c - 1][1] = E.substring(0, E.length - f), o[c + 1][1] = B.substring(f), c++) : (Q >= E.length / 2 || Q >= B.length / 2) && (o.splice(c, 0, new e.Diff(r, E.substring(0, Q))), o[c - 1][0] = n, o[c - 1][1] = B.substring(0, B.length - Q), o[c + 1][0] = A, o[c + 1][1] = E.substring(Q), c++), c++;
|
|
19046
19048
|
}
|
|
19047
19049
|
c++;
|
|
19048
19050
|
}
|
|
@@ -19060,12 +19062,12 @@ var diffMatchPatch = { exports: {} };
|
|
|
19060
19062
|
var d = g.substring(g.length - I);
|
|
19061
19063
|
l = l.substring(0, l.length - I), g = d + g.substring(0, g.length - I), c = d + c;
|
|
19062
19064
|
}
|
|
19063
|
-
for (var h = l, u = g,
|
|
19065
|
+
for (var h = l, u = g, E = c, B = s(l, g) + s(g, c); g.charAt(0) === c.charAt(0); ) {
|
|
19064
19066
|
l += g.charAt(0), g = g.substring(1) + c.charAt(0), c = c.substring(1);
|
|
19065
19067
|
var f = s(l, g) + s(g, c);
|
|
19066
|
-
f >=
|
|
19068
|
+
f >= B && (B = f, h = l, u = g, E = c);
|
|
19067
19069
|
}
|
|
19068
|
-
o[a - 1][1] != h && (h ? o[a - 1][1] = h : (o.splice(a - 1, 1), a--), o[a][1] = u,
|
|
19070
|
+
o[a - 1][1] != h && (h ? o[a - 1][1] = h : (o.splice(a - 1, 1), a--), o[a][1] = u, E ? o[a + 1][1] = E : (o.splice(a + 1, 1), a--));
|
|
19069
19071
|
}
|
|
19070
19072
|
a++;
|
|
19071
19073
|
}
|
|
@@ -19195,11 +19197,11 @@ var diffMatchPatch = { exports: {} };
|
|
|
19195
19197
|
d != -1 && (I = Math.min(c(0, d), I), d = o.lastIndexOf(s, a + s.length), d != -1 && (I = Math.min(c(0, d), I)));
|
|
19196
19198
|
var h = 1 << s.length - 1;
|
|
19197
19199
|
d = -1;
|
|
19198
|
-
for (var u,
|
|
19199
|
-
for (u = 0,
|
|
19200
|
-
c(Q, a +
|
|
19201
|
-
|
|
19202
|
-
var p = Math.max(1, a -
|
|
19200
|
+
for (var u, E, B = s.length + o.length, f, Q = 0; Q < s.length; Q++) {
|
|
19201
|
+
for (u = 0, E = B; u < E; )
|
|
19202
|
+
c(Q, a + E) <= I ? u = E : B = E, E = Math.floor((B - u) / 2 + u);
|
|
19203
|
+
B = E;
|
|
19204
|
+
var p = Math.max(1, a - E + 1), m = Math.min(a + E, o.length) + s.length, y = Array(m + 2);
|
|
19203
19205
|
y[m + 1] = (1 << Q) - 1;
|
|
19204
19206
|
for (var w = m; w >= p; w--) {
|
|
19205
19207
|
var D = l[o.charAt(w - 1)];
|
|
@@ -19260,22 +19262,22 @@ var diffMatchPatch = { exports: {} };
|
|
|
19260
19262
|
throw new Error("Unknown call format to patch_make.");
|
|
19261
19263
|
if (g.length === 0)
|
|
19262
19264
|
return [];
|
|
19263
|
-
for (var c = [], I = new e.patch_obj(), d = 0, h = 0, u = 0,
|
|
19265
|
+
for (var c = [], I = new e.patch_obj(), d = 0, h = 0, u = 0, E = l, B = l, f = 0; f < g.length; f++) {
|
|
19264
19266
|
var Q = g[f][0], p = g[f][1];
|
|
19265
19267
|
switch (!d && Q !== r && (I.start1 = h, I.start2 = u), Q) {
|
|
19266
19268
|
case n:
|
|
19267
|
-
I.diffs[d++] = g[f], I.length2 += p.length,
|
|
19269
|
+
I.diffs[d++] = g[f], I.length2 += p.length, B = B.substring(0, u) + p + B.substring(u);
|
|
19268
19270
|
break;
|
|
19269
19271
|
case A:
|
|
19270
|
-
I.length1 += p.length, I.diffs[d++] = g[f],
|
|
19272
|
+
I.length1 += p.length, I.diffs[d++] = g[f], B = B.substring(0, u) + B.substring(u + p.length);
|
|
19271
19273
|
break;
|
|
19272
19274
|
case r:
|
|
19273
|
-
p.length <= 2 * this.Patch_Margin && d && g.length != f + 1 ? (I.diffs[d++] = g[f], I.length1 += p.length, I.length2 += p.length) : p.length >= 2 * this.Patch_Margin && d && (this.patch_addContext_(I,
|
|
19275
|
+
p.length <= 2 * this.Patch_Margin && d && g.length != f + 1 ? (I.diffs[d++] = g[f], I.length1 += p.length, I.length2 += p.length) : p.length >= 2 * this.Patch_Margin && d && (this.patch_addContext_(I, E), c.push(I), I = new e.patch_obj(), d = 0, E = B, h = u);
|
|
19274
19276
|
break;
|
|
19275
19277
|
}
|
|
19276
19278
|
Q !== n && (h += p.length), Q !== A && (u += p.length);
|
|
19277
19279
|
}
|
|
19278
|
-
return d && (this.patch_addContext_(I,
|
|
19280
|
+
return d && (this.patch_addContext_(I, E), c.push(I)), c;
|
|
19279
19281
|
}, e.prototype.patch_deepCopy = function(o) {
|
|
19280
19282
|
for (var s = [], a = 0; a < o.length; a++) {
|
|
19281
19283
|
var l = o[a], g = new e.patch_obj();
|
|
@@ -19297,18 +19299,18 @@ var diffMatchPatch = { exports: {} };
|
|
|
19297
19299
|
g[c] = !1, l -= o[c].length2 - o[c].length1;
|
|
19298
19300
|
else {
|
|
19299
19301
|
g[c] = !0, l = h - I;
|
|
19300
|
-
var
|
|
19301
|
-
if (u == -1 ?
|
|
19302
|
+
var E;
|
|
19303
|
+
if (u == -1 ? E = s.substring(h, h + d.length) : E = s.substring(h, u + this.Match_MaxBits), d == E)
|
|
19302
19304
|
s = s.substring(0, h) + this.diff_text2(o[c].diffs) + s.substring(h + d.length);
|
|
19303
19305
|
else {
|
|
19304
|
-
var
|
|
19305
|
-
if (d.length > this.Match_MaxBits && this.diff_levenshtein(
|
|
19306
|
+
var B = this.diff_main(d, E, !1);
|
|
19307
|
+
if (d.length > this.Match_MaxBits && this.diff_levenshtein(B) / d.length > this.Patch_DeleteThreshold)
|
|
19306
19308
|
g[c] = !1;
|
|
19307
19309
|
else {
|
|
19308
|
-
this.diff_cleanupSemanticLossless(
|
|
19310
|
+
this.diff_cleanupSemanticLossless(B);
|
|
19309
19311
|
for (var f = 0, Q, p = 0; p < o[c].diffs.length; p++) {
|
|
19310
19312
|
var m = o[c].diffs[p];
|
|
19311
|
-
m[0] !== r && (Q = this.diff_xIndex(
|
|
19313
|
+
m[0] !== r && (Q = this.diff_xIndex(B, f)), m[0] === n ? s = s.substring(0, h + Q) + m[1] + s.substring(h + Q) : m[0] === A && (s = s.substring(0, h + Q) + s.substring(h + this.diff_xIndex(B, f + m[1].length))), m[0] !== A && (f += m[1].length);
|
|
19312
19314
|
}
|
|
19313
19315
|
}
|
|
19314
19316
|
}
|
|
@@ -19342,12 +19344,12 @@ var diffMatchPatch = { exports: {} };
|
|
|
19342
19344
|
for (var g = l.start1, c = l.start2, I = ""; l.diffs.length !== 0; ) {
|
|
19343
19345
|
var d = new e.patch_obj(), h = !0;
|
|
19344
19346
|
for (d.start1 = g - I.length, d.start2 = c - I.length, I !== "" && (d.length1 = d.length2 = I.length, d.diffs.push(new e.Diff(r, I))); l.diffs.length !== 0 && d.length1 < s - this.Patch_Margin; ) {
|
|
19345
|
-
var u = l.diffs[0][0],
|
|
19346
|
-
u === n ? (d.length2 +=
|
|
19347
|
+
var u = l.diffs[0][0], E = l.diffs[0][1];
|
|
19348
|
+
u === n ? (d.length2 += E.length, c += E.length, d.diffs.push(l.diffs.shift()), h = !1) : u === A && d.diffs.length == 1 && d.diffs[0][0] == r && E.length > 2 * s ? (d.length1 += E.length, g += E.length, h = !1, d.diffs.push(new e.Diff(u, E)), l.diffs.shift()) : (E = E.substring(0, s - d.length1 - this.Patch_Margin), d.length1 += E.length, g += E.length, u === r ? (d.length2 += E.length, c += E.length) : h = !1, d.diffs.push(new e.Diff(u, E)), E == l.diffs[0][1] ? l.diffs.shift() : l.diffs[0][1] = l.diffs[0][1].substring(E.length));
|
|
19347
19349
|
}
|
|
19348
19350
|
I = this.diff_text2(d.diffs), I = I.substring(I.length - this.Patch_Margin);
|
|
19349
|
-
var
|
|
19350
|
-
|
|
19351
|
+
var B = this.diff_text1(l.diffs).substring(0, this.Patch_Margin);
|
|
19352
|
+
B !== "" && (d.length1 += B.length, d.length2 += B.length, d.diffs.length !== 0 && d.diffs[d.diffs.length - 1][0] === r ? d.diffs[d.diffs.length - 1][1] += B : d.diffs.push(new e.Diff(r, B))), h || o.splice(++a, 0, d);
|
|
19351
19353
|
}
|
|
19352
19354
|
}
|
|
19353
19355
|
}, e.prototype.patch_toText = function(o) {
|
|
@@ -19905,30 +19907,30 @@ var diffFilter$1 = function t(e) {
|
|
|
19905
19907
|
return;
|
|
19906
19908
|
}
|
|
19907
19909
|
delete A.hashCache1, delete A.hashCache2;
|
|
19908
|
-
var u = l.slice(n, c - r),
|
|
19910
|
+
var u = l.slice(n, c - r), E = g.slice(n, I - r), B = lcs.get(u, E, matchItems, A), f = [];
|
|
19909
19911
|
for (h = h || {
|
|
19910
19912
|
_t: "a"
|
|
19911
19913
|
}, o = n; o < c - r; o++)
|
|
19912
|
-
arrayIndexOf(
|
|
19914
|
+
arrayIndexOf(B.indices1, o - n) < 0 && (h["_" + o] = [l[o], 0, 0], f.push(o));
|
|
19913
19915
|
var Q = !0;
|
|
19914
19916
|
e.options && e.options.arrays && e.options.arrays.detectMove === !1 && (Q = !1);
|
|
19915
19917
|
var p = !1;
|
|
19916
19918
|
e.options && e.options.arrays && e.options.arrays.includeValueOnMove && (p = !0);
|
|
19917
19919
|
var m = f.length;
|
|
19918
19920
|
for (o = n; o < I - r; o++) {
|
|
19919
|
-
var y = arrayIndexOf(
|
|
19921
|
+
var y = arrayIndexOf(B.indices2, o - n);
|
|
19920
19922
|
if (y < 0) {
|
|
19921
19923
|
var w = !1;
|
|
19922
19924
|
if (Q && m > 0) {
|
|
19923
19925
|
for (var D = 0; D < m; D++)
|
|
19924
|
-
if (s = f[D], matchItems(u,
|
|
19926
|
+
if (s = f[D], matchItems(u, E, s - n, o - n, A)) {
|
|
19925
19927
|
h["_" + s].splice(1, 2, o, ARRAY_MOVE), p || (h["_" + s][0] = ""), a = o, d = new DiffContext(e.left[s], e.right[a]), e.push(d, a), f.splice(D, 1), w = !0;
|
|
19926
19928
|
break;
|
|
19927
19929
|
}
|
|
19928
19930
|
}
|
|
19929
19931
|
w || (h[o] = [g[o]]);
|
|
19930
19932
|
} else
|
|
19931
|
-
s =
|
|
19933
|
+
s = B.indices1[y] + n, a = B.indices2[y] + n, d = new DiffContext(e.left[s], e.right[a]), e.push(d, a);
|
|
19932
19934
|
}
|
|
19933
19935
|
e.setResult(h).exit();
|
|
19934
19936
|
}
|
|
@@ -19978,8 +19980,8 @@ var compare = {
|
|
|
19978
19980
|
var h = l.length, u = void 0;
|
|
19979
19981
|
if (h > 0)
|
|
19980
19982
|
for (A = 0; A < h; A++) {
|
|
19981
|
-
var
|
|
19982
|
-
u = new PatchContext(e.left[
|
|
19983
|
+
var E = l[A];
|
|
19984
|
+
u = new PatchContext(e.left[E.index], E.delta), e.push(u, E.index);
|
|
19983
19985
|
}
|
|
19984
19986
|
if (!e.children) {
|
|
19985
19987
|
e.setResult(e.left).exit();
|
|
@@ -20433,14 +20435,14 @@ var adjustArrows = function t(e) {
|
|
|
20433
20435
|
r(A, ".jsondiffpatch-arrow", function(s) {
|
|
20434
20436
|
var a = s.parentNode, l = s.children, g = s.style, c = a, I = l[0], d = I.children[1];
|
|
20435
20437
|
I.style.display = "none";
|
|
20436
|
-
var h = n(c.querySelector(".jsondiffpatch-moved-destination")), u = c.parentNode,
|
|
20438
|
+
var h = n(c.querySelector(".jsondiffpatch-moved-destination")), u = c.parentNode, E = void 0;
|
|
20437
20439
|
if (o(u, function(Q) {
|
|
20438
|
-
Q.getAttribute("data-key") === h && (
|
|
20439
|
-
}), !!
|
|
20440
|
+
Q.getAttribute("data-key") === h && (E = Q);
|
|
20441
|
+
}), !!E)
|
|
20440
20442
|
try {
|
|
20441
|
-
var
|
|
20442
|
-
I.setAttribute("height", Math.abs(
|
|
20443
|
-
var f =
|
|
20443
|
+
var B = E.offsetTop - c.offsetTop;
|
|
20444
|
+
I.setAttribute("height", Math.abs(B) + 6), g.top = -8 + (B > 0 ? 0 : B) + "px";
|
|
20445
|
+
var f = B > 0 ? "M30,0 Q-10," + Math.round(B / 2) + " 26," + (B - 4) : "M30," + -B + " Q-10," + Math.round(-B / 2) + " 26,4";
|
|
20444
20446
|
d.setAttribute("d", f), I.style.display = "";
|
|
20445
20447
|
} catch {
|
|
20446
20448
|
}
|
|
@@ -20985,11 +20987,11 @@ function recurseObjectProperties(t, e, A, n, r, o, s, a, l, g, c) {
|
|
|
20985
20987
|
return null;
|
|
20986
20988
|
const d = createNode(t, e, A, n, o), h = a.get(d.id);
|
|
20987
20989
|
if (r ? d.collapsed = !1 : h && !g ? d.collapsed = h.collapsed : c.shouldExpandNode && (d.collapsed = !c.shouldExpandNode(d)), s.set(d.id, d), shouldRecurseChildren(d, o, l, c)) {
|
|
20988
|
-
const u = c.mapChildren && c.mapChildren(A, getValueType(A), d),
|
|
20989
|
-
d.children =
|
|
20990
|
-
let [Q, p] =
|
|
20990
|
+
const u = c.mapChildren && c.mapChildren(A, getValueType(A), d), E = u ?? getChildren(A, getValueType(A));
|
|
20991
|
+
d.children = E.map((B, f) => {
|
|
20992
|
+
let [Q, p] = B;
|
|
20991
20993
|
return recurseObjectProperties(f, Q, p, n + 1, !1, d, s, a, l, g, c);
|
|
20992
|
-
}).filter((
|
|
20994
|
+
}).filter((B) => B !== null);
|
|
20993
20995
|
}
|
|
20994
20996
|
return d;
|
|
20995
20997
|
}
|
|
@@ -21367,7 +21369,7 @@ function create_fragment$h(t) {
|
|
|
21367
21369
|
let e, A, n, r = (
|
|
21368
21370
|
/*node*/
|
|
21369
21371
|
t[0].key + ""
|
|
21370
|
-
), o, s, a, l, g, c, I, d, h, u,
|
|
21372
|
+
), o, s, a, l, g, c, I, d, h, u, E, B, f, Q, p, m, y = (
|
|
21371
21373
|
/*hasChildren*/
|
|
21372
21374
|
t[2] && create_if_block_4$3(t)
|
|
21373
21375
|
);
|
|
@@ -21390,7 +21392,7 @@ function create_fragment$h(t) {
|
|
|
21390
21392
|
t[2] && create_if_block$9(t);
|
|
21391
21393
|
return {
|
|
21392
21394
|
c() {
|
|
21393
|
-
e = element("li"), y && y.c(), A = space(), n = element("div"), o = text(r), s = text(":"), a = space(), l = element("div"), c.c(), d = space(), h = element("div"), k && k.c(), u = space(), S && S.c(),
|
|
21395
|
+
e = element("li"), y && y.c(), A = space(), n = element("div"), o = text(r), s = text(":"), a = space(), l = element("div"), c.c(), d = space(), h = element("div"), k && k.c(), u = space(), S && S.c(), B = space(), F && F.c(), f = empty(), attr(n, "class", "node-key svelte-ngcjq5"), attr(n, "role", "presentation"), toggle_class(
|
|
21394
21396
|
n,
|
|
21395
21397
|
"has-children",
|
|
21396
21398
|
/*hasChildren*/
|
|
@@ -21404,7 +21406,7 @@ function create_fragment$h(t) {
|
|
|
21404
21406
|
"has-children",
|
|
21405
21407
|
/*hasChildren*/
|
|
21406
21408
|
t[2]
|
|
21407
|
-
), attr(h, "class", "buttons svelte-ngcjq5"), attr(e, "class", "row svelte-ngcjq5"), attr(e, "data-tree-id",
|
|
21409
|
+
), attr(h, "class", "buttons svelte-ngcjq5"), attr(e, "class", "row svelte-ngcjq5"), attr(e, "data-tree-id", E = /*node*/
|
|
21408
21410
|
t[0].id), toggle_class(
|
|
21409
21411
|
e,
|
|
21410
21412
|
"collapsed",
|
|
@@ -21414,7 +21416,7 @@ function create_fragment$h(t) {
|
|
|
21414
21416
|
);
|
|
21415
21417
|
},
|
|
21416
21418
|
m(N, b) {
|
|
21417
|
-
insert(N, e, b), y && y.m(e, null), append(e, A), append(e, n), append(n, o), append(n, s), append(e, a), append(e, l), D[g].m(l, null), append(e, d), append(e, h), k && k.m(h, null), append(h, u), S && S.m(h, null), insert(N,
|
|
21419
|
+
insert(N, e, b), y && y.m(e, null), append(e, A), append(e, n), append(n, o), append(n, s), append(e, a), append(e, l), D[g].m(l, null), append(e, d), append(e, h), k && k.m(h, null), append(h, u), S && S.m(h, null), insert(N, B, b), F && F.m(N, b), insert(N, f, b), Q = !0, p || (m = [listen(
|
|
21418
21420
|
n,
|
|
21419
21421
|
"click",
|
|
21420
21422
|
/*handleToggleCollapse*/
|
|
@@ -21457,8 +21459,8 @@ function create_fragment$h(t) {
|
|
|
21457
21459
|
), /*$props*/
|
|
21458
21460
|
N[1].showLogButton ? k ? k.p(N, R) : (k = create_if_block_2$5(N), k.c(), k.m(h, u)) : k && (k.d(1), k = null), /*$props*/
|
|
21459
21461
|
N[1].showCopyButton ? S ? S.p(N, R) : (S = create_if_block_1$6(N), S.c(), S.m(h, null)) : S && (S.d(1), S = null), (!Q || R & /*node*/
|
|
21460
|
-
1 &&
|
|
21461
|
-
N[0].id)) && attr(e, "data-tree-id",
|
|
21462
|
+
1 && E !== (E = /*node*/
|
|
21463
|
+
N[0].id)) && attr(e, "data-tree-id", E), (!Q || R & /*node, hasChildren*/
|
|
21462
21464
|
5) && toggle_class(
|
|
21463
21465
|
e,
|
|
21464
21466
|
"collapsed",
|
|
@@ -21479,7 +21481,7 @@ function create_fragment$h(t) {
|
|
|
21479
21481
|
transition_out(c), transition_out(F), Q = !1;
|
|
21480
21482
|
},
|
|
21481
21483
|
d(N) {
|
|
21482
|
-
N && (detach(e), detach(
|
|
21484
|
+
N && (detach(e), detach(B), detach(f)), y && y.d(), D[g].d(), k && k.d(), S && S.d(), F && F.d(N), p = !1, run_all(m);
|
|
21483
21485
|
}
|
|
21484
21486
|
};
|
|
21485
21487
|
}
|
|
@@ -21500,7 +21502,7 @@ function instance$h(t, e, A) {
|
|
|
21500
21502
|
const m = p.get(c);
|
|
21501
21503
|
m && u !== m && A(0, u = m);
|
|
21502
21504
|
});
|
|
21503
|
-
function
|
|
21505
|
+
function E() {
|
|
21504
21506
|
console.info("%c [svelte-tree-view]: Property added to window._node", "color: #b8e248"), console.log(u.value);
|
|
21505
21507
|
try {
|
|
21506
21508
|
typeof window < "u" && (window._node = u.value);
|
|
@@ -21508,7 +21510,7 @@ function instance$h(t, e, A) {
|
|
|
21508
21510
|
console.error("Failed to set _node, window was undefined");
|
|
21509
21511
|
}
|
|
21510
21512
|
}
|
|
21511
|
-
function
|
|
21513
|
+
function B() {
|
|
21512
21514
|
try {
|
|
21513
21515
|
navigator.clipboard.writeText(JSON.stringify(u.value));
|
|
21514
21516
|
} catch (p) {
|
|
@@ -21535,7 +21537,7 @@ function instance$h(t, e, A) {
|
|
|
21535
21537
|
t.$$.dirty & /*node*/
|
|
21536
21538
|
1 && A(2, n = u && u.children.length > 0), t.$$.dirty & /*$props*/
|
|
21537
21539
|
2 && A(3, o = a.valueComponent);
|
|
21538
|
-
}, g(A(4, r = d.props)), [u, a, n, o, r, d, h,
|
|
21540
|
+
}, g(A(4, r = d.props)), [u, a, n, o, r, d, h, E, B, f, Q, c];
|
|
21539
21541
|
}
|
|
21540
21542
|
class TreeViewNode extends SvelteComponent {
|
|
21541
21543
|
constructor(e) {
|
|
@@ -21665,8 +21667,8 @@ function instance$g(t, e, A) {
|
|
|
21665
21667
|
valueComponent: d = void 0,
|
|
21666
21668
|
recursionOpts: h = {},
|
|
21667
21669
|
valueFormatter: u = void 0
|
|
21668
|
-
} = e,
|
|
21669
|
-
const
|
|
21670
|
+
} = e, E = null;
|
|
21671
|
+
const B = {
|
|
21670
21672
|
maxDepth: 16,
|
|
21671
21673
|
omitKeys: [],
|
|
21672
21674
|
stopCircularRecursion: !1,
|
|
@@ -21677,7 +21679,7 @@ function instance$g(t, e, A) {
|
|
|
21677
21679
|
showCopyButton: I,
|
|
21678
21680
|
valueComponent: d,
|
|
21679
21681
|
recursionOpts: {
|
|
21680
|
-
...
|
|
21682
|
+
...B,
|
|
21681
21683
|
...h
|
|
21682
21684
|
},
|
|
21683
21685
|
valueFormatter: u
|
|
@@ -21688,11 +21690,11 @@ function instance$g(t, e, A) {
|
|
|
21688
21690
|
rootElementStore: p,
|
|
21689
21691
|
treeStore: m
|
|
21690
21692
|
}), onMount(() => {
|
|
21691
|
-
p.set(
|
|
21693
|
+
p.set(E);
|
|
21692
21694
|
});
|
|
21693
21695
|
function y(w) {
|
|
21694
21696
|
binding_callbacks[w ? "unshift" : "push"](() => {
|
|
21695
|
-
|
|
21697
|
+
E = w, A(0, E);
|
|
21696
21698
|
});
|
|
21697
21699
|
}
|
|
21698
21700
|
return t.$$set = (w) => {
|
|
@@ -21708,7 +21710,7 @@ function instance$g(t, e, A) {
|
|
|
21708
21710
|
}), t.$$.dirty & /*recursionOpts, props, _a, data*/
|
|
21709
21711
|
6672) {
|
|
21710
21712
|
const w = {
|
|
21711
|
-
...
|
|
21713
|
+
...B,
|
|
21712
21714
|
...h
|
|
21713
21715
|
}, D = (A(11, a = f?.recursionOpts) === null || a === void 0 ? void 0 : a.shouldExpandNode) !== w.shouldExpandNode, _ = get_store_value(m.treeMap), {
|
|
21714
21716
|
treeMap: k,
|
|
@@ -21718,14 +21720,14 @@ function instance$g(t, e, A) {
|
|
|
21718
21720
|
m.init(S, k, F), A(12, f.recursionOpts = w, f), Q.setProps(f);
|
|
21719
21721
|
}
|
|
21720
21722
|
if (t.$$.dirty & /*theme, rootElement*/
|
|
21721
|
-
33 && g &&
|
|
21723
|
+
33 && g && E) {
|
|
21722
21724
|
let w;
|
|
21723
21725
|
for (w in g) {
|
|
21724
21726
|
const D = g[w];
|
|
21725
|
-
|
|
21727
|
+
E && w.includes("base") && D && E.style.setProperty("--tree-view-".concat(w), D);
|
|
21726
21728
|
}
|
|
21727
21729
|
}
|
|
21728
|
-
}, s(A(1, n = m.tree)), e = exclude_internal_props(e), [
|
|
21730
|
+
}, s(A(1, n = m.tree)), e = exclude_internal_props(e), [E, n, r, e, l, g, c, I, d, h, u, a, f, y];
|
|
21729
21731
|
}
|
|
21730
21732
|
class TreeView extends SvelteComponent {
|
|
21731
21733
|
constructor(e) {
|
|
@@ -22125,7 +22127,7 @@ function create_if_block$8(t) {
|
|
|
22125
22127
|
};
|
|
22126
22128
|
}
|
|
22127
22129
|
function create_right_slot$5(t) {
|
|
22128
|
-
let e, A, n, r, o, s, a, l, g, c, I, d, h, u,
|
|
22130
|
+
let e, A, n, r, o, s, a, l, g, c, I, d, h, u, E, B, f, Q, p;
|
|
22129
22131
|
o = new Button({
|
|
22130
22132
|
props: {
|
|
22131
22133
|
class: "selection-btn",
|
|
@@ -22172,10 +22174,10 @@ function create_right_slot$5(t) {
|
|
|
22172
22174
|
}
|
|
22173
22175
|
}), {
|
|
22174
22176
|
c() {
|
|
22175
|
-
e = element("div"), A = element("div"), n = element("h2"), n.textContent = "Selection", r = space(), create_component(o.$$.fragment), s = space(), create_component(a.$$.fragment), l = space(), g = element("div"), c = element("h2"), c.textContent = "Active marks", I = space(), h.c(), u = space(),
|
|
22177
|
+
e = element("div"), A = element("div"), n = element("h2"), n.textContent = "Selection", r = space(), create_component(o.$$.fragment), s = space(), create_component(a.$$.fragment), l = space(), g = element("div"), c = element("h2"), c.textContent = "Active marks", I = space(), h.c(), u = space(), E = element("div"), B = element("h2"), B.textContent = "Document stats", f = space(), create_component(Q.$$.fragment), attr(A, "class", "top-row svelte-8c7oqn"), attr(e, "slot", "right"), attr(e, "class", "right-panel svelte-8c7oqn");
|
|
22176
22178
|
},
|
|
22177
22179
|
m(D, _) {
|
|
22178
|
-
insert(D, e, _), append(e, A), append(A, n), append(A, r), mount_component(o, A, null), append(e, s), mount_component(a, e, null), append(e, l), append(e, g), append(g, c), append(g, I), y[d].m(g, null), append(e, u), append(e,
|
|
22180
|
+
insert(D, e, _), append(e, A), append(A, n), append(A, r), mount_component(o, A, null), append(e, s), mount_component(a, e, null), append(e, l), append(e, g), append(g, c), append(g, I), y[d].m(g, null), append(e, u), append(e, E), append(E, B), append(E, f), mount_component(Q, E, null), p = !0;
|
|
22179
22181
|
},
|
|
22180
22182
|
p(D, _) {
|
|
22181
22183
|
const k = {};
|
|
@@ -22485,10 +22487,10 @@ function create_each_block$5(t, e) {
|
|
|
22485
22487
|
let n, r, o, s = (
|
|
22486
22488
|
/*group*/
|
|
22487
22489
|
((A = e[6]) === null || A === void 0 || (A = A.topEntry) === null || A === void 0 ? void 0 : A.timeStr) + ""
|
|
22488
|
-
), a, l, g, c, I, d, h, u,
|
|
22490
|
+
), a, l, g, c, I, d, h, u, E = (
|
|
22489
22491
|
/*group*/
|
|
22490
22492
|
e[6].isGroup && create_if_block_3$3(e)
|
|
22491
|
-
),
|
|
22493
|
+
), B = (
|
|
22492
22494
|
/*group*/
|
|
22493
22495
|
e[6].topEntry && /*group*/
|
|
22494
22496
|
e[6].topEntry.trs.length > 1 && create_if_block_2$4(e)
|
|
@@ -22527,7 +22529,7 @@ function create_each_block$5(t, e) {
|
|
|
22527
22529
|
first: null,
|
|
22528
22530
|
c() {
|
|
22529
22531
|
var y;
|
|
22530
|
-
n = element("li"), r = element("button"), o = element("span"), a = text(s), l = space(),
|
|
22532
|
+
n = element("li"), r = element("button"), o = element("span"), a = text(s), l = space(), E && E.c(), g = space(), B && B.c(), c = space(), f && f.c(), I = space(), m && m.c(), d = empty(), attr(r, "class", "svelte-vbjxb8"), toggle_class(
|
|
22531
22533
|
r,
|
|
22532
22534
|
"is-group",
|
|
22533
22535
|
/*group*/
|
|
@@ -22538,16 +22540,16 @@ function create_each_block$5(t, e) {
|
|
|
22538
22540
|
((y = e[6]) === null || y === void 0 || (y = y.topEntry) === null || y === void 0 ? void 0 : y.id)), this.first = n;
|
|
22539
22541
|
},
|
|
22540
22542
|
m(y, w) {
|
|
22541
|
-
insert(y, n, w), append(n, r), append(r, o), append(o, a), append(o, l),
|
|
22543
|
+
insert(y, n, w), append(n, r), append(r, o), append(o, a), append(o, l), E && E.m(o, null), append(o, g), B && B.m(o, null), append(r, c), f && f.m(r, null), insert(y, I, w), m && m.m(y, w), insert(y, d, w), h || (u = [listen(r, "click", Q), listen(r, "dblclick", p)], h = !0);
|
|
22542
22544
|
},
|
|
22543
22545
|
p(y, w) {
|
|
22544
22546
|
var D;
|
|
22545
22547
|
if (e = y, w & /*listItems*/
|
|
22546
22548
|
1 && s !== (s = /*group*/
|
|
22547
22549
|
((D = e[6]) === null || D === void 0 || (D = D.topEntry) === null || D === void 0 ? void 0 : D.timeStr) + "") && set_data(a, s), /*group*/
|
|
22548
|
-
e[6].isGroup ?
|
|
22550
|
+
e[6].isGroup ? E ? E.p(e, w) : (E = create_if_block_3$3(e), E.c(), E.m(o, g)) : E && (E.d(1), E = null), /*group*/
|
|
22549
22551
|
e[6].topEntry && /*group*/
|
|
22550
|
-
e[6].topEntry.trs.length > 1 ?
|
|
22552
|
+
e[6].topEntry.trs.length > 1 ? B ? B.p(e, w) : (B = create_if_block_2$4(e), B.c(), B.m(o, null)) : B && (B.d(1), B = null), /*group*/
|
|
22551
22553
|
e[6].isGroup && /*group*/
|
|
22552
22554
|
e[6].entries.length > 1 ? f ? f.p(e, w) : (f = create_if_block_1$5(e), f.c(), f.m(r, null)) : f && (f.d(1), f = null), w & /*listItems*/
|
|
22553
22555
|
1 && toggle_class(
|
|
@@ -22568,7 +22570,7 @@ function create_each_block$5(t, e) {
|
|
|
22568
22570
|
e[6].expanded ? m ? m.p(e, w) : (m = create_if_block$7(e), m.c(), m.m(d.parentNode, d)) : m && (m.d(1), m = null);
|
|
22569
22571
|
},
|
|
22570
22572
|
d(y) {
|
|
22571
|
-
y && (detach(n), detach(I), detach(d)),
|
|
22573
|
+
y && (detach(n), detach(I), detach(d)), E && E.d(), B && B.d(), f && f.d(), m && m.d(y), h = !1, run_all(u);
|
|
22572
22574
|
}
|
|
22573
22575
|
};
|
|
22574
22576
|
}
|
|
@@ -23077,10 +23079,10 @@ function create_if_block$5(t) {
|
|
|
23077
23079
|
let e, A, n, r, o, s, a, l, g, c, I, d, h, u = (
|
|
23078
23080
|
/*selectedEntry*/
|
|
23079
23081
|
t[0].contentDiff && create_if_block_5$1(t)
|
|
23080
|
-
),
|
|
23082
|
+
), E = (
|
|
23081
23083
|
/*selectedEntry*/
|
|
23082
23084
|
t[0].selectionDiff && create_if_block_4$1(t)
|
|
23083
|
-
),
|
|
23085
|
+
), B = (
|
|
23084
23086
|
/*selectedEntry*/
|
|
23085
23087
|
t[0].selectionHtml.length > 0 && create_if_block_3$1(t)
|
|
23086
23088
|
), f = (
|
|
@@ -23107,10 +23109,10 @@ function create_if_block$5(t) {
|
|
|
23107
23109
|
);
|
|
23108
23110
|
return {
|
|
23109
23111
|
c() {
|
|
23110
|
-
e = element("div"), u && u.c(), A = space(),
|
|
23112
|
+
e = element("div"), u && u.c(), A = space(), E && E.c(), n = space(), B && B.c(), r = space(), o = element("div"), s = element("div"), a = element("h2"), a.textContent = "Transactions", l = space(), g = element("div"), f && f.c(), c = space(), create_component(I.$$.fragment), d = space(), Q && Q.c(), attr(g, "class", "transaction-buttons svelte-r7zw98"), attr(s, "class", "title-container svelte-r7zw98"), attr(o, "class", "entry-row svelte-r7zw98");
|
|
23111
23113
|
},
|
|
23112
23114
|
m(p, m) {
|
|
23113
|
-
insert(p, e, m), u && u.m(e, null), append(e, A),
|
|
23115
|
+
insert(p, e, m), u && u.m(e, null), append(e, A), E && E.m(e, null), append(e, n), B && B.m(e, null), append(e, r), append(e, o), append(o, s), append(s, a), append(s, l), append(s, g), f && f.m(g, null), append(g, c), mount_component(I, g, null), append(o, d), Q && Q.m(o, null), h = !0;
|
|
23114
23116
|
},
|
|
23115
23117
|
p(p, m) {
|
|
23116
23118
|
/*selectedEntry*/
|
|
@@ -23118,13 +23120,13 @@ function create_if_block$5(t) {
|
|
|
23118
23120
|
1 && transition_in(u, 1)) : (u = create_if_block_5$1(p), u.c(), transition_in(u, 1), u.m(e, A)) : u && (group_outros(), transition_out(u, 1, 1, () => {
|
|
23119
23121
|
u = null;
|
|
23120
23122
|
}), check_outros()), /*selectedEntry*/
|
|
23121
|
-
p[0].selectionDiff ?
|
|
23122
|
-
1 && transition_in(
|
|
23123
|
-
B = null;
|
|
23124
|
-
}), check_outros()), /*selectedEntry*/
|
|
23125
|
-
p[0].selectionHtml.length > 0 ? E ? (E.p(p, m), m & /*selectedEntry*/
|
|
23126
|
-
1 && transition_in(E, 1)) : (E = create_if_block_3$1(p), E.c(), transition_in(E, 1), E.m(e, r)) : E && (group_outros(), transition_out(E, 1, 1, () => {
|
|
23123
|
+
p[0].selectionDiff ? E ? (E.p(p, m), m & /*selectedEntry*/
|
|
23124
|
+
1 && transition_in(E, 1)) : (E = create_if_block_4$1(p), E.c(), transition_in(E, 1), E.m(e, n)) : E && (group_outros(), transition_out(E, 1, 1, () => {
|
|
23127
23125
|
E = null;
|
|
23126
|
+
}), check_outros()), /*selectedEntry*/
|
|
23127
|
+
p[0].selectionHtml.length > 0 ? B ? (B.p(p, m), m & /*selectedEntry*/
|
|
23128
|
+
1 && transition_in(B, 1)) : (B = create_if_block_3$1(p), B.c(), transition_in(B, 1), B.m(e, r)) : B && (group_outros(), transition_out(B, 1, 1, () => {
|
|
23129
|
+
B = null;
|
|
23128
23130
|
}), check_outros()), /*showTr*/
|
|
23129
23131
|
p[1] ? f ? (f.p(p, m), m & /*showTr*/
|
|
23130
23132
|
2 && transition_in(f, 1)) : (f = create_if_block_2$2(p), f.c(), transition_in(f, 1), f.m(g, c)) : f && (group_outros(), transition_out(f, 1, 1, () => {
|
|
@@ -23142,13 +23144,13 @@ function create_if_block$5(t) {
|
|
|
23142
23144
|
}), check_outros());
|
|
23143
23145
|
},
|
|
23144
23146
|
i(p) {
|
|
23145
|
-
h || (transition_in(u), transition_in(
|
|
23147
|
+
h || (transition_in(u), transition_in(E), transition_in(B), transition_in(f), transition_in(I.$$.fragment, p), transition_in(Q), h = !0);
|
|
23146
23148
|
},
|
|
23147
23149
|
o(p) {
|
|
23148
|
-
transition_out(u), transition_out(
|
|
23150
|
+
transition_out(u), transition_out(E), transition_out(B), transition_out(f), transition_out(I.$$.fragment, p), transition_out(Q), h = !1;
|
|
23149
23151
|
},
|
|
23150
23152
|
d(p) {
|
|
23151
|
-
p && detach(e), u && u.d(),
|
|
23153
|
+
p && detach(e), u && u.d(), E && E.d(), B && B.d(), f && f.d(), destroy_component(I), Q && Q.d();
|
|
23152
23154
|
}
|
|
23153
23155
|
};
|
|
23154
23156
|
}
|
|
@@ -23641,7 +23643,7 @@ function create_fragment$a(t) {
|
|
|
23641
23643
|
const func$1 = () => !0, func_1 = () => !0;
|
|
23642
23644
|
function instance$a(t, e, A) {
|
|
23643
23645
|
let n, r, o;
|
|
23644
|
-
component_subscribe(t, stateHistory, (
|
|
23646
|
+
component_subscribe(t, stateHistory, (B) => A(10, r = B)), component_subscribe(t, shownHistoryGroups, (B) => A(11, o = B));
|
|
23645
23647
|
let s, a = !1;
|
|
23646
23648
|
const {
|
|
23647
23649
|
replaceEditorContent: l
|
|
@@ -23652,8 +23654,8 @@ function instance$a(t, e, A) {
|
|
|
23652
23654
|
omitKeys: ["schema"],
|
|
23653
23655
|
shouldExpandNode: () => g
|
|
23654
23656
|
};
|
|
23655
|
-
latestEntry.subscribe((
|
|
23656
|
-
|
|
23657
|
+
latestEntry.subscribe((B) => {
|
|
23658
|
+
B && A(0, s = B);
|
|
23657
23659
|
});
|
|
23658
23660
|
function I() {
|
|
23659
23661
|
A(1, a = !a);
|
|
@@ -23661,36 +23663,36 @@ function instance$a(t, e, A) {
|
|
|
23661
23663
|
function d() {
|
|
23662
23664
|
console.info("%c [prosemirror-dev-toolkit]: Property added to window._trs", "color: #b8e248"), console.log(s?.trs), window._trs = s?.trs;
|
|
23663
23665
|
}
|
|
23664
|
-
function h(
|
|
23666
|
+
function h(B) {
|
|
23665
23667
|
const {
|
|
23666
23668
|
id: f = "",
|
|
23667
23669
|
groupIdx: Q,
|
|
23668
23670
|
wasTopNode: p
|
|
23669
|
-
} =
|
|
23671
|
+
} = B.detail;
|
|
23670
23672
|
if (A(0, s = r.get(f)), !s) return;
|
|
23671
23673
|
const m = n[Q];
|
|
23672
23674
|
m.isGroup && m.entries.length > 1 && p && shownHistoryGroups.update((y) => y.map((w, D) => D !== Q ? w : Object.assign(Object.assign({}, w), {
|
|
23673
23675
|
expanded: !w.expanded
|
|
23674
23676
|
})));
|
|
23675
23677
|
}
|
|
23676
|
-
function u(
|
|
23677
|
-
A(0, s = r.get(
|
|
23678
|
+
function u(B) {
|
|
23679
|
+
A(0, s = r.get(B.detail.id || "")), s && l(s.state);
|
|
23678
23680
|
}
|
|
23679
|
-
function
|
|
23681
|
+
function E() {
|
|
23680
23682
|
A(2, g = !g), A(3, c = Object.assign(Object.assign({}, c), {
|
|
23681
23683
|
shouldExpandNode: () => g
|
|
23682
23684
|
}));
|
|
23683
23685
|
}
|
|
23684
23686
|
return t.$$.update = () => {
|
|
23685
23687
|
t.$$.dirty & /*$shownHistoryGroups, $stateHistory*/
|
|
23686
|
-
3072 && A(4, n = o.map((
|
|
23687
|
-
id:
|
|
23688
|
-
isGroup:
|
|
23689
|
-
topEntry: r.get(
|
|
23690
|
-
entries:
|
|
23691
|
-
expanded:
|
|
23688
|
+
3072 && A(4, n = o.map((B) => ({
|
|
23689
|
+
id: B.id,
|
|
23690
|
+
isGroup: B.isGroup,
|
|
23691
|
+
topEntry: r.get(B.topEntryId),
|
|
23692
|
+
entries: B.entryIds.map((f) => r.get(f)),
|
|
23693
|
+
expanded: B.expanded
|
|
23692
23694
|
})));
|
|
23693
|
-
}, [s, a, g, c, n, I, d, h, u,
|
|
23695
|
+
}, [s, a, g, c, n, I, d, h, u, E, r, o];
|
|
23694
23696
|
}
|
|
23695
23697
|
class HistoryTab extends SvelteComponent {
|
|
23696
23698
|
constructor(e) {
|
|
@@ -24116,10 +24118,10 @@ function instance$8(t, e, A) {
|
|
|
24116
24118
|
shouldExpandNode: () => s
|
|
24117
24119
|
}, l = o.state, g = l.plugins, c = g[0];
|
|
24118
24120
|
latestEntry.subscribe((u) => {
|
|
24119
|
-
u && (A(8, l = u.state), A(9, g = l.plugins), A(0, c = g.find((
|
|
24121
|
+
u && (A(8, l = u.state), A(9, g = l.plugins), A(0, c = g.find((E) => E.key === c?.key)));
|
|
24120
24122
|
});
|
|
24121
24123
|
function I(u) {
|
|
24122
|
-
A(0, c = g.find((
|
|
24124
|
+
A(0, c = g.find((E) => E.key === u.key));
|
|
24123
24125
|
}
|
|
24124
24126
|
function d() {
|
|
24125
24127
|
A(1, s = !s), A(2, a = Object.assign(Object.assign({}, a), {
|
|
@@ -24387,7 +24389,7 @@ function create_each_block$1(t) {
|
|
|
24387
24389
|
};
|
|
24388
24390
|
}
|
|
24389
24391
|
function create_fragment$6(t) {
|
|
24390
|
-
let e, A, n, r, o, s, a, l, g, c, I, d, h, u,
|
|
24392
|
+
let e, A, n, r, o, s, a, l, g, c, I, d, h, u, E, B, f, Q, p = ensure_array_like(
|
|
24391
24393
|
/*fragment*/
|
|
24392
24394
|
t[2].content
|
|
24393
24395
|
), m = [];
|
|
@@ -24423,7 +24425,7 @@ function create_fragment$6(t) {
|
|
|
24423
24425
|
"show-borders",
|
|
24424
24426
|
/*depth*/
|
|
24425
24427
|
t[1] >= 1
|
|
24426
|
-
), attr(e, "class",
|
|
24428
|
+
), attr(e, "class", E = null_to_empty("".concat(
|
|
24427
24429
|
/*$$props*/
|
|
24428
24430
|
t[11].class || "",
|
|
24429
24431
|
" doc-node"
|
|
@@ -24438,7 +24440,7 @@ function create_fragment$6(t) {
|
|
|
24438
24440
|
insert(w, e, D), append(e, A), append(A, n), append(n, r), append(A, o), append(A, s), append(s, a), append(a, l), append(A, g), append(A, c), append(c, I), append(e, h), append(e, u);
|
|
24439
24441
|
for (let _ = 0; _ < m.length; _ += 1)
|
|
24440
24442
|
m[_] && m[_].m(u, null);
|
|
24441
|
-
|
|
24443
|
+
B = !0, f || (Q = [listen(
|
|
24442
24444
|
a,
|
|
24443
24445
|
"click",
|
|
24444
24446
|
/*handleNameClick*/
|
|
@@ -24452,22 +24454,22 @@ function create_fragment$6(t) {
|
|
|
24452
24454
|
},
|
|
24453
24455
|
p(w, D) {
|
|
24454
24456
|
let [_] = D;
|
|
24455
|
-
if ((!
|
|
24457
|
+
if ((!B || _ & /*startPos*/
|
|
24456
24458
|
1) && set_data(
|
|
24457
24459
|
r,
|
|
24458
24460
|
/*startPos*/
|
|
24459
24461
|
w[0]
|
|
24460
|
-
), (!
|
|
24462
|
+
), (!B || _ & /*name*/
|
|
24461
24463
|
64) && set_data(
|
|
24462
24464
|
l,
|
|
24463
24465
|
/*name*/
|
|
24464
24466
|
w[6]
|
|
24465
|
-
), (!
|
|
24467
|
+
), (!B || _ & /*endPos*/
|
|
24466
24468
|
16) && set_data(
|
|
24467
24469
|
I,
|
|
24468
24470
|
/*endPos*/
|
|
24469
24471
|
w[4]
|
|
24470
|
-
), (!
|
|
24472
|
+
), (!B || _ & /*color*/
|
|
24471
24473
|
128 && d !== (d = "background: ".concat(
|
|
24472
24474
|
/*color*/
|
|
24473
24475
|
w[7]
|
|
@@ -24486,24 +24488,24 @@ function create_fragment$6(t) {
|
|
|
24486
24488
|
y(k);
|
|
24487
24489
|
check_outros();
|
|
24488
24490
|
}
|
|
24489
|
-
(!
|
|
24491
|
+
(!B || _ & /*inlineChildren*/
|
|
24490
24492
|
8) && toggle_class(
|
|
24491
24493
|
u,
|
|
24492
24494
|
"inline-children",
|
|
24493
24495
|
/*inlineChildren*/
|
|
24494
24496
|
w[3]
|
|
24495
|
-
), (!
|
|
24497
|
+
), (!B || _ & /*depth*/
|
|
24496
24498
|
2) && toggle_class(
|
|
24497
24499
|
u,
|
|
24498
24500
|
"show-borders",
|
|
24499
24501
|
/*depth*/
|
|
24500
24502
|
w[1] >= 1
|
|
24501
|
-
), (!
|
|
24502
|
-
2048 &&
|
|
24503
|
+
), (!B || _ & /*$$props*/
|
|
24504
|
+
2048 && E !== (E = null_to_empty("".concat(
|
|
24503
24505
|
/*$$props*/
|
|
24504
24506
|
w[11].class || "",
|
|
24505
24507
|
" doc-node"
|
|
24506
|
-
)) + " svelte-1un819s")) && attr(e, "class",
|
|
24508
|
+
)) + " svelte-1un819s")) && attr(e, "class", E), (!B || _ & /*$$props, isRoot*/
|
|
24507
24509
|
2304) && toggle_class(
|
|
24508
24510
|
e,
|
|
24509
24511
|
"root",
|
|
@@ -24512,17 +24514,17 @@ function create_fragment$6(t) {
|
|
|
24512
24514
|
);
|
|
24513
24515
|
},
|
|
24514
24516
|
i(w) {
|
|
24515
|
-
if (!
|
|
24517
|
+
if (!B) {
|
|
24516
24518
|
for (let D = 0; D < p.length; D += 1)
|
|
24517
24519
|
transition_in(m[D]);
|
|
24518
|
-
|
|
24520
|
+
B = !0;
|
|
24519
24521
|
}
|
|
24520
24522
|
},
|
|
24521
24523
|
o(w) {
|
|
24522
24524
|
m = m.filter(Boolean);
|
|
24523
24525
|
for (let D = 0; D < m.length; D += 1)
|
|
24524
24526
|
transition_out(m[D]);
|
|
24525
|
-
|
|
24527
|
+
B = !1;
|
|
24526
24528
|
},
|
|
24527
24529
|
d(w) {
|
|
24528
24530
|
w && detach(e), destroy_each(m, w), f = !1, run_all(Q);
|
|
@@ -24541,10 +24543,10 @@ function instance$6(t, e, A) {
|
|
|
24541
24543
|
depth: h
|
|
24542
24544
|
} = e;
|
|
24543
24545
|
const u = h === 0;
|
|
24544
|
-
function
|
|
24546
|
+
function E() {
|
|
24545
24547
|
c(I, d);
|
|
24546
24548
|
}
|
|
24547
|
-
function
|
|
24549
|
+
function B() {
|
|
24548
24550
|
c(I, d, !0);
|
|
24549
24551
|
}
|
|
24550
24552
|
return t.$$set = (f) => {
|
|
@@ -24562,7 +24564,7 @@ function instance$6(t, e, A) {
|
|
|
24562
24564
|
}, [])), t.$$.dirty & /*startPos, node*/
|
|
24563
24565
|
4097 && A(4, a = d + I.nodeSize), t.$$.dirty & /*fragment*/
|
|
24564
24566
|
4 && A(3, l = n.content.every((f) => f.isInline));
|
|
24565
|
-
}, e = exclude_internal_props(e), [d, h, n, l, a, s, o, r, u,
|
|
24567
|
+
}, e = exclude_internal_props(e), [d, h, n, l, a, s, o, r, u, E, B, e, I];
|
|
24566
24568
|
}
|
|
24567
24569
|
class DocNode extends SvelteComponent {
|
|
24568
24570
|
constructor(e) {
|
|
@@ -24914,17 +24916,17 @@ function instance$4(t, e, A) {
|
|
|
24914
24916
|
node: I,
|
|
24915
24917
|
pos: d
|
|
24916
24918
|
}), !h) return;
|
|
24917
|
-
let
|
|
24918
|
-
for (;
|
|
24919
|
-
|
|
24920
|
-
if (!
|
|
24921
|
-
const
|
|
24922
|
-
if (
|
|
24923
|
-
const p =
|
|
24924
|
-
|
|
24919
|
+
let E = r.nodeDOM(d);
|
|
24920
|
+
for (; E && !(E instanceof HTMLElement); )
|
|
24921
|
+
E = E.parentElement;
|
|
24922
|
+
if (!E || getComputedStyle(E).display === "none") return;
|
|
24923
|
+
const B = getScrollableParent(r.dom);
|
|
24924
|
+
if (B) {
|
|
24925
|
+
const p = B.scrollTop, m = B.offsetTop - window.scrollY, y = B.getBoundingClientRect().top - m, w = E.getBoundingClientRect().top - m, D = B.clientHeight / 2;
|
|
24926
|
+
B.scroll(0, p + y + w - D);
|
|
24925
24927
|
}
|
|
24926
24928
|
const f = r.coordsAtPos(d).top, Q = ((u = document.querySelector(".floating-dock")) === null || u === void 0 ? void 0 : u.clientHeight) || 0;
|
|
24927
|
-
window.scroll(0, f - Q +
|
|
24929
|
+
window.scroll(0, f - Q + E.clientHeight + window.scrollY);
|
|
24928
24930
|
}
|
|
24929
24931
|
function c() {
|
|
24930
24932
|
console.log(s), window._node = s, console.info("%c [prosemirror-dev-toolkit]: Property added to window._node", "color: #b8e248");
|
|
@@ -25073,8 +25075,8 @@ function create_each_block(t) {
|
|
|
25073
25075
|
S[23].timestamp ? create_if_block_2$1 : create_else_block_2
|
|
25074
25076
|
);
|
|
25075
25077
|
}
|
|
25076
|
-
let u = h(t),
|
|
25077
|
-
function
|
|
25078
|
+
let u = h(t), E = u(t);
|
|
25079
|
+
function B(S, F) {
|
|
25078
25080
|
var N;
|
|
25079
25081
|
return (
|
|
25080
25082
|
/*selectedSnapshot*/
|
|
@@ -25082,7 +25084,7 @@ function create_each_block(t) {
|
|
|
25082
25084
|
S[23].timestamp ? create_if_block_1$1 : create_else_block_1
|
|
25083
25085
|
);
|
|
25084
25086
|
}
|
|
25085
|
-
let f =
|
|
25087
|
+
let f = B(t), Q = f(t);
|
|
25086
25088
|
function p() {
|
|
25087
25089
|
return (
|
|
25088
25090
|
/*click_handler*/
|
|
@@ -25130,16 +25132,16 @@ function create_each_block(t) {
|
|
|
25130
25132
|
}
|
|
25131
25133
|
return {
|
|
25132
25134
|
c() {
|
|
25133
|
-
e = element("li"),
|
|
25135
|
+
e = element("li"), E.c(), A = space(), n = element("button"), Q.c(), r = space(), o = element("button"), o.textContent = "Restore", s = space(), a = element("button"), a.textContent = "Export", l = space(), g = element("button"), _.c(), c = space(), attr(n, "class", "snapshot-btn ml-2 svelte-969ox4"), attr(o, "class", "snapshot-btn svelte-969ox4"), attr(a, "class", "snapshot-btn svelte-969ox4"), attr(g, "class", "snapshot-btn svelte-969ox4"), attr(e, "class", "svelte-969ox4");
|
|
25134
25136
|
},
|
|
25135
25137
|
m(S, F) {
|
|
25136
|
-
insert(S, e, F),
|
|
25138
|
+
insert(S, e, F), E.m(e, null), append(e, A), append(e, n), Q.m(n, null), append(e, r), append(e, o), append(e, s), append(e, a), append(e, l), append(e, g), _.m(g, null), append(e, c), I || (d = [listen(n, "click", p), listen(o, "click", m), listen(a, "click", y), listen(g, "click", k)], I = !0);
|
|
25137
25139
|
},
|
|
25138
25140
|
p(S, F) {
|
|
25139
|
-
t = S, u === (u = h(t)) &&
|
|
25141
|
+
t = S, u === (u = h(t)) && E ? E.p(t, F) : (E.d(1), E = u(t), E && (E.c(), E.m(e, A))), f !== (f = B(t)) && (Q.d(1), Q = f(t), Q && (Q.c(), Q.m(n, null))), D !== (D = w(t)) && (_.d(1), _ = D(t), _ && (_.c(), _.m(g, null)));
|
|
25140
25142
|
},
|
|
25141
25143
|
d(S) {
|
|
25142
|
-
S && detach(e),
|
|
25144
|
+
S && detach(e), E.d(), Q.d(), _.d(), I = !1, run_all(d);
|
|
25143
25145
|
}
|
|
25144
25146
|
};
|
|
25145
25147
|
}
|
|
@@ -25205,10 +25207,10 @@ function instance$3(t, e, A) {
|
|
|
25205
25207
|
function u(S) {
|
|
25206
25208
|
A(2, c = S), A(3, I = void 0);
|
|
25207
25209
|
}
|
|
25208
|
-
function
|
|
25210
|
+
function E(S) {
|
|
25209
25211
|
c && (A(2, c.name = S.currentTarget.value, c), h());
|
|
25210
25212
|
}
|
|
25211
|
-
function
|
|
25213
|
+
function B(S) {
|
|
25212
25214
|
S.key === "Enter" && c && (o(c), clearTimeout(d), A(2, c = void 0), A(3, I = void 0));
|
|
25213
25215
|
}
|
|
25214
25216
|
function f(S) {
|
|
@@ -25226,7 +25228,7 @@ function instance$3(t, e, A) {
|
|
|
25226
25228
|
const y = (S) => u(S), w = (S) => f(S), D = (S) => Q(S), _ = (S) => p(S), k = (S) => m(S);
|
|
25227
25229
|
return t.$$set = (S) => {
|
|
25228
25230
|
"snapshots" in S && A(0, n = S.snapshots), "selectedSnapshot" in S && A(1, r = S.selectedSnapshot), "onUpdate" in S && A(11, o = S.onUpdate), "onView" in S && A(12, s = S.onView), "onRestore" in S && A(13, a = S.onRestore), "onExport" in S && A(14, l = S.onExport), "onDelete" in S && A(15, g = S.onDelete);
|
|
25229
|
-
}, [n, r, c, I, u,
|
|
25231
|
+
}, [n, r, c, I, u, E, B, f, Q, p, m, o, s, a, l, g, y, w, D, _, k];
|
|
25230
25232
|
}
|
|
25231
25233
|
class SnapshotsList extends SvelteComponent {
|
|
25232
25234
|
constructor(e) {
|
|
@@ -25538,7 +25540,7 @@ function create_if_block$1(t) {
|
|
|
25538
25540
|
};
|
|
25539
25541
|
}
|
|
25540
25542
|
function create_fragment$1(t) {
|
|
25541
|
-
let e, A, n, r, o, s, a, l, g, c, I, d, h, u,
|
|
25543
|
+
let e, A, n, r, o, s, a, l, g, c, I, d, h, u, E, B, f, Q, p, m, y, w, D, _, k, S, F, N;
|
|
25542
25544
|
A = new PasteModal({
|
|
25543
25545
|
props: {
|
|
25544
25546
|
isOpen: (
|
|
@@ -25590,7 +25592,7 @@ function create_fragment$1(t) {
|
|
|
25590
25592
|
}
|
|
25591
25593
|
return D = v(t), _ = R[D] = b[D](t), {
|
|
25592
25594
|
c() {
|
|
25593
|
-
e = element("div"), create_component(A.$$.fragment), n = space(), r = element("div"), o = element("div"), s = space(), a = element("div"), l = element("div"), g = element("button"), g.textContent = "Copy", c = space(), I = element("button"), I.textContent = "Save", d = space(), h = element("button"), h.textContent = "Import", u = space(),
|
|
25595
|
+
e = element("div"), create_component(A.$$.fragment), n = space(), r = element("div"), o = element("div"), s = space(), a = element("div"), l = element("div"), g = element("button"), g.textContent = "Copy", c = space(), I = element("button"), I.textContent = "Save", d = space(), h = element("button"), h.textContent = "Import", u = space(), E = element("button"), E.textContent = "Paste", B = space(), f = element("button"), f.textContent = "X", Q = space(), p = element("input"), m = space(), create_component(y.$$.fragment), w = space(), _.c(), attr(o, "class", "resizing-div svelte-1quf800"), attr(o, "role", "button"), attr(o, "tabindex", "-1"), attr(g, "class", "copy-btn svelte-1quf800"), attr(I, "class", "save-btn svelte-1quf800"), attr(h, "class", "import-btn svelte-1quf800"), attr(E, "class", "paste-btn svelte-1quf800"), attr(f, "class", "close-btn svelte-1quf800"), attr(f, "aria-label", "Close dev-toolkit"), set_style(p, "display", "none"), attr(p, "type", "file"), attr(p, "accept", ".json"), p.multiple = !0, attr(a, "class", "floating-dock-body svelte-1quf800"), attr(r, "class", "floating-dock svelte-1quf800"), attr(r, "style", k = "top: ".concat(
|
|
25594
25596
|
/*dockTop*/
|
|
25595
25597
|
t[2],
|
|
25596
25598
|
"%; height: "
|
|
@@ -25601,7 +25603,7 @@ function create_fragment$1(t) {
|
|
|
25601
25603
|
)), attr(e, "class", "floating-dock-wrapper svelte-1quf800");
|
|
25602
25604
|
},
|
|
25603
25605
|
m(M, L) {
|
|
25604
|
-
insert(M, e, L), mount_component(A, e, null), append(e, n), append(e, r), append(r, o), append(r, s), append(r, a), append(a, l), append(l, g), append(l, c), append(l, I), append(l, d), append(l, h), append(l, u), append(l,
|
|
25606
|
+
insert(M, e, L), mount_component(A, e, null), append(e, n), append(e, r), append(r, o), append(r, s), append(r, a), append(a, l), append(l, g), append(l, c), append(l, I), append(l, d), append(l, h), append(l, u), append(l, E), append(l, B), append(l, f), append(a, Q), append(a, p), t[15](p), append(a, m), mount_component(y, a, null), append(a, w), R[D].m(a, null), S = !0, F || (N = [listen(
|
|
25605
25607
|
o,
|
|
25606
25608
|
"mousedown",
|
|
25607
25609
|
/*handleResizeMouseDown*/
|
|
@@ -25622,7 +25624,7 @@ function create_fragment$1(t) {
|
|
|
25622
25624
|
/*handleImportSnapshot*/
|
|
25623
25625
|
t[9]
|
|
25624
25626
|
), listen(
|
|
25625
|
-
|
|
25627
|
+
E,
|
|
25626
25628
|
"click",
|
|
25627
25629
|
/*handlePasteSnapshot*/
|
|
25628
25630
|
t[10]
|
|
@@ -25701,10 +25703,10 @@ function instance$1(t, e, A) {
|
|
|
25701
25703
|
const w = (/* @__PURE__ */ new Date()).toLocaleString("sv"), D = prompt("Enter snapshot name", w);
|
|
25702
25704
|
D && saveSnapshot(D, r.state.doc.toJSON());
|
|
25703
25705
|
}
|
|
25704
|
-
function
|
|
25706
|
+
function E() {
|
|
25705
25707
|
l.click();
|
|
25706
25708
|
}
|
|
25707
|
-
function
|
|
25709
|
+
function B() {
|
|
25708
25710
|
A(5, g = !g);
|
|
25709
25711
|
}
|
|
25710
25712
|
function f() {
|
|
@@ -25742,7 +25744,7 @@ function instance$1(t, e, A) {
|
|
|
25742
25744
|
}
|
|
25743
25745
|
return t.$$set = (w) => {
|
|
25744
25746
|
"onClose" in w && A(0, n = w.onClose);
|
|
25745
|
-
}, [n, o, s, a, l, g, c, h, u,
|
|
25747
|
+
}, [n, o, s, a, l, g, c, h, u, E, B, f, Q, p, m, y];
|
|
25746
25748
|
}
|
|
25747
25749
|
class FloatingDock extends SvelteComponent {
|
|
25748
25750
|
constructor(e) {
|
|
@@ -27478,16 +27480,16 @@ function writeIndented$1(t, e, A, n) {
|
|
|
27478
27480
|
let c = "";
|
|
27479
27481
|
if (t.colPos === 0 && (c += "> ".repeat(A.blockquoteCnt)), t.colPos === 0 && g.length > 0) {
|
|
27480
27482
|
c += " ".repeat(A.footnoteCnt);
|
|
27481
|
-
const
|
|
27483
|
+
const B = A.listPath.slice(0, A.listPath.length - 1).map((f) => o[f]).reduce((f, Q) => f + Q, 0);
|
|
27482
27484
|
switch (A.listType) {
|
|
27483
27485
|
case "tl":
|
|
27484
|
-
c += " ".repeat(
|
|
27486
|
+
c += " ".repeat(B), A.itemRow === 0 ? (c += "- ", A.itemSymbol ? c += "[x] " : c += "[ ] ") : c += " ";
|
|
27485
27487
|
break;
|
|
27486
27488
|
case "ul":
|
|
27487
|
-
c += " ".repeat(
|
|
27489
|
+
c += " ".repeat(B), A.itemRow === 0 ? c += A.itemSymbol + " " : c += " ";
|
|
27488
27490
|
break;
|
|
27489
27491
|
case "ol":
|
|
27490
|
-
c += " ".repeat(
|
|
27492
|
+
c += " ".repeat(B), A.itemRow === 0 ? c += A.itemSymbol : c += " ".repeat(4);
|
|
27491
27493
|
break;
|
|
27492
27494
|
case "dl":
|
|
27493
27495
|
A.itemSymbol && (A.itemRow === 0 ? c += `${A.itemSymbol}` : c += " ".repeat(A.itemSymbol.length));
|
|
@@ -27496,12 +27498,12 @@ function writeIndented$1(t, e, A, n) {
|
|
|
27496
27498
|
}
|
|
27497
27499
|
const I = structuredClone(n);
|
|
27498
27500
|
a && I && (I.map = [a + s]), g.length > 0 && A.blockquoteCnt > 0 && t.colPos === A.blockquoteCnt * 2 - 1 && (c += " ");
|
|
27499
|
-
const d = l >= r.length - 1, h = new RegExp(A.lineBreak + "$"), u = g.match(new RegExp(A.lineBreak + "$")),
|
|
27500
|
-
if (d ? u ? (t.log(
|
|
27501
|
+
const d = l >= r.length - 1, h = new RegExp(A.lineBreak + "$"), u = g.match(new RegExp(A.lineBreak + "$")), E = g.replace(h, "").replace(/[ \t\u00A0]+$/g, "");
|
|
27502
|
+
if (d ? u ? (t.log(E ? c : c.trim()), t.log(E + (u ? " " : ""), I), s += (E + (u ? " " : "")).length) : (t.log(g ? c : c.trim()), t.log(g, I), s += g.length) : (t.log(E ? c : c.trim()), t.log(E + (u ? " " : ""), I), s += (E + (u ? " " : "")).length), !d) {
|
|
27501
27503
|
A.itemRow++;
|
|
27502
|
-
const
|
|
27503
|
-
a &&
|
|
27504
|
-
`,
|
|
27504
|
+
const B = structuredClone(n);
|
|
27505
|
+
a && B && (B.map = [a + s]), t.log(`
|
|
27506
|
+
`, B), s++;
|
|
27505
27507
|
}
|
|
27506
27508
|
}
|
|
27507
27509
|
}
|
|
@@ -28054,16 +28056,16 @@ function writeIndented(t, e, A, n) {
|
|
|
28054
28056
|
let c = "";
|
|
28055
28057
|
if (t.colPos === 0 && (c += "> ".repeat(A.blockquoteCnt)), t.colPos === 0 && g.length > 0) {
|
|
28056
28058
|
c += " ".repeat(A.footnoteCnt);
|
|
28057
|
-
const
|
|
28059
|
+
const B = A.listPath.slice(0, A.listPath.length - 1).map((f) => o[f]).reduce((f, Q) => f + Q, 0);
|
|
28058
28060
|
switch (A.listType) {
|
|
28059
28061
|
case "tl":
|
|
28060
|
-
c += " ".repeat(
|
|
28062
|
+
c += " ".repeat(B), A.itemRow === 0 ? (c += "- ", A.itemSymbol ? c += "[x] " : c += "[ ] ") : c += " ";
|
|
28061
28063
|
break;
|
|
28062
28064
|
case "ul":
|
|
28063
|
-
c += " ".repeat(
|
|
28065
|
+
c += " ".repeat(B), A.itemRow === 0 ? c += A.itemSymbol + " " : c += " ";
|
|
28064
28066
|
break;
|
|
28065
28067
|
case "ol":
|
|
28066
|
-
c += " ".repeat(
|
|
28068
|
+
c += " ".repeat(B), A.itemRow === 0 ? c += A.itemSymbol : c += " ".repeat(4);
|
|
28067
28069
|
break;
|
|
28068
28070
|
case "dl":
|
|
28069
28071
|
A.itemSymbol && (A.itemRow === 0 ? c += `${A.itemSymbol}` : c += " ".repeat(A.itemSymbol.length));
|
|
@@ -28072,12 +28074,12 @@ function writeIndented(t, e, A, n) {
|
|
|
28072
28074
|
}
|
|
28073
28075
|
const I = structuredClone(n);
|
|
28074
28076
|
a && I && (I.map = [a + s]), g.length > 0 && A.blockquoteCnt > 0 && t.colPos === A.blockquoteCnt * 2 - 1 && (c += " ");
|
|
28075
|
-
const d = l >= r.length - 1, h = new RegExp(A.lineBreak + "$"), u = g.match(new RegExp(A.lineBreak + "$")),
|
|
28076
|
-
if (d ? u ? (t.log(
|
|
28077
|
+
const d = l >= r.length - 1, h = new RegExp(A.lineBreak + "$"), u = g.match(new RegExp(A.lineBreak + "$")), E = g.replace(h, "").replace(/[ \t\u00A0]+$/g, "");
|
|
28078
|
+
if (d ? u ? (t.log(E ? c : c.trim()), t.log(E + (u ? " " : ""), I), s += (E + (u ? " " : "")).length) : (t.log(g ? c : c.trim()), t.log(g, I), s += g.length) : (t.log(E ? c : c.trim()), t.log(E + (u ? " " : ""), I), s += (E + (u ? " " : "")).length), !d) {
|
|
28077
28079
|
A.itemRow++;
|
|
28078
|
-
const
|
|
28079
|
-
a &&
|
|
28080
|
-
`,
|
|
28080
|
+
const B = structuredClone(n);
|
|
28081
|
+
a && B && (B.map = [a + s]), t.log(`
|
|
28082
|
+
`, B), s++;
|
|
28081
28083
|
}
|
|
28082
28084
|
}
|
|
28083
28085
|
}
|
|
@@ -28291,7 +28293,7 @@ class DocumentMarkdownInlineTokenizer {
|
|
|
28291
28293
|
let [p, m, y] = /^(.*?)(\s*)$/m.exec(g.text);
|
|
28292
28294
|
y && (o.push([y, d]), m ? g = this.schema.text(m, g.marks) : g = nullNode, g || (h = r));
|
|
28293
28295
|
}
|
|
28294
|
-
let
|
|
28296
|
+
let E = h.length ? h[h.length - 1] : null, B = E && this.getMark(E.type.name).escape === !1, f = h.length - (B ? 1 : 0);
|
|
28295
28297
|
e: for (let p = 0; p < f; p++) {
|
|
28296
28298
|
let m = h[p];
|
|
28297
28299
|
if (!this.getMark(m.type.name).mixable) break;
|
|
@@ -28318,12 +28320,12 @@ class DocumentMarkdownInlineTokenizer {
|
|
|
28318
28320
|
let p = h[r.length];
|
|
28319
28321
|
r.push(p), await this.markString(p, !0, s);
|
|
28320
28322
|
}
|
|
28321
|
-
if (
|
|
28322
|
-
if (await this.markString(
|
|
28323
|
+
if (B && g.isText) {
|
|
28324
|
+
if (await this.markString(E, !0, s), g.text) {
|
|
28323
28325
|
const p = new Token("text", "", 0);
|
|
28324
28326
|
p.meta = "noEscText", p.map = [d], p.content = g.text, s.push(p);
|
|
28325
28327
|
}
|
|
28326
|
-
await this.markString(
|
|
28328
|
+
await this.markString(E, !1, s);
|
|
28327
28329
|
} else {
|
|
28328
28330
|
const p = "type" in g && this.nodes[g.type.name] ? this.nodes[g.type.name](g, A) : blankNode$1;
|
|
28329
28331
|
let m = "";
|
|
@@ -28781,13 +28783,13 @@ async function extPmToMdConverter(t, e, A, n) {
|
|
|
28781
28783
|
}
|
|
28782
28784
|
});
|
|
28783
28785
|
n.dispatchEvent(u);
|
|
28784
|
-
const
|
|
28786
|
+
const E = {}, B = [];
|
|
28785
28787
|
let f;
|
|
28786
28788
|
if (e.sourceMap) {
|
|
28787
28789
|
const Q = new SmartOutput();
|
|
28788
28790
|
nodeToTreeStringOutput(Q, t), Q.getSourceMap(
|
|
28789
28791
|
(p, m, y, w) => {
|
|
28790
|
-
w && (
|
|
28792
|
+
w && (E[w.pos] = {
|
|
28791
28793
|
targetRow: p,
|
|
28792
28794
|
targetCol: m
|
|
28793
28795
|
});
|
|
@@ -28796,17 +28798,17 @@ async function extPmToMdConverter(t, e, A, n) {
|
|
|
28796
28798
|
(p, m, y, w) => {
|
|
28797
28799
|
if (w?.map) {
|
|
28798
28800
|
const D = w.map[0], _ = w.map[2];
|
|
28799
|
-
if (
|
|
28801
|
+
if (B.push({
|
|
28800
28802
|
nodeIdx: D,
|
|
28801
28803
|
targetPos: y,
|
|
28802
28804
|
targetRow: p,
|
|
28803
28805
|
targetCol: m,
|
|
28804
28806
|
sourceCol: _
|
|
28805
|
-
}),
|
|
28807
|
+
}), E[D])
|
|
28806
28808
|
return {
|
|
28807
28809
|
sourceNo: 0,
|
|
28808
|
-
sourceRowPos:
|
|
28809
|
-
sourceColPos:
|
|
28810
|
+
sourceRowPos: E[D].targetRow,
|
|
28811
|
+
sourceColPos: E[D].targetCol
|
|
28810
28812
|
};
|
|
28811
28813
|
}
|
|
28812
28814
|
}
|
|
@@ -28816,8 +28818,8 @@ async function extPmToMdConverter(t, e, A, n) {
|
|
|
28816
28818
|
const Q = new CustomEvent("md:sourcemap", {
|
|
28817
28819
|
detail: {
|
|
28818
28820
|
sourceMap: f,
|
|
28819
|
-
debugMap:
|
|
28820
|
-
rawTextMap:
|
|
28821
|
+
debugMap: E,
|
|
28822
|
+
rawTextMap: B
|
|
28821
28823
|
}
|
|
28822
28824
|
});
|
|
28823
28825
|
n.dispatchEvent(Q);
|
|
@@ -28825,8 +28827,8 @@ async function extPmToMdConverter(t, e, A, n) {
|
|
|
28825
28827
|
return {
|
|
28826
28828
|
content: h.toString(),
|
|
28827
28829
|
sourceMap: f,
|
|
28828
|
-
debugMap:
|
|
28829
|
-
rawTextMap:
|
|
28830
|
+
debugMap: E,
|
|
28831
|
+
rawTextMap: B
|
|
28830
28832
|
};
|
|
28831
28833
|
}
|
|
28832
28834
|
const removeWhitespaces = (t) => {
|
|
@@ -28999,16 +29001,16 @@ function treeToTokens(t, e, A) {
|
|
|
28999
29001
|
const d = (u) => {
|
|
29000
29002
|
if (u)
|
|
29001
29003
|
return c.substring(u.startIndex, u.endIndex);
|
|
29002
|
-
}, h = (u,
|
|
29003
|
-
const
|
|
29004
|
+
}, h = (u, E) => {
|
|
29005
|
+
const B = u.split(`
|
|
29004
29006
|
`);
|
|
29005
29007
|
let f = 0;
|
|
29006
|
-
for (const Q of
|
|
29008
|
+
for (const Q of B) {
|
|
29007
29009
|
if (f > 0) {
|
|
29008
29010
|
const y = [
|
|
29009
29011
|
// TODO verify in viewer
|
|
29010
|
-
I.row +
|
|
29011
|
-
I.row +
|
|
29012
|
+
I.row + E.startPosition?.row + f,
|
|
29013
|
+
I.row + E.endPosition?.row + f,
|
|
29012
29014
|
0,
|
|
29013
29015
|
0
|
|
29014
29016
|
], w = new Token("softbreak", "wbr", NESTING_SELF_CLOSING);
|
|
@@ -29016,24 +29018,24 @@ function treeToTokens(t, e, A) {
|
|
|
29016
29018
|
`, s(w, "softbreak between text rows");
|
|
29017
29019
|
}
|
|
29018
29020
|
const p = [
|
|
29019
|
-
I.row +
|
|
29020
|
-
I.row +
|
|
29021
|
-
I.column +
|
|
29022
|
-
(+
|
|
29021
|
+
I.row + E.startPosition?.row + f,
|
|
29022
|
+
I.row + E.endPosition?.row + f,
|
|
29023
|
+
I.column + E.startPosition?.column,
|
|
29024
|
+
(+E.endPosition.row == +E.startPosition.row ? I.column : 0) + E.endPosition?.column
|
|
29023
29025
|
], m = new Token("text", "", NESTING_SELF_CLOSING);
|
|
29024
|
-
m.map = p, m.meta = "noEscText", m.content =
|
|
29026
|
+
m.map = p, m.meta = "noEscText", m.content = B.length > 1 ? Q.replace(/^\s+/, "") : Q, s(m, "text"), f++;
|
|
29025
29027
|
}
|
|
29026
29028
|
};
|
|
29027
29029
|
for (const u of g) {
|
|
29028
|
-
const
|
|
29030
|
+
const E = [
|
|
29029
29031
|
I.row + u.startPosition?.row,
|
|
29030
29032
|
I.row + u.endPosition?.row,
|
|
29031
29033
|
I.column + u.startPosition?.column,
|
|
29032
29034
|
(+u.endPosition.row == +u.startPosition.row ? I.column : 0) + u.endPosition?.column
|
|
29033
29035
|
];
|
|
29034
29036
|
if (u.type.length === 1) {
|
|
29035
|
-
const
|
|
29036
|
-
|
|
29037
|
+
const B = new Token("text", "", NESTING_SELF_CLOSING);
|
|
29038
|
+
B.map = E, B.meta = "noEscText", B.content = d(u) || "", s(B, "walkInline");
|
|
29037
29039
|
continue;
|
|
29038
29040
|
}
|
|
29039
29041
|
switch (u.type) {
|
|
@@ -29043,14 +29045,14 @@ function treeToTokens(t, e, A) {
|
|
|
29043
29045
|
break;
|
|
29044
29046
|
case "text":
|
|
29045
29047
|
{
|
|
29046
|
-
const
|
|
29047
|
-
h(
|
|
29048
|
+
const B = d(u) ?? "";
|
|
29049
|
+
h(B, u);
|
|
29048
29050
|
}
|
|
29049
29051
|
break;
|
|
29050
29052
|
case "latex_block":
|
|
29051
29053
|
{
|
|
29052
|
-
const
|
|
29053
|
-
if (d(
|
|
29054
|
+
const B = u.children.find((Q) => Q?.type === "latex_span_delimiter"), f = u.children.filter((Q) => Q?.type !== "latex_span_delimiter").map((Q) => d(Q)).join("");
|
|
29055
|
+
if (d(B) === "$$") {
|
|
29054
29056
|
const Q = new Token(
|
|
29055
29057
|
"fence",
|
|
29056
29058
|
"pre",
|
|
@@ -29059,45 +29061,45 @@ function treeToTokens(t, e, A) {
|
|
|
29059
29061
|
Q.level = r, Q.markup = "$$", Q.meta = "noEscText", Q.attrSet("lang", "latex"), Q.content = f.trim(), n.push(Q);
|
|
29060
29062
|
} else {
|
|
29061
29063
|
const Q = new Token("math", "", NESTING_SELF_CLOSING);
|
|
29062
|
-
Q.attrSet("lang", "latex"), Q.map =
|
|
29064
|
+
Q.attrSet("lang", "latex"), Q.map = E, Q.meta = "noEscText", Q.content = f, s(Q, "latex_block");
|
|
29063
29065
|
}
|
|
29064
29066
|
}
|
|
29065
29067
|
break;
|
|
29066
29068
|
case "whitespace":
|
|
29067
29069
|
{
|
|
29068
|
-
const
|
|
29069
|
-
if (
|
|
29070
|
+
const B = d(u) || "";
|
|
29071
|
+
if (B === `
|
|
29070
29072
|
`) {
|
|
29071
29073
|
const f = new Token("softbreak", "wbr", NESTING_SELF_CLOSING);
|
|
29072
|
-
f.map =
|
|
29074
|
+
f.map = E, f.content = B ?? "", s(f, `whitespace
|
|
29073
29075
|
`);
|
|
29074
29076
|
break;
|
|
29075
29077
|
}
|
|
29076
|
-
if (
|
|
29077
|
-
if (
|
|
29078
|
+
if (B && B.match(/^\s+$/)) {
|
|
29079
|
+
if (B.endsWith(`
|
|
29078
29080
|
`)) {
|
|
29079
29081
|
const f = new Token(
|
|
29080
29082
|
"hardbreak",
|
|
29081
29083
|
"wbr",
|
|
29082
29084
|
NESTING_SELF_CLOSING
|
|
29083
29085
|
);
|
|
29084
|
-
f.map =
|
|
29086
|
+
f.map = E, f.meta = "noEscText", f.content = B ?? "", s(f, "whitespace hardbreak");
|
|
29085
29087
|
} else {
|
|
29086
29088
|
const f = new Token("text", "br", NESTING_SELF_CLOSING);
|
|
29087
|
-
f.map =
|
|
29089
|
+
f.map = E, f.meta = "noEscText", f.content = B ?? "", s(f, "whitespace space");
|
|
29088
29090
|
}
|
|
29089
29091
|
break;
|
|
29090
29092
|
}
|
|
29091
|
-
if (
|
|
29092
|
-
h(
|
|
29093
|
+
if (B?.trim().length > 0) {
|
|
29094
|
+
h(B, u);
|
|
29093
29095
|
break;
|
|
29094
29096
|
}
|
|
29095
29097
|
}
|
|
29096
29098
|
break;
|
|
29097
29099
|
case "shortcut_link":
|
|
29098
29100
|
{
|
|
29099
|
-
const
|
|
29100
|
-
|
|
29101
|
+
const B = "link", Q = new Token(
|
|
29102
|
+
B + "_open",
|
|
29101
29103
|
"a",
|
|
29102
29104
|
NESTING_OPENING
|
|
29103
29105
|
), p = u.children.find((w) => w?.type === "link_destination");
|
|
@@ -29105,10 +29107,10 @@ function treeToTokens(t, e, A) {
|
|
|
29105
29107
|
const m = u.children.find((w) => w?.type === "link_title");
|
|
29106
29108
|
m && Q.attrSet("title", d(m) || ""), s(Q, "shortcut_link"), u.children.filter((w) => w.type === "link_text").forEach((w) => {
|
|
29107
29109
|
const D = new Token("text", "", NESTING_SELF_CLOSING);
|
|
29108
|
-
D.map =
|
|
29110
|
+
D.map = E, D.meta = "noEscText", D.content = d(w) ?? "", s(D, "link_text");
|
|
29109
29111
|
});
|
|
29110
29112
|
const y = new Token(
|
|
29111
|
-
|
|
29113
|
+
B + "_close",
|
|
29112
29114
|
"a",
|
|
29113
29115
|
NESTING_CLOSING
|
|
29114
29116
|
);
|
|
@@ -29117,8 +29119,8 @@ function treeToTokens(t, e, A) {
|
|
|
29117
29119
|
break;
|
|
29118
29120
|
case "inline_link":
|
|
29119
29121
|
{
|
|
29120
|
-
const
|
|
29121
|
-
|
|
29122
|
+
const B = "link", Q = new Token(
|
|
29123
|
+
B + "_open",
|
|
29122
29124
|
"a",
|
|
29123
29125
|
NESTING_OPENING
|
|
29124
29126
|
), p = u.children.find((w) => w.type === "link_destination");
|
|
@@ -29126,10 +29128,10 @@ function treeToTokens(t, e, A) {
|
|
|
29126
29128
|
const m = u.children.find((w) => w.type === "link_title");
|
|
29127
29129
|
m && Q.attrSet("title", m.text || ""), s(Q, "inline_link"), u.children.filter((w) => w.type === "link_text").forEach((w) => {
|
|
29128
29130
|
const D = new Token("text", "", NESTING_SELF_CLOSING);
|
|
29129
|
-
D.map =
|
|
29131
|
+
D.map = E, D.meta = "noEscText", D.content = d(w) ?? "", s(D, "inline_link_txt");
|
|
29130
29132
|
});
|
|
29131
29133
|
const y = new Token(
|
|
29132
|
-
|
|
29134
|
+
B + "_close",
|
|
29133
29135
|
"a",
|
|
29134
29136
|
NESTING_CLOSING
|
|
29135
29137
|
);
|
|
@@ -29138,8 +29140,8 @@ function treeToTokens(t, e, A) {
|
|
|
29138
29140
|
break;
|
|
29139
29141
|
case "image":
|
|
29140
29142
|
{
|
|
29141
|
-
const
|
|
29142
|
-
|
|
29143
|
+
const B = "image", Q = new Token(
|
|
29144
|
+
B,
|
|
29143
29145
|
"img",
|
|
29144
29146
|
NESTING_SELF_CLOSING
|
|
29145
29147
|
), p = u.children.find((w) => w.type === "image_description");
|
|
@@ -29152,23 +29154,23 @@ function treeToTokens(t, e, A) {
|
|
|
29152
29154
|
break;
|
|
29153
29155
|
case "strong_emphasis":
|
|
29154
29156
|
{
|
|
29155
|
-
const
|
|
29157
|
+
const B = u.children.find((y) => y.type === "emphasis_delimiter"), f = B?.text === "_" ? "underline" : "strong", Q = B?.text === "_" ? "u" : "strong", p = new Token(
|
|
29156
29158
|
f + "_open",
|
|
29157
29159
|
Q,
|
|
29158
29160
|
NESTING_OPENING
|
|
29159
29161
|
);
|
|
29160
|
-
|
|
29162
|
+
B?.text === "_" && (p.markup = "__"), s(p, "strongem"), a(u.children, c);
|
|
29161
29163
|
const m = new Token(
|
|
29162
29164
|
f + "_close",
|
|
29163
29165
|
Q,
|
|
29164
29166
|
NESTING_CLOSING
|
|
29165
29167
|
);
|
|
29166
|
-
d(
|
|
29168
|
+
d(B) === "_" && (m.markup = "__"), s(m, "/strongem");
|
|
29167
29169
|
}
|
|
29168
29170
|
break;
|
|
29169
29171
|
case "emphasis":
|
|
29170
29172
|
{
|
|
29171
|
-
const
|
|
29173
|
+
const B = u.children.find((w) => w.type === "emphasis_delimiter"), f = u.children.filter((w) => w.type !== "emphasis_delimiter"), Q = B?.text === "_" ? "underline" : "em", p = B?.text === "_" ? "u" : "em", m = new Token(
|
|
29172
29174
|
Q + "_open",
|
|
29173
29175
|
p,
|
|
29174
29176
|
NESTING_OPENING
|
|
@@ -29184,14 +29186,14 @@ function treeToTokens(t, e, A) {
|
|
|
29184
29186
|
break;
|
|
29185
29187
|
case "strikethrough":
|
|
29186
29188
|
{
|
|
29187
|
-
const
|
|
29188
|
-
|
|
29189
|
+
const B = "strike", f = "strike", Q = new Token(
|
|
29190
|
+
B + "_open",
|
|
29189
29191
|
f,
|
|
29190
29192
|
NESTING_OPENING
|
|
29191
29193
|
);
|
|
29192
29194
|
s(Q, "s"), a(u.children.filter((m) => !!m), c);
|
|
29193
29195
|
const p = new Token(
|
|
29194
|
-
|
|
29196
|
+
B + "_close",
|
|
29195
29197
|
f,
|
|
29196
29198
|
NESTING_CLOSING
|
|
29197
29199
|
);
|
|
@@ -29200,14 +29202,14 @@ function treeToTokens(t, e, A) {
|
|
|
29200
29202
|
break;
|
|
29201
29203
|
case "code_span":
|
|
29202
29204
|
{
|
|
29203
|
-
const
|
|
29204
|
-
|
|
29205
|
+
const B = "code", f = "code", Q = new Token(
|
|
29206
|
+
B + "_open",
|
|
29205
29207
|
f,
|
|
29206
29208
|
NESTING_OPENING
|
|
29207
29209
|
);
|
|
29208
29210
|
s(Q, "code"), a(u.children.filter((m) => !!m), c);
|
|
29209
29211
|
const p = new Token(
|
|
29210
|
-
|
|
29212
|
+
B + "_close",
|
|
29211
29213
|
f,
|
|
29212
29214
|
NESTING_CLOSING
|
|
29213
29215
|
);
|
|
@@ -29216,8 +29218,8 @@ function treeToTokens(t, e, A) {
|
|
|
29216
29218
|
break;
|
|
29217
29219
|
case "html_tag":
|
|
29218
29220
|
{
|
|
29219
|
-
const
|
|
29220
|
-
|
|
29221
|
+
const B = "html_block", Q = new Token(
|
|
29222
|
+
B,
|
|
29221
29223
|
"",
|
|
29222
29224
|
NESTING_SELF_CLOSING
|
|
29223
29225
|
);
|
|
@@ -29226,12 +29228,12 @@ function treeToTokens(t, e, A) {
|
|
|
29226
29228
|
break;
|
|
29227
29229
|
case "hard_line_break":
|
|
29228
29230
|
{
|
|
29229
|
-
const
|
|
29230
|
-
|
|
29231
|
+
const B = "hardbreak", Q = new Token(
|
|
29232
|
+
B,
|
|
29231
29233
|
"br",
|
|
29232
29234
|
NESTING_SELF_CLOSING
|
|
29233
29235
|
);
|
|
29234
|
-
Q.map =
|
|
29236
|
+
Q.map = E, Q.meta = "noEscText", Q.content = d(u) ?? "", s(Q, "hard_line_break");
|
|
29235
29237
|
}
|
|
29236
29238
|
break;
|
|
29237
29239
|
default:
|
|
@@ -29315,16 +29317,16 @@ function treeToTokens(t, e, A) {
|
|
|
29315
29317
|
NESTING_OPENING
|
|
29316
29318
|
);
|
|
29317
29319
|
u.level = r, u.markup = o(d) || "#", u.attrSet("margin_before", "1"), n.push(u);
|
|
29318
|
-
const
|
|
29320
|
+
const E = g.children.filter((f) => !!f).filter(
|
|
29319
29321
|
(f) => !f.type.startsWith("setext_")
|
|
29320
29322
|
);
|
|
29321
|
-
r++,
|
|
29322
|
-
const
|
|
29323
|
+
r++, E.forEach((f) => l(f, c)), r--;
|
|
29324
|
+
const B = new Token(
|
|
29323
29325
|
I + "_close",
|
|
29324
29326
|
h,
|
|
29325
29327
|
NESTING_CLOSING
|
|
29326
29328
|
);
|
|
29327
|
-
|
|
29329
|
+
B.level = r, B.markup = o(d) || "", B.attrSet("margin_after", "1"), n.push(B);
|
|
29328
29330
|
}
|
|
29329
29331
|
break;
|
|
29330
29332
|
case "atx_heading":
|
|
@@ -29337,14 +29339,14 @@ function treeToTokens(t, e, A) {
|
|
|
29337
29339
|
NESTING_OPENING
|
|
29338
29340
|
);
|
|
29339
29341
|
u.level = r, u.markup = o(d) || "#", u.attrSet("margin_before", "1"), n.push(u);
|
|
29340
|
-
const
|
|
29341
|
-
|
|
29342
|
-
const
|
|
29342
|
+
const E = [...g.children.filter((f) => !!f)];
|
|
29343
|
+
E.length > 0 && E[0].type.endsWith("_marker") && E.splice(0, 1), E.length > 0 && E[0].type === "whitespace" && E.splice(0, 1), E.length > 0 && E[E.length - 1].type === "whitespace" && E.splice(E.length - 1, 1), r++, E.forEach((f) => l(f, c)), r--;
|
|
29344
|
+
const B = new Token(
|
|
29343
29345
|
I + "_close",
|
|
29344
29346
|
h,
|
|
29345
29347
|
NESTING_CLOSING
|
|
29346
29348
|
);
|
|
29347
|
-
|
|
29349
|
+
B.level = r, B.attrSet("margin_after", "1"), n.push(B);
|
|
29348
29350
|
}
|
|
29349
29351
|
break;
|
|
29350
29352
|
case "minus_metadata":
|
|
@@ -29367,10 +29369,10 @@ function treeToTokens(t, e, A) {
|
|
|
29367
29369
|
NESTING_SELF_CLOSING
|
|
29368
29370
|
);
|
|
29369
29371
|
u.meta = "noEscText", u.level = r, u.markup = "```", h && u.attrSet("lang", o(h) || "");
|
|
29370
|
-
const
|
|
29372
|
+
const B = [
|
|
29371
29373
|
...g.children.filter((f) => !!f).filter((f) => f?.type === "code_fence_content")
|
|
29372
29374
|
].map((f) => o(f) || "").join("");
|
|
29373
|
-
u.content =
|
|
29375
|
+
u.content = B, u.attrSet("margin_before", "1"), u.attrSet("margin_after", "1"), n.push(u);
|
|
29374
29376
|
}
|
|
29375
29377
|
break;
|
|
29376
29378
|
case "block_quote":
|
|
@@ -29380,7 +29382,7 @@ function treeToTokens(t, e, A) {
|
|
|
29380
29382
|
d,
|
|
29381
29383
|
NESTING_OPENING
|
|
29382
29384
|
);
|
|
29383
|
-
h.level = r, h.attrSet("margin_before", "1"), n.push(h), r++, g.children?.filter((
|
|
29385
|
+
h.level = r, h.attrSet("margin_before", "1"), n.push(h), r++, g.children?.filter((E) => !["block_quote_marker"].includes(E.type)).forEach((E) => l(E, c)), r--;
|
|
29384
29386
|
const u = new Token(
|
|
29385
29387
|
I + "_close",
|
|
29386
29388
|
d,
|
|
@@ -29399,17 +29401,17 @@ function treeToTokens(t, e, A) {
|
|
|
29399
29401
|
h.level = r;
|
|
29400
29402
|
let u = 80;
|
|
29401
29403
|
"indent" in g && (u = g.indent.length);
|
|
29402
|
-
const
|
|
29404
|
+
const E = g.text.split(`
|
|
29403
29405
|
`);
|
|
29404
|
-
for (const f of
|
|
29406
|
+
for (const f of E) {
|
|
29405
29407
|
if (f.trim().length === 0)
|
|
29406
29408
|
continue;
|
|
29407
29409
|
const Q = f.match(/^ +/);
|
|
29408
29410
|
Q ? u > Q[0].length && (u = Q[0].length) : u = 0;
|
|
29409
29411
|
}
|
|
29410
|
-
const
|
|
29412
|
+
const B = E.map((f) => f.substring(u)).join(`
|
|
29411
29413
|
`);
|
|
29412
|
-
h.attrSet("indent", "" + u), h.content =
|
|
29414
|
+
h.attrSet("indent", "" + u), h.content = B, h.attrSet("margin_before", "1"), h.attrSet("margin_after", "1"), n.push(h);
|
|
29413
29415
|
}
|
|
29414
29416
|
break;
|
|
29415
29417
|
case "paragraph":
|
|
@@ -29419,7 +29421,7 @@ function treeToTokens(t, e, A) {
|
|
|
29419
29421
|
"p",
|
|
29420
29422
|
NESTING_OPENING
|
|
29421
29423
|
);
|
|
29422
|
-
h.level = r, h.attrSet("margin_before", "1"), n.push(h), r++, g.children?.forEach((
|
|
29424
|
+
h.level = r, h.attrSet("margin_before", "1"), n.push(h), r++, g.children?.forEach((E) => l(E, c)), r--;
|
|
29423
29425
|
const u = new Token(
|
|
29424
29426
|
I + "_close",
|
|
29425
29427
|
"p",
|
|
@@ -29437,8 +29439,8 @@ function treeToTokens(t, e, A) {
|
|
|
29437
29439
|
);
|
|
29438
29440
|
h.attrSet("align", c.cellAlign[c.cellNo] || "left"), h.level = r, n.push(h), r++;
|
|
29439
29441
|
{
|
|
29440
|
-
const
|
|
29441
|
-
|
|
29442
|
+
const E = "paragraph", f = new Token(
|
|
29443
|
+
E + "_open",
|
|
29442
29444
|
"p",
|
|
29443
29445
|
NESTING_OPENING
|
|
29444
29446
|
);
|
|
@@ -29458,7 +29460,7 @@ function treeToTokens(t, e, A) {
|
|
|
29458
29460
|
y.map = m, y.meta = "noEscText", y.content = g.text?.replace(/\s+$/, "") ?? "", s(y, "txt5");
|
|
29459
29461
|
}
|
|
29460
29462
|
const p = new Token(
|
|
29461
|
-
|
|
29463
|
+
E + "_close",
|
|
29462
29464
|
"p",
|
|
29463
29465
|
NESTING_CLOSING
|
|
29464
29466
|
);
|
|
@@ -29481,7 +29483,7 @@ function treeToTokens(t, e, A) {
|
|
|
29481
29483
|
"tr",
|
|
29482
29484
|
NESTING_OPENING
|
|
29483
29485
|
);
|
|
29484
|
-
h.level = r, n.push(h), r++, g.children.filter((
|
|
29486
|
+
h.level = r, n.push(h), r++, g.children.filter((E) => !!E).filter((E) => E.type === "pipe_table_cell").forEach((E) => l(E, c)), r--;
|
|
29485
29487
|
const u = new Token(
|
|
29486
29488
|
"tr_close",
|
|
29487
29489
|
"tr",
|
|
@@ -29498,25 +29500,25 @@ function treeToTokens(t, e, A) {
|
|
|
29498
29500
|
NESTING_OPENING
|
|
29499
29501
|
);
|
|
29500
29502
|
h.level = r, h.attrSet("margin_before", "1"), n.push(h), r++;
|
|
29501
|
-
const u = g.children.filter((p) => !!p).filter((p) => p.type === "pipe_table_delimiter_row"),
|
|
29503
|
+
const u = g.children.filter((p) => !!p).filter((p) => p.type === "pipe_table_delimiter_row"), E = [];
|
|
29502
29504
|
if (u.length > 0) {
|
|
29503
29505
|
const m = u[0].children.filter((y) => !!y).filter((y) => y.type === "pipe_table_delimiter_cell");
|
|
29504
29506
|
for (let y = 0; y < m.length; y++)
|
|
29505
|
-
m[y].children.filter((D) => !!D).find((D) => D.type === "pipe_table_align_right") ?
|
|
29507
|
+
m[y].children.filter((D) => !!D).find((D) => D.type === "pipe_table_align_right") ? E.push("right") : E.push("left");
|
|
29506
29508
|
}
|
|
29507
|
-
const
|
|
29508
|
-
if (
|
|
29509
|
+
const B = g.children.filter((p) => !!p).filter((p) => p.type === "pipe_table_header");
|
|
29510
|
+
if (B.length > 0) {
|
|
29509
29511
|
const p = "thead", m = "thead", y = new Token(
|
|
29510
29512
|
p + "_open",
|
|
29511
29513
|
m,
|
|
29512
29514
|
NESTING_OPENING
|
|
29513
29515
|
);
|
|
29514
|
-
y.level = r, n.push(y), r++,
|
|
29516
|
+
y.level = r, n.push(y), r++, B.forEach(
|
|
29515
29517
|
(D) => l(D, {
|
|
29516
29518
|
...c,
|
|
29517
29519
|
tableRowType: "thead",
|
|
29518
29520
|
cellNo: 0,
|
|
29519
|
-
cellAlign:
|
|
29521
|
+
cellAlign: E
|
|
29520
29522
|
})
|
|
29521
29523
|
), r--;
|
|
29522
29524
|
const w = new Token(
|
|
@@ -29531,7 +29533,7 @@ function treeToTokens(t, e, A) {
|
|
|
29531
29533
|
(p) => l(p, {
|
|
29532
29534
|
...c,
|
|
29533
29535
|
tableRowType: "tbody",
|
|
29534
|
-
cellAlign:
|
|
29536
|
+
cellAlign: E
|
|
29535
29537
|
})
|
|
29536
29538
|
), r--), r--;
|
|
29537
29539
|
const Q = new Token(
|
|
@@ -29550,20 +29552,20 @@ function treeToTokens(t, e, A) {
|
|
|
29550
29552
|
const f = u.children.filter((p) => !!p).find((p) => p.type.startsWith("task_list_marker")), Q = u.children.filter((p) => !!p).find((p) => p.type.startsWith("list_marker_dot"));
|
|
29551
29553
|
f ? (I = "task_list", d = "ul") : Q && (I = "ordered_list", d = "ol", h = (o(Q) || "").trim().replace(".", ""));
|
|
29552
29554
|
}
|
|
29553
|
-
const
|
|
29555
|
+
const E = new Token(
|
|
29554
29556
|
I + "_open",
|
|
29555
29557
|
d,
|
|
29556
29558
|
NESTING_OPENING
|
|
29557
29559
|
);
|
|
29558
|
-
|
|
29560
|
+
E.level = r, E.markup = d === "ol" ? "." : "*", E.attrSet("symbol", d === "ol" ? "1" : "*"), h && E.attrSet("start", h), E.attrSet("margin_before", "1"), n.push(E), r++, g.children.filter((f) => !!f).forEach(
|
|
29559
29561
|
(f) => l(f, c)
|
|
29560
29562
|
), r--;
|
|
29561
|
-
const
|
|
29563
|
+
const B = new Token(
|
|
29562
29564
|
I + "_close",
|
|
29563
29565
|
d,
|
|
29564
29566
|
NESTING_CLOSING
|
|
29565
29567
|
);
|
|
29566
|
-
|
|
29568
|
+
B.level = r, B.attrSet("margin_after", "1"), n.push(B);
|
|
29567
29569
|
}
|
|
29568
29570
|
break;
|
|
29569
29571
|
case "list_item":
|
|
@@ -29572,20 +29574,20 @@ function treeToTokens(t, e, A) {
|
|
|
29572
29574
|
if (!d)
|
|
29573
29575
|
break;
|
|
29574
29576
|
let h = I ? "task_item" : "list_item";
|
|
29575
|
-
const u = "li",
|
|
29577
|
+
const u = "li", E = new Token(
|
|
29576
29578
|
h + "_open",
|
|
29577
29579
|
u,
|
|
29578
29580
|
NESTING_OPENING
|
|
29579
29581
|
);
|
|
29580
|
-
|
|
29582
|
+
E.level = r, E.markup = (o(d) || "").trim(), d.type === "list_marker_dot" && (E.info = "", E.markup = ""), I && (I.type, E.attrSet(
|
|
29581
29583
|
"checked",
|
|
29582
29584
|
I.type === "task_list_marker_checked" ? "checked" : ""
|
|
29583
|
-
)), n.push(
|
|
29585
|
+
)), n.push(E), r++, l(
|
|
29584
29586
|
g.children.filter((Q) => !!Q).find((Q) => Q.type === "paragraph"),
|
|
29585
29587
|
c
|
|
29586
29588
|
);
|
|
29587
|
-
const
|
|
29588
|
-
for (const Q of
|
|
29589
|
+
const B = g.children.filter((Q) => !!Q).filter((Q) => Q.type === "list");
|
|
29590
|
+
for (const Q of B)
|
|
29589
29591
|
l(Q, c);
|
|
29590
29592
|
r--;
|
|
29591
29593
|
const f = new Token(
|
|
@@ -29759,26 +29761,26 @@ const addEmptyLines = (t, e) => {
|
|
|
29759
29761
|
for (let h = 0; h < a.length; h++) {
|
|
29760
29762
|
const u = a[h];
|
|
29761
29763
|
if (["image", "node_bookmark"].includes(u.type.name) && h > 0) {
|
|
29762
|
-
const
|
|
29763
|
-
if (
|
|
29764
|
+
const E = a[h - 1];
|
|
29765
|
+
if (E.type !== o) if (E.type === r)
|
|
29764
29766
|
n.setNodeMarkup(
|
|
29765
|
-
n.mapping.map(g + I -
|
|
29767
|
+
n.mapping.map(g + I - E.nodeSize),
|
|
29766
29768
|
o
|
|
29767
29769
|
);
|
|
29768
29770
|
else {
|
|
29769
|
-
const
|
|
29770
|
-
|
|
29771
|
+
const B = o.createAndFill();
|
|
29772
|
+
B && n.insert(
|
|
29771
29773
|
n.mapping.map(g + I),
|
|
29772
|
-
|
|
29774
|
+
B
|
|
29773
29775
|
);
|
|
29774
29776
|
}
|
|
29775
29777
|
}
|
|
29776
29778
|
if (u.type.name === "softbreak") {
|
|
29777
|
-
const
|
|
29778
|
-
a[h + 1],
|
|
29779
|
+
const E = a[h - 1];
|
|
29780
|
+
a[h + 1], E?.type.name === "softbreak" && n.delete(
|
|
29779
29781
|
n.mapping.map(g + I),
|
|
29780
29782
|
n.mapping.map(g + I + u.nodeSize)
|
|
29781
|
-
),
|
|
29783
|
+
), E?.textContent?.endsWith(" ") && n.delete(
|
|
29782
29784
|
n.mapping.map(g + I),
|
|
29783
29785
|
n.mapping.map(g + I + u.nodeSize)
|
|
29784
29786
|
), d || n.delete(
|
|
@@ -29882,20 +29884,20 @@ const addEmptyLines = (t, e) => {
|
|
|
29882
29884
|
const I = l.attrs.href, d = {}, h = await t(I, {
|
|
29883
29885
|
type: "A",
|
|
29884
29886
|
dest: "md",
|
|
29885
|
-
setMeta: (u,
|
|
29886
|
-
d[u] =
|
|
29887
|
+
setMeta: (u, E) => {
|
|
29888
|
+
d[u] = E;
|
|
29887
29889
|
}
|
|
29888
29890
|
});
|
|
29889
29891
|
if (h !== I || d.mdTemplate) {
|
|
29890
29892
|
const u = d.mdTemplate;
|
|
29891
29893
|
n.removeMark(n.mapping.map(g), n.mapping.map(c), l);
|
|
29892
|
-
const
|
|
29894
|
+
const E = e.schema.mark("link", {
|
|
29893
29895
|
...l.attrs,
|
|
29894
29896
|
href: h,
|
|
29895
29897
|
origUrl: I,
|
|
29896
29898
|
mdTemplate: u
|
|
29897
29899
|
});
|
|
29898
|
-
n.addMark(n.mapping.map(g), n.mapping.map(c),
|
|
29900
|
+
n.addMark(n.mapping.map(g), n.mapping.map(c), E);
|
|
29899
29901
|
}
|
|
29900
29902
|
}
|
|
29901
29903
|
for (const [l, g] of a) {
|
|
@@ -29923,9 +29925,9 @@ const addEmptyLines = (t, e) => {
|
|
|
29923
29925
|
let h = 0;
|
|
29924
29926
|
if (c.type.name === "code_block" && c.textContent.trim())
|
|
29925
29927
|
return;
|
|
29926
|
-
function u(
|
|
29928
|
+
function u(B, f) {
|
|
29927
29929
|
let Q = I + f;
|
|
29928
|
-
for (let p =
|
|
29930
|
+
for (let p = B - 1; p >= 0; p--) {
|
|
29929
29931
|
const m = g[p];
|
|
29930
29932
|
if (m?.type.name !== "text")
|
|
29931
29933
|
break;
|
|
@@ -29943,12 +29945,12 @@ const addEmptyLines = (t, e) => {
|
|
|
29943
29945
|
break;
|
|
29944
29946
|
}
|
|
29945
29947
|
}
|
|
29946
|
-
let
|
|
29947
|
-
for (let
|
|
29948
|
-
const f = g[
|
|
29948
|
+
let E = !1;
|
|
29949
|
+
for (let B = 0; B < g.length; B++) {
|
|
29950
|
+
const f = g[B];
|
|
29949
29951
|
if (f.isText) {
|
|
29950
29952
|
let Q = f.text || "";
|
|
29951
|
-
if (Q.match(/^([ \t\u00A0]+)/) && !
|
|
29953
|
+
if (Q.match(/^([ \t\u00A0]+)/) && !E && a !== c.type) {
|
|
29952
29954
|
Q = Q.replace(/^[ \t\u00A0]+/, "");
|
|
29953
29955
|
const p = I + h, m = p + f.nodeSize;
|
|
29954
29956
|
Q ? r.replaceRangeWith(
|
|
@@ -29957,9 +29959,9 @@ const addEmptyLines = (t, e) => {
|
|
|
29957
29959
|
n.text(Q)
|
|
29958
29960
|
) : r.replace(r.mapping.map(p), r.mapping.map(m));
|
|
29959
29961
|
}
|
|
29960
|
-
Q && (
|
|
29962
|
+
Q && (E = !0);
|
|
29961
29963
|
}
|
|
29962
|
-
o === f.type && (u(
|
|
29964
|
+
o === f.type && (u(B, h), B + 1 < g.length && (g[B + 1].type === o || g[B + 1].type === s) && r.setNodeMarkup(r.mapping.map(I + h), s)), l(f.children, f, I + h + 1, d + 1), h += f.nodeSize;
|
|
29963
29965
|
}
|
|
29964
29966
|
u(g.length, h);
|
|
29965
29967
|
}
|
|
@@ -30010,8 +30012,8 @@ const addEmptyLines = (t, e) => {
|
|
|
30010
30012
|
if (u.type !== r)
|
|
30011
30013
|
break;
|
|
30012
30014
|
d -= u.nodeSize;
|
|
30013
|
-
const
|
|
30014
|
-
n.replace(n.mapping.map(
|
|
30015
|
+
const E = g + d, B = E + u.nodeSize;
|
|
30016
|
+
n.replace(n.mapping.map(E), n.mapping.map(B));
|
|
30015
30017
|
}
|
|
30016
30018
|
return;
|
|
30017
30019
|
}
|
|
@@ -30269,11 +30271,6 @@ const icons = {
|
|
|
30269
30271
|
width: 24,
|
|
30270
30272
|
height: 24,
|
|
30271
30273
|
path: "M3 21h18v-2H3v2zm0-4h18v-2H3v2zm0-4h18v-2H3v2zm0-4h18V7H3v2zm0-6v2h18V3H3z"
|
|
30272
|
-
},
|
|
30273
|
-
folderOpen: {
|
|
30274
|
-
width: 24,
|
|
30275
|
-
height: 24,
|
|
30276
|
-
path: "M20 6h-8l-2-2H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2zm0 12H4V8h16v10z"
|
|
30277
30274
|
}
|
|
30278
30275
|
};
|
|
30279
30276
|
class MenuItem {
|
|
@@ -30541,131 +30538,105 @@ function markActive(t, e) {
|
|
|
30541
30538
|
return o ? !!e.isInSet(t.storedMarks || n.marks()) : t.doc.rangeHasMark(A, r, e);
|
|
30542
30539
|
}
|
|
30543
30540
|
function buildMenu(t, e) {
|
|
30544
|
-
function A(E,
|
|
30545
|
-
let
|
|
30546
|
-
active(
|
|
30547
|
-
return markActive(
|
|
30541
|
+
function A(E, B) {
|
|
30542
|
+
let f = {
|
|
30543
|
+
active(Q) {
|
|
30544
|
+
return markActive(Q, E);
|
|
30548
30545
|
}
|
|
30549
30546
|
};
|
|
30550
|
-
for (let
|
|
30551
|
-
Q
|
|
30552
|
-
return cmdItem(t.commandFactories.toggleMark(E),
|
|
30553
|
-
}
|
|
30554
|
-
function n(E,
|
|
30555
|
-
let
|
|
30556
|
-
run(
|
|
30557
|
-
return t.commandFactories.wrapIn(E,
|
|
30547
|
+
for (let Q in B)
|
|
30548
|
+
f[Q] = B[Q];
|
|
30549
|
+
return cmdItem(t.commandFactories.toggleMark(E), f);
|
|
30550
|
+
}
|
|
30551
|
+
function n(E, B) {
|
|
30552
|
+
let f = {
|
|
30553
|
+
run(Q, p) {
|
|
30554
|
+
return t.commandFactories.wrapIn(E, B.attrs).apply({
|
|
30558
30555
|
editor: t
|
|
30559
|
-
}, [
|
|
30556
|
+
}, [Q, p]);
|
|
30560
30557
|
},
|
|
30561
|
-
select(
|
|
30562
|
-
return t.commandFactories.wrapIn(E,
|
|
30558
|
+
select(Q) {
|
|
30559
|
+
return t.commandFactories.wrapIn(E, B.attrs).apply({
|
|
30563
30560
|
editor: t
|
|
30564
|
-
}, [
|
|
30561
|
+
}, [Q]);
|
|
30565
30562
|
}
|
|
30566
30563
|
};
|
|
30567
|
-
for (let
|
|
30568
|
-
Q
|
|
30569
|
-
return new MenuItem(
|
|
30570
|
-
}
|
|
30571
|
-
function r(E,
|
|
30572
|
-
let
|
|
30573
|
-
run:
|
|
30574
|
-
enable(
|
|
30575
|
-
return
|
|
30564
|
+
for (let Q in B)
|
|
30565
|
+
f[Q] = B[Q];
|
|
30566
|
+
return new MenuItem(f);
|
|
30567
|
+
}
|
|
30568
|
+
function r(E, B) {
|
|
30569
|
+
let f = t.commandFactories.setBlockType(E, B.attrs), Q = {
|
|
30570
|
+
run: f,
|
|
30571
|
+
enable(p) {
|
|
30572
|
+
return f.apply({ editor: t }, [p]);
|
|
30576
30573
|
},
|
|
30577
|
-
active(
|
|
30578
|
-
let { $from:
|
|
30579
|
-
return
|
|
30574
|
+
active(p) {
|
|
30575
|
+
let { $from: m, to: y, node: w } = p.selection;
|
|
30576
|
+
return w ? w.hasMarkup(E, B.attrs) : y <= m.end() && m.parent.hasMarkup(E, B.attrs);
|
|
30580
30577
|
}
|
|
30581
30578
|
};
|
|
30582
|
-
for (let
|
|
30583
|
-
p
|
|
30584
|
-
return new MenuItem(
|
|
30579
|
+
for (let p in B)
|
|
30580
|
+
Q[p] = B[p];
|
|
30581
|
+
return new MenuItem(Q);
|
|
30585
30582
|
}
|
|
30586
30583
|
const o = [];
|
|
30587
30584
|
o.push(
|
|
30588
|
-
new MenuItem({
|
|
30589
|
-
title: "Load document",
|
|
30590
|
-
icon: icons.folderOpen,
|
|
30591
|
-
run() {
|
|
30592
|
-
const E = document.createElement("input");
|
|
30593
|
-
return E.type = "file", E.accept = ".odt,application/vnd.oasis.opendocument.text,.md,text/markdown,text/x-markdown", E.onchange = async (f) => {
|
|
30594
|
-
const Q = f.target.files?.[0];
|
|
30595
|
-
if (Q)
|
|
30596
|
-
try {
|
|
30597
|
-
const p = await Q.arrayBuffer();
|
|
30598
|
-
let m = Q.type;
|
|
30599
|
-
if (!m || m === "") {
|
|
30600
|
-
const y = Q.name.split(".").pop()?.toLowerCase();
|
|
30601
|
-
y === "odt" ? m = "application/vnd.oasis.opendocument.text" : y === "md" && (m = "text/x-markdown");
|
|
30602
|
-
}
|
|
30603
|
-
m ? await t.loadDocument(m, new Uint8Array(p)) : console.error("Could not determine file type for:", Q.name);
|
|
30604
|
-
} catch (p) {
|
|
30605
|
-
console.error("Failed to load document:", p);
|
|
30606
|
-
}
|
|
30607
|
-
}, E.click(), !0;
|
|
30608
|
-
},
|
|
30609
|
-
enable: () => !0
|
|
30610
|
-
})
|
|
30611
|
-
);
|
|
30612
|
-
const s = [];
|
|
30613
|
-
s.push(
|
|
30614
30585
|
new MenuItem({
|
|
30615
30586
|
title: "Undo last change",
|
|
30616
|
-
run: (E,
|
|
30617
|
-
const
|
|
30618
|
-
return
|
|
30587
|
+
run: (E, B) => {
|
|
30588
|
+
const f = t.commandFactories.undo?.();
|
|
30589
|
+
return f ? f.apply({ editor: t }, [E, B]) : !1;
|
|
30619
30590
|
},
|
|
30620
30591
|
enable: (E) => {
|
|
30621
|
-
const
|
|
30622
|
-
return
|
|
30592
|
+
const B = t.commandFactories.undo?.();
|
|
30593
|
+
return B ? B.apply({ editor: t }, [E]) : !1;
|
|
30623
30594
|
},
|
|
30624
30595
|
icon: icons.undo
|
|
30625
30596
|
})
|
|
30626
|
-
),
|
|
30597
|
+
), o.push(
|
|
30627
30598
|
new MenuItem({
|
|
30628
30599
|
title: "Redo last undone change",
|
|
30629
|
-
run: (E,
|
|
30630
|
-
const
|
|
30631
|
-
return
|
|
30600
|
+
run: (E, B) => {
|
|
30601
|
+
const f = t.commandFactories.redo?.();
|
|
30602
|
+
return f ? f.apply({ editor: t }, [E, B]) : !1;
|
|
30632
30603
|
},
|
|
30633
30604
|
enable: (E) => {
|
|
30634
|
-
const
|
|
30635
|
-
return
|
|
30605
|
+
const B = t.commandFactories.redo?.();
|
|
30606
|
+
return B ? B.apply({ editor: t }, [E]) : !1;
|
|
30636
30607
|
},
|
|
30637
30608
|
icon: icons.redo
|
|
30638
30609
|
})
|
|
30639
30610
|
);
|
|
30640
|
-
const
|
|
30641
|
-
if (e.nodes.paragraph &&
|
|
30611
|
+
const s = [], a = [];
|
|
30612
|
+
if (e.nodes.paragraph && a.push(r(e.nodes.paragraph, {
|
|
30642
30613
|
title: "Change to paragraph",
|
|
30643
30614
|
label: "Plain"
|
|
30644
|
-
})), e.nodes.code_block &&
|
|
30615
|
+
})), e.nodes.code_block && a.push(r(e.nodes.code_block, {
|
|
30645
30616
|
title: "Change to code block",
|
|
30646
30617
|
label: "Code"
|
|
30647
|
-
})),
|
|
30648
|
-
new Dropdown(
|
|
30618
|
+
})), a.length > 0 && s.push(
|
|
30619
|
+
new Dropdown(a, {
|
|
30649
30620
|
label: "Type",
|
|
30650
30621
|
icon: icons.type
|
|
30651
30622
|
})
|
|
30652
30623
|
), e.nodes.heading) {
|
|
30653
30624
|
const E = [];
|
|
30654
|
-
for (let
|
|
30625
|
+
for (let B = 1; B <= 6; B++)
|
|
30655
30626
|
E.push(r(e.nodes.heading, {
|
|
30656
|
-
title: "Change to heading " +
|
|
30657
|
-
label: "Heading " +
|
|
30658
|
-
attrs: { level:
|
|
30627
|
+
title: "Change to heading " + B,
|
|
30628
|
+
label: "Heading " + B,
|
|
30629
|
+
attrs: { level: B }
|
|
30659
30630
|
}));
|
|
30660
|
-
|
|
30631
|
+
s.push(
|
|
30661
30632
|
new Dropdown(E, {
|
|
30662
30633
|
label: "Heading",
|
|
30663
30634
|
icon: icons.heading
|
|
30664
30635
|
})
|
|
30665
30636
|
);
|
|
30666
30637
|
}
|
|
30667
|
-
const
|
|
30668
|
-
e.nodes.bullet_list &&
|
|
30638
|
+
const l = [];
|
|
30639
|
+
e.nodes.bullet_list && l.push(
|
|
30669
30640
|
cmdItem(
|
|
30670
30641
|
t.commandFactories.toggleBulletList(),
|
|
30671
30642
|
{
|
|
@@ -30674,7 +30645,7 @@ function buildMenu(t, e) {
|
|
|
30674
30645
|
icon: icons.bulletList
|
|
30675
30646
|
}
|
|
30676
30647
|
)
|
|
30677
|
-
), e.nodes.ordered_list &&
|
|
30648
|
+
), e.nodes.ordered_list && l.push(
|
|
30678
30649
|
cmdItem(
|
|
30679
30650
|
t.commandFactories.toggleOrderedList(),
|
|
30680
30651
|
{
|
|
@@ -30683,7 +30654,7 @@ function buildMenu(t, e) {
|
|
|
30683
30654
|
icon: icons.orderedList
|
|
30684
30655
|
}
|
|
30685
30656
|
)
|
|
30686
|
-
), e.nodes.task_list &&
|
|
30657
|
+
), e.nodes.task_list && l.push(
|
|
30687
30658
|
cmdItem(
|
|
30688
30659
|
t.commandFactories.toggleTaskList(),
|
|
30689
30660
|
{
|
|
@@ -30692,69 +30663,69 @@ function buildMenu(t, e) {
|
|
|
30692
30663
|
icon: icons.taskList
|
|
30693
30664
|
}
|
|
30694
30665
|
)
|
|
30695
|
-
),
|
|
30696
|
-
new Dropdown(
|
|
30666
|
+
), l.length > 0 && s.push(
|
|
30667
|
+
new Dropdown(l, {
|
|
30697
30668
|
label: "Lists",
|
|
30698
30669
|
icon: icons.bulletList
|
|
30699
30670
|
})
|
|
30700
|
-
),
|
|
30671
|
+
), s.push(
|
|
30701
30672
|
new MenuItem({
|
|
30702
30673
|
title: "Lift out of enclosing block",
|
|
30703
30674
|
run: () => t.chain().lift().run(),
|
|
30704
30675
|
select: () => t.can().lift().run(),
|
|
30705
30676
|
icon: icons.outdent
|
|
30706
30677
|
})
|
|
30707
|
-
), e.nodes.blockquote &&
|
|
30678
|
+
), e.nodes.blockquote && s.push(n(e.nodes.blockquote, {
|
|
30708
30679
|
title: "Wrap in block quote",
|
|
30709
30680
|
icon: icons.blockquote
|
|
30710
30681
|
}));
|
|
30711
|
-
const
|
|
30712
|
-
if (e.marks.strong &&
|
|
30682
|
+
const g = [];
|
|
30683
|
+
if (e.marks.strong && g.push(
|
|
30713
30684
|
new MenuItem({
|
|
30714
30685
|
title: "Toggle bold",
|
|
30715
30686
|
run: () => t.chain().toggleStrong().run(),
|
|
30716
30687
|
enable: (E) => t.can().toggleStrong().run(),
|
|
30717
30688
|
icon: icons.strong
|
|
30718
30689
|
})
|
|
30719
|
-
), e.marks.em &&
|
|
30690
|
+
), e.marks.em && g.push(
|
|
30720
30691
|
new MenuItem({
|
|
30721
30692
|
title: "Toggle italic",
|
|
30722
30693
|
run: () => t.chain().toggleItalic().run(),
|
|
30723
30694
|
enable: (E) => t.can().toggleItalic().run(),
|
|
30724
30695
|
icon: icons.em
|
|
30725
30696
|
})
|
|
30726
|
-
), e.marks.strike &&
|
|
30697
|
+
), e.marks.strike && g.push(A(e.marks.strike, {
|
|
30727
30698
|
title: "Toggle strikethrough",
|
|
30728
30699
|
icon: icons.strike
|
|
30729
|
-
})), e.marks.code &&
|
|
30700
|
+
})), e.marks.code && g.push(A(e.marks.code, {
|
|
30730
30701
|
title: "Toggle code font",
|
|
30731
30702
|
icon: icons.code
|
|
30732
|
-
})), e.marks.underline &&
|
|
30703
|
+
})), e.marks.underline && g.push(
|
|
30733
30704
|
new MenuItem({
|
|
30734
30705
|
title: "Toggle underline",
|
|
30735
30706
|
run: () => t.chain().toggleUnderline().run(),
|
|
30736
30707
|
enable: (E) => t.can().toggleUnderline().run(),
|
|
30737
30708
|
icon: icons.underline
|
|
30738
30709
|
})
|
|
30739
|
-
), e.marks.highlight &&
|
|
30710
|
+
), e.marks.highlight && g.push(A(e.marks.highlight, {
|
|
30740
30711
|
title: "Toggle highlight",
|
|
30741
30712
|
icon: icons.highlight
|
|
30742
30713
|
})), e.marks.link) {
|
|
30743
30714
|
const E = e.marks.link;
|
|
30744
|
-
|
|
30715
|
+
g.push(
|
|
30745
30716
|
new MenuItem({
|
|
30746
30717
|
title: "Add or remove link",
|
|
30747
30718
|
icon: icons.link,
|
|
30748
|
-
active(
|
|
30749
|
-
return markActive(
|
|
30719
|
+
active(B) {
|
|
30720
|
+
return markActive(B, E);
|
|
30750
30721
|
},
|
|
30751
|
-
enable(
|
|
30752
|
-
return !
|
|
30722
|
+
enable(B) {
|
|
30723
|
+
return !B.selection.empty;
|
|
30753
30724
|
},
|
|
30754
|
-
run(
|
|
30755
|
-
return markActive(
|
|
30756
|
-
|
|
30757
|
-
|
|
30725
|
+
run(B, f) {
|
|
30726
|
+
return markActive(B, E) ? (t.commandFactories.toggleMark(E).apply({ editor: t }, [
|
|
30727
|
+
B,
|
|
30728
|
+
f
|
|
30758
30729
|
]), !0) : (openPrompt({
|
|
30759
30730
|
title: "Create a link",
|
|
30760
30731
|
fields: {
|
|
@@ -30764,8 +30735,8 @@ function buildMenu(t, e) {
|
|
|
30764
30735
|
}),
|
|
30765
30736
|
title: new TextField({ label: "Title" })
|
|
30766
30737
|
},
|
|
30767
|
-
callback(
|
|
30768
|
-
t.commandFactories.toggleMark(E,
|
|
30738
|
+
callback(Q) {
|
|
30739
|
+
t.commandFactories.toggleMark(E, Q).apply({
|
|
30769
30740
|
editor: t
|
|
30770
30741
|
}, [
|
|
30771
30742
|
t.view.state,
|
|
@@ -30777,37 +30748,37 @@ function buildMenu(t, e) {
|
|
|
30777
30748
|
})
|
|
30778
30749
|
);
|
|
30779
30750
|
}
|
|
30780
|
-
const
|
|
30781
|
-
e.marks.superscript &&
|
|
30751
|
+
const c = [];
|
|
30752
|
+
e.marks.superscript && c.push(A(e.marks.superscript, {
|
|
30782
30753
|
title: "Toggle superscript",
|
|
30783
30754
|
icon: icons.superscript
|
|
30784
|
-
})), e.marks.subscript &&
|
|
30755
|
+
})), e.marks.subscript && c.push(A(e.marks.subscript, {
|
|
30785
30756
|
title: "Toggle subscript",
|
|
30786
30757
|
icon: icons.subscript
|
|
30787
30758
|
}));
|
|
30788
|
-
const
|
|
30789
|
-
e.nodes.paragraph?.spec?.attrs?.textAlign !== void 0 && (
|
|
30759
|
+
const I = [];
|
|
30760
|
+
e.nodes.paragraph?.spec?.attrs?.textAlign !== void 0 && (I.push(
|
|
30790
30761
|
new MenuItem({
|
|
30791
30762
|
title: "Align left",
|
|
30792
30763
|
icon: icons.alignLeft,
|
|
30793
30764
|
run: () => t.chain().setTextAlignLeft().run(),
|
|
30794
30765
|
enable: () => t.can().setTextAlignLeft().run()
|
|
30795
30766
|
})
|
|
30796
|
-
),
|
|
30767
|
+
), I.push(
|
|
30797
30768
|
new MenuItem({
|
|
30798
30769
|
title: "Align center",
|
|
30799
30770
|
icon: icons.alignCenter,
|
|
30800
30771
|
run: () => t.chain().setTextAlignCenter().run(),
|
|
30801
30772
|
enable: () => t.can().setTextAlignCenter().run()
|
|
30802
30773
|
})
|
|
30803
|
-
),
|
|
30774
|
+
), I.push(
|
|
30804
30775
|
new MenuItem({
|
|
30805
30776
|
title: "Align right",
|
|
30806
30777
|
icon: icons.alignRight,
|
|
30807
30778
|
run: () => t.chain().setTextAlignRight().run(),
|
|
30808
30779
|
enable: () => t.can().setTextAlignRight().run()
|
|
30809
30780
|
})
|
|
30810
|
-
),
|
|
30781
|
+
), I.push(
|
|
30811
30782
|
new MenuItem({
|
|
30812
30783
|
title: "Justify",
|
|
30813
30784
|
icon: icons.alignJustify,
|
|
@@ -30815,37 +30786,37 @@ function buildMenu(t, e) {
|
|
|
30815
30786
|
enable: () => t.can().setTextAlignJustify().run()
|
|
30816
30787
|
})
|
|
30817
30788
|
));
|
|
30818
|
-
const
|
|
30789
|
+
const d = [];
|
|
30819
30790
|
if (e.nodes.image) {
|
|
30820
30791
|
const E = e.nodes.image;
|
|
30821
|
-
|
|
30792
|
+
d.push(
|
|
30822
30793
|
new MenuItem({
|
|
30823
30794
|
title: "Insert image",
|
|
30824
30795
|
icon: icons.image,
|
|
30825
|
-
enable: (
|
|
30826
|
-
run(
|
|
30827
|
-
let { from:
|
|
30828
|
-
return
|
|
30796
|
+
enable: (B) => canInsert(B, E),
|
|
30797
|
+
run(B, f) {
|
|
30798
|
+
let { from: Q, to: p } = B.selection, m = null;
|
|
30799
|
+
return B.selection instanceof NodeSelection && B.selection.node.type == E && (m = B.selection.node.attrs), openPrompt({
|
|
30829
30800
|
title: "Insert image",
|
|
30830
30801
|
fields: {
|
|
30831
30802
|
src: new FileField({
|
|
30832
30803
|
label: "Choose image",
|
|
30833
30804
|
required: !0,
|
|
30834
|
-
value:
|
|
30805
|
+
value: m && m.src
|
|
30835
30806
|
}),
|
|
30836
30807
|
title: new TextField({
|
|
30837
30808
|
label: "Title",
|
|
30838
|
-
value:
|
|
30809
|
+
value: m && m.title
|
|
30839
30810
|
}),
|
|
30840
30811
|
alt: new TextField({
|
|
30841
30812
|
label: "Description",
|
|
30842
|
-
value:
|
|
30813
|
+
value: m ? m.alt : B.doc.textBetween(Q, p, " ")
|
|
30843
30814
|
})
|
|
30844
30815
|
},
|
|
30845
|
-
callback(
|
|
30816
|
+
callback(y) {
|
|
30846
30817
|
t.view.dispatch(
|
|
30847
30818
|
t.view.state.tr.replaceSelectionWith(
|
|
30848
|
-
E.createAndFill(
|
|
30819
|
+
E.createAndFill(y)
|
|
30849
30820
|
)
|
|
30850
30821
|
), t.view.focus();
|
|
30851
30822
|
}
|
|
@@ -30854,7 +30825,7 @@ function buildMenu(t, e) {
|
|
|
30854
30825
|
})
|
|
30855
30826
|
);
|
|
30856
30827
|
}
|
|
30857
|
-
if (e.nodes.hr &&
|
|
30828
|
+
if (e.nodes.hr && d.push(
|
|
30858
30829
|
new MenuItem({
|
|
30859
30830
|
title: "Insert horizontal rule",
|
|
30860
30831
|
icon: icons.horizontalRule,
|
|
@@ -30862,11 +30833,11 @@ function buildMenu(t, e) {
|
|
|
30862
30833
|
enable: (E) => t.can().setHorizontalRule().run()
|
|
30863
30834
|
})
|
|
30864
30835
|
), e.nodes.table) {
|
|
30865
|
-
const E = (
|
|
30866
|
-
label:
|
|
30867
|
-
enable: () => t.can()[
|
|
30868
|
-
run: () => t.chain()[
|
|
30869
|
-
}),
|
|
30836
|
+
const E = (f, Q) => new MenuItem({
|
|
30837
|
+
label: f,
|
|
30838
|
+
enable: () => t.can()[Q]().run(),
|
|
30839
|
+
run: () => t.chain()[Q]().run()
|
|
30840
|
+
}), B = [
|
|
30870
30841
|
E("Insert table", "insertTable"),
|
|
30871
30842
|
E("Insert column before", "addColumnBefore"),
|
|
30872
30843
|
E("Insert column after", "addColumnAfter"),
|
|
@@ -30881,12 +30852,12 @@ function buildMenu(t, e) {
|
|
|
30881
30852
|
E("Toggle header row", "toggleHeaderRow"),
|
|
30882
30853
|
E("Toggle header cells", "toggleHeaderCell")
|
|
30883
30854
|
];
|
|
30884
|
-
|
|
30885
|
-
new Dropdown(
|
|
30855
|
+
d.push(
|
|
30856
|
+
new Dropdown(B, { label: "Table", icon: icons.table })
|
|
30886
30857
|
);
|
|
30887
30858
|
}
|
|
30888
|
-
const
|
|
30889
|
-
return
|
|
30859
|
+
const h = [];
|
|
30860
|
+
return h.push(
|
|
30890
30861
|
new MenuItem({
|
|
30891
30862
|
title: "Select parent node",
|
|
30892
30863
|
run: () => t.chain().selectParentNode().run(),
|
|
@@ -30895,27 +30866,25 @@ function buildMenu(t, e) {
|
|
|
30895
30866
|
})
|
|
30896
30867
|
), [
|
|
30897
30868
|
o,
|
|
30898
|
-
// Load Document
|
|
30899
|
-
s,
|
|
30900
30869
|
// Undo, Redo
|
|
30901
|
-
|
|
30870
|
+
s,
|
|
30902
30871
|
// Heading, Lift, Join, Blockquote
|
|
30903
|
-
|
|
30872
|
+
g,
|
|
30904
30873
|
// Bold, Italic, Strikethrough, Code, Underline, Highlight, Link
|
|
30905
|
-
|
|
30874
|
+
c,
|
|
30906
30875
|
// Superscript, Subscript
|
|
30907
|
-
|
|
30876
|
+
I,
|
|
30908
30877
|
// Align left, center, right, Justify
|
|
30909
|
-
|
|
30878
|
+
d,
|
|
30910
30879
|
// Image, Lists, HR, Table, Type
|
|
30911
|
-
|
|
30880
|
+
h
|
|
30912
30881
|
// Select parent node
|
|
30913
30882
|
].filter((E) => E.length > 0);
|
|
30914
30883
|
}
|
|
30915
30884
|
const CSS_PREFIX$1 = "kb-custom-menu", STORAGE_KEY = "kb-custom-menu-order", OVERFLOW_BUTTON_WIDTH = 48, DRAG_START_DELAY = 2e3;
|
|
30916
30885
|
class CustomMenuView {
|
|
30917
30886
|
constructor(e, A, n) {
|
|
30918
|
-
this.editorView = e, this.editor = A, this.content = n, this.pinnedDropdownMenu = null, this.tools = [], this.closeOverflowHandler = null, this.closePinnedDropdownHandler = null, this.keydownHandler = null, this.submenuStack = [], this.pinnedDropdownStack = [], this.resizeObserver = null, this.draggedItem = null, this.dragStartTimer = null, this.isDragging = !1, this.isDraggingFromOverflow = !1, this.dragPlaceholder = null, this.dragGhost = null, this.dragSourceWrapper = null, this.currentOverflowTools = [], this.defaultOrder = [], this.
|
|
30887
|
+
this.editorView = e, this.editor = A, this.content = n, this.pinnedDropdownMenu = null, this.tools = [], this.closeOverflowHandler = null, this.closePinnedDropdownHandler = null, this.keydownHandler = null, this.submenuStack = [], this.pinnedDropdownStack = [], this.resizeObserver = null, this.draggedItem = null, this.dragStartTimer = null, this.isDragging = !1, this.isDraggingFromOverflow = !1, this.dragPlaceholder = null, this.dragGhost = null, this.dragSourceWrapper = null, this.currentOverflowTools = [], this.defaultOrder = [], this.root = e.root, this.wrapper = document.createElement("div"), this.wrapper.classList.add(CSS_PREFIX$1 + "__wrapper"), this.toolbar = document.createElement("div"), this.toolbar.classList.add(CSS_PREFIX$1), this.toolbar.setAttribute("role", "toolbar"), this.wrapper.appendChild(this.toolbar), e.dom.parentNode && e.dom.parentNode.replaceChild(this.wrapper, e.dom), this.wrapper.appendChild(e.dom), this.overflowMenu = document.createElement("div"), this.overflowMenu.classList.add(CSS_PREFIX$1 + "__overflow-menu"), this.overflowMenu.style.display = "none", this.wrapper.insertBefore(this.overflowMenu, e.dom), e.dom.classList.add("kb-custom-menu__editor"), this.initializeTools(), this.loadOrderState(), this.render(), typeof ResizeObserver < "u" && (this.resizeObserver = new ResizeObserver(() => {
|
|
30919
30888
|
this.render();
|
|
30920
30889
|
}), this.resizeObserver.observe(this.toolbar)), this.setupKeyboardNavigation();
|
|
30921
30890
|
}
|
|
@@ -31237,8 +31206,8 @@ class CustomMenuView {
|
|
|
31237
31206
|
} else {
|
|
31238
31207
|
const { dom: c } = a.element.render(this.editorView);
|
|
31239
31208
|
c.querySelectorAll("span").forEach((h) => {
|
|
31240
|
-
const u = h.closest(".kb-icon") !== null,
|
|
31241
|
-
h.textContent && h.textContent.trim() && !u &&
|
|
31209
|
+
const u = h.closest(".kb-icon") !== null, E = h.parentElement === c;
|
|
31210
|
+
h.textContent && h.textContent.trim() && !u && E && !h.querySelector("svg") && !h.classList.contains("kb-icon") && (h.style.display = "none");
|
|
31242
31211
|
});
|
|
31243
31212
|
const d = document.createElement("span");
|
|
31244
31213
|
d.classList.add(CSS_PREFIX$1 + "__overflow-item-label"), d.textContent = a.label, g.appendChild(c), g.appendChild(d), g.addEventListener("mousedown", (h) => {
|
|
@@ -31299,22 +31268,22 @@ class CustomMenuView {
|
|
|
31299
31268
|
h.classList.add(CSS_PREFIX$1 + "__overflow-item-label"), h.textContent = a.label, g.appendChild(c), g.appendChild(h), g.addEventListener("mousedown", (u) => {
|
|
31300
31269
|
if (u.target !== c) {
|
|
31301
31270
|
u.preventDefault();
|
|
31302
|
-
const
|
|
31271
|
+
const E = new MouseEvent("mousedown", {
|
|
31303
31272
|
bubbles: !0,
|
|
31304
31273
|
cancelable: !0,
|
|
31305
31274
|
view: window
|
|
31306
31275
|
});
|
|
31307
|
-
c.dispatchEvent(
|
|
31276
|
+
c.dispatchEvent(E);
|
|
31308
31277
|
}
|
|
31309
31278
|
}), g.addEventListener("keydown", (u) => {
|
|
31310
31279
|
if (u.key === "Enter" || u.key === " ") {
|
|
31311
31280
|
u.preventDefault();
|
|
31312
|
-
const
|
|
31281
|
+
const E = new MouseEvent("mousedown", {
|
|
31313
31282
|
bubbles: !0,
|
|
31314
31283
|
cancelable: !0,
|
|
31315
31284
|
view: window
|
|
31316
31285
|
});
|
|
31317
|
-
c.dispatchEvent(
|
|
31286
|
+
c.dispatchEvent(E);
|
|
31318
31287
|
}
|
|
31319
31288
|
});
|
|
31320
31289
|
}
|
|
@@ -31345,7 +31314,7 @@ class CustomMenuView {
|
|
|
31345
31314
|
const { dom: l, update: g } = o.element.render(this.editorView);
|
|
31346
31315
|
l.querySelectorAll("span").forEach((I) => {
|
|
31347
31316
|
!(I.closest(".kb-icon") !== null) && !I.querySelector("svg") && (I.style.display = "none");
|
|
31348
|
-
}), l.style.pointerEvents = "none", a.appendChild(l), a.
|
|
31317
|
+
}), l.style.pointerEvents = "none", a.appendChild(l), a.addEventListener("keydown", (I) => {
|
|
31349
31318
|
(I.key === "Enter" || I.key === " ") && (I.preventDefault(), this.closeAllMenus(), requestAnimationFrame(() => {
|
|
31350
31319
|
const d = o.element;
|
|
31351
31320
|
d.spec && typeof d.spec.run == "function" && d.spec.run(
|
|
@@ -31371,11 +31340,11 @@ class CustomMenuView {
|
|
|
31371
31340
|
this.tools.forEach((I) => {
|
|
31372
31341
|
const d = document.createElement("span");
|
|
31373
31342
|
if (d.classList.add(CSS_PREFIX$1 + "__item"), d.setAttribute("data-tool-id", I.id), d.setAttribute("draggable", "false"), I.element.content !== void 0) {
|
|
31374
|
-
const { dom:
|
|
31375
|
-
|
|
31343
|
+
const { dom: E } = I.element.render(this.editorView), B = E.querySelector(".kb-dropdown__content");
|
|
31344
|
+
B && (B.style.display = "none"), d.appendChild(E);
|
|
31376
31345
|
} else {
|
|
31377
|
-
const { dom:
|
|
31378
|
-
d.appendChild(
|
|
31346
|
+
const { dom: E } = I.element.render(this.editorView);
|
|
31347
|
+
d.appendChild(E);
|
|
31379
31348
|
}
|
|
31380
31349
|
this.toolbar.appendChild(d);
|
|
31381
31350
|
const u = d.getBoundingClientRect().width;
|
|
@@ -31396,7 +31365,7 @@ class CustomMenuView {
|
|
|
31396
31365
|
u.classList.add(CSS_PREFIX$1 + "__separator"), this.toolbar.appendChild(u);
|
|
31397
31366
|
}
|
|
31398
31367
|
if (c = I.groupIndex, I.element.content !== void 0) {
|
|
31399
|
-
const u = d.querySelector("button"),
|
|
31368
|
+
const u = d.querySelector("button"), E = d.querySelector(".kb-dropdown__label"), B = (Q) => {
|
|
31400
31369
|
if (this.isDragging) {
|
|
31401
31370
|
Q.preventDefault(), Q.stopPropagation(), Q.stopImmediatePropagation();
|
|
31402
31371
|
return;
|
|
@@ -31405,9 +31374,9 @@ class CustomMenuView {
|
|
|
31405
31374
|
}, f = (Q) => {
|
|
31406
31375
|
Q.stopImmediatePropagation(), this.isDragging && Q.stopPropagation();
|
|
31407
31376
|
};
|
|
31408
|
-
u && (u.addEventListener("click",
|
|
31377
|
+
u && (u.addEventListener("click", B, { capture: !0 }), u.addEventListener("mousedown", f, {
|
|
31409
31378
|
capture: !0
|
|
31410
|
-
})),
|
|
31379
|
+
})), E && (E.addEventListener("click", B, { capture: !0 }), E.addEventListener("mousedown", f, {
|
|
31411
31380
|
capture: !0
|
|
31412
31381
|
}));
|
|
31413
31382
|
}
|
|
@@ -31430,9 +31399,9 @@ class CustomMenuView {
|
|
|
31430
31399
|
this.overflowMenu.style.display = h ? "none" : "block", I.setAttribute("aria-expanded", String(!h));
|
|
31431
31400
|
const u = this.editorView.dom.ownerDocument || document;
|
|
31432
31401
|
h ? (this.closeOverflowHandler && u.removeEventListener("click", this.closeOverflowHandler), this.submenuStack = []) : (this.submenuStack = [], this.renderOverflowMenu(), setTimeout(() => {
|
|
31433
|
-
this.closeOverflowHandler && u.removeEventListener("click", this.closeOverflowHandler), this.closeOverflowHandler = (
|
|
31434
|
-
const
|
|
31435
|
-
this.editorView.dom.contains(
|
|
31402
|
+
this.closeOverflowHandler && u.removeEventListener("click", this.closeOverflowHandler), this.closeOverflowHandler = (E) => {
|
|
31403
|
+
const B = E.target;
|
|
31404
|
+
this.editorView.dom.contains(B) || !this.overflowMenu.contains(B) && !this.toolbar.contains(B) && (this.overflowMenu.style.display = "none", I.setAttribute("aria-expanded", "false"), this.submenuStack = [], this.closeOverflowHandler && u.removeEventListener("click", this.closeOverflowHandler));
|
|
31436
31405
|
}, u.addEventListener("click", this.closeOverflowHandler);
|
|
31437
31406
|
}, 0));
|
|
31438
31407
|
}), this.toolbar.appendChild(I);
|
|
@@ -31505,8 +31474,8 @@ class CustomMenuView {
|
|
|
31505
31474
|
let d = null;
|
|
31506
31475
|
if (c)
|
|
31507
31476
|
for (let h = 0; h < I.length; h++) {
|
|
31508
|
-
const u = I[h],
|
|
31509
|
-
a.clientX <
|
|
31477
|
+
const u = I[h], E = u.getBoundingClientRect(), B = E.left + E.width / 2;
|
|
31478
|
+
a.clientX < B && d === null && (d = u);
|
|
31510
31479
|
}
|
|
31511
31480
|
if (this.dragPlaceholder && this.dragPlaceholder.parentNode && this.dragPlaceholder.remove(), c && this.dragPlaceholder)
|
|
31512
31481
|
if (d)
|
|
@@ -31649,19 +31618,6 @@ class CustomMenuView {
|
|
|
31649
31618
|
);
|
|
31650
31619
|
A && A.remove(), this.dragPlaceholder && (this.dragPlaceholder.remove(), this.dragPlaceholder = null), this.dragStartTimer && (clearTimeout(this.dragStartTimer), this.dragStartTimer = null);
|
|
31651
31620
|
}
|
|
31652
|
-
setupResize() {
|
|
31653
|
-
let e = !1, A = 0, n = 0;
|
|
31654
|
-
const r = (a) => {
|
|
31655
|
-
e = !0, A = a.clientY, n = this.editorContainer.offsetHeight, this.wrapper.classList.add(CSS_PREFIX$1 + "__wrapper--resizing"), a.preventDefault(), document.addEventListener("mousemove", o), document.addEventListener("mouseup", s);
|
|
31656
|
-
}, o = (a) => {
|
|
31657
|
-
if (!e) return;
|
|
31658
|
-
const l = a.clientY - A, g = n + l, c = 200, I = window.innerHeight - 100;
|
|
31659
|
-
g >= c && g <= I && (this.editorContainer.style.height = g + "px");
|
|
31660
|
-
}, s = () => {
|
|
31661
|
-
e && (e = !1, this.wrapper.classList.remove(CSS_PREFIX$1 + "__wrapper--resizing"), document.removeEventListener("mousemove", o), document.removeEventListener("mouseup", s));
|
|
31662
|
-
};
|
|
31663
|
-
this.resizeHandle.addEventListener("mousedown", r);
|
|
31664
|
-
}
|
|
31665
31621
|
update(e, A) {
|
|
31666
31622
|
this.tools.forEach((n) => {
|
|
31667
31623
|
n.element.render(this.editorView);
|
|
@@ -31683,14 +31639,14 @@ class CustomMenuPlugin extends Plugin {
|
|
|
31683
31639
|
}
|
|
31684
31640
|
}
|
|
31685
31641
|
class ExtensionCustomMenu extends Extension {
|
|
31686
|
-
constructor() {
|
|
31687
|
-
super(
|
|
31642
|
+
constructor(e = {}) {
|
|
31643
|
+
super(e), this.config = e, this.name = "customMenu";
|
|
31688
31644
|
}
|
|
31689
31645
|
getProseMirrorPlugins() {
|
|
31690
31646
|
if (!this.editor.config.element)
|
|
31691
31647
|
return [];
|
|
31692
|
-
|
|
31693
|
-
return [
|
|
31648
|
+
let e = buildMenu(this.editor, this.editor.schema);
|
|
31649
|
+
return this.config.modifyMenu && (e = this.config.modifyMenu(e)), [
|
|
31694
31650
|
new CustomMenuPlugin(this.editor, {
|
|
31695
31651
|
content: e
|
|
31696
31652
|
})
|
|
@@ -32159,7 +32115,7 @@ const convertCodeParagraphsToCodeBlocks = (t, e) => {
|
|
|
32159
32115
|
const c = [];
|
|
32160
32116
|
for (let I = 0; I < s.childCount; I++) {
|
|
32161
32117
|
const d = s.child(I), h = d.marks.some(
|
|
32162
|
-
(
|
|
32118
|
+
(E) => E.type === o
|
|
32163
32119
|
), u = d.textContent.match(/^[ \t\u00A0]+$/);
|
|
32164
32120
|
if (d.type.name === "node_bookmark") {
|
|
32165
32121
|
c.push(d), g += d.nodeSize;
|
|
@@ -32225,8 +32181,8 @@ const convertCodeParagraphsToCodeBlocks = (t, e) => {
|
|
|
32225
32181
|
...c.attrs,
|
|
32226
32182
|
start: h.levels[l],
|
|
32227
32183
|
continue: void 0
|
|
32228
|
-
})), c.forEach((u,
|
|
32229
|
-
g(u, I +
|
|
32184
|
+
})), c.forEach((u, E) => {
|
|
32185
|
+
g(u, I + E + 1, d + 1);
|
|
32230
32186
|
}), l === 1 && r.set("_last", h), l--, a = !1;
|
|
32231
32187
|
}
|
|
32232
32188
|
}
|
|
@@ -32305,16 +32261,16 @@ const convertCodeParagraphsToCodeBlocks = (t, e) => {
|
|
|
32305
32261
|
}
|
|
32306
32262
|
if (c.length > 1) {
|
|
32307
32263
|
const h = n.mapping.map(a), u = n.mapping.map(a + I);
|
|
32308
|
-
let
|
|
32264
|
+
let E = c.join("").replace(/\n+$/gm, `
|
|
32309
32265
|
`);
|
|
32310
|
-
const
|
|
32266
|
+
const B = E.split(`
|
|
32311
32267
|
`);
|
|
32312
32268
|
let f = 0;
|
|
32313
|
-
for (f = 0; f <
|
|
32269
|
+
for (f = 0; f < B.length && !B[f].trim(); f++)
|
|
32314
32270
|
;
|
|
32315
|
-
|
|
32271
|
+
B.splice(0, f), E = B.join(`
|
|
32316
32272
|
`);
|
|
32317
|
-
const Q = A.text(
|
|
32273
|
+
const Q = A.text(E), p = A.nodes.code_block.createAndFill({
|
|
32318
32274
|
lang: g.attrs.lang
|
|
32319
32275
|
}, [Q]);
|
|
32320
32276
|
p && (n = n.replaceRangeWith(h, u, p));
|
|
@@ -32325,18 +32281,18 @@ const convertCodeParagraphsToCodeBlocks = (t, e) => {
|
|
|
32325
32281
|
}, ANY_LIST = ["ordered_list", "bullet_list"], fixListsLevels = (t, e) => {
|
|
32326
32282
|
const A = t.doc, n = t.schema, r = n.nodes.bullet_list, o = n.nodes.list_item, s = n.nodes.paragraph, a = t.tr;
|
|
32327
32283
|
let l = 0, g = [], c = [], I = 0;
|
|
32328
|
-
function d(h, u = 0,
|
|
32329
|
-
let
|
|
32284
|
+
function d(h, u = 0, E = 0) {
|
|
32285
|
+
let B = 0;
|
|
32330
32286
|
for (let f = 0; f < h.length; f++) {
|
|
32331
32287
|
const Q = h[f];
|
|
32332
32288
|
if (!ANY_LIST.includes(Q.type.name))
|
|
32333
|
-
d(Q.children, u +
|
|
32289
|
+
d(Q.children, u + B + 1, E + 1);
|
|
32334
32290
|
else {
|
|
32335
32291
|
const p = Q.attrs.odtMarginLeft || 0;
|
|
32336
32292
|
if (l === 0 && (c = [], I = 0, g.length >= l))
|
|
32337
32293
|
for (let m = 0; m < g.length; m++)
|
|
32338
32294
|
I < g.length && p > g[I] && (c[l + I] = g[I], I++);
|
|
32339
|
-
if (c[l + I] = p, l++, d(Q.children, u +
|
|
32295
|
+
if (c[l + I] = p, l++, d(Q.children, u + B, E + 1), l--, l === 0 && !Q.attrs.toc) {
|
|
32340
32296
|
g = c;
|
|
32341
32297
|
for (let m = 0; m < I; m++) {
|
|
32342
32298
|
const y = r.create(
|
|
@@ -32350,14 +32306,14 @@ const convertCodeParagraphsToCodeBlocks = (t, e) => {
|
|
|
32350
32306
|
)
|
|
32351
32307
|
);
|
|
32352
32308
|
a.replaceWith(
|
|
32353
|
-
a.mapping.map(u +
|
|
32354
|
-
a.mapping.map(u +
|
|
32309
|
+
a.mapping.map(u + B),
|
|
32310
|
+
a.mapping.map(u + B + Q.nodeSize),
|
|
32355
32311
|
y
|
|
32356
32312
|
);
|
|
32357
32313
|
}
|
|
32358
32314
|
}
|
|
32359
32315
|
}
|
|
32360
|
-
|
|
32316
|
+
B += Q.nodeSize;
|
|
32361
32317
|
}
|
|
32362
32318
|
}
|
|
32363
32319
|
return d(A.children), e && e(a), a.docChanged;
|
|
@@ -32653,7 +32609,7 @@ function computeMap(t) {
|
|
|
32653
32609
|
for (let u = 0; ; u++) {
|
|
32654
32610
|
for (; r < n.length && n[r] != 0; ) r++;
|
|
32655
32611
|
if (u == I.childCount) break;
|
|
32656
|
-
const
|
|
32612
|
+
const E = I.child(u), { colspan: B, rowspan: f, colwidth: Q } = E.attrs;
|
|
32657
32613
|
for (let p = 0; p < f; p++) {
|
|
32658
32614
|
if (p + g >= A) {
|
|
32659
32615
|
(o || (o = [])).push({
|
|
@@ -32664,12 +32620,12 @@ function computeMap(t) {
|
|
|
32664
32620
|
break;
|
|
32665
32621
|
}
|
|
32666
32622
|
const m = r + p * e;
|
|
32667
|
-
for (let y = 0; y <
|
|
32623
|
+
for (let y = 0; y < B; y++) {
|
|
32668
32624
|
n[m + y] == 0 ? n[m + y] = c : (o || (o = [])).push({
|
|
32669
32625
|
type: "collision",
|
|
32670
32626
|
row: g,
|
|
32671
32627
|
pos: c,
|
|
32672
|
-
n:
|
|
32628
|
+
n: B - y
|
|
32673
32629
|
});
|
|
32674
32630
|
const w = Q && Q[y];
|
|
32675
32631
|
if (w) {
|
|
@@ -32678,7 +32634,7 @@ function computeMap(t) {
|
|
|
32678
32634
|
}
|
|
32679
32635
|
}
|
|
32680
32636
|
}
|
|
32681
|
-
r +=
|
|
32637
|
+
r += B, c += E.nodeSize;
|
|
32682
32638
|
}
|
|
32683
32639
|
const d = (g + 1) * e;
|
|
32684
32640
|
let h = 0;
|
|
@@ -32875,13 +32831,13 @@ class CellSelection extends Selection {
|
|
|
32875
32831
|
let u = e.nodeAt(d);
|
|
32876
32832
|
if (!u)
|
|
32877
32833
|
throw RangeError(`No cell with offset ${d} found`);
|
|
32878
|
-
const
|
|
32879
|
-
if (
|
|
32834
|
+
const E = r.left - h.left, B = h.right - r.right;
|
|
32835
|
+
if (E > 0 || B > 0) {
|
|
32880
32836
|
let f = u.attrs;
|
|
32881
|
-
if (
|
|
32837
|
+
if (E > 0 && (f = removeColSpan(f, 0, E)), B > 0 && (f = removeColSpan(
|
|
32882
32838
|
f,
|
|
32883
|
-
f.colspan -
|
|
32884
|
-
|
|
32839
|
+
f.colspan - B,
|
|
32840
|
+
B
|
|
32885
32841
|
)), h.left < r.left) {
|
|
32886
32842
|
if (u = u.type.createAndFill(f), !u)
|
|
32887
32843
|
throw RangeError(
|
|
@@ -33083,12 +33039,12 @@ function updateColumnsOnResize(t, e, A, n, r, o) {
|
|
|
33083
33039
|
for (let c = 0, I = 0; c < g.childCount; c++) {
|
|
33084
33040
|
const { colspan: d, colwidth: h } = g.child(c).attrs;
|
|
33085
33041
|
for (let u = 0; u < d; u++, I++) {
|
|
33086
|
-
const
|
|
33087
|
-
if (s +=
|
|
33088
|
-
l.style.width !=
|
|
33042
|
+
const E = r == I ? o : h && h[u], B = E ? E + "px" : "";
|
|
33043
|
+
if (s += E || n, E || (a = !1), l)
|
|
33044
|
+
l.style.width != B && (l.style.width = B), l = l.nextSibling;
|
|
33089
33045
|
else {
|
|
33090
33046
|
const f = document.createElement("col");
|
|
33091
|
-
f.style.width =
|
|
33047
|
+
f.style.width = B, e.appendChild(f);
|
|
33092
33048
|
}
|
|
33093
33049
|
}
|
|
33094
33050
|
}
|
|
@@ -33385,12 +33341,12 @@ function fixTable(t, e, A, n) {
|
|
|
33385
33341
|
let h = "cell";
|
|
33386
33342
|
c.firstChild && (h = c.firstChild.type.spec.tableRole);
|
|
33387
33343
|
const u = [];
|
|
33388
|
-
for (let
|
|
33344
|
+
for (let B = 0; B < d; B++) {
|
|
33389
33345
|
const f = tableNodeTypes(t.schema)[h].createAndFill();
|
|
33390
33346
|
f && u.push(f);
|
|
33391
33347
|
}
|
|
33392
|
-
const
|
|
33393
|
-
n.insert(n.mapping.map(
|
|
33348
|
+
const E = (l == 0 || s == l - 1) && a == l ? g + 1 : I - 1;
|
|
33349
|
+
n.insert(n.mapping.map(E), u);
|
|
33394
33350
|
}
|
|
33395
33351
|
g = I;
|
|
33396
33352
|
}
|
|
@@ -33531,8 +33487,8 @@ function removeRow(t, { map: e, table: A, tableStart: n }, r) {
|
|
|
33531
33487
|
const d = A.nodeAt(I), h = d.attrs, u = d.type.create(
|
|
33532
33488
|
{ ...h, rowspan: d.attrs.rowspan - 1 },
|
|
33533
33489
|
d.content
|
|
33534
|
-
),
|
|
33535
|
-
t.insert(t.mapping.slice(a).map(n +
|
|
33490
|
+
), E = e.positionAt(r + 1, g, A);
|
|
33491
|
+
t.insert(t.mapping.slice(a).map(n + E), u), g += h.colspan - 1;
|
|
33536
33492
|
}
|
|
33537
33493
|
}
|
|
33538
33494
|
}
|
|
@@ -33642,10 +33598,10 @@ const splitCellWithType = (t) => (e, A) => {
|
|
|
33642
33598
|
for (let d = g.top; d < g.bottom; d++) {
|
|
33643
33599
|
let h = g.map.positionAt(d, g.left, g.table);
|
|
33644
33600
|
d == g.top && (h += r.nodeSize);
|
|
33645
|
-
for (let u = g.left,
|
|
33601
|
+
for (let u = g.left, E = 0; u < g.right; u++, E++)
|
|
33646
33602
|
u == g.left && d == g.top || c.insert(
|
|
33647
33603
|
I = c.mapping.map(h + g.tableStart, 1),
|
|
33648
|
-
t({ node: r, row: d, col: u }).createAndFill(a[
|
|
33604
|
+
t({ node: r, row: d, col: u }).createAndFill(a[E])
|
|
33649
33605
|
);
|
|
33650
33606
|
}
|
|
33651
33607
|
c.setNodeMarkup(
|
|
@@ -33746,8 +33702,8 @@ const toggleHeader = (t, e) => (e = e || { useDeprecatedLogic: !1 }, e.useDeprec
|
|
|
33746
33702
|
bottom: 1
|
|
33747
33703
|
} : o, d = t == "column" ? l ? r.cell : r.header_cell : t == "row" ? a ? r.cell : r.header_cell : r.cell;
|
|
33748
33704
|
o.map.cellsInRect(I).forEach((h) => {
|
|
33749
|
-
const u = h + o.tableStart,
|
|
33750
|
-
|
|
33705
|
+
const u = h + o.tableStart, E = s.doc.nodeAt(u);
|
|
33706
|
+
E && s.setNodeMarkup(u, d, E.attrs);
|
|
33751
33707
|
}), n(s);
|
|
33752
33708
|
}
|
|
33753
33709
|
return !0;
|
|
@@ -33917,17 +33873,17 @@ function growTable(t, e, A, n, r, o, s) {
|
|
|
33917
33873
|
const h = A.child(I);
|
|
33918
33874
|
d += h.nodeSize;
|
|
33919
33875
|
const u = [];
|
|
33920
|
-
let
|
|
33921
|
-
h.lastChild == null || h.lastChild.type == l.cell ?
|
|
33922
|
-
for (let
|
|
33876
|
+
let E;
|
|
33877
|
+
h.lastChild == null || h.lastChild.type == l.cell ? E = g || (g = l.cell.createAndFill()) : E = c || (c = l.header_cell.createAndFill());
|
|
33878
|
+
for (let B = e.width; B < r; B++) u.push(E);
|
|
33923
33879
|
t.insert(t.mapping.slice(s).map(d - 1 + n), u);
|
|
33924
33880
|
}
|
|
33925
33881
|
if (o > e.height) {
|
|
33926
33882
|
const I = [];
|
|
33927
|
-
for (let u = 0,
|
|
33928
|
-
const
|
|
33883
|
+
for (let u = 0, E = (e.height - 1) * e.width; u < Math.max(e.width, r); u++) {
|
|
33884
|
+
const B = u >= e.width ? !1 : A.nodeAt(e.map[E + u]).type == l.header_cell;
|
|
33929
33885
|
I.push(
|
|
33930
|
-
|
|
33886
|
+
B ? c || (c = l.header_cell.createAndFill()) : g || (g = l.cell.createAndFill())
|
|
33931
33887
|
);
|
|
33932
33888
|
}
|
|
33933
33889
|
const d = l.row.create(null, Fragment.from(I)), h = [];
|
|
@@ -33998,10 +33954,10 @@ function insertCells(t, e, A, n, r) {
|
|
|
33998
33954
|
}
|
|
33999
33955
|
growTable(I, s, o, A, g, c, d) && h(), isolateHorizontal(I, s, o, A, l, g, a, d) && h(), isolateHorizontal(I, s, o, A, l, g, c, d) && h(), isolateVertical(I, s, o, A, a, c, l, d) && h(), isolateVertical(I, s, o, A, a, c, g, d) && h();
|
|
34000
33956
|
for (let u = a; u < c; u++) {
|
|
34001
|
-
const
|
|
33957
|
+
const E = s.positionAt(u, l, o), B = s.positionAt(u, g, o);
|
|
34002
33958
|
I.replace(
|
|
34003
|
-
I.mapping.slice(d).map(B + A),
|
|
34004
33959
|
I.mapping.slice(d).map(E + A),
|
|
33960
|
+
I.mapping.slice(d).map(B + A),
|
|
34005
33961
|
new Slice(r.rows[u - a], 0, 0)
|
|
34006
33962
|
);
|
|
34007
33963
|
}
|
|
@@ -34389,221 +34345,316 @@ class ExtensionTables extends Extension {
|
|
|
34389
34345
|
];
|
|
34390
34346
|
}
|
|
34391
34347
|
}
|
|
34392
|
-
function escapeForRegEx(t) {
|
|
34393
|
-
return t.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&");
|
|
34394
|
-
}
|
|
34395
|
-
function createDefaultMatcher(t = {}) {
|
|
34396
|
-
const e = t.char || "@", A = t.allowToIncludeChar || !1, n = t.allowedPrefixes || [" "], r = t.startOfLine || !1;
|
|
34397
|
-
return (o) => {
|
|
34398
|
-
const s = t.allowSpaces && !A, a = escapeForRegEx(e), l = new RegExp(`\\s${a}$`), g = r ? "^" : "", c = A ? "" : a, I = s ? new RegExp(
|
|
34399
|
-
`${g}${a}.*?(?=\\s${c}|$)`,
|
|
34400
|
-
"gm"
|
|
34401
|
-
) : new RegExp(
|
|
34402
|
-
`${g}(?:^)?${a}[^\\s${c}]*`,
|
|
34403
|
-
"gm"
|
|
34404
|
-
), d = o.nodeBefore?.isText && o.nodeBefore.text;
|
|
34405
|
-
if (!d)
|
|
34406
|
-
return null;
|
|
34407
|
-
const h = o.pos - d.length, u = Array.from(d.matchAll(I)).pop();
|
|
34408
|
-
if (!u || u.input === void 0 || u.index === void 0)
|
|
34409
|
-
return null;
|
|
34410
|
-
const B = u.input.slice(
|
|
34411
|
-
Math.max(0, u.index - 1),
|
|
34412
|
-
u.index
|
|
34413
|
-
), E = new RegExp(
|
|
34414
|
-
`^[${n?.join("")}\0]?$`
|
|
34415
|
-
).test(B);
|
|
34416
|
-
if (n !== null && !E)
|
|
34417
|
-
return null;
|
|
34418
|
-
const f = h + u.index;
|
|
34419
|
-
let Q = f + u[0].length;
|
|
34420
|
-
return s && l.test(d.slice(Q - 1, Q + 1)) && (u[0] += " ", Q += 1), f < o.pos && Q >= o.pos ? {
|
|
34421
|
-
range: {
|
|
34422
|
-
from: f,
|
|
34423
|
-
to: Q
|
|
34424
|
-
},
|
|
34425
|
-
query: u[0],
|
|
34426
|
-
text: u[0]
|
|
34427
|
-
} : null;
|
|
34428
|
-
};
|
|
34429
|
-
}
|
|
34430
34348
|
const CSS_PREFIX = "kb-autocomplete";
|
|
34431
34349
|
class DefaultRenderer extends EventTarget {
|
|
34432
34350
|
constructor(e) {
|
|
34433
34351
|
super(), this.editor = e, this.items = [], this.pos = -1, this.command = () => {
|
|
34352
|
+
}, this.keyDownHandler = (A) => {
|
|
34353
|
+
this.onKeyDown({ event: A }) && (A.stopPropagation(), A.preventDefault());
|
|
34434
34354
|
};
|
|
34435
34355
|
}
|
|
34436
|
-
onStart(e) {
|
|
34437
|
-
this.command = e.command, this.wrapper && this.wrapper.parentElement?.removeChild(this.wrapper);
|
|
34438
|
-
const A = "root" in this.editor.view ? this.editor.view.root : document || document;
|
|
34439
|
-
this.wrapper = document.createElement("ul"), this.wrapper.classList.add(CSS_PREFIX + "__wrapper"), A.appendChild(this.wrapper), this.items.splice(0, this.items.length, ...e.items), this.recreateList(e);
|
|
34440
|
-
}
|
|
34441
34356
|
onUpdate(e) {
|
|
34442
|
-
this.command = e.command, this.items.splice(0, this.items.length, ...e.items), this.
|
|
34357
|
+
this.command = e.command, this.items.splice(0, this.items.length, ...e.items), this.props = e, this.refresh();
|
|
34443
34358
|
}
|
|
34444
|
-
|
|
34445
|
-
|
|
34359
|
+
destroy() {
|
|
34360
|
+
document.body.removeEventListener("keydown", this.keyDownHandler, {
|
|
34361
|
+
capture: !0
|
|
34362
|
+
}), this.wrapper && (this.wrapper.parentNode?.removeChild(this.wrapper), this.wrapper = void 0, this.dispatchEvent(new Event("close"))), this.pos = -1;
|
|
34446
34363
|
}
|
|
34447
34364
|
onKeyDown(e) {
|
|
34448
|
-
|
|
34365
|
+
if (!this.wrapper || this.items.length === 0)
|
|
34366
|
+
return !1;
|
|
34367
|
+
if (e.event.key === "Escape" && this.wrapper)
|
|
34368
|
+
return this.wrapper.parentNode?.removeChild(this.wrapper), this.wrapper = void 0, !0;
|
|
34369
|
+
if (e.event.key === "ArrowUp" && this.pos > -1)
|
|
34370
|
+
return this.pos = this.pos - 1, this.refresh(), !0;
|
|
34371
|
+
if (e.event.key === "ArrowDown" && this.pos < this.items.length - 1)
|
|
34372
|
+
return this.pos++, this.refresh(), !0;
|
|
34373
|
+
if (e.event.key === "Enter" && this.pos > -1 && this.pos < this.items.length) {
|
|
34374
|
+
const A = this.items[this.pos];
|
|
34375
|
+
return this.items.splice(0, this.items.length), this.destroy(), this.command(A), !0;
|
|
34376
|
+
}
|
|
34377
|
+
return !1;
|
|
34449
34378
|
}
|
|
34450
34379
|
createListItem(e, A) {
|
|
34451
34380
|
const n = document.createElement("li");
|
|
34452
34381
|
return A === this.pos && n.classList.add("active"), n.innerText = "" + e, n.style.cursor = "pointer", n.addEventListener("click", () => {
|
|
34453
|
-
this.command(e);
|
|
34382
|
+
this.destroy(), this.command(e);
|
|
34454
34383
|
}), n;
|
|
34455
34384
|
}
|
|
34456
|
-
|
|
34457
|
-
if (
|
|
34385
|
+
refresh() {
|
|
34386
|
+
if (this.wrapper || (this.wrapper = document.createElement("dialog"), this.wrapper.classList.add(CSS_PREFIX + "__wrapper"), document.body.appendChild(this.wrapper), this.list = document.createElement("ul"), this.wrapper.appendChild(this.list)), document.body.removeEventListener("keydown", this.keyDownHandler, {
|
|
34387
|
+
capture: !0
|
|
34388
|
+
}), !this.list)
|
|
34458
34389
|
return;
|
|
34459
|
-
this.
|
|
34390
|
+
this.list.innerHTML = "";
|
|
34460
34391
|
for (let n = 0; n < this.items.length; n++) {
|
|
34461
34392
|
const r = this.items[n];
|
|
34462
|
-
this.
|
|
34393
|
+
this.list.appendChild(this.createListItem(r, n));
|
|
34463
34394
|
}
|
|
34464
|
-
this.items.length
|
|
34465
|
-
|
|
34395
|
+
this.items.length > 0 && document.body.addEventListener("keydown", this.keyDownHandler, {
|
|
34396
|
+
capture: !0
|
|
34397
|
+
});
|
|
34398
|
+
let e = !1;
|
|
34399
|
+
this.items.length === 0 || (e = !0);
|
|
34400
|
+
const A = this.props?.clientRect?.();
|
|
34466
34401
|
if (A?.height) {
|
|
34467
34402
|
const n = A.left, r = A.bottom;
|
|
34468
34403
|
this.wrapper.style.left = n + "px", this.wrapper.style.top = r + "px";
|
|
34469
|
-
}
|
|
34404
|
+
} else
|
|
34405
|
+
e = !1;
|
|
34406
|
+
if (e) {
|
|
34407
|
+
if (!this.wrapper.open) {
|
|
34408
|
+
const n = document.activeElement, r = n instanceof HTMLElement ? n : null;
|
|
34409
|
+
this.wrapper.show(), requestAnimationFrame(() => {
|
|
34410
|
+
r && r.isConnected && r.focus();
|
|
34411
|
+
});
|
|
34412
|
+
}
|
|
34413
|
+
} else
|
|
34414
|
+
this.wrapper.open && this.wrapper.close();
|
|
34415
|
+
}
|
|
34416
|
+
}
|
|
34417
|
+
function escapeForRegEx(t) {
|
|
34418
|
+
return t.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&");
|
|
34419
|
+
}
|
|
34420
|
+
function createDefaultMatcher(t = {}) {
|
|
34421
|
+
const e = t.char || "@", A = t.allowToIncludeChar || !1, n = t.allowedPrefixes || [" "], r = t.startOfLine || !1;
|
|
34422
|
+
return (o) => {
|
|
34423
|
+
const s = t.allowSpaces && !A, a = escapeForRegEx(e), l = new RegExp(`\\s${a}$`), g = r ? "^" : "", c = A ? "" : a, I = s ? new RegExp(
|
|
34424
|
+
`${g}${a}.*?(?=\\s${c}|$)`,
|
|
34425
|
+
"gm"
|
|
34426
|
+
) : new RegExp(
|
|
34427
|
+
`${g}(?:^)?${a}[^\\s${c}]*`,
|
|
34428
|
+
"gm"
|
|
34429
|
+
), d = o.nodeBefore?.isText && o.nodeBefore.text;
|
|
34430
|
+
if (!d)
|
|
34431
|
+
return;
|
|
34432
|
+
const h = o.pos - d.length, u = Array.from(d.matchAll(I)).pop();
|
|
34433
|
+
if (!u || u.input === void 0 || u.index === void 0)
|
|
34434
|
+
return;
|
|
34435
|
+
const E = u.input.slice(
|
|
34436
|
+
Math.max(0, u.index - 1),
|
|
34437
|
+
u.index
|
|
34438
|
+
), B = new RegExp(
|
|
34439
|
+
`^[${n?.join("")}\0]?$`
|
|
34440
|
+
).test(E);
|
|
34441
|
+
if (n !== null && !B)
|
|
34442
|
+
return;
|
|
34443
|
+
const f = h + u.index;
|
|
34444
|
+
let Q = f + u[0].length;
|
|
34445
|
+
if (s && l.test(d.slice(Q - 1, Q + 1)) && (u[0] += " ", Q += 1), f < o.pos && Q >= o.pos)
|
|
34446
|
+
return {
|
|
34447
|
+
range: {
|
|
34448
|
+
from: f,
|
|
34449
|
+
to: Q
|
|
34450
|
+
},
|
|
34451
|
+
query: u[0]
|
|
34452
|
+
};
|
|
34453
|
+
};
|
|
34454
|
+
}
|
|
34455
|
+
const AutocompletePluginKey = new PluginKey(
|
|
34456
|
+
"autocomplete"
|
|
34457
|
+
);
|
|
34458
|
+
function matchSource(t, e) {
|
|
34459
|
+
let A;
|
|
34460
|
+
const n = t.$anchor.parent;
|
|
34461
|
+
for (const r of e) {
|
|
34462
|
+
if (!r.matchers)
|
|
34463
|
+
continue;
|
|
34464
|
+
const o = r.matchers;
|
|
34465
|
+
if (!["code_blocxk"].includes(n.type.name))
|
|
34466
|
+
for (const s of o) {
|
|
34467
|
+
const a = s(t.$from);
|
|
34468
|
+
if (a)
|
|
34469
|
+
return A = {
|
|
34470
|
+
source: r,
|
|
34471
|
+
match: a
|
|
34472
|
+
}, A;
|
|
34473
|
+
}
|
|
34470
34474
|
}
|
|
34471
34475
|
}
|
|
34472
|
-
const AutocompletePluginKey = new PluginKey("autocomplete");
|
|
34473
34476
|
class AutocompletePlugin extends Plugin {
|
|
34474
34477
|
constructor(e, A) {
|
|
34475
|
-
let n;
|
|
34476
|
-
const r = e.renderer || new DefaultRenderer(A);
|
|
34477
34478
|
super({
|
|
34478
34479
|
key: AutocompletePluginKey,
|
|
34480
|
+
state: {
|
|
34481
|
+
// Initialize the plugin's internal state.
|
|
34482
|
+
init() {
|
|
34483
|
+
return {
|
|
34484
|
+
autocompleteSources: [],
|
|
34485
|
+
manual: !1,
|
|
34486
|
+
active: void 0,
|
|
34487
|
+
composing: !1
|
|
34488
|
+
};
|
|
34489
|
+
},
|
|
34490
|
+
// Apply changes to the plugin state from a view transaction.
|
|
34491
|
+
apply(n, r, o, s) {
|
|
34492
|
+
const a = n.getMeta(
|
|
34493
|
+
AutocompletePluginKey
|
|
34494
|
+
), l = { ...r };
|
|
34495
|
+
!a && n.isGeneric;
|
|
34496
|
+
const { editable: g, composing: c } = A.view, { selection: I } = n, d = () => {
|
|
34497
|
+
l.active && (l.active.renderer.destroy(), l.active = void 0), l.decorationId = void 0;
|
|
34498
|
+
}, h = (E) => {
|
|
34499
|
+
if (E && (!E.source.allow || E.source.allow({
|
|
34500
|
+
range: E.match.range,
|
|
34501
|
+
isActive: !!l.active
|
|
34502
|
+
}))) {
|
|
34503
|
+
const { source: B, match: f } = E;
|
|
34504
|
+
console.info("Trigger matcher autocomplete", f);
|
|
34505
|
+
let Q = l.active?.renderer;
|
|
34506
|
+
l.active?.source !== B && Q && (Q.destroy(), Q = void 0), Q || (Q = new DefaultRenderer(A), Q.addEventListener("close", () => {
|
|
34507
|
+
const m = A.state.tr.setMeta(AutocompletePluginKey, {
|
|
34508
|
+
deactivate: !0
|
|
34509
|
+
});
|
|
34510
|
+
console.info("Manual autocomplete deactivate"), A.view.dispatch(m);
|
|
34511
|
+
})), l.active = {
|
|
34512
|
+
renderer: Q,
|
|
34513
|
+
source: B,
|
|
34514
|
+
match: f
|
|
34515
|
+
};
|
|
34516
|
+
const p = `id_${Math.floor(Math.random() * 4294967295)}`;
|
|
34517
|
+
l.decorationId = l.decorationId || p;
|
|
34518
|
+
} else
|
|
34519
|
+
d();
|
|
34520
|
+
};
|
|
34521
|
+
if (a?.addAutocompleteSource) {
|
|
34522
|
+
const E = {
|
|
34523
|
+
...a.addAutocompleteSource.autocompleteSource
|
|
34524
|
+
};
|
|
34525
|
+
return !E.matchers && E.triggerKeys?.length === 1 && (E.matchers = [
|
|
34526
|
+
createDefaultMatcher({ char: E.triggerKeys[0] })
|
|
34527
|
+
]), l.autocompleteSources.push(
|
|
34528
|
+
E
|
|
34529
|
+
), l;
|
|
34530
|
+
}
|
|
34531
|
+
if (a?.activate) {
|
|
34532
|
+
console.info("Trigger manual autocomplete");
|
|
34533
|
+
const E = matchSource(I, l.autocompleteSources);
|
|
34534
|
+
return h(E), l.manual = !0, l;
|
|
34535
|
+
}
|
|
34536
|
+
if (a?.deactivate)
|
|
34537
|
+
return console.info("Deactivate autocomplete"), d(), l;
|
|
34538
|
+
if (!g || !I.empty && !A.view.composing)
|
|
34539
|
+
return d(), l;
|
|
34540
|
+
if (l.active && !c && !l.composing && (I.from < l.active.match.range.from || I.from > l.active.match.range.to) && d(), l.composing = c, n.getMeta("isCommand"))
|
|
34541
|
+
return l;
|
|
34542
|
+
const u = matchSource(I, l.autocompleteSources);
|
|
34543
|
+
return h(u), l.manual = !1, l;
|
|
34544
|
+
}
|
|
34545
|
+
},
|
|
34479
34546
|
view() {
|
|
34480
34547
|
return {
|
|
34481
|
-
update: async (
|
|
34482
|
-
const
|
|
34483
|
-
|
|
34484
|
-
|
|
34548
|
+
update: async (n, r) => {
|
|
34549
|
+
const o = this.key?.getState(r), s = this.key?.getState(n.state), a = o.active && s.active && o.active.match.range.from !== s.active.match.range.from, l = !o.active?.match && s.active?.match, g = o.active?.match && !s.active?.match, c = !l && !g && o.active?.match.query !== s.active?.match.query;
|
|
34550
|
+
if (g && o.active) {
|
|
34551
|
+
o.active.renderer.destroy();
|
|
34485
34552
|
return;
|
|
34486
|
-
|
|
34487
|
-
|
|
34488
|
-
|
|
34489
|
-
|
|
34490
|
-
|
|
34491
|
-
|
|
34492
|
-
|
|
34493
|
-
|
|
34494
|
-
|
|
34495
|
-
|
|
34496
|
-
|
|
34497
|
-
|
|
34498
|
-
|
|
34499
|
-
|
|
34500
|
-
|
|
34501
|
-
|
|
34502
|
-
|
|
34503
|
-
|
|
34504
|
-
}
|
|
34505
|
-
|
|
34553
|
+
}
|
|
34554
|
+
if (s.active && (o.active?.match.query !== s.active.match.query || a)) {
|
|
34555
|
+
n.dom.querySelector(
|
|
34556
|
+
`[data-decoration-id="${s.decorationId}"]`
|
|
34557
|
+
);
|
|
34558
|
+
const E = s.active.source.onSelect, B = s.active.match.range, f = {
|
|
34559
|
+
match: s.active.match,
|
|
34560
|
+
items: [],
|
|
34561
|
+
command: (Q) => E(Q, B),
|
|
34562
|
+
// decorationNode,
|
|
34563
|
+
// virtual node for popper.js or tippy.js
|
|
34564
|
+
// this can be used for building popups without a DOM node
|
|
34565
|
+
clientRect: () => {
|
|
34566
|
+
const { decorationId: Q } = s;
|
|
34567
|
+
return n.dom.querySelector(
|
|
34568
|
+
`[data-decoration-id="${Q}"]`
|
|
34569
|
+
)?.getBoundingClientRect() || null;
|
|
34570
|
+
}
|
|
34571
|
+
};
|
|
34572
|
+
s.active.renderer.onUpdate(f);
|
|
34506
34573
|
try {
|
|
34507
|
-
const Q = {
|
|
34508
|
-
|
|
34574
|
+
const Q = {
|
|
34575
|
+
range: s.active.match.range,
|
|
34576
|
+
isActive: !!s.active
|
|
34577
|
+
}, p = await s.active.source.getItems(
|
|
34578
|
+
s.active.match.query,
|
|
34579
|
+
Q
|
|
34580
|
+
);
|
|
34581
|
+
s.active.renderer.onUpdate({ ...f, items: p });
|
|
34509
34582
|
} catch (Q) {
|
|
34510
34583
|
if (Q.isLSP)
|
|
34511
|
-
|
|
34584
|
+
console.error(
|
|
34512
34585
|
"LSP error config.getItems()",
|
|
34513
34586
|
Q.message,
|
|
34514
|
-
|
|
34587
|
+
s.active.source.getItems
|
|
34515
34588
|
);
|
|
34516
34589
|
else
|
|
34517
34590
|
throw Q;
|
|
34518
34591
|
}
|
|
34519
|
-
n.items.length === 0 && (B = !0);
|
|
34520
34592
|
}
|
|
34521
|
-
B && r?.onExit?.(n), u && r?.onUpdate?.(n), h && r?.onStart?.(n);
|
|
34522
34593
|
},
|
|
34523
34594
|
destroy: () => {
|
|
34524
|
-
n
|
|
34595
|
+
const n = AutocompletePluginKey.getState(A.state);
|
|
34596
|
+
if (!n)
|
|
34597
|
+
return;
|
|
34598
|
+
const { active: r } = n;
|
|
34599
|
+
r && r.renderer.destroy();
|
|
34525
34600
|
}
|
|
34526
34601
|
};
|
|
34527
34602
|
},
|
|
34528
|
-
state: {
|
|
34529
|
-
// Initialize the plugin's internal state.
|
|
34530
|
-
init() {
|
|
34531
|
-
return {
|
|
34532
|
-
manual: !1,
|
|
34533
|
-
active: !1,
|
|
34534
|
-
range: {
|
|
34535
|
-
from: 0,
|
|
34536
|
-
to: 0
|
|
34537
|
-
},
|
|
34538
|
-
query: null,
|
|
34539
|
-
text: null,
|
|
34540
|
-
composing: !1
|
|
34541
|
-
};
|
|
34542
|
-
},
|
|
34543
|
-
// Apply changes to the plugin state from a view transaction.
|
|
34544
|
-
apply(o, s, a, l) {
|
|
34545
|
-
const { composing: c } = A.view, { selection: I } = o, { empty: d, from: h } = I, u = { ...s }, B = o.getMeta(AutocompletePluginKey);
|
|
34546
|
-
if (!B && !o.isGeneric)
|
|
34547
|
-
return u;
|
|
34548
|
-
if (B?.type === "deactivate")
|
|
34549
|
-
return console.info("Deactivate autocomplete"), u.active = !1, u;
|
|
34550
|
-
if (B?.type === "activate")
|
|
34551
|
-
return console.info("Trigger manual autocomplete"), u.range = { from: I.from, to: I.to }, u.active = !0, u.manual = !0, u.query = null, u;
|
|
34552
|
-
u.composing = c;
|
|
34553
|
-
const E = I.$anchor.parent;
|
|
34554
|
-
if (!["code_block"].includes(E?.type.name) && (d || A.view.composing)) {
|
|
34555
|
-
(h < s.range.from || h > s.range.to) && !c && !s.composing && (u.active = !1);
|
|
34556
|
-
const f = e.matchers || [createDefaultMatcher()];
|
|
34557
|
-
let Q;
|
|
34558
|
-
for (const m of f)
|
|
34559
|
-
if (Q = m(I.$from), Q)
|
|
34560
|
-
break;
|
|
34561
|
-
const p = `id_${Math.floor(Math.random() * 4294967295)}`;
|
|
34562
|
-
Q && (!e.allow || e.allow({
|
|
34563
|
-
state: l,
|
|
34564
|
-
range: Q.range,
|
|
34565
|
-
isActive: s.active
|
|
34566
|
-
})) ? (console.info("Trigger matcher autocomplete", Q), u.active = !0, u.decorationId = s.decorationId ? s.decorationId : p, u.range = Q.range, u.query = Q.query, u.text = Q.text) : u.active = !1;
|
|
34567
|
-
} else
|
|
34568
|
-
u.active = !1;
|
|
34569
|
-
return u.manual = !1, u.active || (u.decorationId = null, u.range = { from: 0, to: 0 }, u.query = null, u.text = null), u;
|
|
34570
|
-
}
|
|
34571
|
-
},
|
|
34572
34603
|
props: {
|
|
34573
34604
|
// Call the keydown hook if suggestion is active.
|
|
34574
|
-
handleKeyDown(
|
|
34575
|
-
const
|
|
34576
|
-
|
|
34577
|
-
const
|
|
34578
|
-
|
|
34579
|
-
|
|
34580
|
-
|
|
34605
|
+
handleKeyDown(n, r) {
|
|
34606
|
+
const o = this.getState(n.state), { autocompleteSources: s } = o;
|
|
34607
|
+
for (const a of s) {
|
|
34608
|
+
const l = [...a.triggerKeys || []];
|
|
34609
|
+
for (const g of l) {
|
|
34610
|
+
let c = g.toLowerCase();
|
|
34611
|
+
if (c.startsWith("ctrl+")) {
|
|
34612
|
+
if (!r.ctrlKey)
|
|
34613
|
+
continue;
|
|
34614
|
+
c = c.substring(5);
|
|
34615
|
+
}
|
|
34616
|
+
if (c === r.key) {
|
|
34617
|
+
const I = n.state.tr.setMeta(AutocompletePluginKey, {
|
|
34618
|
+
activate: !0
|
|
34619
|
+
});
|
|
34620
|
+
return console.info("Manual autocomplete key " + g), n.dispatch(I), !1;
|
|
34621
|
+
}
|
|
34622
|
+
}
|
|
34581
34623
|
}
|
|
34582
|
-
return
|
|
34624
|
+
return !1;
|
|
34583
34625
|
},
|
|
34584
34626
|
// Setup decorator on the currently active suggestion.
|
|
34585
|
-
decorations(
|
|
34586
|
-
const { active:
|
|
34587
|
-
if (!
|
|
34627
|
+
decorations(n) {
|
|
34628
|
+
const { active: r, decorationId: o } = this.getState(n) || {};
|
|
34629
|
+
if (!r || !o)
|
|
34588
34630
|
return null;
|
|
34589
|
-
const
|
|
34590
|
-
return
|
|
34591
|
-
Decoration.widget(
|
|
34631
|
+
const s = document.createElement("span");
|
|
34632
|
+
return s.className = e.decorationClass || "kb-autocomplete--decor", s.setAttribute("data-decoration-id", o), DecorationSet.create(n.doc, [
|
|
34633
|
+
Decoration.widget(r.match.range.from, s, {
|
|
34634
|
+
class: s.className,
|
|
34635
|
+
decorationId: o,
|
|
34636
|
+
refresh: () => r.renderer.refresh()
|
|
34637
|
+
})
|
|
34592
34638
|
]);
|
|
34593
34639
|
}
|
|
34594
34640
|
}
|
|
34595
|
-
}), r.addEventListener("close", () => {
|
|
34596
|
-
const o = A.state.tr.setMeta(AutocompletePluginKey, {
|
|
34597
|
-
type: "deactivate"
|
|
34598
|
-
});
|
|
34599
|
-
console.info("Manual autocomplete deactivate"), A.view.dispatch(o);
|
|
34600
34641
|
});
|
|
34601
34642
|
}
|
|
34602
34643
|
}
|
|
34603
34644
|
class ExtensionAutocomplete extends Extension {
|
|
34604
|
-
constructor(e) {
|
|
34645
|
+
constructor(e = {}) {
|
|
34605
34646
|
super(e), this.config = e, this.name = "autocomplete";
|
|
34606
34647
|
}
|
|
34648
|
+
getCommandFactories() {
|
|
34649
|
+
return {
|
|
34650
|
+
addAutocompleteSource: (A) => (n, r) => {
|
|
34651
|
+
const o = n.tr;
|
|
34652
|
+
return o.setMeta(AutocompletePluginKey, {
|
|
34653
|
+
addAutocompleteSource: { autocompleteSource: A }
|
|
34654
|
+
}), r && r(o), !0;
|
|
34655
|
+
}
|
|
34656
|
+
};
|
|
34657
|
+
}
|
|
34607
34658
|
getProseMirrorPlugins() {
|
|
34608
34659
|
return [
|
|
34609
34660
|
new AutocompletePlugin(this.config, this.editor)
|
|
@@ -34804,8 +34855,8 @@ class Branch {
|
|
|
34804
34855
|
s = Math.min(s, h);
|
|
34805
34856
|
let u = o.maps[h];
|
|
34806
34857
|
if (d.step) {
|
|
34807
|
-
let
|
|
34808
|
-
|
|
34858
|
+
let E = e.steps[h].invert(e.docs[h]), B = d.selection && d.selection.map(o.slice(l + 1, h));
|
|
34859
|
+
B && a++, n.push(new Item(u, E, B));
|
|
34809
34860
|
} else
|
|
34810
34861
|
n.push(new Item(u));
|
|
34811
34862
|
}, r);
|