@ahzoo/sus 1.0.1 → 1.1.1
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/index.js +434 -413
- package/main.ts +5 -0
- package/package.json +1 -1
- package/style.css +1 -1
package/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
var vi = Object.defineProperty;
|
|
2
2
|
var gi = (fe, he, ke) => he in fe ? vi(fe, he, { enumerable: !0, configurable: !0, writable: !0, value: ke }) : fe[he] = ke;
|
|
3
3
|
var We = (fe, he, ke) => (gi(fe, typeof he != "symbol" ? he + "" : he, ke), ke);
|
|
4
|
-
import { defineComponent as
|
|
4
|
+
import { defineComponent as Ht, ref as yt, reactive as yi, onMounted as Wn, openBlock as qe, createElementBlock as ze, createElementVNode as ce, unref as xt, withDirectives as Jt, vModelText as Xt, normalizeClass as bi, toDisplayString as tt, createCommentVNode as nt, createStaticVNode as wi, createVNode as Ei, createBlock as Un, createTextVNode as ki, Fragment as Si, renderList as Li } from "vue";
|
|
5
5
|
var _i = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
6
6
|
function Ci(fe) {
|
|
7
7
|
return fe && fe.__esModule && Object.prototype.hasOwnProperty.call(fe, "default") ? fe.default : fe;
|
|
8
8
|
}
|
|
9
|
-
var
|
|
9
|
+
var zn = { exports: {} };
|
|
10
10
|
(function(fe, he) {
|
|
11
11
|
(function(ke, be) {
|
|
12
12
|
fe.exports = be();
|
|
@@ -88,14 +88,14 @@ var Wn = { exports: {} };
|
|
|
88
88
|
else if (k && (ve = f + E - $) >= 0 && ve < w && S[ve] != -1 && Me >= (le = b - S[ve]))
|
|
89
89
|
return this.diff_bisectSplit_(l, m, Me, me, c);
|
|
90
90
|
}
|
|
91
|
-
for (var
|
|
92
|
-
for (var le, ve = f +
|
|
91
|
+
for (var de = -N + I; de <= N - W; de += 2) {
|
|
92
|
+
for (var le, ve = f + de, xe = (le = de == -N || de != N && S[ve - 1] < S[ve + 1] ? S[ve + 1] : S[ve - 1] + 1) - de; le < b && xe < s && l.charAt(b - le - 1) == m.charAt(s - xe - 1); )
|
|
93
93
|
le++, xe++;
|
|
94
94
|
if (S[ve] = le, le > b)
|
|
95
95
|
W += 2;
|
|
96
96
|
else if (xe > s)
|
|
97
97
|
I += 2;
|
|
98
|
-
else if (!k && (ne = f + E -
|
|
98
|
+
else if (!k && (ne = f + E - de) >= 0 && ne < w && _[ne] != -1) {
|
|
99
99
|
var Me;
|
|
100
100
|
if (me = f + (Me = _[ne]) - ne, Me >= (le = b - le))
|
|
101
101
|
return this.diff_bisectSplit_(l, m, Me, me, c);
|
|
@@ -160,9 +160,9 @@ var Wn = { exports: {} };
|
|
|
160
160
|
return null;
|
|
161
161
|
var s = this;
|
|
162
162
|
function u(p, x, I) {
|
|
163
|
-
for (var W, N, $, ne, me = p.substring(I, I + Math.floor(p.length / 4)),
|
|
164
|
-
var ve = s.diff_commonPrefix(p.substring(I), x.substring(
|
|
165
|
-
le.length < xe + ve && (le = x.substring(
|
|
163
|
+
for (var W, N, $, ne, me = p.substring(I, I + Math.floor(p.length / 4)), de = -1, le = ""; (de = x.indexOf(me, de + 1)) != -1; ) {
|
|
164
|
+
var ve = s.diff_commonPrefix(p.substring(I), x.substring(de)), xe = s.diff_commonSuffix(p.substring(0, I), x.substring(0, de));
|
|
165
|
+
le.length < xe + ve && (le = x.substring(de - xe, de) + x.substring(de, de + ve), W = p.substring(0, I - xe), N = p.substring(I + ve), $ = x.substring(0, de - xe), ne = x.substring(de + ve));
|
|
166
166
|
}
|
|
167
167
|
return 2 * le.length >= p.length ? [W, N, $, ne, le] : null;
|
|
168
168
|
}
|
|
@@ -182,8 +182,8 @@ var Wn = { exports: {} };
|
|
|
182
182
|
function m(p, x) {
|
|
183
183
|
if (!p || !x)
|
|
184
184
|
return 6;
|
|
185
|
-
var I = p.charAt(p.length - 1), W = x.charAt(0), N = I.match(L.nonAlphaNumericRegex_), $ = W.match(L.nonAlphaNumericRegex_), ne = N && I.match(L.whitespaceRegex_), me = $ && W.match(L.whitespaceRegex_),
|
|
186
|
-
return ve || xe ? 5 :
|
|
185
|
+
var I = p.charAt(p.length - 1), W = x.charAt(0), N = I.match(L.nonAlphaNumericRegex_), $ = W.match(L.nonAlphaNumericRegex_), ne = N && I.match(L.whitespaceRegex_), me = $ && W.match(L.whitespaceRegex_), de = ne && I.match(L.linebreakRegex_), le = me && W.match(L.linebreakRegex_), ve = de && p.match(L.blanklineEndRegex_), xe = le && x.match(L.blanklineStartRegex_);
|
|
186
|
+
return ve || xe ? 5 : de || le ? 4 : N && !ne && me ? 3 : ne || me ? 2 : N || $ ? 1 : 0;
|
|
187
187
|
}
|
|
188
188
|
for (var c = 1; c < l.length - 1; ) {
|
|
189
189
|
if (l[c - 1][0] == 0 && l[c + 1][0] == 0) {
|
|
@@ -314,8 +314,8 @@ var Wn = { exports: {} };
|
|
|
314
314
|
if (m.length > this.Match_MaxBits)
|
|
315
315
|
throw new Error("Pattern too long for this browser.");
|
|
316
316
|
var b = this.match_alphabet_(m), s = this;
|
|
317
|
-
function u(me,
|
|
318
|
-
var le = me / m.length, ve = Math.abs(c -
|
|
317
|
+
function u(me, de) {
|
|
318
|
+
var le = me / m.length, ve = Math.abs(c - de);
|
|
319
319
|
return s.Match_Distance ? le + ve / s.Match_Distance : ve ? 1 : le;
|
|
320
320
|
}
|
|
321
321
|
var f = this.Match_Threshold, w = l.indexOf(m, c);
|
|
@@ -536,13 +536,13 @@ var Wn = { exports: {} };
|
|
|
536
536
|
}), K.querySelectorAll("img").forEach(function(V) {
|
|
537
537
|
window.vditorImageIntersectionObserver.observe(V);
|
|
538
538
|
}));
|
|
539
|
-
}, _ = y(466), S = y(554), M = y(40), E = y(563), k = y(749), p = y(818), x = y(408), I = y(54), W = y(227), N = y(526), $ = y(827), ne = y(640), me = y(895),
|
|
539
|
+
}, _ = y(466), S = y(554), M = y(40), E = y(563), k = y(749), p = y(818), x = y(408), I = y(54), W = y(227), N = y(526), $ = y(827), ne = y(640), me = y(895), de = y(393), le = function(K, ge) {
|
|
540
540
|
if (ge === void 0 && (ge = "zh_CN"), typeof speechSynthesis < "u" && typeof SpeechSynthesisUtterance < "u") {
|
|
541
541
|
var V = function() {
|
|
542
|
-
var
|
|
542
|
+
var pe, ue;
|
|
543
543
|
return speechSynthesis.getVoices().forEach(function(Q) {
|
|
544
|
-
Q.lang === ge.replace("_", "-") && (
|
|
545
|
-
}),
|
|
544
|
+
Q.lang === ge.replace("_", "-") && (pe = Q), Q.default && (ue = Q);
|
|
545
|
+
}), pe || (pe = ue), pe;
|
|
546
546
|
}, j = '<svg><use xlink:href="#vditor-icon-play"></use></svg>', ie = '<svg><use xlink:href="#vditor-icon-pause"></use></svg>';
|
|
547
547
|
document.getElementById("vditorIconScript") || (j = '<svg viewBox="0 0 32 32"><path d="M3.436 0l25.128 16-25.128 16v-32z"></path></svg>', ie = '<svg viewBox="0 0 32 32"><path d="M20.617 0h9.128v32h-9.128v-32zM2.255 32v-32h9.128v32h-9.128z"></path></svg>');
|
|
548
548
|
var se = document.querySelector(".vditor-speech");
|
|
@@ -550,43 +550,43 @@ var Wn = { exports: {} };
|
|
|
550
550
|
var oe = V(), Ne = new SpeechSynthesisUtterance();
|
|
551
551
|
Ne.voice = oe, Ne.onend = Ne.onerror = function() {
|
|
552
552
|
se.style.display = "none", speechSynthesis.cancel(), se.classList.remove("vditor-speech--current"), se.innerHTML = j;
|
|
553
|
-
}, K.addEventListener(window.ontouchstart !== void 0 ? "touchend" : "click", function(
|
|
554
|
-
var
|
|
555
|
-
if (
|
|
556
|
-
return se.classList.contains("vditor-speech--current") ? speechSynthesis.speaking && (speechSynthesis.paused ? (speechSynthesis.resume(), se.innerHTML = ie) : (speechSynthesis.pause(), se.innerHTML = j)) : (Ne.text = se.getAttribute("data-text"), speechSynthesis.speak(Ne), se.classList.add("vditor-speech--current"), se.innerHTML = ie), (0,
|
|
553
|
+
}, K.addEventListener(window.ontouchstart !== void 0 ? "touchend" : "click", function(pe) {
|
|
554
|
+
var ue = pe.target;
|
|
555
|
+
if (ue.classList.contains("vditor-speech") || ue.parentElement.classList.contains("vditor-speech"))
|
|
556
|
+
return se.classList.contains("vditor-speech--current") ? speechSynthesis.speaking && (speechSynthesis.paused ? (speechSynthesis.resume(), se.innerHTML = ie) : (speechSynthesis.pause(), se.innerHTML = j)) : (Ne.text = se.getAttribute("data-text"), speechSynthesis.speak(Ne), se.classList.add("vditor-speech--current"), se.innerHTML = ie), (0, de.Hc)(window.vditorSpeechRange), void K.focus();
|
|
557
557
|
if (se.style.display = "none", speechSynthesis.cancel(), se.classList.remove("vditor-speech--current"), se.innerHTML = j, getSelection().rangeCount !== 0) {
|
|
558
|
-
var Q = getSelection().getRangeAt(0),
|
|
559
|
-
if (
|
|
558
|
+
var Q = getSelection().getRangeAt(0), Ke = Q.toString().trim();
|
|
559
|
+
if (Ke) {
|
|
560
560
|
window.vditorSpeechRange = Q.cloneRange();
|
|
561
561
|
var Xe = Q.getBoundingClientRect();
|
|
562
|
-
se.innerHTML = j, se.style.display = "block", se.style.top = Xe.top + Xe.height + document.querySelector("html").scrollTop - 20 + "px", window.ontouchstart !== void 0 ? se.style.left =
|
|
562
|
+
se.innerHTML = j, se.style.display = "block", se.style.top = Xe.top + Xe.height + document.querySelector("html").scrollTop - 20 + "px", window.ontouchstart !== void 0 ? se.style.left = pe.changedTouches[pe.changedTouches.length - 1].pageX + 2 + "px" : se.style.left = pe.clientX + 2 + "px", se.setAttribute("data-text", Ke);
|
|
563
563
|
}
|
|
564
564
|
}
|
|
565
565
|
});
|
|
566
566
|
}
|
|
567
567
|
}, ve = function(K, ge, V, j) {
|
|
568
568
|
return new (V || (V = Promise))(function(ie, se) {
|
|
569
|
-
function oe(
|
|
569
|
+
function oe(ue) {
|
|
570
570
|
try {
|
|
571
|
-
|
|
571
|
+
pe(j.next(ue));
|
|
572
572
|
} catch (Q) {
|
|
573
573
|
se(Q);
|
|
574
574
|
}
|
|
575
575
|
}
|
|
576
|
-
function Ne(
|
|
576
|
+
function Ne(ue) {
|
|
577
577
|
try {
|
|
578
|
-
|
|
578
|
+
pe(j.throw(ue));
|
|
579
579
|
} catch (Q) {
|
|
580
580
|
se(Q);
|
|
581
581
|
}
|
|
582
582
|
}
|
|
583
|
-
function ue
|
|
583
|
+
function pe(ue) {
|
|
584
584
|
var Q;
|
|
585
|
-
|
|
586
|
-
|
|
585
|
+
ue.done ? ie(ue.value) : (Q = ue.value, Q instanceof V ? Q : new V(function(Ke) {
|
|
586
|
+
Ke(Q);
|
|
587
587
|
})).then(oe, Ne);
|
|
588
588
|
}
|
|
589
|
-
|
|
589
|
+
pe((j = j.apply(K, [])).next());
|
|
590
590
|
});
|
|
591
591
|
}, xe = function(K, ge) {
|
|
592
592
|
var V, j, ie, se, oe = { label: 0, sent: function() {
|
|
@@ -597,8 +597,8 @@ var Wn = { exports: {} };
|
|
|
597
597
|
return se = { next: Ne(0), throw: Ne(1), return: Ne(2) }, typeof Symbol == "function" && (se[Symbol.iterator] = function() {
|
|
598
598
|
return this;
|
|
599
599
|
}), se;
|
|
600
|
-
function Ne(
|
|
601
|
-
return function(
|
|
600
|
+
function Ne(pe) {
|
|
601
|
+
return function(ue) {
|
|
602
602
|
return function(Q) {
|
|
603
603
|
if (V)
|
|
604
604
|
throw new TypeError("Generator is already executing.");
|
|
@@ -640,15 +640,15 @@ var Wn = { exports: {} };
|
|
|
640
640
|
continue;
|
|
641
641
|
}
|
|
642
642
|
Q = ge.call(K, oe);
|
|
643
|
-
} catch (
|
|
644
|
-
Q = [6,
|
|
643
|
+
} catch (Ke) {
|
|
644
|
+
Q = [6, Ke], j = 0;
|
|
645
645
|
} finally {
|
|
646
646
|
V = ie = 0;
|
|
647
647
|
}
|
|
648
648
|
if (5 & Q[0])
|
|
649
649
|
throw Q[1];
|
|
650
650
|
return { value: Q[0] ? Q[1] : void 0, done: !0 };
|
|
651
|
-
}([
|
|
651
|
+
}([pe, ue]);
|
|
652
652
|
};
|
|
653
653
|
}
|
|
654
654
|
}, Me = function(K) {
|
|
@@ -674,8 +674,8 @@ var Wn = { exports: {} };
|
|
|
674
674
|
return [3, 2];
|
|
675
675
|
throw new Error("options.lang error, see https://ld246.com/article/1549638745630#options");
|
|
676
676
|
case 2:
|
|
677
|
-
return se = "vditorI18nScript" + j.lang, document.querySelectorAll('head script[id^="vditorI18nScript"]').forEach(function(
|
|
678
|
-
|
|
677
|
+
return se = "vditorI18nScript" + j.lang, document.querySelectorAll('head script[id^="vditorI18nScript"]').forEach(function(pe) {
|
|
678
|
+
pe.id !== se && document.head.removeChild(pe);
|
|
679
679
|
}), [4, (0, N.G)(j.cdn + "/dist/js/i18n/" + j.lang + ".js", se)];
|
|
680
680
|
case 3:
|
|
681
681
|
oe.sent(), oe.label = 4;
|
|
@@ -688,18 +688,18 @@ var Wn = { exports: {} };
|
|
|
688
688
|
case 7:
|
|
689
689
|
oe.sent(), oe.label = 8;
|
|
690
690
|
case 8:
|
|
691
|
-
return (0, W.Z)(j.theme.current, j.theme.path), j.anchor === 1 && K.classList.add("vditor-reset--anchor"), (0, b.O)(K, j.hljs), (0, f.s)(j.hljs, K, j.cdn), (0, _.H)(K, { cdn: j.cdn, math: j.math }), (0, M.i)(K, j.cdn, j.mode), (0, E.K)(K, j.cdn, j.mode), (0, s.P)(K, j.cdn), (0, u.v)(K, j.cdn), (0, c.p)(K, j.cdn, j.mode), (0, k.P)(K, j.cdn, j.mode), (0, x.B)(K, j.cdn), (0, l.Q)(K, j.cdn), j.render.media.enable && (0, S.Y)(K), j.speech.enable && le(K), j.anchor !== 0 && (Ne = j.anchor, document.querySelectorAll(".vditor-anchor").forEach(function(
|
|
692
|
-
Ne === 1 &&
|
|
693
|
-
var
|
|
691
|
+
return (0, W.Z)(j.theme.current, j.theme.path), j.anchor === 1 && K.classList.add("vditor-reset--anchor"), (0, b.O)(K, j.hljs), (0, f.s)(j.hljs, K, j.cdn), (0, _.H)(K, { cdn: j.cdn, math: j.math }), (0, M.i)(K, j.cdn, j.mode), (0, E.K)(K, j.cdn, j.mode), (0, s.P)(K, j.cdn), (0, u.v)(K, j.cdn), (0, c.p)(K, j.cdn, j.mode), (0, k.P)(K, j.cdn, j.mode), (0, x.B)(K, j.cdn), (0, l.Q)(K, j.cdn), j.render.media.enable && (0, S.Y)(K), j.speech.enable && le(K), j.anchor !== 0 && (Ne = j.anchor, document.querySelectorAll(".vditor-anchor").forEach(function(pe) {
|
|
692
|
+
Ne === 1 && pe.classList.add("vditor-anchor--left"), pe.onclick = function() {
|
|
693
|
+
var ue = pe.getAttribute("href").substr(1), Q = document.getElementById("vditorAnchor-" + ue).offsetTop;
|
|
694
694
|
document.querySelector("html").scrollTop = Q;
|
|
695
695
|
};
|
|
696
696
|
}), window.onhashchange = function() {
|
|
697
|
-
var
|
|
698
|
-
|
|
699
|
-
}), j.after && j.after(), j.lazyLoadImage && w(K), K.addEventListener("click", function(
|
|
700
|
-
var
|
|
701
|
-
if (
|
|
702
|
-
var Q = K.querySelector("#" +
|
|
697
|
+
var pe = document.getElementById("vditorAnchor-" + decodeURIComponent(window.location.hash.substr(1)));
|
|
698
|
+
pe && (document.querySelector("html").scrollTop = pe.offsetTop);
|
|
699
|
+
}), j.after && j.after(), j.lazyLoadImage && w(K), K.addEventListener("click", function(pe) {
|
|
700
|
+
var ue = (0, $.lG)(pe.target, "SPAN");
|
|
701
|
+
if (ue && (0, $.fb)(ue, "vditor-toc")) {
|
|
702
|
+
var Q = K.querySelector("#" + ue.getAttribute("data-target-id"));
|
|
703
703
|
Q && window.scrollTo(window.scrollX, Q.offsetTop);
|
|
704
704
|
}
|
|
705
705
|
}), [2];
|
|
@@ -891,14 +891,14 @@ onclick="this.previousElementSibling.select();document.execCommand('copy');this.
|
|
|
891
891
|
var _ = window.markmap, S = _.Transformer, M = _.Markmap, E = _.deriveOptions, k = (_.globalCSS, new S());
|
|
892
892
|
f.innerHTML = '<svg style="width:100%"></svg>';
|
|
893
893
|
var p = f.firstChild, x = M.create(p, null), I = function(ne, me) {
|
|
894
|
-
var
|
|
894
|
+
var de = ne.transform(me), le = Object.keys(de.features).filter(function(Ce) {
|
|
895
895
|
return !b[Ce];
|
|
896
896
|
});
|
|
897
897
|
le.forEach(function(Ce) {
|
|
898
898
|
b[Ce] = !0;
|
|
899
899
|
});
|
|
900
900
|
var ve = ne.getAssets(le), xe = ve.styles, Me = ve.scripts, $e = window.markmap;
|
|
901
|
-
return xe && $e.loadCSS(xe), Me && $e.loadJS(Me),
|
|
901
|
+
return xe && $e.loadCSS(xe), Me && $e.loadJS(Me), de;
|
|
902
902
|
}(k, w), W = I.root, N = I.frontmatter, $ = E(N == null ? void 0 : N.markmap);
|
|
903
903
|
x.setData(W, $), x.fit();
|
|
904
904
|
}, u = function(f, w, _) {
|
|
@@ -1530,27 +1530,27 @@ onclick="this.previousElementSibling.select();document.execCommand('copy');this.
|
|
|
1530
1530
|
}
|
|
1531
1531
|
};
|
|
1532
1532
|
} }, be = {};
|
|
1533
|
-
function
|
|
1533
|
+
function J(Z) {
|
|
1534
1534
|
var L = be[Z];
|
|
1535
1535
|
if (L !== void 0)
|
|
1536
1536
|
return L.exports;
|
|
1537
1537
|
var y = be[Z] = { exports: {} };
|
|
1538
|
-
return ke[Z](y, y.exports,
|
|
1538
|
+
return ke[Z](y, y.exports, J), y.exports;
|
|
1539
1539
|
}
|
|
1540
|
-
|
|
1540
|
+
J.d = (Z, L) => {
|
|
1541
1541
|
for (var y in L)
|
|
1542
|
-
|
|
1543
|
-
},
|
|
1542
|
+
J.o(L, y) && !J.o(Z, y) && Object.defineProperty(Z, y, { enumerable: !0, get: L[y] });
|
|
1543
|
+
}, J.o = (Z, L) => Object.prototype.hasOwnProperty.call(Z, L), J.r = (Z) => {
|
|
1544
1544
|
typeof Symbol < "u" && Symbol.toStringTag && Object.defineProperty(Z, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(Z, "__esModule", { value: !0 });
|
|
1545
1545
|
};
|
|
1546
1546
|
var Se = {};
|
|
1547
1547
|
return (() => {
|
|
1548
|
-
|
|
1549
|
-
var Z, L =
|
|
1548
|
+
J.d(Se, { default: () => hi });
|
|
1549
|
+
var Z, L = J(872), y = J(54), l = J(51), m = function(e) {
|
|
1550
1550
|
return e.currentMode === "sv" ? (0, l.X)((e.sv.element.textContent + `
|
|
1551
1551
|
`).replace(/\n\n$/, `
|
|
1552
1552
|
`)) : e.currentMode === "wysiwyg" ? e.lute.VditorDOM2Md(e.wysiwyg.element.innerHTML) : e.currentMode === "ir" ? e.lute.VditorIRDOM2Md(e.ir.element.innerHTML) : "";
|
|
1553
|
-
}, c =
|
|
1553
|
+
}, c = J(526), b = function() {
|
|
1554
1554
|
function e() {
|
|
1555
1555
|
this.element = document.createElement("div"), this.element.className = "vditor-devtools", this.element.innerHTML = '<div class="vditor-reset--error"></div><div style="height: 100%;"></div>';
|
|
1556
1556
|
}
|
|
@@ -1565,7 +1565,7 @@ onclick="this.previousElementSibling.select();document.execCommand('copy');this.
|
|
|
1565
1565
|
}
|
|
1566
1566
|
});
|
|
1567
1567
|
}, e;
|
|
1568
|
-
}(), s =
|
|
1568
|
+
}(), s = J(794), u = function(e, t) {
|
|
1569
1569
|
t.forEach(function(n) {
|
|
1570
1570
|
if (e[n]) {
|
|
1571
1571
|
var i = e[n].children[0];
|
|
@@ -1611,19 +1611,19 @@ onclick="this.previousElementSibling.select();document.execCommand('copy');this.
|
|
|
1611
1611
|
o.classList.remove("vditor-hint--current");
|
|
1612
1612
|
}), t.style.display === "block" ? t.style.display = "none" : (E(e, ["subToolbar", "hint", "popover"], n.parentElement.parentElement), n.classList.contains("vditor-tooltipped") || n.classList.add("vditor-hint--current"), t.style.display = "block", e.toolbar.element.getBoundingClientRect().right - n.getBoundingClientRect().right < 250 ? t.classList.add("vditor-panel--left") : t.classList.remove("vditor-panel--left")));
|
|
1613
1613
|
});
|
|
1614
|
-
}, p =
|
|
1614
|
+
}, p = J(827), x = J(64), I = function(e, t, n, i) {
|
|
1615
1615
|
i && console.log(e + " - " + n + ": " + t);
|
|
1616
|
-
}, W =
|
|
1616
|
+
}, W = J(478), N = J(314), $ = J(730), ne = J(66), me = J(218), de = J(702), le = J(466), ve = J(40), xe = J(563), Me = J(749), $e = J(408), Ce = function(e, t) {
|
|
1617
1617
|
if (e)
|
|
1618
1618
|
if (e.parentElement.getAttribute("data-type") !== "html-block") {
|
|
1619
1619
|
var n = e.firstElementChild.className.replace("language-", "");
|
|
1620
1620
|
n === "abc" ? (0, W.Q)(e, t.options.cdn) : n === "mermaid" ? (0, ve.i)(e, t.options.cdn, t.options.theme) : n === "markmap" ? (0, xe.K)(e, t.options.cdn, t.options.theme) : n === "flowchart" ? (0, ne.P)(e, t.options.cdn) : n === "echarts" ? (0, N.p)(e, t.options.cdn, t.options.theme) : n === "mindmap" ? (0, Me.P)(e, t.options.cdn, t.options.theme) : n === "plantuml" ? (0, $e.B)(e, t.options.cdn) : n === "graphviz" ? (0, me.v)(e, t.options.cdn) : n === "math" ? (0, le.H)(e, { cdn: t.options.cdn, math: t.options.preview.math }) : t.options.customRenders.find(function(i) {
|
|
1621
1621
|
if (i.language === n)
|
|
1622
1622
|
return i.render(e, t), !0;
|
|
1623
|
-
}) || ((0,
|
|
1623
|
+
}) || ((0, de.s)(Object.assign({}, t.options.preview.hljs), e, t.options.cdn), (0, $.O)(e, t.options.preview.hljs)), e.setAttribute("data-render", "1");
|
|
1624
1624
|
} else
|
|
1625
1625
|
e.setAttribute("data-render", "1");
|
|
1626
|
-
}, T =
|
|
1626
|
+
}, T = J(393), Ve = function(e) {
|
|
1627
1627
|
if (e.currentMode !== "sv") {
|
|
1628
1628
|
var t = e[e.currentMode].element, n = e.outline.render(e);
|
|
1629
1629
|
n === "" && (n = "[ToC]"), t.querySelectorAll('[data-type="toc-block"]').forEach(function(i) {
|
|
@@ -1645,7 +1645,7 @@ onclick="this.previousElementSibling.select();document.execCommand('copy');this.
|
|
|
1645
1645
|
if (e.previousElementSibling && e.previousElementSibling.classList.contains("vditor-toc")) {
|
|
1646
1646
|
if (n.key === "Backspace" && (0, T.im)(e, t[t.currentMode].element, i).start === 0)
|
|
1647
1647
|
return e.previousElementSibling.remove(), ae(t), !0;
|
|
1648
|
-
if (
|
|
1648
|
+
if (at(t, n, i, e, e.previousElementSibling))
|
|
1649
1649
|
return !0;
|
|
1650
1650
|
}
|
|
1651
1651
|
if (e.nextElementSibling && e.nextElementSibling.classList.contains("vditor-toc")) {
|
|
@@ -1663,7 +1663,7 @@ onclick="this.previousElementSibling.select();document.execCommand('copy');this.
|
|
|
1663
1663
|
n === void 0 && (n = !1);
|
|
1664
1664
|
var r = (0, p.F9)(t.startContainer);
|
|
1665
1665
|
if (r && !n && r.getAttribute("data-type") !== "code-block") {
|
|
1666
|
-
if (
|
|
1666
|
+
if (zt(r.innerHTML) && r.previousElementSibling || Kt(r.innerHTML))
|
|
1667
1667
|
return;
|
|
1668
1668
|
for (var o = (0, T.im)(r, e.ir.element, t).start, a = !0, d = o - 1; d > r.textContent.substr(0, o).lastIndexOf(`
|
|
1669
1669
|
`); d--)
|
|
@@ -1720,16 +1720,16 @@ onclick="this.previousElementSibling.select();document.execCommand('copy');this.
|
|
|
1720
1720
|
te && te.setAttribute("aria-label", H.substr(G.length + 3).trim().substr(0, 24));
|
|
1721
1721
|
}
|
|
1722
1722
|
}
|
|
1723
|
-
var
|
|
1723
|
+
var X, ee = e.ir.element.querySelectorAll("[data-type='link-ref-defs-block']");
|
|
1724
1724
|
ee.forEach(function(F, re) {
|
|
1725
1725
|
re === 0 ? A = F : (A.insertAdjacentHTML("beforeend", F.innerHTML), F.remove());
|
|
1726
1726
|
}), ee.length > 0 && e.ir.element.insertAdjacentElement("beforeend", ee[0]);
|
|
1727
1727
|
var Y = e.ir.element.querySelectorAll("[data-type='footnotes-block']");
|
|
1728
1728
|
Y.forEach(function(F, re) {
|
|
1729
|
-
re === 0 ?
|
|
1729
|
+
re === 0 ? X = F : (X.insertAdjacentHTML("beforeend", F.innerHTML), F.remove());
|
|
1730
1730
|
}), Y.length > 0 && e.ir.element.insertAdjacentElement("beforeend", Y[0]), (0, T.ib)(e.ir.element, t), e.ir.element.querySelectorAll(".vditor-ir__preview[data-render='2']").forEach(function(F) {
|
|
1731
1731
|
Ce(F, e);
|
|
1732
|
-
}), Ve(e),
|
|
1732
|
+
}), Ve(e), Fe(e, { enableAddUndoStack: !0, enableHint: !0, enableInput: !0 });
|
|
1733
1733
|
}, V = function(e, t) {
|
|
1734
1734
|
if (e === "")
|
|
1735
1735
|
return !1;
|
|
@@ -1777,7 +1777,7 @@ onclick="this.previousElementSibling.select();document.execCommand('copy');this.
|
|
|
1777
1777
|
}(e);
|
|
1778
1778
|
return o ? (o.classList.add("vditor-ir__node--expand"), void o.classList.remove("vditor-ir__node--hidden")) : void 0;
|
|
1779
1779
|
}
|
|
1780
|
-
}, ie =
|
|
1780
|
+
}, ie = J(863), se = function(e, t) {
|
|
1781
1781
|
e.querySelectorAll("[data-type=footnotes-link]").forEach(function(n) {
|
|
1782
1782
|
for (var i = n.parentElement, r = i.nextSibling; r && r.textContent.startsWith(" "); ) {
|
|
1783
1783
|
var o = r;
|
|
@@ -1847,15 +1847,15 @@ onclick="this.previousElementSibling.select();document.execCommand('copy');this.
|
|
|
1847
1847
|
`, D.parentElement.remove());
|
|
1848
1848
|
}), C = q + C;
|
|
1849
1849
|
}
|
|
1850
|
-
C =
|
|
1850
|
+
C = cn(C, e), R ? o.innerHTML = C : o.outerHTML = C, e.sv.element.querySelectorAll("[data-type='link-ref-defs-block']").forEach(function(D) {
|
|
1851
1851
|
e.sv.element.insertAdjacentElement("beforeend", D.parentElement);
|
|
1852
1852
|
}), se(e.sv.element, function(D) {
|
|
1853
1853
|
e.sv.element.insertAdjacentElement("beforeend", D);
|
|
1854
1854
|
}), (0, T.ib)(e.sv.element, i), Te(e), He(e, { enableAddUndoStack: !0, enableHint: !0, enableInput: !0 });
|
|
1855
1855
|
}
|
|
1856
|
-
}, Ne =
|
|
1856
|
+
}, Ne = J(227), pe = function(e) {
|
|
1857
1857
|
e.options.theme === "dark" ? e.element.classList.add("vditor--dark") : e.element.classList.remove("vditor--dark");
|
|
1858
|
-
},
|
|
1858
|
+
}, ue = function(e) {
|
|
1859
1859
|
var t = window.innerWidth <= y.g.MOBILE_WIDTH ? 10 : 35;
|
|
1860
1860
|
if (e.wysiwyg.element.parentElement.style.display !== "none") {
|
|
1861
1861
|
var n = (e.wysiwyg.element.parentElement.clientWidth - e.options.preview.maxWidth) / 2;
|
|
@@ -1868,12 +1868,12 @@ onclick="this.previousElementSibling.select();document.execCommand('copy');this.
|
|
|
1868
1868
|
typeof e.options.height == "number" ? (t = e.options.height, typeof e.options.minHeight == "number" && (t = Math.max(t, e.options.minHeight)), t = Math.min(window.innerHeight, t)) : t = e.element.clientHeight, e.element.classList.contains("vditor--fullscreen") && (t = window.innerHeight), e[e.currentMode].element.style.setProperty("--editor-bottom", (t - e.toolbar.element.offsetHeight) / 2 + "px");
|
|
1869
1869
|
}
|
|
1870
1870
|
};
|
|
1871
|
-
function
|
|
1871
|
+
function Ke() {
|
|
1872
1872
|
window.removeEventListener("resize", Z);
|
|
1873
1873
|
}
|
|
1874
|
-
var Xe,
|
|
1875
|
-
Q(e),
|
|
1876
|
-
|
|
1874
|
+
var Xe, en, Kn = function(e) {
|
|
1875
|
+
Q(e), Ke(), window.addEventListener("resize", Z = function() {
|
|
1876
|
+
ue(e), Q(e);
|
|
1877
1877
|
});
|
|
1878
1878
|
var t = (0, s.pK)() && localStorage.getItem(e.options.cache.id);
|
|
1879
1879
|
return e.options.cache.enable && t || (e.options.value ? t = e.options.value : e.originalInnerHTML ? t = e.lute.HTML2Md(e.originalInnerHTML) : e.options.cache.enable || (t = "")), t || "";
|
|
@@ -1894,15 +1894,15 @@ onclick="this.previousElementSibling.select();document.execCommand('copy');this.
|
|
|
1894
1894
|
typeof e.options.input == "function" && t.enableInput && e.options.input(n), e.options.counter.enable && e.counter.render(e, n), e.options.cache.enable && (0, s.pK)() && (localStorage.setItem(e.options.cache.id, n), e.options.cache.after && e.options.cache.after(n)), e.devtools && e.devtools.renderEchart(e), t.enableAddUndoStack && e.undo.addToUndoStack(e);
|
|
1895
1895
|
}
|
|
1896
1896
|
}, e.options.undoDelay);
|
|
1897
|
-
},
|
|
1897
|
+
}, tn = function(e) {
|
|
1898
1898
|
for (var t = "", n = e.nextSibling; n; )
|
|
1899
1899
|
n.nodeType === 3 ? t += n.textContent : t += n.outerHTML, n = n.nextSibling;
|
|
1900
1900
|
return t;
|
|
1901
|
-
},
|
|
1901
|
+
}, nn = function(e) {
|
|
1902
1902
|
for (var t = "", n = e.previousSibling; n; )
|
|
1903
1903
|
t = n.nodeType === 3 ? n.textContent + t : n.outerHTML + t, n = n.previousSibling;
|
|
1904
1904
|
return t;
|
|
1905
|
-
},
|
|
1905
|
+
}, rn = function(e, t) {
|
|
1906
1906
|
Array.from(e.wysiwyg.element.childNodes).find(function(n) {
|
|
1907
1907
|
if (n.nodeType === 3) {
|
|
1908
1908
|
var i = document.createElement("p");
|
|
@@ -1916,7 +1916,7 @@ onclick="this.previousElementSibling.select();document.execCommand('copy');this.
|
|
|
1916
1916
|
}, wt = function(e, t) {
|
|
1917
1917
|
var n = (0, T.zh)(e), i = (0, p.F9)(n.startContainer);
|
|
1918
1918
|
i || (i = n.startContainer.childNodes[n.startOffset]), i || e.wysiwyg.element.children.length !== 0 || (i = e.wysiwyg.element), i && !i.classList.contains("vditor-wysiwyg__block") && (n.insertNode(document.createElement("wbr")), i.innerHTML.trim() === "<wbr>" && (i.innerHTML = "<wbr><br>"), i.tagName === "BLOCKQUOTE" || i.classList.contains("vditor-reset") ? i.innerHTML = "<" + t + ' data-block="0">' + i.innerHTML.trim() + "</" + t + ">" : i.outerHTML = "<" + t + ' data-block="0">' + i.innerHTML.trim() + "</" + t + ">", (0, T.ib)(e.wysiwyg.element, n), Ve(e));
|
|
1919
|
-
},
|
|
1919
|
+
}, Dt = function(e) {
|
|
1920
1920
|
var t = getSelection().getRangeAt(0), n = (0, p.F9)(t.startContainer);
|
|
1921
1921
|
n || (n = t.startContainer.childNodes[t.startOffset]), n && (t.insertNode(document.createElement("wbr")), n.outerHTML = '<p data-block="0">' + n.innerHTML + "</p>", (0, T.ib)(e.wysiwyg.element, t)), e.wysiwyg.popover.style.display = "none";
|
|
1922
1922
|
}, pt = function(e, t, n) {
|
|
@@ -1963,29 +1963,29 @@ onclick="this.previousElementSibling.select();document.execCommand('copy');this.
|
|
|
1963
1963
|
if (A)
|
|
1964
1964
|
return e.wysiwyg.popover.innerHTML = "", Re(A, e), void je(e, A);
|
|
1965
1965
|
var O = (0, x.S)(n, "BLOCKQUOTE");
|
|
1966
|
-
if (O && (e.wysiwyg.popover.innerHTML = "",
|
|
1966
|
+
if (O && (e.wysiwyg.popover.innerHTML = "", rt(t, O, e), it(t, O, e), Re(O, e), je(e, O)), r && (e.wysiwyg.popover.innerHTML = "", rt(t, r, e), it(t, r, e), Re(r, e), je(e, r)), g) {
|
|
1967
1967
|
e.options.lang, e.options, e.wysiwyg.popover.innerHTML = "";
|
|
1968
1968
|
var U = function() {
|
|
1969
|
-
var z = g.rows.length, Ee = g.rows[0].cells.length, et = parseInt(re.value, 10) || z,
|
|
1970
|
-
if (et !== z || Ee !==
|
|
1971
|
-
if (Ee !==
|
|
1972
|
-
for (var
|
|
1973
|
-
if (
|
|
1974
|
-
for (var
|
|
1975
|
-
|
|
1969
|
+
var z = g.rows.length, Ee = g.rows[0].cells.length, et = parseInt(re.value, 10) || z, Ze = parseInt(_e.value, 10) || Ee;
|
|
1970
|
+
if (et !== z || Ee !== Ze) {
|
|
1971
|
+
if (Ee !== Ze)
|
|
1972
|
+
for (var Pn = Ze - Ee, ct = 0; ct < g.rows.length; ct++)
|
|
1973
|
+
if (Pn > 0)
|
|
1974
|
+
for (var qn = 0; qn < Pn; qn++)
|
|
1975
|
+
ct === 0 ? g.rows[ct].lastElementChild.insertAdjacentHTML("afterend", "<th> </th>") : g.rows[ct].lastElementChild.insertAdjacentHTML("afterend", "<td> </td>");
|
|
1976
1976
|
else
|
|
1977
|
-
for (var
|
|
1978
|
-
g.rows[
|
|
1977
|
+
for (var Zt = Ee - 1; Zt >= Ze; Zt--)
|
|
1978
|
+
g.rows[ct].cells[Zt].remove();
|
|
1979
1979
|
if (z !== et) {
|
|
1980
|
-
var
|
|
1981
|
-
if (
|
|
1982
|
-
for (var
|
|
1983
|
-
|
|
1984
|
-
for (var
|
|
1985
|
-
g.querySelector("tbody") ? g.querySelector("tbody").insertAdjacentHTML("beforeend",
|
|
1980
|
+
var Bn = et - z;
|
|
1981
|
+
if (Bn > 0) {
|
|
1982
|
+
for (var $t = "<tr>", dt = 0; dt < Ze; dt++)
|
|
1983
|
+
$t += "<td> </td>";
|
|
1984
|
+
for (var Vn = 0; Vn < Bn; Vn++)
|
|
1985
|
+
g.querySelector("tbody") ? g.querySelector("tbody").insertAdjacentHTML("beforeend", $t) : g.querySelector("thead").insertAdjacentHTML("afterend", $t + "</tr>");
|
|
1986
1986
|
} else
|
|
1987
|
-
for (
|
|
1988
|
-
g.rows[
|
|
1987
|
+
for (dt = z - 1; dt >= et; dt--)
|
|
1988
|
+
g.rows[dt].remove(), g.rows.length === 1 && g.querySelector("tbody").remove();
|
|
1989
1989
|
}
|
|
1990
1990
|
typeof e.options.input == "function" && e.options.input(m(e));
|
|
1991
1991
|
}
|
|
@@ -2008,15 +2008,15 @@ onclick="this.previousElementSibling.select();document.execCommand('copy');this.
|
|
|
2008
2008
|
var G = document.createElement("button");
|
|
2009
2009
|
G.setAttribute("type", "button"), G.setAttribute("aria-label", window.VditorI18n.insertRowBelow + "<" + (0, s.ns)("⌘=") + ">"), G.setAttribute("data-type", "insertRow"), G.innerHTML = '<svg><use xlink:href="#vditor-icon-insert-row"></use></svg>', G.className = "vditor-icon vditor-tooltipped vditor-tooltipped__n", G.onclick = function() {
|
|
2010
2010
|
var z = getSelection().getRangeAt(0).startContainer, Ee = (0, p.lG)(z, "TD") || (0, p.lG)(z, "TH");
|
|
2011
|
-
Ee &&
|
|
2011
|
+
Ee && wn(e, t, Ee);
|
|
2012
2012
|
};
|
|
2013
2013
|
var te = document.createElement("button");
|
|
2014
2014
|
te.setAttribute("type", "button"), te.setAttribute("aria-label", window.VditorI18n.insertRowAbove + "<" + (0, s.ns)("⇧⌘F") + ">"), te.setAttribute("data-type", "insertRow"), te.innerHTML = '<svg><use xlink:href="#vditor-icon-insert-rowb"></use></svg>', te.className = "vditor-icon vditor-tooltipped vditor-tooltipped__n", te.onclick = function() {
|
|
2015
2015
|
var z = getSelection().getRangeAt(0).startContainer, Ee = (0, p.lG)(z, "TD") || (0, p.lG)(z, "TH");
|
|
2016
|
-
Ee &&
|
|
2016
|
+
Ee && En(e, t, Ee);
|
|
2017
2017
|
};
|
|
2018
|
-
var
|
|
2019
|
-
|
|
2018
|
+
var X = document.createElement("button");
|
|
2019
|
+
X.setAttribute("type", "button"), X.setAttribute("aria-label", window.VditorI18n.insertColumnRight + "<" + (0, s.ns)("⇧⌘=") + ">"), X.setAttribute("data-type", "insertColumn"), X.innerHTML = '<svg><use xlink:href="#vditor-icon-insert-column"></use></svg>', X.className = "vditor-icon vditor-tooltipped vditor-tooltipped__n", X.onclick = function() {
|
|
2020
2020
|
var z = getSelection().getRangeAt(0).startContainer, Ee = (0, p.lG)(z, "TD") || (0, p.lG)(z, "TH");
|
|
2021
2021
|
Ee && Ct(e, g, Ee);
|
|
2022
2022
|
};
|
|
@@ -2028,12 +2028,12 @@ onclick="this.previousElementSibling.select();document.execCommand('copy');this.
|
|
|
2028
2028
|
var Y = document.createElement("button");
|
|
2029
2029
|
Y.setAttribute("type", "button"), Y.setAttribute("aria-label", window.VditorI18n["delete-row"] + "<" + (0, s.ns)("⌘-") + ">"), Y.setAttribute("data-type", "deleteRow"), Y.innerHTML = '<svg><use xlink:href="#vditor-icon-delete-row"></use></svg>', Y.className = "vditor-icon vditor-tooltipped vditor-tooltipped__n", Y.onclick = function() {
|
|
2030
2030
|
var z = getSelection().getRangeAt(0).startContainer, Ee = (0, p.lG)(z, "TD") || (0, p.lG)(z, "TH");
|
|
2031
|
-
Ee &&
|
|
2031
|
+
Ee && kn(e, t, Ee);
|
|
2032
2032
|
};
|
|
2033
2033
|
var F = document.createElement("button");
|
|
2034
2034
|
F.setAttribute("type", "button"), F.setAttribute("aria-label", window.VditorI18n["delete-column"] + "<" + (0, s.ns)("⇧⌘-") + ">"), F.setAttribute("data-type", "deleteColumn"), F.innerHTML = '<svg><use xlink:href="#vditor-icon-delete-column"></use></svg>', F.className = "vditor-icon vditor-tooltipped vditor-tooltipped__n", F.onclick = function() {
|
|
2035
2035
|
var z = getSelection().getRangeAt(0).startContainer, Ee = (0, p.lG)(z, "TD") || (0, p.lG)(z, "TH");
|
|
2036
|
-
Ee &&
|
|
2036
|
+
Ee && Sn(e, t, g, Ee);
|
|
2037
2037
|
}, (Pe = document.createElement("span")).setAttribute("aria-label", window.VditorI18n.row), Pe.className = "vditor-tooltipped vditor-tooltipped__n";
|
|
2038
2038
|
var re = document.createElement("input");
|
|
2039
2039
|
Pe.appendChild(re), re.type = "number", re.min = "1", re.className = "vditor-input", re.style.width = "42px", re.style.textAlign = "center", re.setAttribute("placeholder", window.VditorI18n.row), re.value = g.rows.length.toString(), re.oninput = function() {
|
|
@@ -2050,10 +2050,10 @@ onclick="this.previousElementSibling.select();document.execCommand('copy');this.
|
|
|
2050
2050
|
}, _e.onkeydown = function(z) {
|
|
2051
2051
|
if (!z.isComposing)
|
|
2052
2052
|
return z.key === "Tab" ? (re.focus(), re.select(), void z.preventDefault()) : void (De(e, z) || Ue(z, t));
|
|
2053
|
-
},
|
|
2053
|
+
}, rt(t, g, e), it(t, g, e), Re(g, e), e.wysiwyg.popover.insertAdjacentElement("beforeend", B), e.wysiwyg.popover.insertAdjacentElement("beforeend", P), e.wysiwyg.popover.insertAdjacentElement("beforeend", H), e.wysiwyg.popover.insertAdjacentElement("beforeend", te), e.wysiwyg.popover.insertAdjacentElement("beforeend", G), e.wysiwyg.popover.insertAdjacentElement("beforeend", ee), e.wysiwyg.popover.insertAdjacentElement("beforeend", X), e.wysiwyg.popover.insertAdjacentElement("beforeend", Y), e.wysiwyg.popover.insertAdjacentElement("beforeend", F), e.wysiwyg.popover.insertAdjacentElement("beforeend", Pe), e.wysiwyg.popover.insertAdjacentHTML("beforeend", " x "), e.wysiwyg.popover.insertAdjacentElement("beforeend", ye), je(e, g);
|
|
2054
2054
|
}
|
|
2055
|
-
var
|
|
2056
|
-
|
|
2055
|
+
var Ge = (0, p.a1)(n, "data-type", "link-ref");
|
|
2056
|
+
Ge && on(e, Ge, t);
|
|
2057
2057
|
var Oe = (0, p.a1)(n, "data-type", "footnotes-ref");
|
|
2058
2058
|
if (Oe) {
|
|
2059
2059
|
e.options.lang, e.options, e.wysiwyg.popover.innerHTML = "", (Pe = document.createElement("span")).setAttribute("aria-label", window.VditorI18n.footnoteRef + "<" + (0, s.ns)("⌥Enter") + ">"), Pe.className = "vditor-tooltipped vditor-tooltipped__n";
|
|
@@ -2064,29 +2064,29 @@ onclick="this.previousElementSibling.select();document.execCommand('copy');this.
|
|
|
2064
2064
|
z.isComposing || De(e, z) || Ue(z, t);
|
|
2065
2065
|
}, Re(Oe, e), e.wysiwyg.popover.insertAdjacentElement("beforeend", Pe), je(e, Oe);
|
|
2066
2066
|
}
|
|
2067
|
-
var Ae = (0, p.fb)(n, "vditor-wysiwyg__block"),
|
|
2067
|
+
var Ae = (0, p.fb)(n, "vditor-wysiwyg__block"), st = !!Ae && Ae.getAttribute("data-type").indexOf("block") > -1;
|
|
2068
2068
|
if (e.wysiwyg.element.querySelectorAll(".vditor-wysiwyg__preview").forEach(function(z) {
|
|
2069
|
-
(!Ae || Ae &&
|
|
2070
|
-
}), Ae &&
|
|
2071
|
-
if (e.wysiwyg.popover.innerHTML = "",
|
|
2069
|
+
(!Ae || Ae && st && !Ae.contains(z)) && (z.previousElementSibling.style.display = "none");
|
|
2070
|
+
}), Ae && st) {
|
|
2071
|
+
if (e.wysiwyg.popover.innerHTML = "", rt(t, Ae, e), it(t, Ae, e), Re(Ae, e), Ae.getAttribute("data-type") === "code-block") {
|
|
2072
2072
|
var At = document.createElement("span");
|
|
2073
2073
|
At.setAttribute("aria-label", window.VditorI18n.language + "<" + (0, s.ns)("⌥Enter") + ">"), At.className = "vditor-tooltipped vditor-tooltipped__n";
|
|
2074
|
-
var
|
|
2075
|
-
At.appendChild(
|
|
2074
|
+
var Be = document.createElement("input");
|
|
2075
|
+
At.appendChild(Be);
|
|
2076
2076
|
var gt = Ae.firstElementChild.firstElementChild;
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
},
|
|
2077
|
+
Be.className = "vditor-input", Be.setAttribute("placeholder", window.VditorI18n.language + "<" + (0, s.ns)("⌥Enter") + ">"), Be.value = gt.className.indexOf("language-") > -1 ? gt.className.split("-")[1].split(" ")[0] : "", Be.oninput = function(z) {
|
|
2078
|
+
Be.value.trim() !== "" ? gt.className = "language-" + Be.value : (gt.className = "", e.hint.recentLanguage = ""), Ae.lastElementChild.classList.contains("vditor-wysiwyg__preview") && (Ae.lastElementChild.innerHTML = Ae.firstElementChild.innerHTML, Ce(Ae.lastElementChild, e)), we(e), z.detail === 1 && (t.setStart(gt.firstChild, 0), t.collapse(!0), (0, T.Hc)(t));
|
|
2079
|
+
}, Be.onkeydown = function(z) {
|
|
2080
2080
|
if (!z.isComposing && !De(e, z)) {
|
|
2081
2081
|
if (z.key === "Escape" && e.hint.element.style.display === "block")
|
|
2082
2082
|
return e.hint.element.style.display = "none", void z.preventDefault();
|
|
2083
2083
|
e.hint.select(z, e), Ue(z, t);
|
|
2084
2084
|
}
|
|
2085
|
-
},
|
|
2085
|
+
}, Be.onkeyup = function(z) {
|
|
2086
2086
|
if (!z.isComposing && z.key !== "Enter" && z.key !== "ArrowUp" && z.key !== "Escape" && z.key !== "ArrowDown") {
|
|
2087
|
-
var Ee = [], et =
|
|
2088
|
-
(e.options.preview.hljs.langs || y.g.CODE_LANGUAGES).forEach(function(
|
|
2089
|
-
|
|
2087
|
+
var Ee = [], et = Be.value.substring(0, Be.selectionStart);
|
|
2088
|
+
(e.options.preview.hljs.langs || y.g.CODE_LANGUAGES).forEach(function(Ze) {
|
|
2089
|
+
Ze.indexOf(et.toLowerCase()) > -1 && Ee.push({ html: Ze, value: Ze });
|
|
2090
2090
|
}), e.hint.genHTML(Ee, et, e), z.preventDefault();
|
|
2091
2091
|
}
|
|
2092
2092
|
}, e.wysiwyg.popover.insertAdjacentElement("beforeend", At);
|
|
@@ -2102,23 +2102,23 @@ onclick="this.previousElementSibling.select();document.execCommand('copy');this.
|
|
|
2102
2102
|
h.setAttribute("data-id", Je.value), typeof e.options.input == "function" && e.options.input(m(e));
|
|
2103
2103
|
}, Je.onkeydown = function(z) {
|
|
2104
2104
|
z.isComposing || De(e, z) || Ue(z, t);
|
|
2105
|
-
},
|
|
2105
|
+
}, rt(t, h, e), it(t, h, e), Re(h, e), e.wysiwyg.popover.insertAdjacentElement("beforeend", Pe), je(e, h);
|
|
2106
2106
|
}
|
|
2107
|
-
if (v &&
|
|
2108
|
-
var
|
|
2109
|
-
|
|
2107
|
+
if (v && Ot(e, v, t), !(O || r || g || Ae || v || Ge || Oe || h || A)) {
|
|
2108
|
+
var lt = (0, p.a1)(n, "data-block", "0");
|
|
2109
|
+
lt && lt.parentElement.isEqualNode(e.wysiwyg.element) ? (e.wysiwyg.popover.innerHTML = "", rt(t, lt, e), it(t, lt, e), Re(lt, e), je(e, lt)) : e.wysiwyg.popover.style.display = "none";
|
|
2110
2110
|
}
|
|
2111
2111
|
e.wysiwyg.element.querySelectorAll('span[data-type="backslash"] > span').forEach(function(z) {
|
|
2112
2112
|
z.style.display = "none";
|
|
2113
2113
|
});
|
|
2114
|
-
var
|
|
2115
|
-
|
|
2114
|
+
var Rn = (0, p.a1)(t.startContainer, "data-type", "backslash");
|
|
2115
|
+
Rn && (Rn.querySelector("span").style.display = "inline");
|
|
2116
2116
|
}
|
|
2117
2117
|
}, 200);
|
|
2118
2118
|
}, je = function(e, t) {
|
|
2119
2119
|
var n = t, i = (0, p.lG)(t, "TABLE");
|
|
2120
2120
|
i && (n = i), e.wysiwyg.popover.style.left = "0", e.wysiwyg.popover.style.display = "block", e.wysiwyg.popover.style.top = Math.max(-8, n.offsetTop - 21 - e.wysiwyg.element.scrollTop) + "px", e.wysiwyg.popover.style.left = Math.min(n.offsetLeft, e.wysiwyg.element.clientWidth - e.wysiwyg.popover.clientWidth) + "px", e.wysiwyg.popover.setAttribute("data-top", (n.offsetTop - 21).toString());
|
|
2121
|
-
},
|
|
2121
|
+
}, on = function(e, t, n) {
|
|
2122
2122
|
n === void 0 && (n = getSelection().getRangeAt(0)), e.wysiwyg.popover.innerHTML = "";
|
|
2123
2123
|
var i = function() {
|
|
2124
2124
|
o.value.trim() !== "" && (t.tagName === "IMG" ? t.setAttribute("alt", o.value) : t.textContent = o.value), d.value.trim() !== "" && t.setAttribute("data-link-label", d.value), typeof e.options.input == "function" && e.options.input(m(e));
|
|
@@ -2138,7 +2138,7 @@ onclick="this.previousElementSibling.select();document.execCommand('copy');this.
|
|
|
2138
2138
|
}, d.onkeydown = function(v) {
|
|
2139
2139
|
De(e, v) || Ue(v, n) || mt(e, t, v, o);
|
|
2140
2140
|
}, Re(t, e), e.wysiwyg.popover.insertAdjacentElement("beforeend", r), e.wysiwyg.popover.insertAdjacentElement("beforeend", a), je(e, t);
|
|
2141
|
-
},
|
|
2141
|
+
}, rt = function(e, t, n) {
|
|
2142
2142
|
var i = t.previousElementSibling;
|
|
2143
2143
|
if (i && (t.parentElement.isEqualNode(n.wysiwyg.element) || t.tagName === "LI")) {
|
|
2144
2144
|
var r = document.createElement("button");
|
|
@@ -2146,7 +2146,7 @@ onclick="this.previousElementSibling.select();document.execCommand('copy');this.
|
|
|
2146
2146
|
e.insertNode(document.createElement("wbr")), i.insertAdjacentElement("beforebegin", t), (0, T.ib)(n.wysiwyg.element, e), we(n), Qe(n), Te(n);
|
|
2147
2147
|
}, n.wysiwyg.popover.insertAdjacentElement("beforeend", r);
|
|
2148
2148
|
}
|
|
2149
|
-
},
|
|
2149
|
+
}, it = function(e, t, n) {
|
|
2150
2150
|
var i = t.nextElementSibling;
|
|
2151
2151
|
if (i && (t.parentElement.isEqualNode(n.wysiwyg.element) || t.tagName === "LI")) {
|
|
2152
2152
|
var r = document.createElement("button");
|
|
@@ -2169,7 +2169,7 @@ onclick="this.previousElementSibling.select();document.execCommand('copy');this.
|
|
|
2169
2169
|
t.insertAdjacentHTML("afterend", y.g.ZWSP), r.setStartAfter(t.nextSibling), r.collapse(!0), (0, T.Hc)(r), n.preventDefault();
|
|
2170
2170
|
}
|
|
2171
2171
|
}
|
|
2172
|
-
},
|
|
2172
|
+
}, Ot = function(e, t, n) {
|
|
2173
2173
|
e.wysiwyg.popover.innerHTML = "";
|
|
2174
2174
|
var i = function() {
|
|
2175
2175
|
o.value.trim() !== "" && (t.innerHTML = o.value), t.setAttribute("href", d.value), t.setAttribute("title", g.value), we(e);
|
|
@@ -2204,9 +2204,9 @@ onclick="this.previousElementSibling.select();document.execCommand('copy');this.
|
|
|
2204
2204
|
}, Ue = function(e, t) {
|
|
2205
2205
|
if (!(0, s.yl)(e) && !e.shiftKey && e.key === "Enter" || e.key === "Escape")
|
|
2206
2206
|
return t && (0, T.Hc)(t), e.preventDefault(), e.stopPropagation(), !0;
|
|
2207
|
-
},
|
|
2207
|
+
}, ot = function(e) {
|
|
2208
2208
|
e.currentMode === "wysiwyg" ? Qe(e) : e.currentMode === "ir" && ut(e);
|
|
2209
|
-
},
|
|
2209
|
+
}, an = function(e, t, n) {
|
|
2210
2210
|
n === void 0 && (n = { enableAddUndoStack: !0, enableHint: !1, enableInput: !0 });
|
|
2211
2211
|
var i = e.wysiwyg.element;
|
|
2212
2212
|
i.innerHTML = e.lute.Md2VditorDOM(t), i.querySelectorAll(".vditor-wysiwyg__preview[data-render='2']").forEach(function(r) {
|
|
@@ -2214,13 +2214,13 @@ onclick="this.previousElementSibling.select();document.execCommand('copy');this.
|
|
|
2214
2214
|
}), we(e, n);
|
|
2215
2215
|
}, Fn = function(e, t, n) {
|
|
2216
2216
|
for (var i = e.startContainer.parentElement, r = !1, o = "", a = "", d = function(C) {
|
|
2217
|
-
var R =
|
|
2217
|
+
var R = nn(C.startContainer), q = tn(C.startContainer), D = C.startContainer.textContent, B = C.startOffset, P = "", H = "";
|
|
2218
2218
|
return (D.substr(0, B) !== "" && D.substr(0, B) !== y.g.ZWSP || R) && (P = "" + R + D.substr(0, B)), (D.substr(B) !== "" && D.substr(B) !== y.g.ZWSP || q) && (H = "" + D.substr(B) + q), { afterHTML: H, beforeHTML: P };
|
|
2219
2219
|
}(e), v = d.beforeHTML, g = d.afterHTML; i && !r; ) {
|
|
2220
2220
|
var h = i.tagName;
|
|
2221
2221
|
if (h === "STRIKE" && (h = "S"), h === "I" && (h = "EM"), h === "B" && (h = "STRONG"), h === "S" || h === "STRONG" || h === "EM") {
|
|
2222
2222
|
var A = "", O = "", U = "";
|
|
2223
|
-
i.parentElement.getAttribute("data-block") !== "0" && (O =
|
|
2223
|
+
i.parentElement.getAttribute("data-block") !== "0" && (O = nn(i), U = tn(i)), (v || O) && (v = A = O + "<" + h + ">" + v + "</" + h + ">"), (n === "bold" && h === "STRONG" || n === "italic" && h === "EM" || n === "strikeThrough" && h === "S") && (A += "" + o + y.g.ZWSP + "<wbr>" + a, r = !0), (g || U) && (A += g = "<" + h + ">" + g + "</" + h + ">" + U), i.parentElement.getAttribute("data-block") !== "0" ? (i = i.parentElement).innerHTML = A : (i.outerHTML = A, i = i.parentElement), o = "<" + h + ">" + o, a = "</" + h + ">" + a;
|
|
2224
2224
|
} else
|
|
2225
2225
|
r = !0;
|
|
2226
2226
|
}
|
|
@@ -2280,13 +2280,13 @@ onclick="this.previousElementSibling.select();document.execCommand('copy');this.
|
|
|
2280
2280
|
else if (R === "link") {
|
|
2281
2281
|
if (C.toString() === "") {
|
|
2282
2282
|
var G = document.createElement("a");
|
|
2283
|
-
G.innerText = y.g.ZWSP, C.insertNode(G), C.setStart(G.firstChild, 1), C.collapse(!0),
|
|
2283
|
+
G.innerText = y.g.ZWSP, C.insertNode(G), C.setStart(G.firstChild, 1), C.collapse(!0), Ot(g, G, C);
|
|
2284
2284
|
var te = g.wysiwyg.popover.querySelector("input");
|
|
2285
2285
|
te.value = "", te.focus(), U = !1;
|
|
2286
2286
|
} else {
|
|
2287
|
-
(H = document.createElement("a")).setAttribute("href", ""), H.innerHTML = C.toString(), C.surroundContents(H), C.insertNode(H), (0, T.Hc)(C),
|
|
2288
|
-
var
|
|
2289
|
-
|
|
2287
|
+
(H = document.createElement("a")).setAttribute("href", ""), H.innerHTML = C.toString(), C.surroundContents(H), C.insertNode(H), (0, T.Hc)(C), Ot(g, H, C);
|
|
2288
|
+
var X = g.wysiwyg.popover.querySelectorAll("input");
|
|
2289
|
+
X[0].value = H.innerText, X[1].focus();
|
|
2290
2290
|
}
|
|
2291
2291
|
O = !1, h.classList.add("vditor-menu--current");
|
|
2292
2292
|
} else if (R === "table") {
|
|
@@ -2297,10 +2297,10 @@ onclick="this.previousElementSibling.select();document.execCommand('copy');this.
|
|
|
2297
2297
|
ee = '<table data-block="0"><thead><tr>';
|
|
2298
2298
|
var Y = C.toString().split(`
|
|
2299
2299
|
`), F = Y[0].split(",").length > Y[0].split(" ").length ? "," : " ";
|
|
2300
|
-
Y.forEach(function(_e,
|
|
2301
|
-
|
|
2300
|
+
Y.forEach(function(_e, Ge) {
|
|
2301
|
+
Ge === 0 ? (_e.split(F).forEach(function(Oe, Ie) {
|
|
2302
2302
|
ee += Ie === 0 ? "<th>" + Oe + "<wbr></th>" : "<th>" + Oe + "</th>";
|
|
2303
|
-
}), ee += "</tr></thead>") : (ee +=
|
|
2303
|
+
}), ee += "</tr></thead>") : (ee += Ge === 1 ? "<tbody><tr>" : "<tr>", _e.split(F).forEach(function(Oe) {
|
|
2304
2304
|
ee += "<td>" + Oe + "</td>";
|
|
2305
2305
|
}), ee += "</tr>");
|
|
2306
2306
|
}), ee += "</tbody></table>", document.execCommand("insertHTML", !1, ee), (0, T.ib)(g.wysiwyg.element, C);
|
|
@@ -2339,21 +2339,21 @@ onclick="this.previousElementSibling.select();document.execCommand('copy');this.
|
|
|
2339
2339
|
var i;
|
|
2340
2340
|
if (typeof n != "string" ? (E(e, ["subToolbar", "hint"]), n.preventDefault(), i = m(e)) : i = n, e.currentMode !== t || typeof n == "string") {
|
|
2341
2341
|
if (e.devtools && e.devtools.renderEchart(e), e.options.preview.mode === "both" && t === "sv" ? e.preview.element.style.display = "block" : e.preview.element.style.display = "none", w(e.toolbar.elements, y.g.EDIT_TOOLBARS), u(e.toolbar.elements, y.g.EDIT_TOOLBARS), _(e.toolbar.elements, ["outdent", "indent"]), t === "ir")
|
|
2342
|
-
S(e.toolbar.elements, ["both"]), M(e.toolbar.elements, ["outdent", "indent", "outline", "insert-before", "insert-after"]), e.sv.element.style.display = "none", e.wysiwyg.element.parentElement.style.display = "none", e.ir.element.parentElement.style.display = "block", e.lute.SetVditorIR(!0), e.lute.SetVditorWYSIWYG(!1), e.lute.SetVditorSV(!1), e.currentMode = "ir", e.ir.element.innerHTML = e.lute.Md2VditorIRDOM(i),
|
|
2342
|
+
S(e.toolbar.elements, ["both"]), M(e.toolbar.elements, ["outdent", "indent", "outline", "insert-before", "insert-after"]), e.sv.element.style.display = "none", e.wysiwyg.element.parentElement.style.display = "none", e.ir.element.parentElement.style.display = "block", e.lute.SetVditorIR(!0), e.lute.SetVditorWYSIWYG(!1), e.lute.SetVditorSV(!1), e.currentMode = "ir", e.ir.element.innerHTML = e.lute.Md2VditorIRDOM(i), Fe(e, { enableAddUndoStack: !0, enableHint: !1, enableInput: !1 }), ue(e), e.ir.element.querySelectorAll(".vditor-ir__preview[data-render='2']").forEach(function(o) {
|
|
2343
2343
|
Ce(o, e);
|
|
2344
2344
|
}), e.ir.element.querySelectorAll(".vditor-toc").forEach(function(o) {
|
|
2345
2345
|
(0, le.H)(o, { cdn: e.options.cdn, math: e.options.preview.math });
|
|
2346
2346
|
});
|
|
2347
2347
|
else if (t === "wysiwyg")
|
|
2348
|
-
S(e.toolbar.elements, ["both"]), M(e.toolbar.elements, ["outdent", "indent", "outline", "insert-before", "insert-after"]), e.sv.element.style.display = "none", e.wysiwyg.element.parentElement.style.display = "block", e.ir.element.parentElement.style.display = "none", e.lute.SetVditorIR(!1), e.lute.SetVditorWYSIWYG(!0), e.lute.SetVditorSV(!1), e.currentMode = "wysiwyg",
|
|
2348
|
+
S(e.toolbar.elements, ["both"]), M(e.toolbar.elements, ["outdent", "indent", "outline", "insert-before", "insert-after"]), e.sv.element.style.display = "none", e.wysiwyg.element.parentElement.style.display = "block", e.ir.element.parentElement.style.display = "none", e.lute.SetVditorIR(!1), e.lute.SetVditorWYSIWYG(!0), e.lute.SetVditorSV(!1), e.currentMode = "wysiwyg", ue(e), an(e, i, { enableAddUndoStack: !0, enableHint: !1, enableInput: !1 }), e.wysiwyg.element.querySelectorAll(".vditor-toc").forEach(function(o) {
|
|
2349
2349
|
(0, le.H)(o, { cdn: e.options.cdn, math: e.options.preview.math });
|
|
2350
2350
|
}), e.wysiwyg.popover.style.display = "none";
|
|
2351
2351
|
else if (t === "sv") {
|
|
2352
2352
|
M(e.toolbar.elements, ["both"]), S(e.toolbar.elements, ["outdent", "indent", "outline", "insert-before", "insert-after"]), e.wysiwyg.element.parentElement.style.display = "none", e.ir.element.parentElement.style.display = "none", (e.options.preview.mode === "both" || e.options.preview.mode === "editor") && (e.sv.element.style.display = "block"), e.lute.SetVditorIR(!1), e.lute.SetVditorWYSIWYG(!1), e.lute.SetVditorSV(!0), e.currentMode = "sv";
|
|
2353
|
-
var r =
|
|
2354
|
-
r === "<div data-block='0'></div>" && (r = ""), e.sv.element.innerHTML = r, se(e.sv.element), He(e, { enableAddUndoStack: !0, enableHint: !1, enableInput: !1 }),
|
|
2353
|
+
var r = cn(i, e);
|
|
2354
|
+
r === "<div data-block='0'></div>" && (r = ""), e.sv.element.innerHTML = r, se(e.sv.element), He(e, { enableAddUndoStack: !0, enableHint: !1, enableInput: !1 }), ue(e);
|
|
2355
2355
|
}
|
|
2356
|
-
e.undo.resetIcon(e), typeof n != "string" && (e[e.currentMode].element.focus(),
|
|
2356
|
+
e.undo.resetIcon(e), typeof n != "string" && (e[e.currentMode].element.focus(), ot(e)), Ve(e), Q(e), e.toolbar.elements["edit-mode"] && (e.toolbar.elements["edit-mode"].querySelectorAll("button").forEach(function(o) {
|
|
2357
2357
|
o.classList.remove("vditor-menu--current");
|
|
2358
2358
|
}), e.toolbar.elements["edit-mode"].querySelector('button[data-mode="' + e.currentMode + '"]').classList.add("vditor-menu--current")), e.outline.toggle(e, e.currentMode !== "sv" && e.options.outline.enable, typeof n != "string");
|
|
2359
2359
|
}
|
|
@@ -2376,15 +2376,15 @@ onclick="this.previousElementSibling.select();document.execCommand('copy');this.
|
|
|
2376
2376
|
}, t;
|
|
2377
2377
|
}(Le), ft = function(e, t) {
|
|
2378
2378
|
return (0, T.Gb)(e, t) ? getSelection().toString() : "";
|
|
2379
|
-
},
|
|
2379
|
+
}, It = function(e, t) {
|
|
2380
2380
|
t.addEventListener("focus", function() {
|
|
2381
2381
|
e.options.focus && e.options.focus(m(e)), E(e, ["subToolbar", "hint"]);
|
|
2382
2382
|
});
|
|
2383
|
-
},
|
|
2383
|
+
}, sn = function(e, t) {
|
|
2384
2384
|
t.addEventListener("dblclick", function(n) {
|
|
2385
2385
|
n.target.tagName === "IMG" && (e.options.image.preview ? e.options.image.preview(n.target) : e.options.image.isPreview && (0, ie.E)(n.target, e.options.lang, e.options.theme));
|
|
2386
2386
|
});
|
|
2387
|
-
},
|
|
2387
|
+
}, jt = function(e, t) {
|
|
2388
2388
|
t.addEventListener("blur", function(n) {
|
|
2389
2389
|
if (e.currentMode === "ir") {
|
|
2390
2390
|
var i = e.ir.element.querySelector(".vditor-ir__node--expand");
|
|
@@ -2393,7 +2393,7 @@ onclick="this.previousElementSibling.select();document.execCommand('copy');this.
|
|
|
2393
2393
|
e.currentMode !== "wysiwyg" || e.wysiwyg.selectPopover.contains(n.relatedTarget) || e.wysiwyg.hideComment();
|
|
2394
2394
|
e[e.currentMode].range = (0, T.zh)(e), e.options.blur && e.options.blur(m(e));
|
|
2395
2395
|
});
|
|
2396
|
-
},
|
|
2396
|
+
}, Rt = function(e, t) {
|
|
2397
2397
|
t.addEventListener("dragstart", function(n) {
|
|
2398
2398
|
n.dataTransfer.setData(y.g.DROP_EDITOR, y.g.DROP_EDITOR);
|
|
2399
2399
|
}), t.addEventListener("drop", function(n) {
|
|
@@ -2401,11 +2401,11 @@ onclick="this.previousElementSibling.select();document.execCommand('copy');this.
|
|
|
2401
2401
|
document.execCommand("insertHTML", !1, i);
|
|
2402
2402
|
} });
|
|
2403
2403
|
});
|
|
2404
|
-
},
|
|
2404
|
+
}, Pt = function(e, t, n) {
|
|
2405
2405
|
t.addEventListener("copy", function(i) {
|
|
2406
2406
|
return n(i, e);
|
|
2407
2407
|
});
|
|
2408
|
-
},
|
|
2408
|
+
}, qt = function(e, t, n) {
|
|
2409
2409
|
t.addEventListener("cut", function(i) {
|
|
2410
2410
|
n(i, e), e.options.comment.enable && e.currentMode === "wysiwyg" && e.wysiwyg.getComments(e), document.execCommand("delete");
|
|
2411
2411
|
});
|
|
@@ -2414,7 +2414,7 @@ onclick="this.previousElementSibling.select();document.execCommand('copy');this.
|
|
|
2414
2414
|
var t = e[e.currentMode].element, n = (0, T.Ny)(t).top;
|
|
2415
2415
|
e.options.height !== "auto" || e.element.classList.contains("vditor--fullscreen") || window.scrollTo(window.scrollX, n + e.element.offsetTop + e.toolbar.element.offsetHeight - window.innerHeight / 2 + 10), (e.options.height !== "auto" || e.element.classList.contains("vditor--fullscreen")) && (t.scrollTop = n + t.scrollTop - t.clientHeight / 2 + 10);
|
|
2416
2416
|
}
|
|
2417
|
-
},
|
|
2417
|
+
}, Bt = function(e, t) {
|
|
2418
2418
|
t.addEventListener("keydown", function(n) {
|
|
2419
2419
|
if (!n.isComposing && e.options.keydown && e.options.keydown(n), !(e.options.hint.extend.length > 1 || e.toolbar.elements.emoji) || !e.hint.select(n, e)) {
|
|
2420
2420
|
if (e.options.comment.enable && e.currentMode === "wysiwyg" && (n.key === "Backspace" || V("⌘X", n)) && e.wysiwyg.getComments(e), e.currentMode === "sv") {
|
|
@@ -2437,12 +2437,12 @@ onclick="this.previousElementSibling.select();document.execCommand('copy');this.
|
|
|
2437
2437
|
return H.insertAdjacentHTML("beforebegin", '<span data-type="padding">' + H.textContent.replace(/\S/g, " ") + "</span>"), /^\d/.test(H.textContent) && (H.textContent = H.textContent.replace(/^\d{1,}/, "1"), A.selectNodeContents(D.firstChild), A.collapse(!1)), oe(r), o.preventDefault(), !0;
|
|
2438
2438
|
}
|
|
2439
2439
|
}
|
|
2440
|
-
if (
|
|
2440
|
+
if (Ft(r, A, o))
|
|
2441
2441
|
return !0;
|
|
2442
2442
|
var G = (0, p.a1)(O, "data-block", "0"), te = (0, x.S)(O, "SPAN");
|
|
2443
2443
|
if (o.key === "Enter" && !(0, s.yl)(o) && !o.altKey && !o.shiftKey && G) {
|
|
2444
|
-
var
|
|
2445
|
-
(0, T.im)(G, r.sv.element).start <= (ee ? ee[0].length : 0) && (
|
|
2444
|
+
var X = !1, ee = G.textContent.match(/^\n+/);
|
|
2445
|
+
(0, T.im)(G, r.sv.element).start <= (ee ? ee[0].length : 0) && (X = !0);
|
|
2446
2446
|
var Y = `
|
|
2447
2447
|
`;
|
|
2448
2448
|
if (te) {
|
|
@@ -2450,7 +2450,7 @@ onclick="this.previousElementSibling.select();document.execCommand('copy');this.
|
|
|
2450
2450
|
return te.previousElementSibling.remove(), He(r), o.preventDefault(), !0;
|
|
2451
2451
|
Y += $n(te);
|
|
2452
2452
|
}
|
|
2453
|
-
return A.insertNode(document.createTextNode(Y)), A.collapse(!1), G && G.textContent.trim() !== "" && !
|
|
2453
|
+
return A.insertNode(document.createTextNode(Y)), A.collapse(!1), G && G.textContent.trim() !== "" && !X ? oe(r) : He(r), o.preventDefault(), !0;
|
|
2454
2454
|
}
|
|
2455
2455
|
if (o.key === "Backspace" && !(0, s.yl)(o) && !o.altKey && !o.shiftKey) {
|
|
2456
2456
|
if (te && ((g = te.previousElementSibling) === null || g === void 0 ? void 0 : g.getAttribute("data-type")) === "newline" && (0, T.im)(te, r.sv.element, A).start === 1 && te.getAttribute("data-type").indexOf("code-block-") === -1)
|
|
@@ -2470,10 +2470,10 @@ onclick="this.previousElementSibling.select();document.execCommand('copy');this.
|
|
|
2470
2470
|
return !1;
|
|
2471
2471
|
o.key.indexOf("Arrow") !== -1 || o.key === "Meta" || o.key === "Control" || o.key === "Alt" || o.key === "Shift" || o.key === "CapsLock" || o.key === "Escape" || /^F\d{1,2}$/.test(o.key) || r.undo.recordFirstPosition(r, o);
|
|
2472
2472
|
var a = (0, T.zh)(r), d = a.startContainer;
|
|
2473
|
-
if (!
|
|
2473
|
+
if (!mn(o, r, d) || (fn(a, r, o), An(a), o.key !== "Enter" && o.key !== "Tab" && o.key !== "Backspace" && o.key.indexOf("Arrow") === -1 && !(0, s.yl)(o) && o.key !== "Escape" && o.key !== "Delete"))
|
|
2474
2474
|
return !1;
|
|
2475
2475
|
var v = (0, p.F9)(d), g = (0, p.lG)(d, "P");
|
|
2476
|
-
if (
|
|
2476
|
+
if (bn(o, r, g, a) || yn(a, r, g, o) || Ln(r, o, a))
|
|
2477
2477
|
return !0;
|
|
2478
2478
|
var h = (0, p.fb)(d, "vditor-wysiwyg__block");
|
|
2479
2479
|
if (h) {
|
|
@@ -2483,10 +2483,10 @@ onclick="this.previousElementSibling.select();document.execCommand('copy');this.
|
|
|
2483
2483
|
var A = r.wysiwyg.popover.querySelector(".vditor-input");
|
|
2484
2484
|
return A.focus(), A.select(), o.preventDefault(), !0;
|
|
2485
2485
|
}
|
|
2486
|
-
if (h.getAttribute("data-block") === "0" && (
|
|
2486
|
+
if (h.getAttribute("data-block") === "0" && (_n(r, o, h.firstElementChild, a) || ht(r, o, a, h.firstElementChild, h) || h.getAttribute("data-type") !== "yaml-front-matter" && at(r, o, a, h.firstElementChild, h)))
|
|
2487
2487
|
return !0;
|
|
2488
2488
|
}
|
|
2489
|
-
if (
|
|
2489
|
+
if (Cn(r, a, o, g))
|
|
2490
2490
|
return !0;
|
|
2491
2491
|
var O = (0, p.E2)(d, "BLOCKQUOTE");
|
|
2492
2492
|
if (O && !o.shiftKey && o.altKey && o.key === "Enter") {
|
|
@@ -2507,9 +2507,9 @@ onclick="this.previousElementSibling.select();document.execCommand('copy');this.
|
|
|
2507
2507
|
return (D = parseInt(R.tagName.substr(1), 10) - 1) > 0 && (wt(r, "h" + D), we(r)), o.preventDefault(), !0;
|
|
2508
2508
|
if (V("⌘-", o))
|
|
2509
2509
|
return (D = parseInt(R.tagName.substr(1), 10) + 1) < 7 && (wt(r, "h" + D), we(r)), o.preventDefault(), !0;
|
|
2510
|
-
o.key !== "Backspace" || (0, s.yl)(o) || o.shiftKey || o.altKey || R.textContent.length !== 1 ||
|
|
2510
|
+
o.key !== "Backspace" || (0, s.yl)(o) || o.shiftKey || o.altKey || R.textContent.length !== 1 || Dt(r);
|
|
2511
2511
|
}
|
|
2512
|
-
if (
|
|
2512
|
+
if (Mn(r, a, o))
|
|
2513
2513
|
return !0;
|
|
2514
2514
|
if (o.altKey && o.key === "Enter" && !(0, s.yl)(o) && !o.shiftKey) {
|
|
2515
2515
|
var B = (0, p.lG)(d, "A"), P = (0, p.a1)(d, "data-type", "link-ref"), H = (0, p.a1)(d, "data-type", "footnotes-ref");
|
|
@@ -2522,14 +2522,14 @@ onclick="this.previousElementSibling.select();document.execCommand('copy');this.
|
|
|
2522
2522
|
return !0;
|
|
2523
2523
|
if (V("⇧⌘U", o) && (C = r.wysiwyg.popover.querySelector('[data-type="up"]')) || V("⇧⌘D", o) && (C = r.wysiwyg.popover.querySelector('[data-type="down"]')))
|
|
2524
2524
|
return C.click(), o.preventDefault(), !0;
|
|
2525
|
-
if (
|
|
2525
|
+
if (Ft(r, a, o))
|
|
2526
2526
|
return !0;
|
|
2527
2527
|
if (!(0, s.yl)(o) && o.shiftKey && !o.altKey && o.key === "Enter" && d.parentElement.tagName !== "LI" && d.parentElement.tagName !== "P")
|
|
2528
2528
|
return ["STRONG", "STRIKE", "S", "I", "EM", "B"].includes(d.parentElement.tagName) ? a.insertNode(document.createTextNode(`
|
|
2529
2529
|
` + y.g.ZWSP)) : a.insertNode(document.createTextNode(`
|
|
2530
2530
|
`)), a.collapse(!1), (0, T.Hc)(a), we(r), Te(r), o.preventDefault(), !0;
|
|
2531
2531
|
if (o.key === "Backspace" && !(0, s.yl)(o) && !o.shiftKey && !o.altKey && a.toString() === "") {
|
|
2532
|
-
if (
|
|
2532
|
+
if (Tn(r, a, o, g))
|
|
2533
2533
|
return !0;
|
|
2534
2534
|
if (v) {
|
|
2535
2535
|
if (v.previousElementSibling && v.previousElementSibling.classList.contains("vditor-wysiwyg__block") && v.previousElementSibling.getAttribute("data-block") === "0" && v.tagName !== "UL" && v.tagName !== "OL") {
|
|
@@ -2537,10 +2537,10 @@ onclick="this.previousElementSibling.select();document.execCommand('copy');this.
|
|
|
2537
2537
|
if (te === 0 && a.startOffset === 0 || te === 1 && v.innerText.startsWith(y.g.ZWSP))
|
|
2538
2538
|
return pt(v.previousElementSibling.lastElementChild, r, !1), v.innerHTML.trim().replace(y.g.ZWSP, "") === "" && (v.remove(), we(r)), o.preventDefault(), !0;
|
|
2539
2539
|
}
|
|
2540
|
-
var
|
|
2541
|
-
if (a.toString() === "" && d.nodeType === 3 && d.textContent.charAt(
|
|
2542
|
-
` && d.textContent.charAt(
|
|
2543
|
-
return d.textContent = d.textContent.substring(0,
|
|
2540
|
+
var X = a.startOffset;
|
|
2541
|
+
if (a.toString() === "" && d.nodeType === 3 && d.textContent.charAt(X - 2) === `
|
|
2542
|
+
` && d.textContent.charAt(X - 1) !== y.g.ZWSP && ["STRONG", "STRIKE", "S", "I", "EM", "B"].includes(d.parentElement.tagName))
|
|
2543
|
+
return d.textContent = d.textContent.substring(0, X - 1) + y.g.ZWSP, a.setStart(d, X), a.collapse(!0), we(r), o.preventDefault(), !0;
|
|
2544
2544
|
d.textContent === y.g.ZWSP && a.startOffset === 1 && !d.previousSibling && function(Y) {
|
|
2545
2545
|
for (var F = Y.startContainer.nextSibling; F && F.textContent === ""; )
|
|
2546
2546
|
F = F.nextSibling;
|
|
@@ -2554,9 +2554,9 @@ onclick="this.previousElementSibling.select();document.execCommand('copy');this.
|
|
|
2554
2554
|
}
|
|
2555
2555
|
if ((0, s.vU)() && a.startOffset === 1 && d.textContent.indexOf(y.g.ZWSP) > -1 && d.previousSibling && d.previousSibling.nodeType !== 3 && d.previousSibling.tagName === "CODE" && (o.key === "Backspace" || o.key === "ArrowLeft"))
|
|
2556
2556
|
return a.selectNodeContents(d.previousSibling), a.collapse(!1), o.preventDefault(), !0;
|
|
2557
|
-
if (
|
|
2557
|
+
if (xn(o, v, a))
|
|
2558
2558
|
return o.preventDefault(), !0;
|
|
2559
|
-
if (
|
|
2559
|
+
if (hn(a, o.key), o.key === "ArrowDown") {
|
|
2560
2560
|
var ee = d.nextSibling;
|
|
2561
2561
|
ee && ee.nodeType !== 3 && ee.getAttribute("data-type") === "math-inline" && a.setStartAfter(ee);
|
|
2562
2562
|
}
|
|
@@ -2568,7 +2568,7 @@ onclick="this.previousElementSibling.select();document.execCommand('copy');this.
|
|
|
2568
2568
|
return !1;
|
|
2569
2569
|
o.key.indexOf("Arrow") !== -1 || o.key === "Meta" || o.key === "Control" || o.key === "Alt" || o.key === "Shift" || o.key === "CapsLock" || o.key === "Escape" || /^F\d{1,2}$/.test(o.key) || r.undo.recordFirstPosition(r, o);
|
|
2570
2570
|
var a = (0, T.zh)(r), d = a.startContainer;
|
|
2571
|
-
if (!
|
|
2571
|
+
if (!mn(o, r, d) || (fn(a, r, o), An(a), o.key !== "Enter" && o.key !== "Tab" && o.key !== "Backspace" && o.key.indexOf("Arrow") === -1 && !(0, s.yl)(o) && o.key !== "Escape" && o.key !== "Delete"))
|
|
2572
2572
|
return !1;
|
|
2573
2573
|
var v = (0, p.a1)(d, "data-newline", "1");
|
|
2574
2574
|
if (!(0, s.yl)(o) && !o.altKey && !o.shiftKey && o.key === "Enter" && v && a.startOffset < v.textContent.length) {
|
|
@@ -2578,12 +2578,12 @@ onclick="this.previousElementSibling.select();document.execCommand('copy');this.
|
|
|
2578
2578
|
h && (a.insertNode(document.createTextNode(h.textContent)), a.collapse(!0));
|
|
2579
2579
|
}
|
|
2580
2580
|
var A = (0, p.lG)(d, "P");
|
|
2581
|
-
if (
|
|
2581
|
+
if (bn(o, r, A, a) || yn(a, r, A, o) || Cn(r, a, o, A))
|
|
2582
2582
|
return !0;
|
|
2583
2583
|
var O = (0, p.fb)(d, "vditor-ir__marker--pre");
|
|
2584
2584
|
if (O && O.tagName === "PRE") {
|
|
2585
2585
|
var U = O.firstChild;
|
|
2586
|
-
if (
|
|
2586
|
+
if (_n(r, o, O, a) || (U.getAttribute("data-type") === "math-block" || U.getAttribute("data-type") === "html-block") && at(r, o, a, U, O.parentElement) || ht(r, o, a, U, O.parentElement))
|
|
2587
2587
|
return !0;
|
|
2588
2588
|
}
|
|
2589
2589
|
var C = (0, p.a1)(d, "data-type", "code-block-info");
|
|
@@ -2594,19 +2594,19 @@ onclick="this.previousElementSibling.select();document.execCommand('copy');this.
|
|
|
2594
2594
|
var R = (0, T.im)(C, r.ir.element).start;
|
|
2595
2595
|
R === 1 && a.setStart(d, 0), R === 2 && (r.hint.recentLanguage = "");
|
|
2596
2596
|
}
|
|
2597
|
-
if (
|
|
2597
|
+
if (at(r, o, a, C, C.parentElement))
|
|
2598
2598
|
return E(r, ["hint"]), !0;
|
|
2599
2599
|
}
|
|
2600
2600
|
var q = (0, p.lG)(d, "TD") || (0, p.lG)(d, "TH");
|
|
2601
2601
|
if (o.key.indexOf("Arrow") > -1 && q) {
|
|
2602
2602
|
var D = rr(q);
|
|
2603
|
-
if (D &&
|
|
2603
|
+
if (D && at(r, o, a, q, D))
|
|
2604
2604
|
return !0;
|
|
2605
2605
|
var B = ir(q);
|
|
2606
2606
|
if (B && ht(r, o, a, q, B))
|
|
2607
2607
|
return !0;
|
|
2608
2608
|
}
|
|
2609
|
-
if (
|
|
2609
|
+
if (Ln(r, o, a) || Mn(r, a, o) || Ft(r, a, o))
|
|
2610
2610
|
return !0;
|
|
2611
2611
|
var P = (0, x.W)(d);
|
|
2612
2612
|
if (P) {
|
|
@@ -2618,21 +2618,21 @@ onclick="this.previousElementSibling.select();document.execCommand('copy');this.
|
|
|
2618
2618
|
}
|
|
2619
2619
|
var G = (0, p.F9)(d);
|
|
2620
2620
|
if (o.key === "Backspace" && !(0, s.yl)(o) && !o.shiftKey && !o.altKey && a.toString() === "") {
|
|
2621
|
-
if (
|
|
2621
|
+
if (Tn(r, a, o, A))
|
|
2622
2622
|
return !0;
|
|
2623
2623
|
if (G && G.previousElementSibling && G.tagName !== "UL" && G.tagName !== "OL" && (G.previousElementSibling.getAttribute("data-type") === "code-block" || G.previousElementSibling.getAttribute("data-type") === "math-block")) {
|
|
2624
2624
|
var te = (0, T.im)(G, r.ir.element, a).start;
|
|
2625
2625
|
if (te === 0 || te === 1 && G.innerText.startsWith(y.g.ZWSP))
|
|
2626
|
-
return a.selectNodeContents(G.previousElementSibling.querySelector(".vditor-ir__marker--pre code")), a.collapse(!1), j(a, r), G.textContent.trim().replace(y.g.ZWSP, "") === "" && (G.remove(),
|
|
2626
|
+
return a.selectNodeContents(G.previousElementSibling.querySelector(".vditor-ir__marker--pre code")), a.collapse(!1), j(a, r), G.textContent.trim().replace(y.g.ZWSP, "") === "" && (G.remove(), Fe(r)), o.preventDefault(), !0;
|
|
2627
2627
|
}
|
|
2628
2628
|
if (P) {
|
|
2629
|
-
var
|
|
2630
|
-
(0, T.im)(P, r.ir.element).start ===
|
|
2629
|
+
var X = P.firstElementChild.textContent.length;
|
|
2630
|
+
(0, T.im)(P, r.ir.element).start === X && (a.setStart(P.firstElementChild.firstChild, X - 1), a.collapse(!0), (0, T.Hc)(a));
|
|
2631
2631
|
}
|
|
2632
2632
|
}
|
|
2633
2633
|
return !((o.key !== "ArrowUp" && o.key !== "ArrowDown" || !G || (G.querySelectorAll(".vditor-ir__node").forEach(function(ee) {
|
|
2634
2634
|
ee.contains(d) || ee.classList.add("vditor-ir__node--hidden");
|
|
2635
|
-
}), !
|
|
2635
|
+
}), !xn(o, G, a))) && (hn(a, o.key), !G || !K(G, r, o, a) || (o.preventDefault(), 0)));
|
|
2636
2636
|
}(e, n))
|
|
2637
2637
|
return;
|
|
2638
2638
|
if (e.options.ctrlEnter && V("⌘Enter", n))
|
|
@@ -2646,9 +2646,9 @@ onclick="this.previousElementSibling.select();document.execCommand('copy');this.
|
|
|
2646
2646
|
if ((0, s.yl)(n) && n.altKey && !n.shiftKey && /^Digit[1-6]$/.test(n.code)) {
|
|
2647
2647
|
if (e.currentMode === "wysiwyg") {
|
|
2648
2648
|
var i = n.code.replace("Digit", "H");
|
|
2649
|
-
(0, p.lG)(getSelection().getRangeAt(0).startContainer, i) ?
|
|
2649
|
+
(0, p.lG)(getSelection().getRangeAt(0).startContainer, i) ? Dt(e) : wt(e, i), we(e);
|
|
2650
2650
|
} else
|
|
2651
|
-
e.currentMode === "sv" ?
|
|
2651
|
+
e.currentMode === "sv" ? dn(e, "#".repeat(parseInt(n.code.replace("Digit", ""), 10)) + " ") : e.currentMode === "ir" && vt(e, "#".repeat(parseInt(n.code.replace("Digit", ""), 10)) + " ");
|
|
2652
2652
|
return n.preventDefault(), !0;
|
|
2653
2653
|
}
|
|
2654
2654
|
if ((0, s.yl)(n) && n.altKey && !n.shiftKey && /^Digit[7-9]$/.test(n.code))
|
|
@@ -2660,7 +2660,7 @@ onclick="this.previousElementSibling.select();document.execCommand('copy');this.
|
|
|
2660
2660
|
});
|
|
2661
2661
|
}
|
|
2662
2662
|
});
|
|
2663
|
-
},
|
|
2663
|
+
}, Vt = function(e, t) {
|
|
2664
2664
|
t.addEventListener("selectstart", function(n) {
|
|
2665
2665
|
t.onmouseup = function() {
|
|
2666
2666
|
setTimeout(function() {
|
|
@@ -2669,7 +2669,7 @@ onclick="this.previousElementSibling.select();document.execCommand('copy');this.
|
|
|
2669
2669
|
});
|
|
2670
2670
|
};
|
|
2671
2671
|
});
|
|
2672
|
-
},
|
|
2672
|
+
}, ln = function(e, t) {
|
|
2673
2673
|
var n = (0, T.zh)(e);
|
|
2674
2674
|
n.extractContents(), n.insertNode(document.createTextNode(Lute.Caret)), n.insertNode(document.createTextNode(t));
|
|
2675
2675
|
var i = (0, p.a1)(n.startContainer, "data-block", "0");
|
|
@@ -2687,7 +2687,7 @@ onclick="this.previousElementSibling.select();document.execCommand('copy');this.
|
|
|
2687
2687
|
i = n ? i.previousElementSibling : i.nextElementSibling;
|
|
2688
2688
|
}
|
|
2689
2689
|
return !1;
|
|
2690
|
-
},
|
|
2690
|
+
}, cn = function(e, t) {
|
|
2691
2691
|
return I("SpinVditorSVDOM", e, "argument", t.options.debugger), e = "<div data-block='0'>" + t.lute.SpinVditorSVDOM(e).replace(/<span data-type="newline"><br \/><span style="display: none">\n<\/span><\/span><span data-type="newline"><br \/><span style="display: none">\n<\/span><\/span></g, `<span data-type="newline"><br /><span style="display: none">
|
|
2692
2692
|
</span></span><span data-type="newline"><br /><span style="display: none">
|
|
2693
2693
|
</span></span></div><div data-block="0"><`) + "</div>", I("SpinVditorSVDOM", e, "result", t.options.debugger), e;
|
|
@@ -2716,7 +2716,7 @@ onclick="this.previousElementSibling.select();document.execCommand('copy');this.
|
|
|
2716
2716
|
typeof e.options.input == "function" && t.enableInput && e.options.input(n), e.options.counter.enable && e.counter.render(e, n), e.options.cache.enable && (0, s.pK)() && (localStorage.setItem(e.options.cache.id, n), e.options.cache.after && e.options.cache.after(n)), e.devtools && e.devtools.renderEchart(e), clearTimeout(e.sv.processTimeoutId), e.sv.processTimeoutId = window.setTimeout(function() {
|
|
2717
2717
|
t.enableAddUndoStack && !e.sv.composingLock && e.undo.addToUndoStack(e);
|
|
2718
2718
|
}, e.options.undoDelay);
|
|
2719
|
-
},
|
|
2719
|
+
}, dn = function(e, t) {
|
|
2720
2720
|
var n = (0, T.zh)(e), i = (0, x.S)(n.startContainer, "SPAN");
|
|
2721
2721
|
i && i.textContent.trim() !== "" && (t = `
|
|
2722
2722
|
` + t), n.collapse(!0), document.execCommand("insertHTML", !1, t);
|
|
@@ -2745,7 +2745,7 @@ onclick="this.previousElementSibling.select();document.execCommand('copy');this.
|
|
|
2745
2745
|
}
|
|
2746
2746
|
(0, T.ib)(e.sv.element, r), He(e);
|
|
2747
2747
|
}
|
|
2748
|
-
},
|
|
2748
|
+
}, un = function(e) {
|
|
2749
2749
|
switch (e.currentMode) {
|
|
2750
2750
|
case "ir":
|
|
2751
2751
|
return e.ir.element;
|
|
@@ -2754,7 +2754,7 @@ onclick="this.previousElementSibling.select();document.execCommand('copy');this.
|
|
|
2754
2754
|
case "sv":
|
|
2755
2755
|
return e.sv.element;
|
|
2756
2756
|
}
|
|
2757
|
-
},
|
|
2757
|
+
}, pn = function(e, t) {
|
|
2758
2758
|
e.options.upload.setHeaders && (e.options.upload.headers = e.options.upload.setHeaders()), e.options.upload.headers && Object.keys(e.options.upload.headers).forEach(function(n) {
|
|
2759
2759
|
t.setRequestHeader(n, e.options.upload.headers[n]);
|
|
2760
2760
|
});
|
|
@@ -2847,7 +2847,7 @@ onclick="this.previousElementSibling.select();document.execCommand('copy');this.
|
|
|
2847
2847
|
}
|
|
2848
2848
|
}, Yn = function() {
|
|
2849
2849
|
this.isUploading = !1, this.element = document.createElement("div"), this.element.className = "vditor-upload";
|
|
2850
|
-
},
|
|
2850
|
+
}, Ut = function(e, t, n) {
|
|
2851
2851
|
return Xn(void 0, void 0, void 0, function() {
|
|
2852
2852
|
var i, r, o, a, d, v, g, h, A, O, U, C, R, q;
|
|
2853
2853
|
return Qn(this, function(D) {
|
|
@@ -2865,23 +2865,23 @@ onclick="this.previousElementSibling.select();document.execCommand('copy');this.
|
|
|
2865
2865
|
case 4:
|
|
2866
2866
|
if (e.options.upload.validate && typeof (a = e.options.upload.validate(i)) == "string")
|
|
2867
2867
|
return e.tip.show(a), [2];
|
|
2868
|
-
if (d =
|
|
2868
|
+
if (d = un(e), e.upload.range = (0, T.zh)(e), v = function(B, P) {
|
|
2869
2869
|
B.tip.hide();
|
|
2870
|
-
for (var H = [], G = "", te = "",
|
|
2870
|
+
for (var H = [], G = "", te = "", X = (B.options.lang, B.options, function(F, re) {
|
|
2871
2871
|
var ye = P[re], _e = !0;
|
|
2872
2872
|
ye.name || (G += "<li>" + window.VditorI18n.nameEmpty + "</li>", _e = !1), ye.size > B.options.upload.max && (G += "<li>" + ye.name + " " + window.VditorI18n.over + " " + B.options.upload.max / 1024 / 1024 + "M</li>", _e = !1);
|
|
2873
|
-
var
|
|
2873
|
+
var Ge = ye.name.lastIndexOf("."), Oe = ye.name.substr(Ge), Ie = B.options.upload.filename(ye.name.substr(0, Ge)) + Oe;
|
|
2874
2874
|
B.options.upload.accept && (B.options.upload.accept.split(",").some(function(Ae) {
|
|
2875
|
-
var
|
|
2876
|
-
if (
|
|
2877
|
-
if (Oe.toLowerCase() ===
|
|
2875
|
+
var st = Ae.trim();
|
|
2876
|
+
if (st.indexOf(".") === 0) {
|
|
2877
|
+
if (Oe.toLowerCase() === st.toLowerCase())
|
|
2878
2878
|
return !0;
|
|
2879
|
-
} else if (ye.type.split("/")[0] ===
|
|
2879
|
+
} else if (ye.type.split("/")[0] === st.split("/")[0])
|
|
2880
2880
|
return !0;
|
|
2881
2881
|
return !1;
|
|
2882
2882
|
}) || (G += "<li>" + ye.name + " " + window.VditorI18n.fileTypeError + "</li>", _e = !1)), _e && (H.push(ye), te += "<li>" + Ie + " " + window.VditorI18n.uploading + "</li>");
|
|
2883
2883
|
}), ee = P.length, Y = 0; Y < ee; Y++)
|
|
2884
|
-
|
|
2884
|
+
X(0, Y);
|
|
2885
2885
|
return B.tip.show("<ul>" + G + te + "</ul>"), H;
|
|
2886
2886
|
}(e, i), v.length === 0)
|
|
2887
2887
|
return n && (n.value = ""), [2];
|
|
@@ -2889,7 +2889,7 @@ onclick="this.previousElementSibling.select();document.execCommand('copy');this.
|
|
|
2889
2889
|
U = O[A], g.append(U, h[U]);
|
|
2890
2890
|
for (C = 0, R = v.length; C < R; C++)
|
|
2891
2891
|
g.append(e.options.upload.fieldName, v[C]);
|
|
2892
|
-
return (q = new XMLHttpRequest()).open("POST", e.options.upload.url), e.options.upload.token && q.setRequestHeader("X-Upload-Token", e.options.upload.token), e.options.upload.withCredentials && (q.withCredentials = !0),
|
|
2892
|
+
return (q = new XMLHttpRequest()).open("POST", e.options.upload.url), e.options.upload.token && q.setRequestHeader("X-Upload-Token", e.options.upload.token), e.options.upload.withCredentials && (q.withCredentials = !0), pn(e, q), e.upload.isUploading = !0, d.setAttribute("contenteditable", "false"), q.onreadystatechange = function() {
|
|
2893
2893
|
if (q.readyState === XMLHttpRequest.DONE) {
|
|
2894
2894
|
if (e.upload.isUploading = !1, d.setAttribute("contenteditable", "true"), q.status >= 200 && q.status < 300)
|
|
2895
2895
|
if (e.options.upload.success)
|
|
@@ -2897,25 +2897,25 @@ onclick="this.previousElementSibling.select();document.execCommand('copy');this.
|
|
|
2897
2897
|
else {
|
|
2898
2898
|
var B = q.responseText;
|
|
2899
2899
|
e.options.upload.format && (B = e.options.upload.format(t, q.responseText)), function(P, H) {
|
|
2900
|
-
|
|
2900
|
+
un(H).focus();
|
|
2901
2901
|
var G = JSON.parse(P), te = "";
|
|
2902
2902
|
G.code === 1 && (te = "" + G.msg), G.data.errFiles && G.data.errFiles.length > 0 && (te = "<ul><li>" + te + "</li>", G.data.errFiles.forEach(function(ee) {
|
|
2903
2903
|
var Y = ee.lastIndexOf("."), F = H.options.upload.filename(ee.substr(0, Y)) + ee.substr(Y);
|
|
2904
2904
|
te += "<li>" + F + " " + window.VditorI18n.uploadError + "</li>";
|
|
2905
2905
|
}), te += "</ul>"), te ? H.tip.show(te) : H.tip.hide();
|
|
2906
|
-
var
|
|
2906
|
+
var X = "";
|
|
2907
2907
|
Object.keys(G.data.succMap).forEach(function(ee) {
|
|
2908
2908
|
var Y = G.data.succMap[ee], F = ee.lastIndexOf("."), re = ee.substr(F), ye = H.options.upload.filename(ee.substr(0, F)) + re;
|
|
2909
|
-
(re = re.toLowerCase()).indexOf(".wav") === 0 || re.indexOf(".mp3") === 0 || re.indexOf(".ogg") === 0 ? H.currentMode === "wysiwyg" ?
|
|
2909
|
+
(re = re.toLowerCase()).indexOf(".wav") === 0 || re.indexOf(".mp3") === 0 || re.indexOf(".ogg") === 0 ? H.currentMode === "wysiwyg" ? X += `<div class="vditor-wysiwyg__block" data-type="html-block"
|
|
2910
2910
|
data-block="0"><pre><code><audio controls="controls" src="` + Y + '"></audio></code></pre><pre class="vditor-wysiwyg__preview" data-render="1"><audio controls="controls" src="' + Y + `"></audio></pre></div>
|
|
2911
|
-
` : H.currentMode === "ir" ?
|
|
2912
|
-
` :
|
|
2913
|
-
` : re.indexOf(".apng") === 0 || re.indexOf(".bmp") === 0 || re.indexOf(".gif") === 0 || re.indexOf(".ico") === 0 || re.indexOf(".cur") === 0 || re.indexOf(".jpg") === 0 || re.indexOf(".jpeg") === 0 || re.indexOf(".jfif") === 0 || re.indexOf(".pjp") === 0 || re.indexOf(".pjpeg") === 0 || re.indexOf(".png") === 0 || re.indexOf(".svg") === 0 || re.indexOf(".webp") === 0 ? H.currentMode === "wysiwyg" ?
|
|
2914
|
-
` :
|
|
2915
|
-
` : H.currentMode === "wysiwyg" ?
|
|
2916
|
-
` :
|
|
2911
|
+
` : H.currentMode === "ir" ? X += '<audio controls="controls" src="' + Y + `"></audio>
|
|
2912
|
+
` : X += "[" + ye + "](" + Y + `)
|
|
2913
|
+
` : re.indexOf(".apng") === 0 || re.indexOf(".bmp") === 0 || re.indexOf(".gif") === 0 || re.indexOf(".ico") === 0 || re.indexOf(".cur") === 0 || re.indexOf(".jpg") === 0 || re.indexOf(".jpeg") === 0 || re.indexOf(".jfif") === 0 || re.indexOf(".pjp") === 0 || re.indexOf(".pjpeg") === 0 || re.indexOf(".png") === 0 || re.indexOf(".svg") === 0 || re.indexOf(".webp") === 0 ? H.currentMode === "wysiwyg" ? X += '<img alt="' + ye + '" src="' + Y + `">
|
|
2914
|
+
` : X += "
|
|
2915
|
+
` : H.currentMode === "wysiwyg" ? X += '<a href="' + Y + '">' + ye + `</a>
|
|
2916
|
+
` : X += "[" + ye + "](" + Y + `)
|
|
2917
2917
|
`;
|
|
2918
|
-
}), (0, T.Hc)(H.upload.range), document.execCommand("insertHTML", !1,
|
|
2918
|
+
}), (0, T.Hc)(H.upload.range), document.execCommand("insertHTML", !1, X), H.upload.range = getSelection().getRangeAt(0).cloneRange();
|
|
2919
2919
|
}(B, e);
|
|
2920
2920
|
}
|
|
2921
2921
|
else
|
|
@@ -3082,14 +3082,14 @@ onclick="this.previousElementSibling.select();document.execCommand('copy');this.
|
|
|
3082
3082
|
}([v, g]);
|
|
3083
3083
|
};
|
|
3084
3084
|
}
|
|
3085
|
-
},
|
|
3085
|
+
}, mn = function(e, t, n) {
|
|
3086
3086
|
if (e.keyCode === 229 && e.code === "" && e.key === "Unidentified" && t.currentMode !== "sv") {
|
|
3087
3087
|
var i = (0, p.F9)(n);
|
|
3088
3088
|
if (i && i.textContent.trim() === "")
|
|
3089
3089
|
return t[t.currentMode].composingLock = !0, !1;
|
|
3090
3090
|
}
|
|
3091
3091
|
return !0;
|
|
3092
|
-
},
|
|
3092
|
+
}, fn = function(e, t, n) {
|
|
3093
3093
|
if (!(n.key === "Enter" || n.key === "Tab" || n.key === "Backspace" || n.key.indexOf("Arrow") > -1 || (0, s.yl)(n) || n.key === "Escape" || n.shiftKey || n.altKey)) {
|
|
3094
3094
|
var i = (0, p.lG)(e.startContainer, "P") || (0, p.lG)(e.startContainer, "LI");
|
|
3095
3095
|
if (i && (0, T.im)(i, t[t.currentMode].element, e).start === 0) {
|
|
@@ -3098,7 +3098,7 @@ onclick="this.previousElementSibling.select();document.execCommand('copy');this.
|
|
|
3098
3098
|
e.insertNode(r), e.setStartAfter(r);
|
|
3099
3099
|
}
|
|
3100
3100
|
}
|
|
3101
|
-
},
|
|
3101
|
+
}, hn = function(e, t) {
|
|
3102
3102
|
if (t === "ArrowDown" || t === "ArrowUp") {
|
|
3103
3103
|
var n = (0, p.a1)(e.startContainer, "data-type", "math-inline") || (0, p.a1)(e.startContainer, "data-type", "html-entity") || (0, p.a1)(e.startContainer, "data-type", "html-inline");
|
|
3104
3104
|
n && (t === "ArrowDown" && e.setStartAfter(n.parentElement), t === "ArrowUp" && e.setStartBefore(n.parentElement));
|
|
@@ -3106,14 +3106,14 @@ onclick="this.previousElementSibling.select();document.execCommand('copy');this.
|
|
|
3106
3106
|
}, St = function(e, t) {
|
|
3107
3107
|
var n = (0, T.zh)(e), i = (0, p.F9)(n.startContainer);
|
|
3108
3108
|
i && (i.insertAdjacentHTML(t, '<p data-block="0">' + y.g.ZWSP + `<wbr>
|
|
3109
|
-
</p>`), (0, T.ib)(e[e.currentMode].element, n),
|
|
3109
|
+
</p>`), (0, T.ib)(e[e.currentMode].element, n), ot(e), ae(e));
|
|
3110
3110
|
}, rr = function(e) {
|
|
3111
3111
|
var t = (0, p.lG)(e, "TABLE");
|
|
3112
3112
|
return !(!t || !t.rows[0].cells[0].isSameNode(e)) && t;
|
|
3113
3113
|
}, ir = function(e) {
|
|
3114
3114
|
var t = (0, p.lG)(e, "TABLE");
|
|
3115
3115
|
return !(!t || !t.lastElementChild.lastElementChild.lastElementChild.isSameNode(e)) && t;
|
|
3116
|
-
},
|
|
3116
|
+
}, vn = function(e, t, n) {
|
|
3117
3117
|
n === void 0 && (n = !0);
|
|
3118
3118
|
var i = e.previousElementSibling;
|
|
3119
3119
|
return i || (i = e.parentElement.previousElementSibling ? e.parentElement.previousElementSibling.lastElementChild : e.parentElement.parentElement.tagName === "TBODY" && e.parentElement.parentElement.previousElementSibling ? e.parentElement.parentElement.previousElementSibling.lastElementChild.lastElementChild : null), i && (t.selectNodeContents(i), n || t.collapse(!1), (0, T.Hc)(t)), i;
|
|
@@ -3125,7 +3125,7 @@ onclick="this.previousElementSibling.select();document.execCommand('copy');this.
|
|
|
3125
3125
|
return !a || a && (a.tagName === "TABLE" || a.getAttribute("data-type")) ? (r.insertAdjacentHTML("afterend", '<p data-block="0">' + y.g.ZWSP + "<wbr></p>"), (0, T.ib)(e[e.currentMode].element, n)) : (n.selectNodeContents(a), n.collapse(!0), (0, T.Hc)(n)), t.preventDefault(), !0;
|
|
3126
3126
|
}
|
|
3127
3127
|
return !1;
|
|
3128
|
-
},
|
|
3128
|
+
}, at = function(e, t, n, i, r) {
|
|
3129
3129
|
var o = (0, T.im)(i, e[e.currentMode].element, n);
|
|
3130
3130
|
if (t.key === "ArrowUp" && i.textContent.substr(0, o.start).indexOf(`
|
|
3131
3131
|
`) === -1 || (t.key === "ArrowLeft" || t.key === "Backspace" && n.toString() === "") && o.start === 0) {
|
|
@@ -3160,7 +3160,7 @@ onclick="this.previousElementSibling.select();document.execCommand('copy');this.
|
|
|
3160
3160
|
var g = (0, p.a1)(t.startContainer, "data-block", "0");
|
|
3161
3161
|
g || (e[e.currentMode].element.querySelector("wbr").remove(), (g = e[e.currentMode].element.querySelector("p")).innerHTML = "<wbr>"), n === "check" ? (g.insertAdjacentHTML("beforebegin", '<ul data-block="0"><li class="vditor-task"><input type="checkbox" /> ' + g.innerHTML + "</li></ul>"), g.remove()) : n === "list" ? (g.insertAdjacentHTML("beforebegin", '<ul data-block="0"><li>' + g.innerHTML + "</li></ul>"), g.remove()) : n === "ordered-list" && (g.insertAdjacentHTML("beforebegin", '<ol data-block="0"><li>' + g.innerHTML + "</li></ol>"), g.remove());
|
|
3162
3162
|
}
|
|
3163
|
-
},
|
|
3163
|
+
}, gn = function(e, t, n) {
|
|
3164
3164
|
var i = t.previousElementSibling;
|
|
3165
3165
|
if (t && i) {
|
|
3166
3166
|
var r = [t];
|
|
@@ -3177,10 +3177,10 @@ onclick="this.previousElementSibling.select();document.execCommand('copy');this.
|
|
|
3177
3177
|
var d = (0, p.O9)(n.startContainer);
|
|
3178
3178
|
d && d.querySelectorAll(".vditor-" + e.currentMode + "__preview[data-render='2']").forEach(function(v) {
|
|
3179
3179
|
Ce(v, e), e.currentMode === "wysiwyg" && v.previousElementSibling.setAttribute("style", "display:none");
|
|
3180
|
-
}), ae(e),
|
|
3180
|
+
}), ae(e), ot(e);
|
|
3181
3181
|
} else
|
|
3182
3182
|
e[e.currentMode].element.focus();
|
|
3183
|
-
},
|
|
3183
|
+
}, Wt = function(e, t, n, i) {
|
|
3184
3184
|
var r = (0, p.lG)(t.parentElement, "LI");
|
|
3185
3185
|
if (r) {
|
|
3186
3186
|
e[e.currentMode].element.querySelectorAll("wbr").forEach(function(A) {
|
|
@@ -3199,7 +3199,7 @@ onclick="this.previousElementSibling.select();document.execCommand('copy');this.
|
|
|
3199
3199
|
var h = (0, p.O9)(n.startContainer);
|
|
3200
3200
|
h && h.querySelectorAll(".vditor-" + e.currentMode + "__preview[data-render='2']").forEach(function(A) {
|
|
3201
3201
|
Ce(A, e), e.currentMode === "wysiwyg" && A.previousElementSibling.setAttribute("style", "display:none");
|
|
3202
|
-
}), ae(e),
|
|
3202
|
+
}), ae(e), ot(e);
|
|
3203
3203
|
} else
|
|
3204
3204
|
e[e.currentMode].element.focus();
|
|
3205
3205
|
}, _t = function(e, t) {
|
|
@@ -3211,18 +3211,18 @@ onclick="this.previousElementSibling.select();document.execCommand('copy');this.
|
|
|
3211
3211
|
}
|
|
3212
3212
|
for (var v = 0; v < r; v++)
|
|
3213
3213
|
e.rows[v].cells[o].setAttribute("align", t);
|
|
3214
|
-
},
|
|
3214
|
+
}, zt = function(e) {
|
|
3215
3215
|
var t = e.trimRight().split(`
|
|
3216
3216
|
`).pop();
|
|
3217
3217
|
return t !== "" && (t.replace(/ |-/g, "") === "" || t.replace(/ |_/g, "") === "" || t.replace(/ |\*/g, "") === "") && t.replace(/ /g, "").length > 2 && !(t.indexOf("-") > -1 && t.trimLeft().indexOf(" ") === -1 && e.trimRight().split(`
|
|
3218
3218
|
`).length > 1) && t.indexOf(" ") !== 0 && t.indexOf(" ") !== 0;
|
|
3219
|
-
},
|
|
3219
|
+
}, Kt = function(e) {
|
|
3220
3220
|
var t = e.trimRight().split(`
|
|
3221
3221
|
`);
|
|
3222
3222
|
return (e = t.pop()).indexOf(" ") !== 0 && e.indexOf(" ") !== 0 && (e = e.trimLeft()) !== "" && t.length !== 0 && (e.replace(/-/g, "") === "" || e.replace(/=/g, "") === "");
|
|
3223
3223
|
}, ae = function(e, t) {
|
|
3224
|
-
t === void 0 && (t = { enableAddUndoStack: !0, enableHint: !1, enableInput: !0 }), e.currentMode === "wysiwyg" ? we(e, t) : e.currentMode === "ir" ?
|
|
3225
|
-
},
|
|
3224
|
+
t === void 0 && (t = { enableAddUndoStack: !0, enableHint: !1, enableInput: !0 }), e.currentMode === "wysiwyg" ? we(e, t) : e.currentMode === "ir" ? Fe(e, t) : e.currentMode === "sv" && He(e, t);
|
|
3225
|
+
}, yn = function(e, t, n, i) {
|
|
3226
3226
|
var r, o = e.startContainer, a = (0, p.lG)(o, "LI");
|
|
3227
3227
|
if (a) {
|
|
3228
3228
|
if (!(0, s.yl)(i) && !i.altKey && i.key === "Enter" && !i.shiftKey && n && a.contains(n) && n.nextElementSibling)
|
|
@@ -3240,17 +3240,17 @@ onclick="this.previousElementSibling.select();document.execCommand('copy');this.
|
|
|
3240
3240
|
if (!(0, s.yl)(i) && !i.altKey && i.key === "Tab") {
|
|
3241
3241
|
var d = !1;
|
|
3242
3242
|
if ((e.startOffset === 0 && (o.nodeType === 3 && !o.previousSibling || o.nodeType !== 3 && o.nodeName === "LI") || a.classList.contains("vditor-task") && e.startOffset === 1 && o.previousSibling.nodeType !== 3 && o.previousSibling.tagName === "INPUT") && (d = !0), d || e.toString() !== "")
|
|
3243
|
-
return i.shiftKey ?
|
|
3243
|
+
return i.shiftKey ? Wt(t, a, e, a.parentElement) : gn(t, a, e), i.preventDefault(), !0;
|
|
3244
3244
|
}
|
|
3245
3245
|
}
|
|
3246
3246
|
return !1;
|
|
3247
|
-
},
|
|
3247
|
+
}, Ft = function(e, t, n) {
|
|
3248
3248
|
if (e.options.tab && n.key === "Tab")
|
|
3249
3249
|
return n.shiftKey || (t.toString() === "" ? (t.insertNode(document.createTextNode(e.options.tab)), t.collapse(!1)) : (t.extractContents(), t.insertNode(document.createTextNode(e.options.tab)), t.collapse(!1))), (0, T.Hc)(t), ae(e), n.preventDefault(), !0;
|
|
3250
|
-
},
|
|
3250
|
+
}, bn = function(e, t, n, i) {
|
|
3251
3251
|
if (n) {
|
|
3252
3252
|
if (!(0, s.yl)(e) && !e.altKey && e.key === "Enter") {
|
|
3253
|
-
var r = String.raw(
|
|
3253
|
+
var r = String.raw(en || (en = er(["", ""], ["", ""])), n.textContent).replace(/\\\|/g, "").trim(), o = r.split("|");
|
|
3254
3254
|
if (r.startsWith("|") && r.endsWith("|") && o.length > 3) {
|
|
3255
3255
|
var a = o.map(function() {
|
|
3256
3256
|
return "---";
|
|
@@ -3259,14 +3259,14 @@ onclick="this.previousElementSibling.select();document.execCommand('copy');this.
|
|
|
3259
3259
|
` + a.substring(3, a.length - 3) + `
|
|
3260
3260
|
|<wbr>`, n.outerHTML = t.lute.SpinVditorDOM(a), (0, T.ib)(t[t.currentMode].element, i), ae(t), Te(t), e.preventDefault(), !0;
|
|
3261
3261
|
}
|
|
3262
|
-
if (
|
|
3262
|
+
if (zt(n.innerHTML) && n.previousElementSibling) {
|
|
3263
3263
|
var d = "", v = n.innerHTML.trimRight().split(`
|
|
3264
3264
|
`);
|
|
3265
3265
|
return v.length > 1 && (v.pop(), d = '<p data-block="0">' + v.join(`
|
|
3266
3266
|
`) + "</p>"), n.insertAdjacentHTML("afterend", d + `<hr data-block="0"><p data-block="0"><wbr>
|
|
3267
3267
|
</p>`), n.remove(), (0, T.ib)(t[t.currentMode].element, i), ae(t), Te(t), e.preventDefault(), !0;
|
|
3268
3268
|
}
|
|
3269
|
-
if (
|
|
3269
|
+
if (Kt(n.innerHTML))
|
|
3270
3270
|
return t.currentMode === "wysiwyg" ? n.outerHTML = t.lute.SpinVditorDOM(n.innerHTML + `<p data-block="0"><wbr>
|
|
3271
3271
|
</p>`) : n.outerHTML = t.lute.SpinVditorIRDOM(n.innerHTML + `<p data-block="0"><wbr>
|
|
3272
3272
|
</p>`), (0, T.ib)(t[t.currentMode].element, i), ae(t), Te(t), e.preventDefault(), !0;
|
|
@@ -3280,11 +3280,11 @@ onclick="this.previousElementSibling.select();document.execCommand('copy');this.
|
|
|
3280
3280
|
}
|
|
3281
3281
|
return !1;
|
|
3282
3282
|
}
|
|
3283
|
-
},
|
|
3283
|
+
}, wn = function(e, t, n) {
|
|
3284
3284
|
for (var i = "", r = 0; r < n.parentElement.childElementCount; r++)
|
|
3285
3285
|
i += '<td align="' + n.parentElement.children[r].getAttribute("align") + '"> </td>';
|
|
3286
3286
|
n.tagName === "TH" ? n.parentElement.parentElement.insertAdjacentHTML("afterend", "<tbody><tr>" + i + "</tr></tbody>") : n.parentElement.insertAdjacentHTML("afterend", "<tr>" + i + "</tr>"), ae(e);
|
|
3287
|
-
},
|
|
3287
|
+
}, En = function(e, t, n) {
|
|
3288
3288
|
for (var i = "", r = 0; r < n.parentElement.childElementCount; r++)
|
|
3289
3289
|
n.tagName === "TH" ? i += '<th align="' + n.parentElement.children[r].getAttribute("align") + '"> </th>' : i += '<td align="' + n.parentElement.children[r].getAttribute("align") + '"> </td>';
|
|
3290
3290
|
if (n.tagName === "TH") {
|
|
@@ -3301,25 +3301,25 @@ onclick="this.previousElementSibling.select();document.execCommand('copy');this.
|
|
|
3301
3301
|
for (var a = 0; a < t.rows.length; a++)
|
|
3302
3302
|
a === 0 ? t.rows[a].cells[r].insertAdjacentHTML(i, "<th> </th>") : t.rows[a].cells[r].insertAdjacentHTML(i, "<td> </td>");
|
|
3303
3303
|
ae(e);
|
|
3304
|
-
},
|
|
3304
|
+
}, kn = function(e, t, n) {
|
|
3305
3305
|
if (n.tagName === "TD") {
|
|
3306
3306
|
var i = n.parentElement.parentElement;
|
|
3307
3307
|
n.parentElement.previousElementSibling ? t.selectNodeContents(n.parentElement.previousElementSibling.lastElementChild) : t.selectNodeContents(i.previousElementSibling.lastElementChild.lastElementChild), i.childElementCount === 1 ? i.remove() : n.parentElement.remove(), t.collapse(!1), (0, T.Hc)(t), ae(e);
|
|
3308
3308
|
}
|
|
3309
|
-
},
|
|
3309
|
+
}, Sn = function(e, t, n, i) {
|
|
3310
3310
|
for (var r = 0, o = i.previousElementSibling; o; )
|
|
3311
3311
|
r++, o = o.previousElementSibling;
|
|
3312
3312
|
(i.previousElementSibling || i.nextElementSibling) && (t.selectNodeContents(i.previousElementSibling || i.nextElementSibling), t.collapse(!0));
|
|
3313
3313
|
for (var a = 0; a < n.rows.length; a++) {
|
|
3314
3314
|
var d = n.rows[a].cells;
|
|
3315
3315
|
if (d.length === 1) {
|
|
3316
|
-
n.remove(),
|
|
3316
|
+
n.remove(), ot(e);
|
|
3317
3317
|
break;
|
|
3318
3318
|
}
|
|
3319
3319
|
d[r].remove();
|
|
3320
3320
|
}
|
|
3321
3321
|
(0, T.Hc)(t), ae(e);
|
|
3322
|
-
},
|
|
3322
|
+
}, Ln = function(e, t, n) {
|
|
3323
3323
|
var i = n.startContainer, r = (0, p.lG)(i, "TD") || (0, p.lG)(i, "TH");
|
|
3324
3324
|
if (r) {
|
|
3325
3325
|
if (!(0, s.yl)(t) && !t.altKey && t.key === "Enter") {
|
|
@@ -3328,7 +3328,7 @@ onclick="this.previousElementSibling.select();document.execCommand('copy');this.
|
|
|
3328
3328
|
return n.insertNode(o), n.setStartAfter(o), ae(e), Te(e), t.preventDefault(), !0;
|
|
3329
3329
|
}
|
|
3330
3330
|
if (t.key === "Tab")
|
|
3331
|
-
return t.shiftKey ? (
|
|
3331
|
+
return t.shiftKey ? (vn(r, n), t.preventDefault(), !0) : ((h = r.nextElementSibling) || (h = r.parentElement.nextElementSibling ? r.parentElement.nextElementSibling.firstElementChild : r.parentElement.parentElement.tagName === "THEAD" && r.parentElement.parentElement.nextElementSibling ? r.parentElement.parentElement.nextElementSibling.firstElementChild.firstElementChild : null), h && (n.selectNodeContents(h), (0, T.Hc)(n)), t.preventDefault(), !0);
|
|
3332
3332
|
var a = r.parentElement.parentElement.parentElement;
|
|
3333
3333
|
if (t.key === "ArrowUp") {
|
|
3334
3334
|
if (t.preventDefault(), r.tagName === "TH")
|
|
@@ -3351,20 +3351,20 @@ onclick="this.previousElementSibling.select();document.execCommand('copy');this.
|
|
|
3351
3351
|
return A.focus(), A.select(), t.preventDefault(), !0;
|
|
3352
3352
|
}
|
|
3353
3353
|
if (!(0, s.yl)(t) && !t.shiftKey && !t.altKey && t.key === "Backspace" && n.startOffset === 0 && n.toString() === "")
|
|
3354
|
-
return !
|
|
3354
|
+
return !vn(r, n, !1) && a && (a.textContent.trim() === "" ? (a.outerHTML = `<p data-block="0"><wbr>
|
|
3355
3355
|
</p>`, (0, T.ib)(e[e.currentMode].element, n)) : (n.setStartBefore(a), n.collapse(!0)), ae(e)), t.preventDefault(), !0;
|
|
3356
3356
|
if (V("⇧⌘F", t))
|
|
3357
|
-
return
|
|
3357
|
+
return En(e, n, r), t.preventDefault(), !0;
|
|
3358
3358
|
if (V("⌘=", t))
|
|
3359
|
-
return
|
|
3359
|
+
return wn(e, n, r), t.preventDefault(), !0;
|
|
3360
3360
|
if (V("⇧⌘G", t))
|
|
3361
3361
|
return Ct(e, a, r, "beforebegin"), t.preventDefault(), !0;
|
|
3362
3362
|
if (V("⇧⌘=", t))
|
|
3363
3363
|
return Ct(e, a, r), t.preventDefault(), !0;
|
|
3364
3364
|
if (V("⌘-", t))
|
|
3365
|
-
return
|
|
3365
|
+
return kn(e, n, r), t.preventDefault(), !0;
|
|
3366
3366
|
if (V("⇧⌘-", t))
|
|
3367
|
-
return
|
|
3367
|
+
return Sn(e, n, a, r), t.preventDefault(), !0;
|
|
3368
3368
|
if (V("⇧⌘L", t)) {
|
|
3369
3369
|
if (e.currentMode === "ir")
|
|
3370
3370
|
return _t(a, "left"), ae(e), t.preventDefault(), !0;
|
|
@@ -3386,7 +3386,7 @@ onclick="this.previousElementSibling.select();document.execCommand('copy');this.
|
|
|
3386
3386
|
}
|
|
3387
3387
|
}
|
|
3388
3388
|
return !1;
|
|
3389
|
-
},
|
|
3389
|
+
}, _n = function(e, t, n, i) {
|
|
3390
3390
|
if (n.tagName === "PRE" && V("⌘A", t))
|
|
3391
3391
|
return i.selectNodeContents(n.firstElementChild), t.preventDefault(), !0;
|
|
3392
3392
|
if (e.options.tab && t.key === "Tab" && !t.shiftKey && i.toString() === "")
|
|
@@ -3401,7 +3401,7 @@ onclick="this.previousElementSibling.select();document.execCommand('copy');this.
|
|
|
3401
3401
|
`) || n.firstElementChild.insertAdjacentText("beforeend", `
|
|
3402
3402
|
`), i.extractContents(), i.insertNode(document.createTextNode(`
|
|
3403
3403
|
`)), i.collapse(!1), (0, T.Hc)(i), (0, s.vU)() || (e.currentMode === "wysiwyg" ? kt(e, i) : ge(e, i)), Te(e), t.preventDefault(), !0);
|
|
3404
|
-
},
|
|
3404
|
+
}, Cn = function(e, t, n, i) {
|
|
3405
3405
|
var r = t.startContainer, o = (0, p.lG)(r, "BLOCKQUOTE");
|
|
3406
3406
|
if (o && t.toString() === "") {
|
|
3407
3407
|
if (n.key === "Backspace" && !(0, s.yl)(n) && !n.shiftKey && !n.altKey && (0, T.im)(o, e[e.currentMode].element, t).start === 0)
|
|
@@ -3418,11 +3418,11 @@ onclick="this.previousElementSibling.select();document.execCommand('copy');this.
|
|
|
3418
3418
|
var d = (0, p.F9)(r);
|
|
3419
3419
|
if (e.currentMode === "wysiwyg" && d && V("⇧⌘;", n))
|
|
3420
3420
|
return t.insertNode(document.createElement("wbr")), d.outerHTML = '<blockquote data-block="0">' + d.outerHTML + "</blockquote>", (0, T.ib)(e.wysiwyg.element, t), we(e), n.preventDefault(), !0;
|
|
3421
|
-
if (ht(e, n, t, o, o) ||
|
|
3421
|
+
if (ht(e, n, t, o, o) || at(e, n, t, o, o))
|
|
3422
3422
|
return !0;
|
|
3423
3423
|
}
|
|
3424
3424
|
return !1;
|
|
3425
|
-
},
|
|
3425
|
+
}, Mn = function(e, t, n) {
|
|
3426
3426
|
var i = t.startContainer, r = (0, p.fb)(i, "vditor-task");
|
|
3427
3427
|
if (r) {
|
|
3428
3428
|
if (V("⇧⌘J", n)) {
|
|
@@ -3438,7 +3438,7 @@ onclick="this.previousElementSibling.select();document.execCommand('copy');this.
|
|
|
3438
3438
|
if (r.textContent.trim() === "")
|
|
3439
3439
|
if ((0, p.fb)(r.parentElement, "vditor-task")) {
|
|
3440
3440
|
var d = (0, p.O9)(i);
|
|
3441
|
-
d &&
|
|
3441
|
+
d && Wt(e, r, t, d);
|
|
3442
3442
|
} else if (r.nextElementSibling) {
|
|
3443
3443
|
var v = "", g = "", h = !1;
|
|
3444
3444
|
Array.from(r.parentElement.children).forEach(function(C) {
|
|
@@ -3457,7 +3457,7 @@ onclick="this.previousElementSibling.select();document.execCommand('copy');this.
|
|
|
3457
3457
|
}
|
|
3458
3458
|
}
|
|
3459
3459
|
return !1;
|
|
3460
|
-
},
|
|
3460
|
+
}, Tn = function(e, t, n, i) {
|
|
3461
3461
|
if (t.startContainer.nodeType !== 3) {
|
|
3462
3462
|
var r = t.startContainer.children[t.startOffset];
|
|
3463
3463
|
if (r && r.tagName === "HR")
|
|
@@ -3475,9 +3475,9 @@ onclick="this.previousElementSibling.select();document.execCommand('copy');this.
|
|
|
3475
3475
|
}
|
|
3476
3476
|
}
|
|
3477
3477
|
return !1;
|
|
3478
|
-
},
|
|
3478
|
+
}, An = function(e) {
|
|
3479
3479
|
(0, s.vU)() && e.startContainer.nodeType !== 3 && e.startContainer.tagName === "HR" && e.setStartBefore(e.startContainer);
|
|
3480
|
-
},
|
|
3480
|
+
}, xn = function(e, t, n) {
|
|
3481
3481
|
var i, r;
|
|
3482
3482
|
if (!(0, s.vU)())
|
|
3483
3483
|
return !1;
|
|
@@ -3497,12 +3497,12 @@ onclick="this.previousElementSibling.select();document.execCommand('copy');this.
|
|
|
3497
3497
|
return ["", Lute.WalkContinue];
|
|
3498
3498
|
var te = H.TokensStr();
|
|
3499
3499
|
if (H.__internal_object__.Parent.Type === 34 && te && te.indexOf("file://") === -1 && e.options.upload.linkToImgUrl) {
|
|
3500
|
-
var
|
|
3501
|
-
|
|
3502
|
-
if (
|
|
3503
|
-
if (
|
|
3504
|
-
var ee =
|
|
3505
|
-
e.options.upload.linkToImgFormat && (ee = e.options.upload.linkToImgFormat(
|
|
3500
|
+
var X = new XMLHttpRequest();
|
|
3501
|
+
X.open("POST", e.options.upload.linkToImgUrl), e.options.upload.token && X.setRequestHeader("X-Upload-Token", e.options.upload.token), e.options.upload.withCredentials && (X.withCredentials = !0), pn(e, X), X.setRequestHeader("Content-Type", "application/json; charset=utf-8"), X.onreadystatechange = function() {
|
|
3502
|
+
if (X.readyState === XMLHttpRequest.DONE) {
|
|
3503
|
+
if (X.status === 200) {
|
|
3504
|
+
var ee = X.responseText;
|
|
3505
|
+
e.options.upload.linkToImgFormat && (ee = e.options.upload.linkToImgFormat(X.responseText));
|
|
3506
3506
|
var Y = JSON.parse(ee);
|
|
3507
3507
|
if (Y.code !== 0)
|
|
3508
3508
|
return void e.tip.show(Y.msg);
|
|
@@ -3517,21 +3517,21 @@ onclick="this.previousElementSibling.select();document.execCommand('copy');this.
|
|
|
3517
3517
|
}
|
|
3518
3518
|
ae(e);
|
|
3519
3519
|
} else
|
|
3520
|
-
e.tip.show(
|
|
3521
|
-
e.options.upload.linkToImgCallback && e.options.upload.linkToImgCallback(
|
|
3520
|
+
e.tip.show(X.responseText);
|
|
3521
|
+
e.options.upload.linkToImgCallback && e.options.upload.linkToImgCallback(X.responseText);
|
|
3522
3522
|
}
|
|
3523
|
-
},
|
|
3523
|
+
}, X.send(JSON.stringify({ url: te }));
|
|
3524
3524
|
}
|
|
3525
3525
|
return e.currentMode === "ir" ? ['<span class="vditor-ir__marker vditor-ir__marker--link">' + Lute.EscapeHTMLStr(te) + "</span>", Lute.WalkContinue] : e.currentMode === "wysiwyg" ? ["", Lute.WalkContinue] : ['<span class="vditor-sv__marker--link">' + Lute.EscapeHTMLStr(te) + "</span>", Lute.WalkContinue];
|
|
3526
3526
|
}, i.replace(/&/g, "&").replace(/<(|\/)(html|body|meta)[^>]*?>/gi, "").trim() !== '<a href="' + r + '">' + r + "</a>" && i.replace(/&/g, "&").replace(/<(|\/)(html|body|meta)[^>]*?>/gi, "").trim() !== '<!--StartFragment--><a href="' + r + '">' + r + "</a><!--EndFragment-->" || (i = ""), (v = new DOMParser().parseFromString(i, "text/html")).body && (i = v.body.innerHTML), i = Lute.Sanitize(i), e.wysiwyg.getComments(e), g = e[e.currentMode].element.scrollHeight, h = function(H, G, te) {
|
|
3527
3527
|
te === void 0 && (te = "sv");
|
|
3528
|
-
var
|
|
3529
|
-
|
|
3528
|
+
var X = document.createElement("div");
|
|
3529
|
+
X.innerHTML = H;
|
|
3530
3530
|
var ee = !1;
|
|
3531
|
-
|
|
3532
|
-
var Y =
|
|
3533
|
-
if (
|
|
3534
|
-
<p class="p1">`) === 0 && (ee = !0),
|
|
3531
|
+
X.childElementCount === 1 && X.lastElementChild.style.fontFamily.indexOf("monospace") > -1 && (ee = !0);
|
|
3532
|
+
var Y = X.querySelectorAll("pre");
|
|
3533
|
+
if (X.childElementCount === 1 && Y.length === 1 && Y[0].className !== "vditor-wysiwyg" && Y[0].className !== "vditor-sv" && (ee = !0), H.indexOf(`
|
|
3534
|
+
<p class="p1">`) === 0 && (ee = !0), X.childElementCount === 1 && X.firstElementChild.tagName === "TABLE" && X.querySelector(".line-number") && X.querySelector(".line-content") && (ee = !0), ee) {
|
|
3535
3535
|
var F = G || H;
|
|
3536
3536
|
return /\n/.test(F) || Y.length === 1 ? te === "wysiwyg" ? '<div class="vditor-wysiwyg__block" data-block="0" data-type="code-block"><pre><code>' + F.replace(/&/g, "&").replace(/</g, "<") + "<wbr></code></pre></div>" : "\n```\n" + F.replace(/&/g, "&").replace(/</g, "<") + "\n```" : te === "wysiwyg" ? "<code>" + F.replace(/&/g, "&").replace(/</g, "<") + "</code><wbr>" : "`" + F + "`";
|
|
3537
3537
|
}
|
|
@@ -3544,9 +3544,9 @@ onclick="this.previousElementSibling.select();document.execCommand('copy');this.
|
|
|
3544
3544
|
H.removeAttribute("style");
|
|
3545
3545
|
}), U.querySelectorAll(".vditor-copy").forEach(function(H) {
|
|
3546
3546
|
H.remove();
|
|
3547
|
-
}), e.currentMode === "ir" ? (a.HTML2VditorIRDOM = { renderLinkDest: d }, e.lute.SetJSRenderers({ renderers: a }), (0, T.oC)(e.lute.HTML2VditorIRDOM(U.innerHTML), e)) : e.currentMode === "wysiwyg" ? (a.HTML2VditorDOM = { renderLinkDest: d }, e.lute.SetJSRenderers({ renderers: a }), (0, T.oC)(e.lute.HTML2VditorDOM(U.innerHTML), e)) : (a.Md2VditorSVDOM = { renderLinkDest: d }, e.lute.SetJSRenderers({ renderers: a }),
|
|
3547
|
+
}), e.currentMode === "ir" ? (a.HTML2VditorIRDOM = { renderLinkDest: d }, e.lute.SetJSRenderers({ renderers: a }), (0, T.oC)(e.lute.HTML2VditorIRDOM(U.innerHTML), e)) : e.currentMode === "wysiwyg" ? (a.HTML2VditorDOM = { renderLinkDest: d }, e.lute.SetJSRenderers({ renderers: a }), (0, T.oC)(e.lute.HTML2VditorDOM(U.innerHTML), e)) : (a.Md2VditorSVDOM = { renderLinkDest: d }, e.lute.SetJSRenderers({ renderers: a }), ln(e, e.lute.HTML2Md(U.innerHTML).trimRight())), e.outline.render(e), [3, 8]);
|
|
3548
3548
|
case 3:
|
|
3549
|
-
return o.length > 0 ? e.options.upload.url || e.options.upload.handler ? [4,
|
|
3549
|
+
return o.length > 0 ? e.options.upload.url || e.options.upload.handler ? [4, Ut(e, o)] : [3, 5] : [3, 7];
|
|
3550
3550
|
case 4:
|
|
3551
3551
|
return P.sent(), [3, 6];
|
|
3552
3552
|
case 5:
|
|
@@ -3559,7 +3559,7 @@ onclick="this.previousElementSibling.select();document.execCommand('copy');this.
|
|
|
3559
3559
|
case 6:
|
|
3560
3560
|
return [3, 8];
|
|
3561
3561
|
case 7:
|
|
3562
|
-
r.trim() !== "" && o.length === 0 && ((D = (0, T.zh)(e)).toString() !== "" && e.lute.IsValidLinkDest(r) && (r = "[" + D.toString() + "](" + r + ")"), e.currentMode === "ir" ? (a.Md2VditorIRDOM = { renderLinkDest: d }, e.lute.SetJSRenderers({ renderers: a }), (0, T.oC)(e.lute.Md2VditorIRDOM(r), e)) : e.currentMode === "wysiwyg" ? (a.Md2VditorDOM = { renderLinkDest: d }, e.lute.SetJSRenderers({ renderers: a }), (0, T.oC)(e.lute.Md2VditorDOM(r), e)) : (a.Md2VditorSVDOM = { renderLinkDest: d }, e.lute.SetJSRenderers({ renderers: a }),
|
|
3562
|
+
r.trim() !== "" && o.length === 0 && ((D = (0, T.zh)(e)).toString() !== "" && e.lute.IsValidLinkDest(r) && (r = "[" + D.toString() + "](" + r + ")"), e.currentMode === "ir" ? (a.Md2VditorIRDOM = { renderLinkDest: d }, e.lute.SetJSRenderers({ renderers: a }), (0, T.oC)(e.lute.Md2VditorIRDOM(r), e)) : e.currentMode === "wysiwyg" ? (a.Md2VditorDOM = { renderLinkDest: d }, e.lute.SetJSRenderers({ renderers: a }), (0, T.oC)(e.lute.Md2VditorDOM(r), e)) : (a.Md2VditorSVDOM = { renderLinkDest: d }, e.lute.SetJSRenderers({ renderers: a }), ln(e, r)), e.outline.render(e)), P.label = 8;
|
|
3563
3563
|
case 8:
|
|
3564
3564
|
return e.currentMode !== "sv" && ((q = (0, p.F9)((0, T.zh)(e).startContainer)) && (D = (0, T.zh)(e), e[e.currentMode].element.querySelectorAll("wbr").forEach(function(H) {
|
|
3565
3565
|
H.remove();
|
|
@@ -3569,7 +3569,7 @@ onclick="this.previousElementSibling.select();document.execCommand('copy');this.
|
|
|
3569
3569
|
}
|
|
3570
3570
|
});
|
|
3571
3571
|
});
|
|
3572
|
-
},
|
|
3572
|
+
}, Hn = function(e) {
|
|
3573
3573
|
e.hint.render(e);
|
|
3574
3574
|
var t = (0, T.zh)(e).startContainer, n = (0, p.a1)(t, "data-type", "code-block-info");
|
|
3575
3575
|
if (n)
|
|
@@ -3581,8 +3581,8 @@ onclick="this.previousElementSibling.select();document.execCommand('copy');this.
|
|
|
3581
3581
|
o.indexOf(r.toLowerCase()) > -1 && i.push({ html: o, value: o });
|
|
3582
3582
|
}), e.hint.genHTML(i, r, e);
|
|
3583
3583
|
}
|
|
3584
|
-
},
|
|
3585
|
-
t === void 0 && (t = { enableAddUndoStack: !0, enableHint: !1, enableInput: !0 }), t.enableHint &&
|
|
3584
|
+
}, Fe = function(e, t) {
|
|
3585
|
+
t === void 0 && (t = { enableAddUndoStack: !0, enableHint: !1, enableInput: !0 }), t.enableHint && Hn(e), clearTimeout(e.ir.processTimeoutId), e.ir.processTimeoutId = window.setTimeout(function() {
|
|
3586
3586
|
if (!e.ir.composingLock) {
|
|
3587
3587
|
var n = m(e);
|
|
3588
3588
|
typeof e.options.input == "function" && t.enableInput && e.options.input(n), e.options.counter.enable && e.counter.render(e, n), e.options.cache.enable && (0, s.pK)() && (localStorage.setItem(e.options.cache.id, n), e.options.cache.after && e.options.cache.after(n)), e.devtools && e.devtools.renderEchart(e), t.enableAddUndoStack && e.undo.addToUndoStack(e);
|
|
@@ -3642,7 +3642,7 @@ onclick="this.previousElementSibling.select();document.execCommand('copy');this.
|
|
|
3642
3642
|
} else
|
|
3643
3643
|
o !== "check" && o !== "list" && o !== "ordered-list" || (Lt(e, r, o, !1), d = !1, u(e.toolbar.elements, ["check", "list", "ordered-list"]), t.classList.add("vditor-menu--current"));
|
|
3644
3644
|
}
|
|
3645
|
-
(0, T.ib)(e.ir.element, r),
|
|
3645
|
+
(0, T.ib)(e.ir.element, r), Fe(e), d && ut(e);
|
|
3646
3646
|
}, ar = function(e, t, n, i) {
|
|
3647
3647
|
return new (n || (n = Promise))(function(r, o) {
|
|
3648
3648
|
function a(g) {
|
|
@@ -3739,7 +3739,7 @@ onclick="this.previousElementSibling.select();document.execCommand('copy');this.
|
|
|
3739
3739
|
if (r.currentMode === "ir") {
|
|
3740
3740
|
var d = (0, p.a1)(a.startContainer, "data-type", "code-block-info");
|
|
3741
3741
|
if (d)
|
|
3742
|
-
return d.textContent = y.g.ZWSP + o.trimRight(), a.selectNodeContents(d), a.collapse(!1),
|
|
3742
|
+
return d.textContent = y.g.ZWSP + o.trimRight(), a.selectNodeContents(d), a.collapse(!1), Fe(r), d.parentElement.querySelectorAll("code").forEach(function(A) {
|
|
3743
3743
|
A.className = "language-" + o.trimRight();
|
|
3744
3744
|
}), Ce(d.parentElement.querySelector(".vditor-ir__preview"), r), void (n.recentLanguage = o.trimRight());
|
|
3745
3745
|
}
|
|
@@ -3848,7 +3848,7 @@ onclick="this.previousElementSibling.select();document.execCommand('copy');this.
|
|
|
3848
3848
|
this.composingLock = !1;
|
|
3849
3849
|
var n = document.createElement("div");
|
|
3850
3850
|
n.className = "vditor-ir", n.innerHTML = '<pre class="vditor-reset" placeholder="' + t.options.placeholder + `"
|
|
3851
|
-
contenteditable="true" spellcheck="false"></pre>`, this.element = n.firstElementChild, this.bindEvent(t),
|
|
3851
|
+
contenteditable="true" spellcheck="false"></pre>`, this.element = n.firstElementChild, this.bindEvent(t), It(t, this.element), sn(t, this.element), jt(t, this.element), Bt(t, this.element), Vt(t, this.element), Rt(t, this.element), Pt(t, this.element, this.copy), qt(t, this.element, this.copy);
|
|
3852
3852
|
}
|
|
3853
3853
|
return e.prototype.copy = function(t, n) {
|
|
3854
3854
|
var i = getSelection().getRangeAt(0);
|
|
@@ -3871,10 +3871,10 @@ onclick="this.previousElementSibling.select();document.execCommand('copy');this.
|
|
|
3871
3871
|
(0, s.vU)() || ge(t, getSelection().getRangeAt(0).cloneRange()), n.composingLock = !1;
|
|
3872
3872
|
}), this.element.addEventListener("input", function(i) {
|
|
3873
3873
|
if (i.inputType !== "deleteByDrag" && i.inputType !== "insertFromDrop")
|
|
3874
|
-
return n.preventInput ? (n.preventInput = !1, void
|
|
3874
|
+
return n.preventInput ? (n.preventInput = !1, void Fe(t, { enableAddUndoStack: !0, enableHint: !0, enableInput: !0 })) : void (n.composingLock || i.data === "‘" || i.data === "“" || i.data === "《" || ge(t, getSelection().getRangeAt(0).cloneRange(), !1, i));
|
|
3875
3875
|
}), this.element.addEventListener("click", function(i) {
|
|
3876
3876
|
if (i.target.tagName === "INPUT")
|
|
3877
|
-
return i.target.checked ? i.target.setAttribute("checked", "checked") : i.target.removeAttribute("checked"), n.preventInput = !0, void
|
|
3877
|
+
return i.target.checked ? i.target.setAttribute("checked", "checked") : i.target.removeAttribute("checked"), n.preventInput = !0, void Fe(t);
|
|
3878
3878
|
var r = (0, T.zh)(t), o = (0, p.fb)(i.target, "vditor-ir__preview");
|
|
3879
3879
|
if (o || (o = (0, p.fb)(r.startContainer, "vditor-ir__preview")), o && (o.previousElementSibling.firstElementChild ? r.selectNodeContents(o.previousElementSibling.firstElementChild) : r.selectNodeContents(o.previousElementSibling), r.collapse(!0), (0, T.Hc)(r), Te(t)), i.target.tagName === "IMG") {
|
|
3880
3880
|
var a = i.target.parentElement.querySelector(".vditor-ir__marker--link");
|
|
@@ -3900,7 +3900,7 @@ onclick="this.previousElementSibling.select();document.execCommand('copy');this.
|
|
|
3900
3900
|
` && r.startOffset === 1 && (r.startContainer.textContent = "", j(r, t)), n.element.querySelectorAll(".language-math").forEach(function(a) {
|
|
3901
3901
|
var d = a.querySelector("br");
|
|
3902
3902
|
d && d.remove();
|
|
3903
|
-
})) : i.key.indexOf("Arrow") > -1 ? (i.key !== "ArrowLeft" && i.key !== "ArrowRight" ||
|
|
3903
|
+
})) : i.key.indexOf("Arrow") > -1 ? (i.key !== "ArrowLeft" && i.key !== "ArrowRight" || Hn(t), j(r, t)) : i.keyCode === 229 && i.code === "" && i.key === "Unidentified" && j(r, t);
|
|
3904
3904
|
var o = (0, p.fb)(r.startContainer, "vditor-ir__preview");
|
|
3905
3905
|
if (o) {
|
|
3906
3906
|
if (i.key === "ArrowUp" || i.key === "ArrowLeft")
|
|
@@ -3912,15 +3912,15 @@ onclick="this.previousElementSibling.select();document.execCommand('copy');this.
|
|
|
3912
3912
|
t.ir.element.innerHTML = "";
|
|
3913
3913
|
});
|
|
3914
3914
|
}, e;
|
|
3915
|
-
}(),
|
|
3915
|
+
}(), Nn = function(e) {
|
|
3916
3916
|
return e.currentMode === "sv" ? e.lute.Md2HTML(m(e)) : e.currentMode === "wysiwyg" ? e.lute.VditorDOM2HTML(e.wysiwyg.element.innerHTML) : e.currentMode === "ir" ? e.lute.VditorIRDOM2HTML(e.ir.element.innerHTML) : void 0;
|
|
3917
|
-
}, dr =
|
|
3917
|
+
}, dr = J(895), Dn = J(818), ur = function() {
|
|
3918
3918
|
function e(t) {
|
|
3919
3919
|
this.element = document.createElement("div"), this.element.className = "vditor-outline", this.element.innerHTML = '<div class="vditor-outline__title">' + t + `</div>
|
|
3920
3920
|
<div class="vditor-outline__content"></div>`;
|
|
3921
3921
|
}
|
|
3922
3922
|
return e.prototype.render = function(t) {
|
|
3923
|
-
return t.preview.element.style.display === "block" ? (0,
|
|
3923
|
+
return t.preview.element.style.display === "block" ? (0, Dn.k)(t.preview.previewElement, this.element.lastElementChild, t) : (0, Dn.k)(t[t.currentMode].element, this.element.lastElementChild, t);
|
|
3924
3924
|
}, e.prototype.toggle = function(t, n, i) {
|
|
3925
3925
|
var r;
|
|
3926
3926
|
n === void 0 && (n = !0), i === void 0 && (i = !0);
|
|
@@ -3929,9 +3929,9 @@ onclick="this.previousElementSibling.select();document.execCommand('copy');this.
|
|
|
3929
3929
|
var a = getSelection().getRangeAt(0);
|
|
3930
3930
|
t[t.currentMode].element.contains(a.startContainer) && (0, T.Hc)(a);
|
|
3931
3931
|
}
|
|
3932
|
-
|
|
3932
|
+
ue(t);
|
|
3933
3933
|
}, e;
|
|
3934
|
-
}(), pr =
|
|
3934
|
+
}(), pr = J(554), mr = function() {
|
|
3935
3935
|
function e(t) {
|
|
3936
3936
|
var n = this;
|
|
3937
3937
|
this.element = document.createElement("div"), this.element.className = "vditor-preview", this.previewElement = document.createElement("div"), this.previewElement.className = "vditor-reset", t.options.classes.preview && this.previewElement.classList.add(t.options.classes.preview), this.previewElement.style.maxWidth = t.options.preview.maxWidth + "px", this.previewElement.addEventListener("copy", function(v) {
|
|
@@ -4025,7 +4025,7 @@ onclick="this.previousElementSibling.select();document.execCommand('copy');this.
|
|
|
4025
4025
|
var i = (/* @__PURE__ */ new Date()).getTime() - n;
|
|
4026
4026
|
(/* @__PURE__ */ new Date()).getTime() - n > 2600 ? (t.tip.show(window.VditorI18n.performanceTip.replace("${x}", i.toString())), t.preview.element.setAttribute("data-type", "renderPerformance")) : t.preview.element.getAttribute("data-type") === "renderPerformance" && (t.tip.hide(), t.preview.element.removeAttribute("data-type"));
|
|
4027
4027
|
var r = t.preview.element.querySelector(".vditor-comment--focus");
|
|
4028
|
-
r && r.classList.remove("vditor-comment--focus"), (0, $.O)(t.preview.previewElement, t.options.preview.hljs), (0,
|
|
4028
|
+
r && r.classList.remove("vditor-comment--focus"), (0, $.O)(t.preview.previewElement, t.options.preview.hljs), (0, de.s)(t.options.preview.hljs, t.preview.previewElement, t.options.cdn), (0, ve.i)(t.preview.previewElement, t.options.cdn, t.options.theme), (0, xe.K)(t.preview.previewElement, t.options.cdn, t.options.theme), (0, ne.P)(t.preview.previewElement, t.options.cdn), (0, me.v)(t.preview.previewElement, t.options.cdn), (0, N.p)(t.preview.previewElement, t.options.cdn, t.options.theme), (0, Me.P)(t.preview.previewElement, t.options.cdn, t.options.theme), (0, $e.B)(t.preview.previewElement, t.options.cdn), (0, W.Q)(t.preview.previewElement, t.options.cdn), t.options.preview.render.media.enable && (0, pr.Y)(t.preview.previewElement), t.options.customRenders.forEach(function(d) {
|
|
4029
4029
|
d.render(t.preview.previewElement, t);
|
|
4030
4030
|
});
|
|
4031
4031
|
var o = t.preview.element, a = t.outline.render(t);
|
|
@@ -4062,7 +4062,7 @@ onclick="this.previousElementSibling.select();document.execCommand('copy');this.
|
|
|
4062
4062
|
}, e;
|
|
4063
4063
|
}(), hr = function() {
|
|
4064
4064
|
function e(t) {
|
|
4065
|
-
this.composingLock = !1, this.element = document.createElement("pre"), this.element.className = "vditor-sv vditor-reset", this.element.setAttribute("placeholder", t.options.placeholder), this.element.setAttribute("contenteditable", "true"), this.element.setAttribute("spellcheck", "false"), this.bindEvent(t),
|
|
4065
|
+
this.composingLock = !1, this.element = document.createElement("pre"), this.element.className = "vditor-sv vditor-reset", this.element.setAttribute("placeholder", t.options.placeholder), this.element.setAttribute("contenteditable", "true"), this.element.setAttribute("spellcheck", "false"), this.bindEvent(t), It(t, this.element), jt(t, this.element), Bt(t, this.element), Vt(t, this.element), Rt(t, this.element), Pt(t, this.element, this.copy), qt(t, this.element, this.copy);
|
|
4066
4066
|
}
|
|
4067
4067
|
return e.prototype.copy = function(t, n) {
|
|
4068
4068
|
t.stopPropagation(), t.preventDefault(), t.clipboardData.setData("text/plain", ft(n[n.currentMode].element));
|
|
@@ -4089,7 +4089,7 @@ onclick="this.previousElementSibling.select();document.execCommand('copy');this.
|
|
|
4089
4089
|
` ? i.key === "Enter" && Te(t) : t.sv.element.innerHTML = "");
|
|
4090
4090
|
});
|
|
4091
4091
|
}, e;
|
|
4092
|
-
}(),
|
|
4092
|
+
}(), On = function() {
|
|
4093
4093
|
function e() {
|
|
4094
4094
|
this.element = document.createElement("div"), this.element.className = "vditor-tip";
|
|
4095
4095
|
}
|
|
@@ -4106,7 +4106,7 @@ onclick="this.previousElementSibling.select();document.execCommand('copy');this.
|
|
|
4106
4106
|
}, e.prototype.hide = function() {
|
|
4107
4107
|
this.element.className = "vditor-messageElementtip", this.element.innerHTML = "";
|
|
4108
4108
|
}, e;
|
|
4109
|
-
}(),
|
|
4109
|
+
}(), Gt = function(e, t) {
|
|
4110
4110
|
if (t.options.preview.mode !== e) {
|
|
4111
4111
|
switch (t.options.preview.mode = e, e) {
|
|
4112
4112
|
case "both":
|
|
@@ -4136,13 +4136,13 @@ onclick="this.previousElementSibling.select();document.execCommand('copy');this.
|
|
|
4136
4136
|
function t(n, i) {
|
|
4137
4137
|
var r = e.call(this, n, i) || this;
|
|
4138
4138
|
return n.options.preview.mode === "both" && r.element.children[0].classList.add("vditor-menu--current"), r.element.children[0].addEventListener((0, s.Le)(), function(o) {
|
|
4139
|
-
r.element.firstElementChild.classList.contains(y.g.CLASS_MENU_DISABLED) || (o.preventDefault(), n.currentMode === "sv" && (n.options.preview.mode === "both" ?
|
|
4139
|
+
r.element.firstElementChild.classList.contains(y.g.CLASS_MENU_DISABLED) || (o.preventDefault(), n.currentMode === "sv" && (n.options.preview.mode === "both" ? Gt("editor", n) : Gt("both", n)));
|
|
4140
4140
|
}), r;
|
|
4141
4141
|
}
|
|
4142
4142
|
return vr(t, e), t;
|
|
4143
4143
|
}(Le), yr = function() {
|
|
4144
4144
|
this.element = document.createElement("div"), this.element.className = "vditor-toolbar__br";
|
|
4145
|
-
},
|
|
4145
|
+
}, In = J(312), br = /* @__PURE__ */ function() {
|
|
4146
4146
|
var e = function(t, n) {
|
|
4147
4147
|
return e = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(i, r) {
|
|
4148
4148
|
i.__proto__ = r;
|
|
@@ -4165,7 +4165,7 @@ onclick="this.previousElementSibling.select();document.execCommand('copy');this.
|
|
|
4165
4165
|
return y.g.CODE_THEME.forEach(function(v) {
|
|
4166
4166
|
d += "<button>" + v + "</button>";
|
|
4167
4167
|
}), a.innerHTML = '<div style="overflow: auto;max-height:' + window.innerHeight / 2 + 'px">' + d + "</div>", a.addEventListener((0, s.Le)(), function(v) {
|
|
4168
|
-
v.target.tagName === "BUTTON" && (E(n, ["subToolbar"]), n.options.preview.hljs.style = v.target.textContent, (0,
|
|
4168
|
+
v.target.tagName === "BUTTON" && (E(n, ["subToolbar"]), n.options.preview.hljs.style = v.target.textContent, (0, In.Y)(v.target.textContent, n.options.cdn), v.preventDefault(), v.stopPropagation());
|
|
4169
4169
|
}), r.element.appendChild(a), k(n, a, o, i.level), r;
|
|
4170
4170
|
}
|
|
4171
4171
|
return br(t, e), t;
|
|
@@ -4254,7 +4254,7 @@ onclick="this.previousElementSibling.select();document.execCommand('copy');this.
|
|
|
4254
4254
|
var r = e.call(this, n, i) || this;
|
|
4255
4255
|
return r.element.firstElementChild.addEventListener((0, s.Le)(), function(o) {
|
|
4256
4256
|
var a = r.element.firstElementChild;
|
|
4257
|
-
a.classList.contains(y.g.CLASS_MENU_DISABLED) || (o.preventDefault(), a.classList.contains("vditor-menu--current") ? (a.classList.remove("vditor-menu--current"), n.devtools.element.style.display = "none",
|
|
4257
|
+
a.classList.contains(y.g.CLASS_MENU_DISABLED) || (o.preventDefault(), a.classList.contains("vditor-menu--current") ? (a.classList.remove("vditor-menu--current"), n.devtools.element.style.display = "none", ue(n)) : (a.classList.add("vditor-menu--current"), n.devtools.element.style.display = "block", ue(n), n.devtools.renderEchart(n)));
|
|
4258
4258
|
}), r;
|
|
4259
4259
|
}
|
|
4260
4260
|
return Cr(t, e), t;
|
|
@@ -4308,7 +4308,7 @@ data-value=":` + d + ': " data-key=":' + d + ':" class="vditor-emojis__icon" src
|
|
|
4308
4308
|
o && (i.element.querySelector(".vditor-emojis__tip").innerHTML = o.getAttribute("data-key"));
|
|
4309
4309
|
});
|
|
4310
4310
|
}, t;
|
|
4311
|
-
}(Le),
|
|
4311
|
+
}(Le), jn = function(e, t, n) {
|
|
4312
4312
|
var i = document.createElement("a");
|
|
4313
4313
|
"download" in i ? (i.download = n, i.style.display = "none", i.href = URL.createObjectURL(new Blob([t])), document.body.appendChild(i), i.click(), i.remove()) : e.tip.show(window.VditorI18n.downloadTip, 0);
|
|
4314
4314
|
}, Hr = /* @__PURE__ */ function() {
|
|
@@ -4338,7 +4338,7 @@ data-value=":` + d + ': " data-key=":' + d + ':" class="vditor-emojis__icon" src
|
|
|
4338
4338
|
case "markdown":
|
|
4339
4339
|
(function(g) {
|
|
4340
4340
|
var h = m(g);
|
|
4341
|
-
|
|
4341
|
+
jn(g, h, h.substr(0, 10) + ".md");
|
|
4342
4342
|
})(n);
|
|
4343
4343
|
break;
|
|
4344
4344
|
case "pdf":
|
|
@@ -4373,7 +4373,7 @@ window.addEventListener("message", (e) => {
|
|
|
4373
4373
|
break;
|
|
4374
4374
|
case "html":
|
|
4375
4375
|
(function(g) {
|
|
4376
|
-
var h =
|
|
4376
|
+
var h = Nn(g), A = '<html><head><link rel="stylesheet" type="text/css" href="' + g.options.cdn + `/dist/index.css"/>
|
|
4377
4377
|
<script src="` + g.options.cdn + "/dist/js/i18n/" + g.options.lang + `.js"><\/script>
|
|
4378
4378
|
<script src="` + g.options.cdn + `/dist/method.min.js"><\/script></head>
|
|
4379
4379
|
<body><div class="vditor-reset" id="preview">` + h + `</div>
|
|
@@ -4397,7 +4397,7 @@ window.addEventListener("message", (e) => {
|
|
|
4397
4397
|
Vditor.speechRender(previewElement);
|
|
4398
4398
|
<\/script>
|
|
4399
4399
|
<script src="` + g.options.cdn + "/dist/js/icons/" + g.options.icon + '.js"><\/script></body></html>';
|
|
4400
|
-
|
|
4400
|
+
jn(g, A, h.substr(0, 10) + ".html");
|
|
4401
4401
|
})(n);
|
|
4402
4402
|
}
|
|
4403
4403
|
E(n, ["subToolbar"]), d.preventDefault(), d.stopPropagation();
|
|
@@ -4435,7 +4435,7 @@ window.addEventListener("message", (e) => {
|
|
|
4435
4435
|
}), n.counter && (n.counter.element.className = n.counter.element.className.replace("__s", "__n"))) : (i.level || (this.innerHTML = '<svg><use xlink:href="#vditor-icon-contract"></use></svg>'), n.element.style.zIndex = n.options.fullscreen.index.toString(), document.body.style.overflow = "hidden", n.element.classList.add("vditor--fullscreen"), Object.keys(n.toolbar.elements).forEach(function(o) {
|
|
4436
4436
|
var a = n.toolbar.elements[o].firstChild;
|
|
4437
4437
|
a && (a.className = a.className.replace("__n", "__s"));
|
|
4438
|
-
}), n.counter && (n.counter.element.className = n.counter.element.className.replace("__n", "__s"))), n.devtools && n.devtools.renderEchart(n), i.click && i.click(r, n),
|
|
4438
|
+
}), n.counter && (n.counter.element.className = n.counter.element.className.replace("__n", "__s"))), n.devtools && n.devtools.renderEchart(n), i.click && i.click(r, n), ue(n), Q(n);
|
|
4439
4439
|
});
|
|
4440
4440
|
}, t;
|
|
4441
4441
|
}(Le), Ir = /* @__PURE__ */ function() {
|
|
@@ -4466,11 +4466,11 @@ window.addEventListener("message", (e) => {
|
|
|
4466
4466
|
return Ir(t, e), t.prototype._bindEvent = function(n, i) {
|
|
4467
4467
|
var r = this.element.children[0];
|
|
4468
4468
|
r.addEventListener((0, s.Le)(), function(a) {
|
|
4469
|
-
a.preventDefault(), clearTimeout(n.wysiwyg.afterRenderTimeoutId), clearTimeout(n.ir.processTimeoutId), clearTimeout(n.sv.processTimeoutId), r.classList.contains(y.g.CLASS_MENU_DISABLED) || (r.blur(), r.classList.contains("vditor-menu--current") ? (n.currentMode === "wysiwyg" ? (
|
|
4469
|
+
a.preventDefault(), clearTimeout(n.wysiwyg.afterRenderTimeoutId), clearTimeout(n.ir.processTimeoutId), clearTimeout(n.sv.processTimeoutId), r.classList.contains(y.g.CLASS_MENU_DISABLED) || (r.blur(), r.classList.contains("vditor-menu--current") ? (n.currentMode === "wysiwyg" ? (Dt(n), we(n)) : n.currentMode === "ir" && vt(n, ""), r.classList.remove("vditor-menu--current")) : (E(n, ["subToolbar"]), i.style.display = "block"));
|
|
4470
4470
|
});
|
|
4471
4471
|
for (var o = 0; o < 6; o++)
|
|
4472
4472
|
i.children.item(o).addEventListener((0, s.Le)(), function(a) {
|
|
4473
|
-
a.preventDefault(), n.currentMode === "wysiwyg" ? (wt(n, a.target.getAttribute("data-tag")), we(n), r.classList.add("vditor-menu--current")) : n.currentMode === "ir" ? (vt(n, a.target.getAttribute("data-value")), r.classList.add("vditor-menu--current")) :
|
|
4473
|
+
a.preventDefault(), n.currentMode === "wysiwyg" ? (wt(n, a.target.getAttribute("data-tag")), we(n), r.classList.add("vditor-menu--current")) : n.currentMode === "ir" ? (vt(n, a.target.getAttribute("data-value")), r.classList.add("vditor-menu--current")) : dn(n, a.target.getAttribute("data-value")), i.style.display = "none";
|
|
4474
4474
|
});
|
|
4475
4475
|
}, t;
|
|
4476
4476
|
}(Le), Rr = /* @__PURE__ */ function() {
|
|
@@ -4535,7 +4535,7 @@ window.addEventListener("message", (e) => {
|
|
|
4535
4535
|
return r.element.children[0].addEventListener((0, s.Le)(), function(o) {
|
|
4536
4536
|
if (o.preventDefault(), !r.element.firstElementChild.classList.contains(y.g.CLASS_MENU_DISABLED) && n.currentMode !== "sv") {
|
|
4537
4537
|
var a = (0, T.zh)(n), d = (0, p.lG)(a.startContainer, "LI");
|
|
4538
|
-
d &&
|
|
4538
|
+
d && gn(n, d, a);
|
|
4539
4539
|
}
|
|
4540
4540
|
}), r;
|
|
4541
4541
|
}
|
|
@@ -4660,7 +4660,7 @@ window.addEventListener("message", (e) => {
|
|
|
4660
4660
|
return r.element.children[0].addEventListener((0, s.Le)(), function(o) {
|
|
4661
4661
|
if (o.preventDefault(), !r.element.firstElementChild.classList.contains(y.g.CLASS_MENU_DISABLED) && n.currentMode !== "sv") {
|
|
4662
4662
|
var a = (0, T.zh)(n), d = (0, p.lG)(a.startContainer, "LI");
|
|
4663
|
-
d &&
|
|
4663
|
+
d && Wt(n, d, a, d.parentElement);
|
|
4664
4664
|
}
|
|
4665
4665
|
}), r;
|
|
4666
4666
|
}
|
|
@@ -4717,7 +4717,7 @@ window.addEventListener("message", (e) => {
|
|
|
4717
4717
|
var a = y.g.EDIT_TOOLBARS.concat(["both", "edit-mode", "devtools"]);
|
|
4718
4718
|
o.classList.contains("vditor-menu--current") ? (o.classList.remove("vditor-menu--current"), n.currentMode === "sv" ? (n.sv.element.style.display = "block", n.options.preview.mode === "both" ? n.preview.element.style.display = "block" : n.preview.element.style.display = "none") : (n[n.currentMode].element.parentElement.style.display = "block", n.preview.element.style.display = "none"), w(n.toolbar.elements, a), n.outline.render(n)) : (_(n.toolbar.elements, a), n.preview.element.style.display = "block", n.currentMode === "sv" ? n.sv.element.style.display = "none" : n[n.currentMode].element.parentElement.style.display = "none", n.preview.render(n), o.classList.add("vditor-menu--current"), E(n, ["subToolbar", "hint", "popover"]), setTimeout(function() {
|
|
4719
4719
|
n.outline.render(n);
|
|
4720
|
-
}, n.options.preview.delay + 10)),
|
|
4720
|
+
}, n.options.preview.delay + 10)), ue(n);
|
|
4721
4721
|
}
|
|
4722
4722
|
});
|
|
4723
4723
|
}, t;
|
|
@@ -4800,7 +4800,7 @@ window.addEventListener("message", (e) => {
|
|
|
4800
4800
|
if (i.isRecording) {
|
|
4801
4801
|
i.stopRecording(), n.tip.hide();
|
|
4802
4802
|
var d = new File([i.buildWavFileBlob()], "record" + (/* @__PURE__ */ new Date()).getTime() + ".wav", { type: "video/webm" });
|
|
4803
|
-
|
|
4803
|
+
Ut(n, [d]), r.element.children[0].classList.remove("vditor-menu--current");
|
|
4804
4804
|
} else
|
|
4805
4805
|
n.tip.show(window.VditorI18n.recording), a.setAttribute("contenteditable", "false"), i.startRecordingNewWavFile(), r.element.children[0].classList.add("vditor-menu--current");
|
|
4806
4806
|
else
|
|
@@ -4891,7 +4891,7 @@ window.addEventListener("message", (e) => {
|
|
|
4891
4891
|
}), this.element.querySelector("input").addEventListener("change", function(r) {
|
|
4892
4892
|
if (i.element.firstElementChild.classList.contains(y.g.CLASS_MENU_DISABLED))
|
|
4893
4893
|
return r.stopPropagation(), void r.preventDefault();
|
|
4894
|
-
r.target.files.length !== 0 &&
|
|
4894
|
+
r.target.files.length !== 0 && Ut(n, r.target.files, r.target);
|
|
4895
4895
|
});
|
|
4896
4896
|
}, t;
|
|
4897
4897
|
}(Le), li = function() {
|
|
@@ -5004,7 +5004,7 @@ window.addEventListener("message", (e) => {
|
|
|
5004
5004
|
return o !== "br" && o !== "|" || (o += i), this.elements[o] = r.element, r.element;
|
|
5005
5005
|
}
|
|
5006
5006
|
}, e;
|
|
5007
|
-
}(), ci =
|
|
5007
|
+
}(), ci = J(471), di = function() {
|
|
5008
5008
|
function e() {
|
|
5009
5009
|
this.stackSize = 50, this.resetStack(), this.dmp = new ci();
|
|
5010
5010
|
}
|
|
@@ -5049,7 +5049,7 @@ window.addEventListener("message", (e) => {
|
|
|
5049
5049
|
var a = getSelection().getRangeAt(0);
|
|
5050
5050
|
a.setEndBefore(n[n.currentMode].element), a.collapse(!1);
|
|
5051
5051
|
}
|
|
5052
|
-
Ve(n), ae(n, { enableAddUndoStack: !1, enableHint: !1, enableInput: !0 }),
|
|
5052
|
+
Ve(n), ae(n, { enableAddUndoStack: !1, enableHint: !1, enableInput: !0 }), ot(n), n[n.currentMode].element.querySelectorAll(".vditor-" + n.currentMode + "__preview[data-render='2']").forEach(function(d) {
|
|
5053
5053
|
Ce(d, n);
|
|
5054
5054
|
}), this[n.currentMode].undoStack.length > 1 ? w(n.toolbar.elements, ["undo"]) : _(n.toolbar.elements, ["undo"]), this[n.currentMode].redoStack.length !== 0 ? w(n.toolbar.elements, ["redo"]) : _(n.toolbar.elements, ["redo"]);
|
|
5055
5055
|
}, e.prototype.resetStack = function() {
|
|
@@ -5072,7 +5072,7 @@ window.addEventListener("message", (e) => {
|
|
|
5072
5072
|
d.remove();
|
|
5073
5073
|
}), n && i && (0, T.Hc)(i), a.replace('<span class="vditor-wbr"></span>', "<wbr>");
|
|
5074
5074
|
}, e;
|
|
5075
|
-
}(), ui =
|
|
5075
|
+
}(), ui = J(640), pi = function() {
|
|
5076
5076
|
function e(t) {
|
|
5077
5077
|
this.defaultOptions = { rtl: !1, after: void 0, cache: { enable: !0 }, cdn: y.g.CDN, classes: { preview: "" }, comment: { enable: !1 }, counter: { enable: !1, type: "markdown" }, customRenders: [], debugger: !1, fullscreen: { index: 90 }, height: "auto", hint: { delay: 200, emoji: { "+1": "👍", "-1": "👎", confused: "😕", eyes: "👀️", heart: "❤️", rocket: "🚀️", smile: "😄", tada: "🎉️" }, emojiPath: y.g.CDN + "/dist/images/emoji", extend: [], parse: !0 }, icon: "ant", lang: "zh_CN", mode: "ir", outline: { enable: !1, position: "left" }, placeholder: "", preview: { actions: ["desktop", "tablet", "mobile", "mp-wechat", "zhihu"], delay: 1e3, hljs: y.g.HLJS_OPTIONS, markdown: y.g.MARKDOWN_OPTIONS, math: y.g.MATH_OPTIONS, maxWidth: 800, mode: "both", theme: y.g.THEME_OPTIONS, render: { media: { enable: !0 } } }, link: { isOpen: !0 }, image: { isPreview: !0 }, resize: { enable: !1, position: "bottom" }, theme: "classic", toolbar: ["emoji", "headings", "bold", "italic", "strike", "link", "|", "list", "ordered-list", "check", "outdent", "indent", "|", "quote", "line", "code", "inline-code", "insert-before", "insert-after", "|", "upload", "record", "table", "|", "undo", "redo", "|", "fullscreen", "edit-mode", { name: "more", toolbar: ["both", "code-theme", "content-theme", "export", "outline", "preview", "devtools", "info", "help"] }], toolbarConfig: { hide: !1, pin: !1 }, typewriterMode: !1, undoDelay: 800, upload: { extraData: {}, fieldName: "file[]", filename: function(n) {
|
|
5078
5078
|
return n.replace(/\W/g, "");
|
|
@@ -5109,7 +5109,7 @@ window.addEventListener("message", (e) => {
|
|
|
5109
5109
|
<button type="button" aria-label="` + window.VditorI18n.comment + `" class="vditor-icon vditor-tooltipped vditor-tooltipped__n">
|
|
5110
5110
|
<svg><use xlink:href="#vditor-icon-comment"></use></svg>
|
|
5111
5111
|
</button>
|
|
5112
|
-
</div>`, this.element = i.firstElementChild, this.popover = i.firstElementChild.nextElementSibling, this.selectPopover = i.lastElementChild, this.bindEvent(t),
|
|
5112
|
+
</div>`, this.element = i.firstElementChild, this.popover = i.firstElementChild.nextElementSibling, this.selectPopover = i.lastElementChild, this.bindEvent(t), It(t, this.element), sn(t, this.element), jt(t, this.element), Bt(t, this.element), Vt(t, this.element), Rt(t, this.element), Pt(t, this.element, this.copy), qt(t, this.element, this.copy), t.options.comment.enable && (this.selectPopover.querySelector("button").onclick = function() {
|
|
5113
5113
|
var r, o, a = Lute.NewNodeID(), d = getSelection().getRangeAt(0), v = d.cloneRange(), g = d.extractContents(), h = !1, A = !1;
|
|
5114
5114
|
g.childNodes.forEach(function(C, R) {
|
|
5115
5115
|
var q = !1;
|
|
@@ -5218,7 +5218,7 @@ window.addEventListener("message", (e) => {
|
|
|
5218
5218
|
we(t);
|
|
5219
5219
|
else {
|
|
5220
5220
|
var r = getSelection().getRangeAt(0), o = (0, p.F9)(r.startContainer);
|
|
5221
|
-
if (o || (
|
|
5221
|
+
if (o || (rn(t, r), o = (0, p.F9)(r.startContainer)), o) {
|
|
5222
5222
|
for (var a = (0, T.im)(o, t.wysiwyg.element, r).start, d = !0, v = a - 1; v > o.textContent.substr(0, a).lastIndexOf(`
|
|
5223
5223
|
`); v--)
|
|
5224
5224
|
if (o.textContent.charAt(v) !== " " && o.textContent.charAt(v) !== " ") {
|
|
@@ -5234,7 +5234,7 @@ window.addEventListener("message", (e) => {
|
|
|
5234
5234
|
break;
|
|
5235
5235
|
}
|
|
5236
5236
|
var h = (0, x.W)(getSelection().getRangeAt(0).startContainer);
|
|
5237
|
-
h && h.textContent === "" && (Ve(t), h.remove()), d && o.getAttribute("data-type") !== "code-block" || g ||
|
|
5237
|
+
h && h.textContent === "" && (Ve(t), h.remove()), d && o.getAttribute("data-type") !== "code-block" || g || Kt(o.innerHTML) || zt(o.innerHTML) && o.previousElementSibling ? typeof t.options.input == "function" && t.options.input(m(t)) : (i.inputType === "insertParagraph" && n.element.innerHTML === "<p><br></p><p><br></p>" && o.previousElementSibling.remove(), kt(t, r, i));
|
|
5238
5238
|
}
|
|
5239
5239
|
}
|
|
5240
5240
|
}
|
|
@@ -5256,7 +5256,7 @@ window.addEventListener("message", (e) => {
|
|
|
5256
5256
|
var v = (0, p.fb)(i.target, "vditor-wysiwyg__preview");
|
|
5257
5257
|
v || (v = (0, p.fb)((0, T.zh)(t).startContainer, "vditor-wysiwyg__preview")), v && pt(v, t), bt(i, t);
|
|
5258
5258
|
} else
|
|
5259
|
-
i.target.getAttribute("data-type") === "link-ref" ?
|
|
5259
|
+
i.target.getAttribute("data-type") === "link-ref" ? on(t, i.target) : function(g, h) {
|
|
5260
5260
|
var A = g.target;
|
|
5261
5261
|
h.wysiwyg.popover.innerHTML = "";
|
|
5262
5262
|
var O = function() {
|
|
@@ -5292,7 +5292,7 @@ window.addEventListener("message", (e) => {
|
|
|
5292
5292
|
` || (t.wysiwyg.element.innerHTML = "");
|
|
5293
5293
|
var r = (0, T.zh)(t);
|
|
5294
5294
|
if (i.key === "Backspace" && (0, s.vU)() && r.startContainer.textContent === `
|
|
5295
|
-
` && r.startOffset === 1 && (r.startContainer.textContent = ""),
|
|
5295
|
+
` && r.startOffset === 1 && (r.startContainer.textContent = ""), rn(t, r), Qe(t), i.key === "ArrowDown" || i.key === "ArrowRight" || i.key === "Backspace" || i.key === "ArrowLeft" || i.key === "ArrowUp") {
|
|
5296
5296
|
i.key !== "ArrowLeft" && i.key !== "ArrowRight" || t.hint.render(t);
|
|
5297
5297
|
var o = (0, p.fb)(r.startContainer, "vditor-wysiwyg__preview");
|
|
5298
5298
|
if (!o && r.startContainer.nodeType !== 3 && r.startOffset > 0 && (d = r.startContainer).classList.contains("vditor-wysiwyg__block") && (o = d.lastElementChild), o)
|
|
@@ -5365,10 +5365,10 @@ window.addEventListener("message", (e) => {
|
|
|
5365
5365
|
return r;
|
|
5366
5366
|
}
|
|
5367
5367
|
return fi(t, e), t.prototype.showErrorTip = function(n) {
|
|
5368
|
-
var i = new
|
|
5368
|
+
var i = new On();
|
|
5369
5369
|
document.body.appendChild(i.element), i.show(n, 0);
|
|
5370
5370
|
}, t.prototype.setTheme = function(n, i, r, o) {
|
|
5371
|
-
this.vditor.options.theme = n,
|
|
5371
|
+
this.vditor.options.theme = n, pe(this.vditor), i && (this.vditor.options.preview.theme.current = i, (0, Ne.Z)(i, o || this.vditor.options.preview.theme.path)), r && (this.vditor.options.preview.hljs.style = r, (0, In.Y)(r, this.vditor.options.cdn));
|
|
5372
5372
|
}, t.prototype.getValue = function() {
|
|
5373
5373
|
return m(this.vditor);
|
|
5374
5374
|
}, t.prototype.getCurrentMode = function() {
|
|
@@ -5402,11 +5402,11 @@ window.addEventListener("message", (e) => {
|
|
|
5402
5402
|
}, t.prototype.exportJSON = function(n) {
|
|
5403
5403
|
return this.vditor.lute.RenderJSON(n);
|
|
5404
5404
|
}, t.prototype.getHTML = function() {
|
|
5405
|
-
return
|
|
5405
|
+
return Nn(this.vditor);
|
|
5406
5406
|
}, t.prototype.tip = function(n, i) {
|
|
5407
5407
|
this.vditor.tip.show(n, i);
|
|
5408
5408
|
}, t.prototype.setPreviewMode = function(n) {
|
|
5409
|
-
|
|
5409
|
+
Gt(n, this.vditor);
|
|
5410
5410
|
}, t.prototype.deleteValue = function() {
|
|
5411
5411
|
window.getSelection().isCollapsed || document.execCommand("delete", !1);
|
|
5412
5412
|
}, t.prototype.updateValue = function(n) {
|
|
@@ -5419,15 +5419,15 @@ window.addEventListener("message", (e) => {
|
|
|
5419
5419
|
o.innerHTML = n, r.insertNode(o.content.cloneNode(!0)), r.collapse(!1), this.vditor.currentMode === "sv" ? (this.vditor.sv.preventInput = !0, i && oe(this.vditor)) : this.vditor.currentMode === "wysiwyg" ? i && kt(this.vditor, getSelection().getRangeAt(0)) : this.vditor.currentMode === "ir" && (this.vditor.ir.preventInput = !0, i && ge(this.vditor, getSelection().getRangeAt(0), !0));
|
|
5420
5420
|
}, t.prototype.setValue = function(n, i) {
|
|
5421
5421
|
var r = this;
|
|
5422
|
-
i === void 0 && (i = !1), this.vditor.currentMode === "sv" ? (this.vditor.sv.element.innerHTML = "<div data-block='0'>" + this.vditor.lute.SpinVditorSVDOM(n) + "</div>", He(this.vditor, { enableAddUndoStack: !0, enableHint: !1, enableInput: !1 })) : this.vditor.currentMode === "wysiwyg" ?
|
|
5422
|
+
i === void 0 && (i = !1), this.vditor.currentMode === "sv" ? (this.vditor.sv.element.innerHTML = "<div data-block='0'>" + this.vditor.lute.SpinVditorSVDOM(n) + "</div>", He(this.vditor, { enableAddUndoStack: !0, enableHint: !1, enableInput: !1 })) : this.vditor.currentMode === "wysiwyg" ? an(this.vditor, n, { enableAddUndoStack: !0, enableHint: !1, enableInput: !1 }) : (this.vditor.ir.element.innerHTML = this.vditor.lute.Md2VditorIRDOM(n), this.vditor.ir.element.querySelectorAll(".vditor-ir__preview[data-render='2']").forEach(function(o) {
|
|
5423
5423
|
Ce(o, r.vditor);
|
|
5424
|
-
}),
|
|
5424
|
+
}), Fe(this.vditor, { enableAddUndoStack: !0, enableHint: !1, enableInput: !1 })), this.vditor.outline.render(this.vditor), n || (E(this.vditor, ["emoji", "headings", "submenu", "hint"]), this.vditor.wysiwyg.popover && (this.vditor.wysiwyg.popover.style.display = "none"), this.clearCache()), i && this.clearStack();
|
|
5425
5425
|
}, t.prototype.clearStack = function() {
|
|
5426
5426
|
this.vditor.undo.clearStack(this.vditor), this.vditor.undo.addToUndoStack(this.vditor);
|
|
5427
5427
|
}, t.prototype.destroy = function() {
|
|
5428
5428
|
this.vditor.element.innerHTML = this.vditor.originalInnerHTML, this.vditor.element.classList.remove("vditor"), this.vditor.element.removeAttribute("style");
|
|
5429
5429
|
var n = document.getElementById("vditorIconScript");
|
|
5430
|
-
n && n.remove(), this.clearCache(),
|
|
5430
|
+
n && n.remove(), this.clearCache(), Ke(), this.vditor.wysiwyg.unbindListener();
|
|
5431
5431
|
}, t.prototype.getCommentIds = function() {
|
|
5432
5432
|
return this.vditor.currentMode !== "wysiwyg" ? [] : this.vditor.wysiwyg.getComments(this.vditor, !0);
|
|
5433
5433
|
}, t.prototype.hlCommentIds = function(n) {
|
|
@@ -5476,9 +5476,9 @@ window.addEventListener("message", (e) => {
|
|
|
5476
5476
|
}
|
|
5477
5477
|
}, t.prototype.init = function(n, i) {
|
|
5478
5478
|
var r = this;
|
|
5479
|
-
this.vditor = { currentMode: i.mode, element: n, hint: new lr(i.hint.extend), lute: void 0, options: i, originalInnerHTML: n.innerHTML, outline: new ur(window.VditorI18n.outline), tip: new
|
|
5479
|
+
this.vditor = { currentMode: i.mode, element: n, hint: new lr(i.hint.extend), lute: void 0, options: i, originalInnerHTML: n.innerHTML, outline: new ur(window.VditorI18n.outline), tip: new On() }, this.vditor.sv = new hr(this.vditor), this.vditor.undo = new di(), this.vditor.wysiwyg = new mi(this.vditor), this.vditor.ir = new cr(this.vditor), this.vditor.toolbar = new li(this.vditor), i.resize.enable && (this.vditor.resize = new fr(this.vditor)), this.vditor.toolbar.elements.devtools && (this.vditor.devtools = new b()), (i.upload.url || i.upload.handler) && (this.vditor.upload = new Yn()), (0, c.G)(i._lutePath || i.cdn + "/dist/js/lute/lute.min.js", "vditorLuteScript").then(function() {
|
|
5480
5480
|
r.vditor.lute = (0, dr.X)({ autoSpace: r.vditor.options.preview.markdown.autoSpace, gfmAutoLink: r.vditor.options.preview.markdown.gfmAutoLink, codeBlockPreview: r.vditor.options.preview.markdown.codeBlockPreview, emojiSite: r.vditor.options.hint.emojiPath, emojis: r.vditor.options.hint.emoji, fixTermTypo: r.vditor.options.preview.markdown.fixTermTypo, footnotes: r.vditor.options.preview.markdown.footnotes, headingAnchor: !1, inlineMathDigit: r.vditor.options.preview.math.inlineDigit, linkBase: r.vditor.options.preview.markdown.linkBase, linkPrefix: r.vditor.options.preview.markdown.linkPrefix, listStyle: r.vditor.options.preview.markdown.listStyle, mark: r.vditor.options.preview.markdown.mark, mathBlockPreview: r.vditor.options.preview.markdown.mathBlockPreview, paragraphBeginningSpace: r.vditor.options.preview.markdown.paragraphBeginningSpace, sanitize: r.vditor.options.preview.markdown.sanitize, toc: r.vditor.options.preview.markdown.toc }), r.vditor.preview = new mr(r.vditor), function(o) {
|
|
5481
|
-
o.element.innerHTML = "", o.element.classList.add("vditor"), o.options.rtl && o.element.setAttribute("dir", "rtl"),
|
|
5481
|
+
o.element.innerHTML = "", o.element.classList.add("vditor"), o.options.rtl && o.element.setAttribute("dir", "rtl"), pe(o), (0, Ne.Z)(o.options.preview.theme.current, o.options.preview.theme.path), typeof o.options.height == "number" ? o.element.style.height = o.options.height + "px" : o.element.style.height = o.options.height, typeof o.options.minHeight == "number" && (o.element.style.minHeight = o.options.minHeight + "px"), typeof o.options.width == "number" ? o.element.style.width = o.options.width + "px" : o.element.style.width = o.options.width, o.element.appendChild(o.toolbar.element);
|
|
5482
5482
|
var a = document.createElement("div");
|
|
5483
5483
|
if (a.className = "vditor-content", o.options.outline.position === "left" && a.appendChild(o.outline.element), a.appendChild(o.wysiwyg.element.parentElement), a.appendChild(o.sv.element), a.appendChild(o.ir.element.parentElement), a.appendChild(o.preview.element), o.toolbar.elements.devtools && a.appendChild(o.devtools.element), o.options.outline.position === "right" && (o.outline.element.classList.add("vditor-outline--right"), a.appendChild(o.outline.element)), o.upload && a.appendChild(o.upload.element), o.options.resize.enable && a.appendChild(o.resize.element), a.appendChild(o.hint.element), a.appendChild(o.tip.element), o.element.appendChild(a), a.addEventListener("click", function() {
|
|
5484
5484
|
E(o, ["subToolbar"]);
|
|
@@ -5498,28 +5498,28 @@ window.addEventListener("message", (e) => {
|
|
|
5498
5498
|
}(L.default);
|
|
5499
5499
|
})(), Se = Se.default;
|
|
5500
5500
|
})());
|
|
5501
|
-
})(
|
|
5502
|
-
var Mi =
|
|
5501
|
+
})(zn);
|
|
5502
|
+
var Mi = zn.exports;
|
|
5503
5503
|
const Ti = /* @__PURE__ */ Ci(Mi);
|
|
5504
|
-
function
|
|
5504
|
+
function Yt(fe) {
|
|
5505
5505
|
let he = fe.srcElement;
|
|
5506
5506
|
he.src = "data:image/webp;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAIAAAD8GO2jAAAAY0lEQVR4Xu2TQQoAIQwD/bw/8I0L/sKTELaW5KAIkpCTnTqnltr6sh8kTnWmxCd9WWEeECCEyT7CKIwFlLGAMucFCGULcaozFlAmFeyqBbTpoe2KBTQW0NwT4LH8ZzMKYwFlBkgVqojTTfZKAAAAAElFTkSuQmCC", he.onerror = null;
|
|
5507
5507
|
}
|
|
5508
5508
|
function Ai(fe) {
|
|
5509
|
-
const he = new Date(fe), ke = he.getFullYear(), be = he.getMonth() + 1,
|
|
5509
|
+
const he = new Date(fe), ke = he.getFullYear(), be = he.getMonth() + 1, J = he.getDate(), Se = /* @__PURE__ */ new Date(), Z = Se.getFullYear(), L = Se.getMonth() + 1, y = Se.getDate();
|
|
5510
5510
|
if (Z === ke && L == be) {
|
|
5511
|
-
const l = y -
|
|
5511
|
+
const l = y - J;
|
|
5512
5512
|
if (l === 0)
|
|
5513
5513
|
return "今天";
|
|
5514
5514
|
if (l < 7)
|
|
5515
5515
|
return l + "天前";
|
|
5516
5516
|
}
|
|
5517
|
-
return Z === ke ? `${be}月${
|
|
5517
|
+
return Z === ke ? `${be}月${J}日` : `${ke}年${be}月${J}日`;
|
|
5518
5518
|
}
|
|
5519
5519
|
const xi = { class: "sus-comment flex flex-row w-full" }, Hi = {
|
|
5520
5520
|
class: "sus-comment-avatar",
|
|
5521
5521
|
title: "输入QQ邮箱自动获取头像"
|
|
5522
|
-
}, Ni = ["src", "onerror"], Di = { class: "sus-comment__main" }, Oi = { class: "sus-comment__info my-1" }, Ii = { class: "sus-comment__info-input" }, ji = { class: "sus-comment__info-input" }, Ri = { class: "sus-comment__info-input" }, Pi = ["id"], qi = /* @__PURE__ */
|
|
5522
|
+
}, Ni = ["src", "onerror"], Di = { class: "sus-comment__main" }, Oi = { class: "sus-comment__info my-1" }, Ii = { class: "sus-comment__info-input" }, ji = { class: "sus-comment__info-input" }, Ri = { class: "sus-comment__info-input" }, Pi = ["id"], qi = /* @__PURE__ */ Ht({
|
|
5523
5523
|
__name: "index",
|
|
5524
5524
|
props: {
|
|
5525
5525
|
vId: { default: "sus-vditor" },
|
|
@@ -5527,7 +5527,7 @@ const xi = { class: "sus-comment flex flex-row w-full" }, Hi = {
|
|
|
5527
5527
|
replyComment: {},
|
|
5528
5528
|
emoji: {}
|
|
5529
5529
|
},
|
|
5530
|
-
emits: ["
|
|
5530
|
+
emits: ["on-save", "on-cancel"],
|
|
5531
5531
|
setup(fe, { emit: he }) {
|
|
5532
5532
|
class ke {
|
|
5533
5533
|
constructor() {
|
|
@@ -5542,11 +5542,11 @@ const xi = { class: "sus-comment flex flex-row w-full" }, Hi = {
|
|
|
5542
5542
|
We(this, "parentId", "");
|
|
5543
5543
|
}
|
|
5544
5544
|
}
|
|
5545
|
-
const be = fe,
|
|
5545
|
+
const be = fe, J = he, Se = be.replyComment.userName, Z = yt("在此处留下你的足迹吧!(支持markdown语法)"), L = yi(new ke()), y = yt(null);
|
|
5546
5546
|
async function l() {
|
|
5547
5547
|
var f, w;
|
|
5548
5548
|
if (!y.value) {
|
|
5549
|
-
|
|
5549
|
+
J("on-save", L);
|
|
5550
5550
|
return;
|
|
5551
5551
|
}
|
|
5552
5552
|
const s = (f = y.value) == null ? void 0 : f.getHTML(), u = (w = y.value) == null ? void 0 : w.getValue();
|
|
@@ -5554,10 +5554,10 @@ const xi = { class: "sus-comment flex flex-row w-full" }, Hi = {
|
|
|
5554
5554
|
const _ = be.replyComment.parentId;
|
|
5555
5555
|
L.parentId = _ === "0" ? be.replyComment.id : _, L.replyName = be.replyComment.userName, Z.value = "@" + Se + ":";
|
|
5556
5556
|
}
|
|
5557
|
-
L.content = s, L.contentMD = u,
|
|
5557
|
+
L.content = s, L.contentMD = u, J("on-save", L), y.value.setValue("");
|
|
5558
5558
|
}
|
|
5559
5559
|
function m() {
|
|
5560
|
-
|
|
5560
|
+
J("on-cancel");
|
|
5561
5561
|
}
|
|
5562
5562
|
function c() {
|
|
5563
5563
|
y.value = new Ti(be.vId, {
|
|
@@ -5586,46 +5586,46 @@ const xi = { class: "sus-comment flex flex-row w-full" }, Hi = {
|
|
|
5586
5586
|
var s;
|
|
5587
5587
|
L.userEmail.trim().endsWith("@qq.com") && (L.userAvatar = "https://thirdqq.qlogo.cn/g?b=sdk&nk=" + ((s = L.userEmail) == null ? void 0 : s.replace("@qq.com", "").trim()) + "&s=140");
|
|
5588
5588
|
}
|
|
5589
|
-
return
|
|
5589
|
+
return Wn(() => {
|
|
5590
5590
|
c();
|
|
5591
5591
|
const s = localStorage.getItem("user");
|
|
5592
5592
|
if (s) {
|
|
5593
5593
|
const u = JSON.parse(s);
|
|
5594
5594
|
L.userName = u.userName, L.userEmail = u.userEmail, L.userWebsite = u.userWebsite, b();
|
|
5595
5595
|
}
|
|
5596
|
-
}), (s, u) => (
|
|
5597
|
-
|
|
5598
|
-
|
|
5596
|
+
}), (s, u) => (qe(), ze("div", xi, [
|
|
5597
|
+
ce("div", Hi, [
|
|
5598
|
+
ce("img", {
|
|
5599
5599
|
src: L.userAvatar,
|
|
5600
5600
|
class: "sus-avatar",
|
|
5601
|
-
onerror:
|
|
5601
|
+
onerror: xt(Yt)
|
|
5602
5602
|
}, null, 8, Ni)
|
|
5603
5603
|
]),
|
|
5604
|
-
|
|
5605
|
-
|
|
5606
|
-
|
|
5607
|
-
|
|
5604
|
+
ce("div", Di, [
|
|
5605
|
+
ce("div", Oi, [
|
|
5606
|
+
ce("div", Ii, [
|
|
5607
|
+
Jt(ce("input", {
|
|
5608
5608
|
class: "sus-input sus-username",
|
|
5609
5609
|
placeholder: "昵称(必填)",
|
|
5610
5610
|
"onUpdate:modelValue": u[0] || (u[0] = (f) => L.userName = f),
|
|
5611
5611
|
maxlength: "23"
|
|
5612
5612
|
}, null, 512), [
|
|
5613
|
-
[
|
|
5613
|
+
[Xt, L.userName]
|
|
5614
5614
|
])
|
|
5615
5615
|
]),
|
|
5616
|
-
|
|
5617
|
-
|
|
5616
|
+
ce("div", ji, [
|
|
5617
|
+
Jt(ce("input", {
|
|
5618
5618
|
class: "sus-input sus-web",
|
|
5619
5619
|
title: "点击昵称时可跳转",
|
|
5620
5620
|
placeholder: "网址",
|
|
5621
5621
|
"onUpdate:modelValue": u[1] || (u[1] = (f) => L.userWebsite = f),
|
|
5622
5622
|
maxlength: "35"
|
|
5623
5623
|
}, null, 512), [
|
|
5624
|
-
[
|
|
5624
|
+
[Xt, L.userWebsite]
|
|
5625
5625
|
])
|
|
5626
5626
|
]),
|
|
5627
|
-
|
|
5628
|
-
|
|
5627
|
+
ce("div", Ri, [
|
|
5628
|
+
Jt(ce("input", {
|
|
5629
5629
|
onBlur: b,
|
|
5630
5630
|
title: "邮箱仅用于通知回复,不会公开",
|
|
5631
5631
|
class: "sus-input sus-email",
|
|
@@ -5633,21 +5633,21 @@ const xi = { class: "sus-comment flex flex-row w-full" }, Hi = {
|
|
|
5633
5633
|
"onUpdate:modelValue": u[2] || (u[2] = (f) => L.userEmail = f),
|
|
5634
5634
|
maxlength: "35"
|
|
5635
5635
|
}, null, 544), [
|
|
5636
|
-
[
|
|
5636
|
+
[Xt, L.userEmail]
|
|
5637
5637
|
])
|
|
5638
5638
|
])
|
|
5639
5639
|
]),
|
|
5640
|
-
|
|
5640
|
+
ce("div", {
|
|
5641
5641
|
id: s.vId,
|
|
5642
5642
|
class: "sus-comment__editor h-full w-full"
|
|
5643
5643
|
}, null, 8, Pi),
|
|
5644
|
-
|
|
5645
|
-
|
|
5646
|
-
|
|
5644
|
+
ce("div", { class: "sus-comment__footer" }, [
|
|
5645
|
+
ce("div", { class: "sus-comment__footer-send flex justify-end my-2" }, [
|
|
5646
|
+
ce("button", {
|
|
5647
5647
|
class: "sus-button cancel mx-2",
|
|
5648
5648
|
onClick: m
|
|
5649
5649
|
}, "取消"),
|
|
5650
|
-
|
|
5650
|
+
ce("button", {
|
|
5651
5651
|
class: "sus-button ok",
|
|
5652
5652
|
onClick: l
|
|
5653
5653
|
}, "发送")
|
|
@@ -5656,68 +5656,73 @@ const xi = { class: "sus-comment flex flex-row w-full" }, Hi = {
|
|
|
5656
5656
|
])
|
|
5657
5657
|
]));
|
|
5658
5658
|
}
|
|
5659
|
-
}),
|
|
5659
|
+
}), Nt = (fe, he) => {
|
|
5660
5660
|
const ke = fe.__vccOpts || fe;
|
|
5661
|
-
for (const [be,
|
|
5662
|
-
ke[be] =
|
|
5661
|
+
for (const [be, J] of he)
|
|
5662
|
+
ke[be] = J;
|
|
5663
5663
|
return ke;
|
|
5664
|
-
}, Bi = /* @__PURE__ */
|
|
5664
|
+
}, Bi = /* @__PURE__ */ Nt(qi, [["__scopeId", "data-v-5bc823b7"]]), Vi = { class: "sus-item__container flex flex-row" }, Ui = { class: "sus-comment-avatar" }, Wi = ["src", "onerror"], zi = { class: "sus-item__main" }, Ki = { class: "sus-item__user leading-loose" }, Fi = ["href"], Gi = { class: "sus-item__user-date ml-5" }, Zi = { class: "sus-item__content" }, $i = {
|
|
5665
5665
|
key: 0,
|
|
5666
5666
|
class: "sus-item__content-name font-semibold"
|
|
5667
|
-
}, Ji = ["innerHTML"], Xi = { class: "sus-item__info" }, Qi = { class: "sus-item__info-ip" }, Yi = /* @__PURE__ */ wi('<svg class="sus-svg equipment" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 16 16" data-v-
|
|
5667
|
+
}, Ji = ["innerHTML"], Xi = { class: "sus-item__info" }, Qi = { class: "sus-item__info-ip" }, Yi = /* @__PURE__ */ wi('<svg class="sus-svg equipment" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 16 16" data-v-3c1f21df><defs data-v-3c1f21df><linearGradient id="a2" x1="50%" x2="50%" y1="0%" y2="100%" data-v-3c1f21df><stop offset="0%" stop-color="#FF6680" data-v-3c1f21df></stop><stop offset="100%" stop-color="#E61739" data-v-3c1f21df></stop></linearGradient><filter id="c2" width="118.8%" height="118.8%" x="-9.4%" y="-9.4%" filterUnits="objectBoundingBox" data-v-3c1f21df><feGaussianBlur in="SourceAlpha" result="shadowBlurInner1" stdDeviation="1" data-v-3c1f21df></feGaussianBlur><feOffset dy="-1" in="shadowBlurInner1" result="shadowOffsetInner1" data-v-3c1f21df></feOffset><feComposite in="shadowOffsetInner1" in2="SourceAlpha" k2="-1" k3="1" operator="arithmetic" result="shadowInnerInner1" data-v-3c1f21df></feComposite><feColorMatrix in="shadowInnerInner1" values="0 0 0 0 0.710144928 0 0 0 0 0 0 0 0 0 0.117780134 0 0 0 0.349786932 0" data-v-3c1f21df></feColorMatrix></filter><path id="b2" d="M8 0a8 8 0 100 16A8 8 0 008 0z" data-v-3c1f21df></path></defs><g fill="none" data-v-3c1f21df><use fill="url(#a2)" xlink:href="#b2" data-v-3c1f21df></use><use fill="black" filter="url(#c2)" xlink:href="#b2" data-v-3c1f21df></use><path fill="white" d="M10.473 4C8.275 4 8 5.824 8 5.824S7.726 4 5.528 4c-2.114 0-2.73 2.222-2.472 3.41C3.736 10.55 8 12.75 8 12.75s4.265-2.2 4.945-5.34c.257-1.188-.36-3.41-2.472-3.41" data-v-3c1f21df></path></g></svg><svg class="sus-svg comment" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="16" height="16" viewBox="0 0 16 16" fill="none" data-v-3c1f21df><g opacity="1" transform="translate(0 0) rotate(0)" data-v-3c1f21df><mask id="bg-comment-mask-0" fill="white" data-v-3c1f21df><use transform="translate(0 0) rotate(0)" xlink:href="#ahzoo_comment_0" data-v-3c1f21df></use></mask><g mask="url(#bg-comment-mask-0)" data-v-3c1f21df><g opacity="1" transform="translate(0 0) rotate(0)" data-v-3c1f21df><path id="ah1" fill-rule="evenodd" fill="url(#comment_linear_0)" opacity="1" d="M0 8C0 12.42 3.58 16 8 16C12.42 16 16 12.42 16 8C16 3.58 12.42 0 8 0C3.58 0 0 3.58 0 8Z" data-v-3c1f21df></path></g><g opacity="1" transform="translate(2 2) rotate(0)" data-v-3c1f21df><mask id="bg-comment-mask-1" fill="white" data-v-3c1f21df><use transform="translate(0 0) rotate(0)" xlink:href="#ahzoo_comment_1" data-v-3c1f21df></use></mask><g mask="url(#bg-comment-mask-1)" data-v-3c1f21df><path id="ahzoo_comment_path_1" fill-rule="evenodd" style="fill:#FFFFFF;" opacity="1" d="M4.65402 2.58221C2.49402 2.58221 0.744019 3.99221 0.744019 5.73221C0.744019 6.45221 1.04402 7.11222 1.55402 7.64221L1.55402 7.65222L1.31402 8.91222C1.29402 9.01221 1.39402 9.09222 1.48402 9.06222L2.69402 8.64222L2.94402 8.55221C3.45402 8.76221 4.04402 8.87222 4.65402 8.87222C6.82402 8.87222 8.57402 7.46221 8.57402 5.73221C8.57402 3.99221 6.82402 2.58221 4.65402 2.58221Z" data-v-3c1f21df></path><path id="ahzoo_comment_path_2" fill-rule="evenodd" style="fill:#FFFFFF;" opacity="1" d="M10.6503 8.36141C11.0303 7.96141 11.2603 7.47141 11.2603 6.93141C11.2603 5.74141 10.3203 4.65141 8.89029 4.51141C9.20029 4.94141 9.19029 5.55141 9.19029 6.08141C9.19029 7.37141 8.16029 8.56141 6.73029 8.97141C7.19029 9.22141 7.75029 9.27141 8.35029 9.27141C8.80029 9.27141 9.24029 9.18141 9.62029 9.03141L9.81029 9.10141L10.7003 9.41141C10.7703 9.44141 10.8503 9.37141 10.8303 9.30141L10.6603 8.37141L10.6503 8.36141Z" data-v-3c1f21df></path></g></g></g></g><defs data-v-3c1f21df><rect id="ahzoo_comment_0" x="0" y="0" width="16" height="16" data-v-3c1f21df></rect><linearGradient id="comment_linear_0" x1="50%" y1="0%" x2="51%" y2="100%" gradientUnits="objectBoundingBox" data-v-3c1f21df><stop offset="0" stop-color="#1AAFFF" stop-opacity="1" data-v-3c1f21df></stop><stop offset="1" stop-color="#0261DE" stop-opacity="1" data-v-3c1f21df></stop></linearGradient><rect id="ahzoo_comment_1" x="0" y="0" width="12" height="12" data-v-3c1f21df></rect></defs></svg>', 2), eo = [
|
|
5668
5668
|
Yi
|
|
5669
|
-
], to = /* @__PURE__ */
|
|
5669
|
+
], to = /* @__PURE__ */ Ht({
|
|
5670
5670
|
__name: "item",
|
|
5671
5671
|
props: {
|
|
5672
5672
|
comment: {}
|
|
5673
5673
|
},
|
|
5674
|
-
emits: ["
|
|
5674
|
+
emits: ["on-reply"],
|
|
5675
5675
|
setup(fe, { emit: he }) {
|
|
5676
|
-
const ke = fe, be = yt(),
|
|
5676
|
+
const ke = fe, be = yt(), J = yt(!1), Se = he;
|
|
5677
5677
|
function Z() {
|
|
5678
|
-
be.value.style.display = "block",
|
|
5678
|
+
be.value.style.display = "block", J.value = !1;
|
|
5679
5679
|
}
|
|
5680
5680
|
function L() {
|
|
5681
|
-
be.value.clientHeight > 110 && (
|
|
5681
|
+
be.value.clientHeight > 110 && (J.value = !0);
|
|
5682
5682
|
}
|
|
5683
5683
|
function y() {
|
|
5684
|
-
Se("
|
|
5684
|
+
Se("on-reply", ke.comment);
|
|
5685
5685
|
}
|
|
5686
|
-
return
|
|
5686
|
+
return Wn(() => {
|
|
5687
5687
|
L();
|
|
5688
|
-
}), (l, m) => (
|
|
5689
|
-
|
|
5690
|
-
|
|
5688
|
+
}), (l, m) => (qe(), ze("div", Vi, [
|
|
5689
|
+
ce("div", Ui, [
|
|
5690
|
+
ce("img", {
|
|
5691
|
+
alt: "",
|
|
5691
5692
|
class: "sus-avatar",
|
|
5693
|
+
loading: "lazy",
|
|
5694
|
+
decoding: "async",
|
|
5692
5695
|
src: l.comment.userAvatar,
|
|
5693
|
-
onerror:
|
|
5696
|
+
onerror: xt(Yt)
|
|
5694
5697
|
}, null, 8, Wi)
|
|
5695
5698
|
]),
|
|
5696
|
-
|
|
5697
|
-
|
|
5698
|
-
|
|
5699
|
+
ce("div", zi, [
|
|
5700
|
+
ce("div", Ki, [
|
|
5701
|
+
ce("a", {
|
|
5702
|
+
target: "_blank",
|
|
5703
|
+
rel: "noreferrer noopener",
|
|
5699
5704
|
href: l.comment.userWebsite,
|
|
5700
5705
|
class: bi(["sus-item__user-name font-semibold ml-1", { master: l.comment.tagName === "博主" }])
|
|
5701
|
-
},
|
|
5702
|
-
|
|
5706
|
+
}, tt(l.comment.userName), 11, Fi),
|
|
5707
|
+
ce("span", Gi, tt(xt(Ai)(l.comment.createdDate)), 1)
|
|
5703
5708
|
]),
|
|
5704
|
-
|
|
5705
|
-
l.comment.replyName ? (
|
|
5706
|
-
|
|
5709
|
+
ce("div", Zi, [
|
|
5710
|
+
l.comment.replyName ? (qe(), ze("span", $i, "@" + tt(l.comment.replyName) + ":", 1)) : nt("", !0),
|
|
5711
|
+
ce("span", {
|
|
5707
5712
|
ref_key: "contentDom",
|
|
5708
5713
|
ref: be,
|
|
5709
5714
|
class: "sus-item__content-text",
|
|
5710
5715
|
innerHTML: l.comment.content
|
|
5711
5716
|
}, null, 8, Ji),
|
|
5712
|
-
|
|
5717
|
+
J.value ? (qe(), ze("a", {
|
|
5713
5718
|
key: 1,
|
|
5714
5719
|
class: "sus-show-detail",
|
|
5715
5720
|
onClick: Z
|
|
5716
|
-
}, "显示更多")) :
|
|
5721
|
+
}, "显示更多")) : nt("", !0)
|
|
5717
5722
|
]),
|
|
5718
|
-
|
|
5719
|
-
|
|
5720
|
-
|
|
5723
|
+
ce("div", Xi, [
|
|
5724
|
+
ce("span", Qi, tt(l.comment.area), 1),
|
|
5725
|
+
ce("span", {
|
|
5721
5726
|
onClick: y,
|
|
5722
5727
|
class: "sus-item__info-reply",
|
|
5723
5728
|
title: "回复"
|
|
@@ -5726,74 +5731,90 @@ const xi = { class: "sus-comment flex flex-row w-full" }, Hi = {
|
|
|
5726
5731
|
])
|
|
5727
5732
|
]));
|
|
5728
5733
|
}
|
|
5729
|
-
}),
|
|
5734
|
+
}), Qt = /* @__PURE__ */ Nt(to, [["__scopeId", "data-v-3c1f21df"]]), no = { class: "sus-comment__item" }, ro = { class: "sus-comment__item-child" }, io = { key: 1 }, oo = { class: "sus-comment__item-footer flex justify-center w-auto" }, ao = /* @__PURE__ */ Ht({
|
|
5730
5735
|
__name: "index",
|
|
5731
5736
|
props: {
|
|
5732
5737
|
comment: {}
|
|
5733
5738
|
},
|
|
5734
|
-
emits: ["
|
|
5739
|
+
emits: ["on-reply"],
|
|
5735
5740
|
setup(fe, { emit: he }) {
|
|
5736
5741
|
const ke = yt(!1), be = he;
|
|
5737
|
-
function
|
|
5738
|
-
be("
|
|
5742
|
+
function J(Se) {
|
|
5743
|
+
be("on-reply", Se);
|
|
5739
5744
|
}
|
|
5740
5745
|
return (Se, Z) => {
|
|
5741
5746
|
var L, y;
|
|
5742
|
-
return
|
|
5743
|
-
Ei(
|
|
5747
|
+
return qe(), ze("div", no, [
|
|
5748
|
+
Ei(Qt, {
|
|
5744
5749
|
comment: Se.comment,
|
|
5745
|
-
onOnReply: Z[0] || (Z[0] = (l) =>
|
|
5750
|
+
onOnReply: Z[0] || (Z[0] = (l) => J(Se.comment))
|
|
5746
5751
|
}, null, 8, ["comment"]),
|
|
5747
|
-
|
|
5748
|
-
((L = Se.comment.child) == null ? void 0 : L.length) > 0 ? (
|
|
5752
|
+
ce("div", ro, [
|
|
5753
|
+
((L = Se.comment.child) == null ? void 0 : L.length) > 0 ? (qe(), Un(Qt, {
|
|
5749
5754
|
key: 0,
|
|
5750
|
-
onOnReply: Z[1] || (Z[1] = (l) =>
|
|
5755
|
+
onOnReply: Z[1] || (Z[1] = (l) => J(Se.comment)),
|
|
5751
5756
|
comment: Se.comment.child[0]
|
|
5752
|
-
}, null, 8, ["comment"])) :
|
|
5753
|
-
ki(" " +
|
|
5754
|
-
((y = Se.comment.child) == null ? void 0 : y.length) > 1 ? (
|
|
5755
|
-
|
|
5756
|
-
ke.value ?
|
|
5757
|
+
}, null, 8, ["comment"])) : nt("", !0),
|
|
5758
|
+
ki(" " + tt(Se.comment.showMore) + " ", 1),
|
|
5759
|
+
((y = Se.comment.child) == null ? void 0 : y.length) > 1 ? (qe(), ze("div", io, [
|
|
5760
|
+
ce("div", oo, [
|
|
5761
|
+
ke.value ? nt("", !0) : (qe(), ze("button", {
|
|
5757
5762
|
key: 0,
|
|
5758
5763
|
class: "sus-load-more",
|
|
5759
5764
|
onClick: Z[2] || (Z[2] = (l) => ke.value = !0)
|
|
5760
5765
|
}, " 查看更多回复 "))
|
|
5761
5766
|
]),
|
|
5762
|
-
ke.value ? (
|
|
5763
|
-
onOnReply: Z[3] || (Z[3] = (c) =>
|
|
5767
|
+
ke.value ? (qe(!0), ze(Si, { key: 0 }, Li(Se.comment.child.slice(1), (l, m) => (qe(), Un(Qt, {
|
|
5768
|
+
onOnReply: Z[3] || (Z[3] = (c) => J(Se.comment)),
|
|
5764
5769
|
key: m,
|
|
5765
5770
|
comment: l
|
|
5766
|
-
}, null, 8, ["comment"]))), 128)) :
|
|
5767
|
-
])) :
|
|
5771
|
+
}, null, 8, ["comment"]))), 128)) : nt("", !0)
|
|
5772
|
+
])) : nt("", !0)
|
|
5768
5773
|
])
|
|
5769
5774
|
]);
|
|
5770
5775
|
};
|
|
5771
5776
|
}
|
|
5772
|
-
}), so = /* @__PURE__ */
|
|
5777
|
+
}), so = /* @__PURE__ */ Nt(ao, [["__scopeId", "data-v-7de7388c"]]), lo = { class: "sus-top-item__user flex items-center" }, co = {
|
|
5778
|
+
key: 0,
|
|
5779
|
+
class: "sus-top-item__user-avatar ml-1 mr-2"
|
|
5780
|
+
}, uo = ["src", "onerror"], po = { class: "sus-top-item__user-owner" }, mo = { class: "sus-top-item__user-reply ml-3 opacity-70" }, fo = ["innerHTML"], ho = /* @__PURE__ */ Ht({
|
|
5773
5781
|
__name: "index",
|
|
5774
5782
|
props: {
|
|
5775
5783
|
comment: {}
|
|
5776
5784
|
},
|
|
5777
|
-
emits: ["
|
|
5785
|
+
emits: ["go-local"],
|
|
5778
5786
|
setup(fe, { emit: he }) {
|
|
5779
5787
|
const ke = he;
|
|
5780
5788
|
function be() {
|
|
5781
|
-
ke("
|
|
5789
|
+
ke("go-local");
|
|
5782
5790
|
}
|
|
5783
|
-
return (
|
|
5784
|
-
class: "sus-top-item
|
|
5791
|
+
return (J, Se) => (qe(), ze("div", {
|
|
5792
|
+
class: "sus-top-item cursor-pointer",
|
|
5785
5793
|
onClick: be
|
|
5786
5794
|
}, [
|
|
5787
|
-
|
|
5788
|
-
|
|
5789
|
-
|
|
5790
|
-
|
|
5791
|
-
|
|
5795
|
+
ce("div", lo, [
|
|
5796
|
+
J.comment.userAvatar ? (qe(), ze("div", co, [
|
|
5797
|
+
ce("img", {
|
|
5798
|
+
alt: "",
|
|
5799
|
+
class: "sus-avatar",
|
|
5800
|
+
loading: "lazy",
|
|
5801
|
+
decoding: "async",
|
|
5802
|
+
src: J.comment.userAvatar,
|
|
5803
|
+
onerror: xt(Yt)
|
|
5804
|
+
}, null, 8, uo)
|
|
5805
|
+
])) : nt("", !0),
|
|
5806
|
+
ce("div", po, tt(J.comment.userName), 1),
|
|
5807
|
+
ce("div", mo, tt(J.comment.replyName ? "@" + J.comment.replyName : ""), 1)
|
|
5808
|
+
]),
|
|
5809
|
+
ce("div", {
|
|
5810
|
+
class: "sus-top-item__content",
|
|
5811
|
+
innerHTML: J.comment.content
|
|
5812
|
+
}, null, 8, fo)
|
|
5792
5813
|
]));
|
|
5793
5814
|
}
|
|
5794
|
-
}),
|
|
5815
|
+
}), vo = /* @__PURE__ */ Nt(ho, [["__scopeId", "data-v-2dfcc9f2"]]), go = [Bi, so, vo], wo = {
|
|
5795
5816
|
install(fe) {
|
|
5796
|
-
|
|
5817
|
+
go.forEach((he) => {
|
|
5797
5818
|
fe.component(he.name, he);
|
|
5798
5819
|
});
|
|
5799
5820
|
}
|
|
@@ -5801,6 +5822,6 @@ const xi = { class: "sus-comment flex flex-row w-full" }, Hi = {
|
|
|
5801
5822
|
export {
|
|
5802
5823
|
Bi as SuSComment,
|
|
5803
5824
|
so as SuSList,
|
|
5804
|
-
|
|
5805
|
-
|
|
5825
|
+
vo as SuSTop,
|
|
5826
|
+
wo as default
|
|
5806
5827
|
};
|