md-editor-v3 3.0.0-beta.4 → 3.0.0-beta.5
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/lib/md-editor-v3.cjs +5 -5
- package/lib/md-editor-v3.mjs +162 -161
- package/lib/md-editor-v3.umd.js +21 -16
- package/lib/style.css +1 -1
- package/package.json +3 -2
package/lib/md-editor-v3.mjs
CHANGED
|
@@ -15,14 +15,15 @@ import _t from "copy-to-clipboard";
|
|
|
15
15
|
import Nt from "markdown-it";
|
|
16
16
|
import Vt from "markdown-it-image-figures";
|
|
17
17
|
import Ut from "markdown-it-task-lists";
|
|
18
|
-
import qt from "
|
|
19
|
-
|
|
18
|
+
import qt from "markdown-it-codetabs";
|
|
19
|
+
import Wt from "lru-cache";
|
|
20
|
+
const s = "md-editor", Gt = "md-editor-v3", Kt = "https://at.alicdn.com/t/c/font_2605852_u82y61ve02.js", L = "https://cdnjs.cloudflare.com/ajax/libs", zt = `${L}/highlight.js/11.7.0/highlight.min.js`, Ge = {
|
|
20
21
|
main: `${L}/prettier/2.8.0/standalone.js`,
|
|
21
22
|
markdown: `${L}/prettier/2.8.0/parser-markdown.js`
|
|
22
23
|
}, Ke = {
|
|
23
24
|
css: `${L}/cropperjs/1.5.13/cropper.min.css`,
|
|
24
25
|
js: `${L}/cropperjs/1.5.13/cropper.min.js`
|
|
25
|
-
},
|
|
26
|
+
}, Xt = `${L}/screenfull.js/5.2.0/screenfull.min.js`, bt = [
|
|
26
27
|
"bold",
|
|
27
28
|
"underline",
|
|
28
29
|
"italic",
|
|
@@ -218,7 +219,7 @@ const s = "md-editor", Wt = "md-editor-v3", Gt = "https://at.alicdn.com/t/c/font
|
|
|
218
219
|
scrollAuto: "Scroll Auto"
|
|
219
220
|
}
|
|
220
221
|
}
|
|
221
|
-
},
|
|
222
|
+
}, Zt = `${L}/mermaid/9.4.0/mermaid.min.js`, Xe = {
|
|
222
223
|
js: `${L}/KaTeX/0.16.3/katex.min.js`,
|
|
223
224
|
css: `${L}/KaTeX/0.16.3/katex.min.css`
|
|
224
225
|
}, Ze = {
|
|
@@ -263,14 +264,14 @@ const s = "md-editor", Wt = "md-editor-v3", Gt = "https://at.alicdn.com/t/c/font
|
|
|
263
264
|
codeMirrorExtensions: (e, l) => l,
|
|
264
265
|
markdownItConfig: () => {
|
|
265
266
|
}
|
|
266
|
-
},
|
|
267
|
+
}, Jt = (e) => {
|
|
267
268
|
if (e)
|
|
268
269
|
for (const l in e) {
|
|
269
270
|
const o = e[l];
|
|
270
271
|
o && (A[l] = o);
|
|
271
272
|
}
|
|
272
273
|
};
|
|
273
|
-
const
|
|
274
|
+
const Yt = /* @__PURE__ */ M({
|
|
274
275
|
setup() {
|
|
275
276
|
return () => i("div", {
|
|
276
277
|
class: `${s}-divider`
|
|
@@ -284,7 +285,7 @@ const Jt = /* @__PURE__ */ M({
|
|
|
284
285
|
const r = (e == null ? void 0 : e.$slots[t]) || (l == null ? void 0 : l.slots[t]);
|
|
285
286
|
return (r ? r(e) : "") || o[t];
|
|
286
287
|
};
|
|
287
|
-
const
|
|
288
|
+
const Qt = {
|
|
288
289
|
trigger: {
|
|
289
290
|
type: String,
|
|
290
291
|
default: "hover"
|
|
@@ -308,7 +309,7 @@ const Yt = {
|
|
|
308
309
|
default: "html"
|
|
309
310
|
}
|
|
310
311
|
}, oe = /* @__PURE__ */ M({
|
|
311
|
-
props:
|
|
312
|
+
props: Qt,
|
|
312
313
|
setup(e, l) {
|
|
313
314
|
const o = `${s}-dropdown-hidden`, t = q({
|
|
314
315
|
overlayClass: [o],
|
|
@@ -363,7 +364,7 @@ const Yt = {
|
|
|
363
364
|
};
|
|
364
365
|
}
|
|
365
366
|
});
|
|
366
|
-
class
|
|
367
|
+
class el {
|
|
367
368
|
constructor() {
|
|
368
369
|
// 事件池
|
|
369
370
|
K(this, "pools", {});
|
|
@@ -394,14 +395,14 @@ class Qt {
|
|
|
394
395
|
});
|
|
395
396
|
}
|
|
396
397
|
}
|
|
397
|
-
const k = new
|
|
398
|
+
const k = new el(), tl = (e, l = {
|
|
398
399
|
newWindow: !0,
|
|
399
400
|
nofollow: !0
|
|
400
401
|
}) => {
|
|
401
402
|
e || console.error("error link!");
|
|
402
403
|
const o = document.createElement("a");
|
|
403
404
|
o.href = e, o.style.display = "none", l.newWindow && (o.target = "_blank"), l.nofollow && (o.rel = "noopener noreferrer"), document.body.appendChild(o), o.click(), document.body.removeChild(o);
|
|
404
|
-
},
|
|
405
|
+
}, ll = (e, l = "image.png") => {
|
|
405
406
|
const o = e.split(","), t = o[0].match(/:(.*?);/);
|
|
406
407
|
if (t) {
|
|
407
408
|
const r = t[1], n = atob(o[1]);
|
|
@@ -412,7 +413,7 @@ const k = new Qt(), el = (e, l = {
|
|
|
412
413
|
return new File([d], l, { type: r });
|
|
413
414
|
}
|
|
414
415
|
return null;
|
|
415
|
-
},
|
|
416
|
+
}, ol = (e) => {
|
|
416
417
|
if (!e)
|
|
417
418
|
return e;
|
|
418
419
|
const l = e.split(`
|
|
@@ -427,7 +428,7 @@ const k = new Qt(), el = (e, l = {
|
|
|
427
428
|
e.apply(void 0, t), o = 0, r("done");
|
|
428
429
|
}, l);
|
|
429
430
|
});
|
|
430
|
-
},
|
|
431
|
+
}, nl = (e, l = 200) => {
|
|
431
432
|
let o = 0, t = null;
|
|
432
433
|
return (...r) => {
|
|
433
434
|
const n = (a) => {
|
|
@@ -435,13 +436,13 @@ const k = new Qt(), el = (e, l = {
|
|
|
435
436
|
};
|
|
436
437
|
t === null && window.requestAnimationFrame(n), t = r;
|
|
437
438
|
};
|
|
438
|
-
},
|
|
439
|
+
}, rl = (e, l) => {
|
|
439
440
|
const o = e == null ? void 0 : e.getBoundingClientRect();
|
|
440
441
|
if (l === document.documentElement)
|
|
441
442
|
return o.top - l.clientTop;
|
|
442
443
|
const t = l == null ? void 0 : l.getBoundingClientRect();
|
|
443
444
|
return o.top - t.top;
|
|
444
|
-
},
|
|
445
|
+
}, il = () => `${Date.now().toString(36)}${Math.random().toString(36).substring(2)}`, al = {
|
|
445
446
|
noPrettier: {
|
|
446
447
|
type: Boolean
|
|
447
448
|
},
|
|
@@ -504,10 +505,10 @@ const k = new Qt(), el = (e, l = {
|
|
|
504
505
|
typeof t == "function" && t.bind(this)(n), e.removeEventListener("load", r);
|
|
505
506
|
};
|
|
506
507
|
o ? l !== "" && (o.addEventListener("load", r), Reflect.get(window, l) && o.dispatchEvent(new Event("load"))) : (e.addEventListener("load", r), document.head.appendChild(e));
|
|
507
|
-
},
|
|
508
|
+
}, sl = ve((e, l, o) => {
|
|
508
509
|
const t = document.getElementById(e);
|
|
509
510
|
t && t.setAttribute(l, o);
|
|
510
|
-
}, 10),
|
|
511
|
+
}, 10), cl = (e) => {
|
|
511
512
|
var m, u, c, f;
|
|
512
513
|
const l = x("editorId");
|
|
513
514
|
let o = (u = (m = A.editorExtensions) == null ? void 0 : m.screenfull) == null ? void 0 : u.instance;
|
|
@@ -530,7 +531,7 @@ const k = new Qt(), el = (e, l = {
|
|
|
530
531
|
return H(() => {
|
|
531
532
|
if (a(), !o) {
|
|
532
533
|
const h = document.createElement("script");
|
|
533
|
-
h.src = t ||
|
|
534
|
+
h.src = t || Xt, h.onload = d, h.id = `${s}-screenfull`, V(h, "screenfull");
|
|
534
535
|
}
|
|
535
536
|
}), H(() => {
|
|
536
537
|
k.on(l, {
|
|
@@ -538,7 +539,7 @@ const k = new Qt(), el = (e, l = {
|
|
|
538
539
|
callback: n
|
|
539
540
|
});
|
|
540
541
|
}), { fullscreenHandler: n };
|
|
541
|
-
},
|
|
542
|
+
}, dl = {
|
|
542
543
|
tableShape: {
|
|
543
544
|
type: Array,
|
|
544
545
|
default: () => [6, 4]
|
|
@@ -548,9 +549,9 @@ const k = new Qt(), el = (e, l = {
|
|
|
548
549
|
default: () => {
|
|
549
550
|
}
|
|
550
551
|
}
|
|
551
|
-
},
|
|
552
|
+
}, ul = /* @__PURE__ */ M({
|
|
552
553
|
name: "TableShape",
|
|
553
|
-
props:
|
|
554
|
+
props: dl,
|
|
554
555
|
setup(e) {
|
|
555
556
|
const l = q({
|
|
556
557
|
x: -1,
|
|
@@ -578,7 +579,7 @@ const k = new Qt(), el = (e, l = {
|
|
|
578
579
|
}, null)]))]))]);
|
|
579
580
|
}
|
|
580
581
|
});
|
|
581
|
-
const
|
|
582
|
+
const ml = {
|
|
582
583
|
title: {
|
|
583
584
|
type: String,
|
|
584
585
|
default: ""
|
|
@@ -617,7 +618,7 @@ const ul = {
|
|
|
617
618
|
type: String
|
|
618
619
|
}
|
|
619
620
|
}, Ae = /* @__PURE__ */ M({
|
|
620
|
-
props:
|
|
621
|
+
props: ml,
|
|
621
622
|
setup(e, l) {
|
|
622
623
|
const o = B(e.visible), t = B([`${s}-modal`]), r = B(), n = B();
|
|
623
624
|
let a = () => {
|
|
@@ -712,7 +713,7 @@ const ul = {
|
|
|
712
713
|
}, null)])])])])]);
|
|
713
714
|
};
|
|
714
715
|
}
|
|
715
|
-
}),
|
|
716
|
+
}), fl = {
|
|
716
717
|
type: {
|
|
717
718
|
type: String,
|
|
718
719
|
default: "link"
|
|
@@ -731,8 +732,8 @@ const ul = {
|
|
|
731
732
|
default: () => {
|
|
732
733
|
}
|
|
733
734
|
}
|
|
734
|
-
},
|
|
735
|
-
props:
|
|
735
|
+
}, gl = /* @__PURE__ */ M({
|
|
736
|
+
props: fl,
|
|
736
737
|
setup(e) {
|
|
737
738
|
const l = x("usedLanguageText"), o = x("editorId"), t = U(() => {
|
|
738
739
|
var n, a;
|
|
@@ -802,7 +803,7 @@ const ul = {
|
|
|
802
803
|
});
|
|
803
804
|
}
|
|
804
805
|
});
|
|
805
|
-
const
|
|
806
|
+
const hl = {
|
|
806
807
|
visible: {
|
|
807
808
|
type: Boolean,
|
|
808
809
|
default: !1
|
|
@@ -817,8 +818,8 @@ const gl = {
|
|
|
817
818
|
default: () => {
|
|
818
819
|
}
|
|
819
820
|
}
|
|
820
|
-
},
|
|
821
|
-
props:
|
|
821
|
+
}, vl = /* @__PURE__ */ M({
|
|
822
|
+
props: hl,
|
|
822
823
|
setup(e) {
|
|
823
824
|
var c, f;
|
|
824
825
|
const l = x("usedLanguageText"), o = x("editorId");
|
|
@@ -929,7 +930,7 @@ const gl = {
|
|
|
929
930
|
onClick: () => {
|
|
930
931
|
if (m) {
|
|
931
932
|
const b = m.getCroppedCanvas();
|
|
932
|
-
k.emit(o, "uploadImage", [
|
|
933
|
+
k.emit(o, "uploadImage", [ll(b.toDataURL("image/png"))], e.onOk), u();
|
|
933
934
|
}
|
|
934
935
|
}
|
|
935
936
|
}, [((p = l.value.clipModalTips) == null ? void 0 : p.buttonUpload) || ((v = l.value.linkModalTips) == null ? void 0 : v.buttonOK)])]), i("input", {
|
|
@@ -945,7 +946,7 @@ const gl = {
|
|
|
945
946
|
});
|
|
946
947
|
};
|
|
947
948
|
}
|
|
948
|
-
}),
|
|
949
|
+
}), pl = {
|
|
949
950
|
type: {
|
|
950
951
|
type: String,
|
|
951
952
|
default: "link"
|
|
@@ -968,27 +969,27 @@ const gl = {
|
|
|
968
969
|
default: () => {
|
|
969
970
|
}
|
|
970
971
|
}
|
|
971
|
-
},
|
|
972
|
-
props:
|
|
972
|
+
}, bl = /* @__PURE__ */ M({
|
|
973
|
+
props: pl,
|
|
973
974
|
setup(e) {
|
|
974
|
-
return () => i(xe, null, [i(
|
|
975
|
+
return () => i(xe, null, [i(gl, {
|
|
975
976
|
type: e.type,
|
|
976
977
|
visible: e.linkVisible,
|
|
977
978
|
onOk: e.onOk,
|
|
978
979
|
onCancel: e.onCancel
|
|
979
|
-
}, null), i(
|
|
980
|
+
}, null), i(vl, {
|
|
980
981
|
visible: e.clipVisible,
|
|
981
982
|
onOk: e.onOk,
|
|
982
983
|
onCancel: e.onCancel
|
|
983
984
|
}, null)]);
|
|
984
985
|
}
|
|
985
|
-
}),
|
|
986
|
+
}), kl = /* @__PURE__ */ M({
|
|
986
987
|
name: "MDEditorToolbar",
|
|
987
|
-
props:
|
|
988
|
+
props: al,
|
|
988
989
|
setup(e) {
|
|
989
990
|
const l = x("editorId"), o = x("usedLanguageText"), {
|
|
990
991
|
fullscreenHandler: t
|
|
991
|
-
} =
|
|
992
|
+
} = cl(e), r = `${l}-toolbar-wrapper`, n = q({
|
|
992
993
|
title: !1,
|
|
993
994
|
catalog: !1,
|
|
994
995
|
// 图片上传下拉
|
|
@@ -1027,7 +1028,7 @@ const gl = {
|
|
|
1027
1028
|
if (bt.includes(p))
|
|
1028
1029
|
switch (p) {
|
|
1029
1030
|
case "-":
|
|
1030
|
-
return i(
|
|
1031
|
+
return i(Yt, null, null);
|
|
1031
1032
|
case "bold":
|
|
1032
1033
|
return i("div", {
|
|
1033
1034
|
class: `${s}-toolbar-item`,
|
|
@@ -1315,7 +1316,7 @@ const gl = {
|
|
|
1315
1316
|
n.table = E;
|
|
1316
1317
|
},
|
|
1317
1318
|
key: "bar-table",
|
|
1318
|
-
overlay: i(
|
|
1319
|
+
overlay: i(ul, {
|
|
1319
1320
|
tableShape: e.tableShape,
|
|
1320
1321
|
onSelected: (E) => {
|
|
1321
1322
|
a("table", {
|
|
@@ -1459,7 +1460,7 @@ const gl = {
|
|
|
1459
1460
|
return i("div", {
|
|
1460
1461
|
class: `${s}-toolbar-item`,
|
|
1461
1462
|
title: (Re = o.value.toolbarTips) == null ? void 0 : Re.github,
|
|
1462
|
-
onClick: () =>
|
|
1463
|
+
onClick: () => tl("https://github.com/imzbf/md-editor-v3")
|
|
1463
1464
|
}, [i("svg", {
|
|
1464
1465
|
class: `${s}-icon`,
|
|
1465
1466
|
"aria-hidden": "true"
|
|
@@ -1596,7 +1597,7 @@ const gl = {
|
|
|
1596
1597
|
style: {
|
|
1597
1598
|
display: "none"
|
|
1598
1599
|
}
|
|
1599
|
-
}, null), i(
|
|
1600
|
+
}, null), i(bl, {
|
|
1600
1601
|
linkVisible: d.linkVisible,
|
|
1601
1602
|
clipVisible: d.clipVisible,
|
|
1602
1603
|
type: d.type,
|
|
@@ -1619,7 +1620,7 @@ const gl = {
|
|
|
1619
1620
|
t = t + n / 5, Math.abs(n) < 1 ? (e.scrollTo(0, l), o && setTimeout(o, 100)) : (e.scrollTo(0, t), requestAnimationFrame(r));
|
|
1620
1621
|
};
|
|
1621
1622
|
r();
|
|
1622
|
-
},
|
|
1623
|
+
}, yl = (e, l) => {
|
|
1623
1624
|
const o = ve(() => {
|
|
1624
1625
|
e.removeEventListener("scroll", t), e.addEventListener("scroll", t), l.removeEventListener("scroll", t), l.addEventListener("scroll", t);
|
|
1625
1626
|
}, 50), t = (r) => {
|
|
@@ -1642,7 +1643,7 @@ const gl = {
|
|
|
1642
1643
|
e.removeEventListener("scroll", t), l.removeEventListener("scroll", t);
|
|
1643
1644
|
}
|
|
1644
1645
|
];
|
|
1645
|
-
},
|
|
1646
|
+
}, Cl = (e, l, o) => {
|
|
1646
1647
|
const { view: t } = o, r = (f) => t.lineBlockAt(t.state.doc.line(f).from).top, n = (f) => t.lineBlockAt(t.state.doc.line(f).from).height;
|
|
1647
1648
|
let a = [];
|
|
1648
1649
|
const d = () => {
|
|
@@ -1740,7 +1741,7 @@ const gl = {
|
|
|
1740
1741
|
a = [], e.removeEventListener("scroll", c), l.removeEventListener("scroll", c);
|
|
1741
1742
|
}
|
|
1742
1743
|
];
|
|
1743
|
-
},
|
|
1744
|
+
}, $l = (e, l, o, t, r) => {
|
|
1744
1745
|
const n = x("previewOnly");
|
|
1745
1746
|
let a = () => {
|
|
1746
1747
|
}, d = () => {
|
|
@@ -1748,7 +1749,7 @@ const gl = {
|
|
|
1748
1749
|
const m = () => {
|
|
1749
1750
|
a();
|
|
1750
1751
|
const u = document.querySelector(".cm-scroller");
|
|
1751
|
-
!n && (o.value || t.value) && ([d, a] = (o.value ?
|
|
1752
|
+
!n && (o.value || t.value) && ([d, a] = (o.value ? Cl : yl)(
|
|
1752
1753
|
u,
|
|
1753
1754
|
o.value || t.value,
|
|
1754
1755
|
r.value
|
|
@@ -1771,7 +1772,7 @@ const gl = {
|
|
|
1771
1772
|
u ? d() : a();
|
|
1772
1773
|
}
|
|
1773
1774
|
), H(m);
|
|
1774
|
-
},
|
|
1775
|
+
}, wl = (e, l, o) => {
|
|
1775
1776
|
var c, f, h, p, v, b;
|
|
1776
1777
|
let t = "", r = 0, n = 0, a = !0, d = !1;
|
|
1777
1778
|
const m = l.getSelectedText(), u = (c = A.editorConfig) == null ? void 0 : c.mermaidTemplate;
|
|
@@ -1804,7 +1805,7 @@ const gl = {
|
|
|
1804
1805
|
break;
|
|
1805
1806
|
}
|
|
1806
1807
|
case "strikeThrough": {
|
|
1807
|
-
t =
|
|
1808
|
+
t = `~~${m}~~`, r = 1, n = -1;
|
|
1808
1809
|
break;
|
|
1809
1810
|
}
|
|
1810
1811
|
case "sub": {
|
|
@@ -1983,7 +1984,7 @@ $$
|
|
|
1983
1984
|
replaceAll: d
|
|
1984
1985
|
}
|
|
1985
1986
|
};
|
|
1986
|
-
},
|
|
1987
|
+
}, Tl = "#e5c07b", ot = "var(--md-color)", Sl = "#56b6c2", xl = "#ffffff", se = "var(--md-color)", nt = "#e5c07b", El = "#e5c07b", Ll = "var(--md-color)", rt = "#d19a66", Al = "#c678dd", Il = "#21252b", it = "#2c313a", at = "#000", ke = "#353a42", Hl = "#ceedfa33", st = "#528bff", Fl = Ee.theme(
|
|
1987
1988
|
{
|
|
1988
1989
|
"&": {
|
|
1989
1990
|
color: se,
|
|
@@ -1993,8 +1994,8 @@ $$
|
|
|
1993
1994
|
caretColor: st
|
|
1994
1995
|
},
|
|
1995
1996
|
".cm-cursor, .cm-dropCursor": { borderLeftColor: st },
|
|
1996
|
-
"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection": { backgroundColor:
|
|
1997
|
-
".cm-panels": { backgroundColor:
|
|
1997
|
+
"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection": { backgroundColor: Hl },
|
|
1998
|
+
".cm-panels": { backgroundColor: Il, color: se },
|
|
1998
1999
|
".cm-panels.cm-panels-top": { borderBottom: "2px solid black" },
|
|
1999
2000
|
".cm-panels.cm-panels-bottom": { borderTop: "2px solid black" },
|
|
2000
2001
|
".cm-searchMatch": {
|
|
@@ -2043,10 +2044,10 @@ $$
|
|
|
2043
2044
|
}
|
|
2044
2045
|
},
|
|
2045
2046
|
{ dark: !0 }
|
|
2046
|
-
),
|
|
2047
|
-
{ tag: g.keyword, color:
|
|
2047
|
+
), Ml = vt.define([
|
|
2048
|
+
{ tag: g.keyword, color: Al },
|
|
2048
2049
|
{ tag: [g.name, g.deleted, g.character, g.propertyName, g.macroName], color: ot },
|
|
2049
|
-
{ tag: [g.function(g.variableName), g.labelName], color:
|
|
2050
|
+
{ tag: [g.function(g.variableName), g.labelName], color: El },
|
|
2050
2051
|
{ tag: [g.color, g.constant(g.name), g.standard(g.name)], color: rt },
|
|
2051
2052
|
{ tag: [g.definition(g.name), g.separator], color: se },
|
|
2052
2053
|
{
|
|
@@ -2060,7 +2061,7 @@ $$
|
|
|
2060
2061
|
g.self,
|
|
2061
2062
|
g.namespace
|
|
2062
2063
|
],
|
|
2063
|
-
color:
|
|
2064
|
+
color: Tl
|
|
2064
2065
|
},
|
|
2065
2066
|
{
|
|
2066
2067
|
tag: [
|
|
@@ -2072,7 +2073,7 @@ $$
|
|
|
2072
2073
|
g.link,
|
|
2073
2074
|
g.special(g.string)
|
|
2074
2075
|
],
|
|
2075
|
-
color:
|
|
2076
|
+
color: Sl
|
|
2076
2077
|
},
|
|
2077
2078
|
{ tag: [g.meta, g.comment], color: nt },
|
|
2078
2079
|
{ tag: g.strong, fontWeight: "bold" },
|
|
@@ -2081,12 +2082,12 @@ $$
|
|
|
2081
2082
|
{ tag: g.link, color: nt, textDecoration: "underline" },
|
|
2082
2083
|
{ tag: g.heading, fontWeight: "bold", color: ot },
|
|
2083
2084
|
{ tag: [g.atom, g.bool, g.special(g.variableName)], color: rt },
|
|
2084
|
-
{ tag: [g.processingInstruction, g.string, g.inserted], color:
|
|
2085
|
-
{ tag: g.invalid, color:
|
|
2086
|
-
]),
|
|
2087
|
-
|
|
2088
|
-
pt(
|
|
2089
|
-
],
|
|
2085
|
+
{ tag: [g.processingInstruction, g.string, g.inserted], color: Ll },
|
|
2086
|
+
{ tag: g.invalid, color: xl }
|
|
2087
|
+
]), Bl = [
|
|
2088
|
+
Fl,
|
|
2089
|
+
pt(Ml)
|
|
2090
|
+
], Rl = "#e5c07b", ct = "#3f4a54", jl = "#56b6c2", Pl = "#fff", ce = "#3f4a54", dt = "#2d8cf0", Dl = "#2d8cf0", Ol = "#3f4a54", ut = "#d19a66", _l = "#c678dd", Nl = "#21252b", mt = "#ceedfa33", ft = "#fff", ye = "#353a42", Vl = "#bad5fa", gt = "#3f4a54", Ul = Ee.theme(
|
|
2090
2091
|
{
|
|
2091
2092
|
"&": {
|
|
2092
2093
|
color: ce,
|
|
@@ -2096,8 +2097,8 @@ $$
|
|
|
2096
2097
|
caretColor: gt
|
|
2097
2098
|
},
|
|
2098
2099
|
".cm-cursor, .cm-dropCursor": { borderLeftColor: gt },
|
|
2099
|
-
"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection": { backgroundColor:
|
|
2100
|
-
".cm-panels": { backgroundColor:
|
|
2100
|
+
"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection": { backgroundColor: Vl },
|
|
2101
|
+
".cm-panels": { backgroundColor: Nl, color: ce },
|
|
2101
2102
|
".cm-panels.cm-panels-top": { borderBottom: "2px solid black" },
|
|
2102
2103
|
".cm-panels.cm-panels-bottom": { borderTop: "2px solid black" },
|
|
2103
2104
|
".cm-searchMatch": {
|
|
@@ -2146,10 +2147,10 @@ $$
|
|
|
2146
2147
|
}
|
|
2147
2148
|
},
|
|
2148
2149
|
{ dark: !0 }
|
|
2149
|
-
),
|
|
2150
|
-
{ tag: g.keyword, color:
|
|
2150
|
+
), ql = vt.define([
|
|
2151
|
+
{ tag: g.keyword, color: _l },
|
|
2151
2152
|
{ tag: [g.name, g.deleted, g.character, g.propertyName, g.macroName], color: ct },
|
|
2152
|
-
{ tag: [g.function(g.variableName), g.labelName], color:
|
|
2153
|
+
{ tag: [g.function(g.variableName), g.labelName], color: Dl },
|
|
2153
2154
|
{ tag: [g.color, g.constant(g.name), g.standard(g.name)], color: ut },
|
|
2154
2155
|
{ tag: [g.definition(g.name), g.separator], color: ce },
|
|
2155
2156
|
{
|
|
@@ -2163,7 +2164,7 @@ $$
|
|
|
2163
2164
|
g.self,
|
|
2164
2165
|
g.namespace
|
|
2165
2166
|
],
|
|
2166
|
-
color:
|
|
2167
|
+
color: Rl
|
|
2167
2168
|
},
|
|
2168
2169
|
{
|
|
2169
2170
|
tag: [
|
|
@@ -2175,7 +2176,7 @@ $$
|
|
|
2175
2176
|
g.link,
|
|
2176
2177
|
g.special(g.string)
|
|
2177
2178
|
],
|
|
2178
|
-
color:
|
|
2179
|
+
color: jl
|
|
2179
2180
|
},
|
|
2180
2181
|
{ tag: [g.meta, g.comment], color: dt },
|
|
2181
2182
|
{ tag: g.strong, fontWeight: "bold" },
|
|
@@ -2184,18 +2185,18 @@ $$
|
|
|
2184
2185
|
{ tag: g.link, color: dt, textDecoration: "underline" },
|
|
2185
2186
|
{ tag: g.heading, fontWeight: "bold", color: ct },
|
|
2186
2187
|
{ tag: [g.atom, g.bool, g.special(g.variableName)], color: ut },
|
|
2187
|
-
{ tag: [g.processingInstruction, g.string, g.inserted], color:
|
|
2188
|
-
{ tag: g.invalid, color:
|
|
2189
|
-
]),
|
|
2190
|
-
|
|
2191
|
-
pt(
|
|
2188
|
+
{ tag: [g.processingInstruction, g.string, g.inserted], color: Ol },
|
|
2189
|
+
{ tag: g.invalid, color: Pl }
|
|
2190
|
+
]), Wl = [
|
|
2191
|
+
Ul,
|
|
2192
|
+
pt(ql)
|
|
2192
2193
|
], le = (e) => {
|
|
2193
2194
|
const l = new Lt();
|
|
2194
2195
|
return (t) => (l.get(e.state) ? e.dispatch({ effects: l.reconfigure(t) }) : e.dispatch({
|
|
2195
2196
|
effects: At.appendConfig.of(l.of(t))
|
|
2196
2197
|
}), !0);
|
|
2197
2198
|
};
|
|
2198
|
-
class
|
|
2199
|
+
class Gl {
|
|
2199
2200
|
constructor(l) {
|
|
2200
2201
|
K(this, "view");
|
|
2201
2202
|
// 切换tabSize的执行方法。切换时,Compartment实例需要相同
|
|
@@ -2304,7 +2305,7 @@ class Wl {
|
|
|
2304
2305
|
]);
|
|
2305
2306
|
}
|
|
2306
2307
|
}
|
|
2307
|
-
const
|
|
2308
|
+
const Kl = (e) => {
|
|
2308
2309
|
const l = x("editorId");
|
|
2309
2310
|
return (t) => {
|
|
2310
2311
|
if (t.clipboardData) {
|
|
@@ -2325,7 +2326,7 @@ const Gl = (e) => {
|
|
|
2325
2326
|
}
|
|
2326
2327
|
}
|
|
2327
2328
|
};
|
|
2328
|
-
},
|
|
2329
|
+
}, zl = (e) => {
|
|
2329
2330
|
const l = x("editorId");
|
|
2330
2331
|
H(() => {
|
|
2331
2332
|
k.on(l, {
|
|
@@ -2336,7 +2337,7 @@ const Gl = (e) => {
|
|
|
2336
2337
|
}
|
|
2337
2338
|
});
|
|
2338
2339
|
});
|
|
2339
|
-
},
|
|
2340
|
+
}, Xl = (e, l) => [
|
|
2340
2341
|
{
|
|
2341
2342
|
key: "Ctrl-b",
|
|
2342
2343
|
mac: "Cmd-b",
|
|
@@ -2432,8 +2433,8 @@ const Gl = (e) => {
|
|
|
2432
2433
|
{
|
|
2433
2434
|
any: (I, w) => (w.ctrlKey || w.metaKey) && w.altKey && w.shiftKey && w.code === "KeyT" ? (k.emit(e, "replace", "table"), !0) : !1
|
|
2434
2435
|
}
|
|
2435
|
-
],
|
|
2436
|
-
const l = x("tabWidth"), o = x("editorId"), t = x("theme"), r = B(), n = de(), a =
|
|
2436
|
+
], Zl = (e) => {
|
|
2437
|
+
const l = x("tabWidth"), o = x("editorId"), t = x("theme"), r = B(), n = de(), a = Xl(o, e), d = Kl(e), m = [
|
|
2437
2438
|
Ht.of([...a, Rt]),
|
|
2438
2439
|
Et,
|
|
2439
2440
|
Mt({ codeLanguages: Ft }),
|
|
@@ -2449,11 +2450,11 @@ const Gl = (e) => {
|
|
|
2449
2450
|
})
|
|
2450
2451
|
], u = () => t.value === "light" ? A.codeMirrorExtensions(
|
|
2451
2452
|
t.value,
|
|
2452
|
-
[...m,
|
|
2453
|
+
[...m, Wl],
|
|
2453
2454
|
a
|
|
2454
2455
|
) : A.codeMirrorExtensions(
|
|
2455
2456
|
t.value,
|
|
2456
|
-
[...m,
|
|
2457
|
+
[...m, Bl],
|
|
2457
2458
|
a
|
|
2458
2459
|
);
|
|
2459
2460
|
return H(() => {
|
|
@@ -2463,7 +2464,7 @@ const Gl = (e) => {
|
|
|
2463
2464
|
state: c,
|
|
2464
2465
|
parent: r.value
|
|
2465
2466
|
});
|
|
2466
|
-
n.value = new
|
|
2467
|
+
n.value = new Gl(f), n.value.setTabSize(l), n.value.setExtensions(u()), n.value.setPlaceholder(e.placeholder), n.value.setDisabled(e.disabled), n.value.setReadOnly(e.readonly), e.autofocus && f.focus(), e.maxlength && n.value.setMaxLength(e.maxlength), k.on(o, {
|
|
2467
2468
|
name: "ctrlZ",
|
|
2468
2469
|
callback() {
|
|
2469
2470
|
jt(f);
|
|
@@ -2477,7 +2478,7 @@ const Gl = (e) => {
|
|
|
2477
2478
|
name: "replace",
|
|
2478
2479
|
callback(h, p = {}) {
|
|
2479
2480
|
var y;
|
|
2480
|
-
const { text: v, options: b } =
|
|
2481
|
+
const { text: v, options: b } = wl(h, n.value, p);
|
|
2481
2482
|
(y = n.value) == null || y.replaceSelectedText(v, b);
|
|
2482
2483
|
}
|
|
2483
2484
|
});
|
|
@@ -2517,11 +2518,11 @@ const Gl = (e) => {
|
|
|
2517
2518
|
var c;
|
|
2518
2519
|
e.maxlength && ((c = n.value) == null || c.setMaxLength(e.maxlength));
|
|
2519
2520
|
}
|
|
2520
|
-
),
|
|
2521
|
+
), zl(n), {
|
|
2521
2522
|
inputWrapperRef: r,
|
|
2522
2523
|
codeMirrorUt: n
|
|
2523
2524
|
};
|
|
2524
|
-
},
|
|
2525
|
+
}, Jl = (e, l) => {
|
|
2525
2526
|
const o = x("editorId"), t = ve(() => {
|
|
2526
2527
|
const r = document.querySelectorAll(`#${o}-preview img`);
|
|
2527
2528
|
r.length !== 0 && Ot(r, {
|
|
@@ -2529,7 +2530,7 @@ const Gl = (e) => {
|
|
|
2529
2530
|
});
|
|
2530
2531
|
});
|
|
2531
2532
|
H(t), S([l, ne(e.setting, "preview")], t);
|
|
2532
|
-
},
|
|
2533
|
+
}, Yl = (e, l) => {
|
|
2533
2534
|
const o = x("editorId"), t = x("usedLanguageText"), r = () => {
|
|
2534
2535
|
document.querySelectorAll(`#${o}-preview pre`).forEach((d) => {
|
|
2535
2536
|
var f, h;
|
|
@@ -2551,7 +2552,7 @@ const Gl = (e) => {
|
|
|
2551
2552
|
d && Y(r);
|
|
2552
2553
|
};
|
|
2553
2554
|
S(() => l.value, n), S(() => e.setting.preview, a), S(() => e.setting.htmlPreview, a), S(() => t.value, r), H(r);
|
|
2554
|
-
},
|
|
2555
|
+
}, Ql = (e) => {
|
|
2555
2556
|
var n;
|
|
2556
2557
|
const l = (n = A.editorExtensions) == null ? void 0 : n.highlight, o = l == null ? void 0 : l.instance, t = x("highlight"), r = de(o);
|
|
2557
2558
|
return H(() => {
|
|
@@ -2568,11 +2569,11 @@ const Gl = (e) => {
|
|
|
2568
2569
|
}), S(
|
|
2569
2570
|
() => t.value.css,
|
|
2570
2571
|
(a) => {
|
|
2571
|
-
|
|
2572
|
+
sl(`${s}-hlCss`, "href", a);
|
|
2572
2573
|
}
|
|
2573
2574
|
), r;
|
|
2574
|
-
},
|
|
2575
|
-
const l = x("theme"), { editorExtensions: o } = A, t = o == null ? void 0 : o.mermaid, r = de(t == null ? void 0 : t.instance), n = de(!1), a = new
|
|
2575
|
+
}, eo = (e) => {
|
|
2576
|
+
const l = x("theme"), { editorExtensions: o } = A, t = o == null ? void 0 : o.mermaid, r = de(t == null ? void 0 : t.instance), n = de(!1), a = new Wt({
|
|
2576
2577
|
max: 1e3,
|
|
2577
2578
|
// 缓存10分钟
|
|
2578
2579
|
ttl: 6e5
|
|
@@ -2592,7 +2593,7 @@ const Gl = (e) => {
|
|
|
2592
2593
|
if (!e.noMermaid && !(t != null && t.instance)) {
|
|
2593
2594
|
const u = document.createElement("script");
|
|
2594
2595
|
u.id = `${s}-mermaid`;
|
|
2595
|
-
const c = (t == null ? void 0 : t.js) ||
|
|
2596
|
+
const c = (t == null ? void 0 : t.js) || Zt;
|
|
2596
2597
|
/\.mjs/.test(c) ? (u.setAttribute("type", "module"), u.innerHTML = `import mermaid from "${c}";window.mermaid=mermaid;document.getElementById('${s}-mermaid').dispatchEvent(new Event('load'));`) : u.src = c, u.onload = () => {
|
|
2597
2598
|
r.value = window.mermaid, d();
|
|
2598
2599
|
}, V(u, "mermaid");
|
|
@@ -2604,7 +2605,7 @@ const Gl = (e) => {
|
|
|
2604
2605
|
).forEach(async (c) => {
|
|
2605
2606
|
let f = a.get(c.innerText);
|
|
2606
2607
|
if (!f) {
|
|
2607
|
-
const p =
|
|
2608
|
+
const p = il(), b = await (r.value.renderAsync || r.value.render)(p, c.innerText);
|
|
2608
2609
|
f = typeof b == "string" ? b : b.svg, a.set(c.innerText, f);
|
|
2609
2610
|
}
|
|
2610
2611
|
const h = document.createElement("p");
|
|
@@ -2612,7 +2613,7 @@ const Gl = (e) => {
|
|
|
2612
2613
|
});
|
|
2613
2614
|
});
|
|
2614
2615
|
} };
|
|
2615
|
-
},
|
|
2616
|
+
}, to = (e) => {
|
|
2616
2617
|
var r;
|
|
2617
2618
|
const l = (r = A.editorExtensions) == null ? void 0 : r.katex, o = l == null ? void 0 : l.instance, t = de(o);
|
|
2618
2619
|
return H(() => {
|
|
@@ -2625,7 +2626,7 @@ const Gl = (e) => {
|
|
|
2625
2626
|
a.rel = "stylesheet", a.href = (l == null ? void 0 : l.css) || Xe.css, a.id = `${s}-katexCss`, V(n, "katex"), V(a);
|
|
2626
2627
|
}
|
|
2627
2628
|
}), t;
|
|
2628
|
-
},
|
|
2629
|
+
}, lo = (e, l) => {
|
|
2629
2630
|
const o = e.renderer.rules.fence.bind(e.renderer.rules);
|
|
2630
2631
|
e.renderer.rules.fence = (t, r, n, a, d) => {
|
|
2631
2632
|
const m = t[r], u = m.content.trim();
|
|
@@ -2642,7 +2643,7 @@ const Gl = (e) => {
|
|
|
2642
2643
|
can_open: o,
|
|
2643
2644
|
can_close: t
|
|
2644
2645
|
};
|
|
2645
|
-
},
|
|
2646
|
+
}, oo = (e, l) => {
|
|
2646
2647
|
let o, t, r, n;
|
|
2647
2648
|
if (e.src[e.pos] !== "$")
|
|
2648
2649
|
return !1;
|
|
@@ -2657,7 +2658,7 @@ const Gl = (e) => {
|
|
|
2657
2658
|
o += 1;
|
|
2658
2659
|
}
|
|
2659
2660
|
return o === -1 ? (l || (e.pending += "$"), e.pos = a, !0) : o - a === 0 ? (l || (e.pending += "$$"), e.pos = a + 1, !0) : (r = ht(e, o), r.can_close ? (l || (t = e.push("math_inline", "math", 0), t.markup = "$", t.content = e.src.slice(a, o)), e.pos = o + 1, !0) : (l || (e.pending += "$"), e.pos = a, !0));
|
|
2660
|
-
},
|
|
2661
|
+
}, no = (e, l, o, t) => {
|
|
2661
2662
|
let r, n, a, d, m = !1, u = e.bMarks[l] + e.tShift[l], c = e.eMarks[l];
|
|
2662
2663
|
if (u + 2 > c || e.src.slice(u, u + 2) !== "$$")
|
|
2663
2664
|
return !1;
|
|
@@ -2669,7 +2670,7 @@ const Gl = (e) => {
|
|
|
2669
2670
|
const f = e.push("math_block", "math", 0);
|
|
2670
2671
|
return f.block = !0, f.content = (r && r.trim() ? r + `
|
|
2671
2672
|
` : "") + e.getLines(l + 1, a, e.tShift[l], !0) + (n && n.trim() ? n : ""), f.map = [l, e.line], f.markup = "$$", !0;
|
|
2672
|
-
},
|
|
2673
|
+
}, ro = (e, l) => {
|
|
2673
2674
|
const o = (r) => {
|
|
2674
2675
|
if (l.katexRef.value) {
|
|
2675
2676
|
const n = l.katexRef.value.renderToString(r, {
|
|
@@ -2688,11 +2689,11 @@ const Gl = (e) => {
|
|
|
2688
2689
|
} else
|
|
2689
2690
|
return `<p class="${s}-katex-block" data-line=${n}>${r}</p>`;
|
|
2690
2691
|
};
|
|
2691
|
-
e.inline.ruler.after("escape", "math_inline",
|
|
2692
|
+
e.inline.ruler.after("escape", "math_inline", oo), e.block.ruler.after("blockquote", "math_block", no, {
|
|
2692
2693
|
alt: ["paragraph", "reference", "blockquote", "list"]
|
|
2693
2694
|
}), e.renderer.rules.math_inline = (r, n) => o(r[n].content), e.renderer.rules.math_block = (r, n) => t(r[n].content, r[n].map[0]) + `
|
|
2694
2695
|
`;
|
|
2695
|
-
},
|
|
2696
|
+
}, io = (e, l) => {
|
|
2696
2697
|
l = l || {};
|
|
2697
2698
|
const o = 3, t = l.marker || "!", r = t.charCodeAt(0), n = t.length;
|
|
2698
2699
|
let a = "", d = "";
|
|
@@ -2738,7 +2739,7 @@ const Gl = (e) => {
|
|
|
2738
2739
|
alt: ["paragraph", "reference", "blockquote", "list"]
|
|
2739
2740
|
}
|
|
2740
2741
|
), e.renderer.rules.admonition_open = m, e.renderer.rules.admonition_title_open = m, e.renderer.rules.admonition_title_close = m, e.renderer.rules.admonition_close = m;
|
|
2741
|
-
},
|
|
2742
|
+
}, ao = (e, l) => {
|
|
2742
2743
|
let o;
|
|
2743
2744
|
e.core.ruler.push("headingLinks", (t) => {
|
|
2744
2745
|
o || (o = t.Token);
|
|
@@ -2752,7 +2753,7 @@ const Gl = (e) => {
|
|
|
2752
2753
|
l.mdHeadingId(a, d, l.headsRef.value.length)
|
|
2753
2754
|
)), e.renderer.renderToken(t, r, l);
|
|
2754
2755
|
}, e.renderer.rules.heading_close = (t, r, n, a, d) => d.renderToken(t, r, n);
|
|
2755
|
-
},
|
|
2756
|
+
}, so = (e) => {
|
|
2756
2757
|
[
|
|
2757
2758
|
"paragraph_open",
|
|
2758
2759
|
"table_open",
|
|
@@ -2773,22 +2774,22 @@ const Gl = (e) => {
|
|
|
2773
2774
|
return t[r].map && t[r].level === 0 ? (m = t[r].map[0], u.replace(/^(<[^>]*)/, `$1 data-line="${m}"`)) : u;
|
|
2774
2775
|
};
|
|
2775
2776
|
});
|
|
2776
|
-
},
|
|
2777
|
-
const { editorConfig: l, markdownItConfig: o } = A, t = x("editorId"), r = x("showCodeRowNumber"), n = x("previewOnly"), a = x("theme"), d = B([]), m =
|
|
2777
|
+
}, co = (e) => {
|
|
2778
|
+
const { editorConfig: l, markdownItConfig: o } = A, t = x("editorId"), r = x("showCodeRowNumber"), n = x("previewOnly"), a = x("theme"), d = B([]), m = Ql(e), u = to(e), { reRenderRef: c, replaceMermaid: f } = eo(e), h = Nt({
|
|
2778
2779
|
html: !0,
|
|
2779
2780
|
breaks: !0
|
|
2780
2781
|
});
|
|
2781
|
-
h.use(
|
|
2782
|
+
h.use(ro, { katexRef: u }), h.use(Vt, { figcaption: !0 }), h.use(io), h.use(Ut), h.use(ao, { mdHeadingId: e.mdHeadingId, headsRef: d }), h.use(qt), e.noMermaid || h.use(lo, { themeRef: a }), h.set({
|
|
2782
2783
|
highlight: (y, C) => {
|
|
2783
2784
|
let $;
|
|
2784
2785
|
!e.noHighlight && m.value ? m.value.getLanguage(C) ? $ = m.value.highlight(y, {
|
|
2785
2786
|
language: C,
|
|
2786
2787
|
ignoreIllegals: !0
|
|
2787
2788
|
}).value : $ = m.value.highlightAuto(y).value : $ = h.utils.escapeHtml(y);
|
|
2788
|
-
const T = r ?
|
|
2789
|
+
const T = r ? ol($.trim()) : `<span class="code-block">${$.trim()}</span>`;
|
|
2789
2790
|
return `<pre><code class="language-${C}" language=${C}>${T}</code></pre>`;
|
|
2790
2791
|
}
|
|
2791
|
-
}),
|
|
2792
|
+
}), so(h), o(h);
|
|
2792
2793
|
const p = B(e.sanitize(h.render(e.value))), v = ve(
|
|
2793
2794
|
async () => {
|
|
2794
2795
|
d.value = [], p.value = e.sanitize(h.render(e.value)), k.emit(t, "buildFinished", p.value), e.onHtmlChanged(p.value), f();
|
|
@@ -2808,7 +2809,7 @@ const Gl = (e) => {
|
|
|
2808
2809
|
}
|
|
2809
2810
|
});
|
|
2810
2811
|
}), { html: p };
|
|
2811
|
-
},
|
|
2812
|
+
}, uo = {
|
|
2812
2813
|
value: {
|
|
2813
2814
|
type: String,
|
|
2814
2815
|
default: ""
|
|
@@ -2898,17 +2899,17 @@ const Gl = (e) => {
|
|
|
2898
2899
|
type: Boolean,
|
|
2899
2900
|
default: !1
|
|
2900
2901
|
}
|
|
2901
|
-
},
|
|
2902
|
+
}, mo = /* @__PURE__ */ M({
|
|
2902
2903
|
name: "MDEditorContent",
|
|
2903
|
-
props:
|
|
2904
|
+
props: uo,
|
|
2904
2905
|
setup(e) {
|
|
2905
2906
|
const l = x("previewOnly"), o = x("showCodeRowNumber"), t = x("previewTheme"), r = x("editorId"), n = B(), a = B(), {
|
|
2906
2907
|
inputWrapperRef: d,
|
|
2907
2908
|
codeMirrorUt: m
|
|
2908
|
-
} =
|
|
2909
|
+
} = Zl(e), {
|
|
2909
2910
|
html: u
|
|
2910
|
-
} =
|
|
2911
|
-
return
|
|
2911
|
+
} = co(e);
|
|
2912
|
+
return $l(e, u, n, a, m), Yl(e, u), Jl(e, u), () => i("div", {
|
|
2912
2913
|
class: `${s}-content`
|
|
2913
2914
|
}, [!l && i("div", {
|
|
2914
2915
|
class: `${s}-input-wrapper`,
|
|
@@ -2930,7 +2931,7 @@ const Gl = (e) => {
|
|
|
2930
2931
|
class: `${s}-html`
|
|
2931
2932
|
}, [u.value])])]);
|
|
2932
2933
|
}
|
|
2933
|
-
}),
|
|
2934
|
+
}), fo = /* @__PURE__ */ M({
|
|
2934
2935
|
props: {
|
|
2935
2936
|
modelValue: {
|
|
2936
2937
|
type: String,
|
|
@@ -2949,7 +2950,7 @@ const Gl = (e) => {
|
|
|
2949
2950
|
};
|
|
2950
2951
|
}
|
|
2951
2952
|
});
|
|
2952
|
-
const
|
|
2953
|
+
const go = {
|
|
2953
2954
|
checked: {
|
|
2954
2955
|
type: Boolean,
|
|
2955
2956
|
default: !1
|
|
@@ -2959,8 +2960,8 @@ const fo = {
|
|
|
2959
2960
|
default: () => {
|
|
2960
2961
|
}
|
|
2961
2962
|
}
|
|
2962
|
-
},
|
|
2963
|
-
props:
|
|
2963
|
+
}, ho = /* @__PURE__ */ M({
|
|
2964
|
+
props: go,
|
|
2964
2965
|
setup(e) {
|
|
2965
2966
|
return () => i("div", {
|
|
2966
2967
|
class: [`${s}-checkbox`, e.checked && `${s}-checkbox-checked`],
|
|
@@ -2969,7 +2970,7 @@ const fo = {
|
|
|
2969
2970
|
}
|
|
2970
2971
|
}, null);
|
|
2971
2972
|
}
|
|
2972
|
-
}),
|
|
2973
|
+
}), vo = {
|
|
2973
2974
|
scrollAuto: {
|
|
2974
2975
|
type: Boolean
|
|
2975
2976
|
},
|
|
@@ -2978,8 +2979,8 @@ const fo = {
|
|
|
2978
2979
|
default: () => {
|
|
2979
2980
|
}
|
|
2980
2981
|
}
|
|
2981
|
-
},
|
|
2982
|
-
props:
|
|
2982
|
+
}, po = /* @__PURE__ */ M({
|
|
2983
|
+
props: vo,
|
|
2983
2984
|
setup(e) {
|
|
2984
2985
|
const l = x("usedLanguageText");
|
|
2985
2986
|
return () => {
|
|
@@ -2991,13 +2992,13 @@ const fo = {
|
|
|
2991
2992
|
onClick: () => {
|
|
2992
2993
|
e.onScrollAutoChange(!e.scrollAuto);
|
|
2993
2994
|
}
|
|
2994
|
-
}, [(o = l.value.footer) == null ? void 0 : o.scrollAuto]), i(
|
|
2995
|
+
}, [(o = l.value.footer) == null ? void 0 : o.scrollAuto]), i(ho, {
|
|
2995
2996
|
checked: e.scrollAuto,
|
|
2996
2997
|
onChange: e.onScrollAutoChange
|
|
2997
2998
|
}, null)]);
|
|
2998
2999
|
};
|
|
2999
3000
|
}
|
|
3000
|
-
}),
|
|
3001
|
+
}), bo = {
|
|
3001
3002
|
modelValue: {
|
|
3002
3003
|
type: String,
|
|
3003
3004
|
default: ""
|
|
@@ -3017,9 +3018,9 @@ const fo = {
|
|
|
3017
3018
|
defFooters: {
|
|
3018
3019
|
type: Object
|
|
3019
3020
|
}
|
|
3020
|
-
},
|
|
3021
|
+
}, ko = /* @__PURE__ */ M({
|
|
3021
3022
|
name: "MDEditorFooter",
|
|
3022
|
-
props:
|
|
3023
|
+
props: bo,
|
|
3023
3024
|
setup(e) {
|
|
3024
3025
|
const l = U(() => {
|
|
3025
3026
|
const t = e.footers.indexOf("="), r = t === -1 ? e.footers : e.footers.slice(0, t), n = t === -1 ? [] : e.footers.slice(t, Number.MAX_SAFE_INTEGER);
|
|
@@ -3028,11 +3029,11 @@ const fo = {
|
|
|
3028
3029
|
if (kt.includes(t))
|
|
3029
3030
|
switch (t) {
|
|
3030
3031
|
case "markdownTotal":
|
|
3031
|
-
return i(
|
|
3032
|
+
return i(fo, {
|
|
3032
3033
|
modelValue: e.modelValue
|
|
3033
3034
|
}, null);
|
|
3034
3035
|
case "scrollSwitch":
|
|
3035
|
-
return i(
|
|
3036
|
+
return i(po, {
|
|
3036
3037
|
scrollAuto: e.scrollAuto,
|
|
3037
3038
|
onScrollAutoChange: e.onScrollAutoChange
|
|
3038
3039
|
}, null);
|
|
@@ -3051,7 +3052,7 @@ const fo = {
|
|
|
3051
3052
|
}, [r])]);
|
|
3052
3053
|
};
|
|
3053
3054
|
}
|
|
3054
|
-
}),
|
|
3055
|
+
}), yo = {
|
|
3055
3056
|
tocItem: {
|
|
3056
3057
|
type: Object,
|
|
3057
3058
|
default: () => ({})
|
|
@@ -3075,7 +3076,7 @@ const fo = {
|
|
|
3075
3076
|
default: 0
|
|
3076
3077
|
}
|
|
3077
3078
|
}, $t = /* @__PURE__ */ M({
|
|
3078
|
-
props:
|
|
3079
|
+
props: yo,
|
|
3079
3080
|
setup(e) {
|
|
3080
3081
|
return () => {
|
|
3081
3082
|
const {
|
|
@@ -3116,7 +3117,7 @@ const fo = {
|
|
|
3116
3117
|
};
|
|
3117
3118
|
}
|
|
3118
3119
|
});
|
|
3119
|
-
const
|
|
3120
|
+
const Co = {
|
|
3120
3121
|
/**
|
|
3121
3122
|
* 编辑器的Id,务必与需要绑定的编辑器Id相同
|
|
3122
3123
|
*/
|
|
@@ -3167,7 +3168,7 @@ const yo = {
|
|
|
3167
3168
|
}
|
|
3168
3169
|
}, he = /* @__PURE__ */ M({
|
|
3169
3170
|
name: "MdCatalog",
|
|
3170
|
-
props:
|
|
3171
|
+
props: Co,
|
|
3171
3172
|
emits: ["onClick"],
|
|
3172
3173
|
setup(e, l) {
|
|
3173
3174
|
const o = e.editorId, t = q({
|
|
@@ -3226,7 +3227,7 @@ const yo = {
|
|
|
3226
3227
|
const n = () => {
|
|
3227
3228
|
var d;
|
|
3228
3229
|
const a = t.scrollElement instanceof HTMLElement ? t.scrollElement : document.querySelector(t.scrollElement);
|
|
3229
|
-
(d = a === document.documentElement ? window : a) == null || d.addEventListener("scroll",
|
|
3230
|
+
(d = a === document.documentElement ? window : a) == null || d.addEventListener("scroll", nl(() => {
|
|
3230
3231
|
if (t.list.length === 0)
|
|
3231
3232
|
return !1;
|
|
3232
3233
|
const {
|
|
@@ -3234,7 +3235,7 @@ const yo = {
|
|
|
3234
3235
|
} = t.list.reduce((u, c, f) => {
|
|
3235
3236
|
const h = document.getElementById(e.mdHeadingId(c.text, c.level, f + 1));
|
|
3236
3237
|
if (h instanceof HTMLElement) {
|
|
3237
|
-
const p =
|
|
3238
|
+
const p = rl(h, a);
|
|
3238
3239
|
if (p < e.offsetTop && p > u.minTop)
|
|
3239
3240
|
return {
|
|
3240
3241
|
activeHead: c,
|
|
@@ -3275,7 +3276,7 @@ const yo = {
|
|
|
3275
3276
|
scrollElementOffsetTop: e.scrollElementOffsetTop
|
|
3276
3277
|
}, null))]);
|
|
3277
3278
|
}
|
|
3278
|
-
}),
|
|
3279
|
+
}), $o = (e, l) => {
|
|
3279
3280
|
const { editorId: o, previewOnly: t } = e, r = q({
|
|
3280
3281
|
// 是否已编译成html
|
|
3281
3282
|
buildFinished: !1,
|
|
@@ -3313,7 +3314,7 @@ const yo = {
|
|
|
3313
3314
|
}
|
|
3314
3315
|
}));
|
|
3315
3316
|
});
|
|
3316
|
-
},
|
|
3317
|
+
}, wo = (e) => {
|
|
3317
3318
|
var n;
|
|
3318
3319
|
const { editorId: l, previewOnly: o } = e, t = (n = A == null ? void 0 : A.editorExtensions) == null ? void 0 : n.highlight;
|
|
3319
3320
|
Z("editorId", l), Z("tabWidth", e.tabWidth), Z(
|
|
@@ -3327,7 +3328,7 @@ const yo = {
|
|
|
3327
3328
|
...t == null ? void 0 : t.css
|
|
3328
3329
|
}, d = e.codeStyleReverse && e.codeStyleReverseList.includes(e.previewTheme) ? "dark" : e.theme;
|
|
3329
3330
|
return {
|
|
3330
|
-
js: (t == null ? void 0 : t.js) ||
|
|
3331
|
+
js: (t == null ? void 0 : t.js) || zt,
|
|
3331
3332
|
css: a[e.codeTheme] ? a[e.codeTheme][d] : Ze.atom[d]
|
|
3332
3333
|
};
|
|
3333
3334
|
})
|
|
@@ -3344,13 +3345,13 @@ const yo = {
|
|
|
3344
3345
|
"previewTheme",
|
|
3345
3346
|
U(() => e.previewTheme)
|
|
3346
3347
|
);
|
|
3347
|
-
},
|
|
3348
|
+
}, To = (e) => {
|
|
3348
3349
|
var u, c, f, h, p, v;
|
|
3349
3350
|
const { noPrettier: l, previewOnly: o, noIconfont: t, noUploadImg: r } = e, { editorExtensions: n } = A, a = l || !!((c = (u = A.editorExtensions) == null ? void 0 : u.prettier) != null && c.prettierInstance), d = l || !!((h = (f = A.editorExtensions) == null ? void 0 : f.prettier) != null && h.parserMarkdownInstance), m = r || !!((v = (p = A.editorExtensions) == null ? void 0 : p.cropper) != null && v.instance);
|
|
3350
3351
|
H(() => {
|
|
3351
3352
|
var I, w, F, j;
|
|
3352
3353
|
const b = document.createElement("script");
|
|
3353
|
-
b.src = (n == null ? void 0 : n.iconfont) ||
|
|
3354
|
+
b.src = (n == null ? void 0 : n.iconfont) || Kt, b.id = `${s}-icon`;
|
|
3354
3355
|
const y = document.createElement("script"), C = document.createElement("script");
|
|
3355
3356
|
y.src = ((I = n == null ? void 0 : n.prettier) == null ? void 0 : I.standaloneJs) || Ge.main, y.id = `${s}-prettier`, C.src = ((w = n == null ? void 0 : n.prettier) == null ? void 0 : w.parserMarkdownJs) || Ge.markdown, C.id = `${s}-prettierMD`;
|
|
3356
3357
|
const $ = document.createElement("link");
|
|
@@ -3358,7 +3359,7 @@ const yo = {
|
|
|
3358
3359
|
const T = document.createElement("script");
|
|
3359
3360
|
T.src = ((j = n == null ? void 0 : n.cropper) == null ? void 0 : j.js) || Ke.js, T.id = `${s}-cropper`, t || V(b), o || (m || (V($), V(T)), a || V(y), d || V(C));
|
|
3360
3361
|
});
|
|
3361
|
-
},
|
|
3362
|
+
}, So = (e, l) => {
|
|
3362
3363
|
const { editorId: o, previewOnly: t } = e, r = q({
|
|
3363
3364
|
pageFullscreen: e.pageFullscreen,
|
|
3364
3365
|
fullscreen: !1,
|
|
@@ -3385,7 +3386,7 @@ const yo = {
|
|
|
3385
3386
|
}
|
|
3386
3387
|
}), a = document.body.style.overflow, d();
|
|
3387
3388
|
}), [r, n];
|
|
3388
|
-
},
|
|
3389
|
+
}, xo = (e) => {
|
|
3389
3390
|
const { editorId: l } = e, o = B(!1);
|
|
3390
3391
|
H(() => {
|
|
3391
3392
|
k.on(l, {
|
|
@@ -3397,7 +3398,7 @@ const yo = {
|
|
|
3397
3398
|
});
|
|
3398
3399
|
const t = U(() => !e.toolbarsExclude.includes("catalog") && e.toolbars.includes("catalog"));
|
|
3399
3400
|
return [o, t];
|
|
3400
|
-
},
|
|
3401
|
+
}, Eo = (e, l, o, t, r) => {
|
|
3401
3402
|
const { editorId: n } = e;
|
|
3402
3403
|
S(
|
|
3403
3404
|
() => t.pageFullscreen,
|
|
@@ -3498,7 +3499,7 @@ const yo = {
|
|
|
3498
3499
|
}
|
|
3499
3500
|
};
|
|
3500
3501
|
l.expose(a);
|
|
3501
|
-
},
|
|
3502
|
+
}, Lo = (e) => e, Ao = {
|
|
3502
3503
|
/**
|
|
3503
3504
|
* 主题
|
|
3504
3505
|
*
|
|
@@ -3635,7 +3636,7 @@ const yo = {
|
|
|
3635
3636
|
*/
|
|
3636
3637
|
editorId: {
|
|
3637
3638
|
type: String,
|
|
3638
|
-
default:
|
|
3639
|
+
default: Gt
|
|
3639
3640
|
},
|
|
3640
3641
|
/**
|
|
3641
3642
|
* 一个tab等于空格数
|
|
@@ -3678,7 +3679,7 @@ const yo = {
|
|
|
3678
3679
|
*/
|
|
3679
3680
|
mdHeadingId: {
|
|
3680
3681
|
type: Function,
|
|
3681
|
-
default:
|
|
3682
|
+
default: Lo
|
|
3682
3683
|
},
|
|
3683
3684
|
/**
|
|
3684
3685
|
* 表格预设格子数
|
|
@@ -3869,7 +3870,7 @@ const yo = {
|
|
|
3869
3870
|
type: Boolean,
|
|
3870
3871
|
default: !1
|
|
3871
3872
|
}
|
|
3872
|
-
},
|
|
3873
|
+
}, Io = [
|
|
3873
3874
|
"onChange",
|
|
3874
3875
|
"onSave",
|
|
3875
3876
|
"onUploadImg",
|
|
@@ -3882,8 +3883,8 @@ const yo = {
|
|
|
3882
3883
|
];
|
|
3883
3884
|
const J = /* @__PURE__ */ M({
|
|
3884
3885
|
name: "MdEditorV3",
|
|
3885
|
-
props:
|
|
3886
|
-
emits:
|
|
3886
|
+
props: Ao,
|
|
3887
|
+
emits: Io,
|
|
3887
3888
|
setup(e, l) {
|
|
3888
3889
|
const {
|
|
3889
3890
|
editorId: o,
|
|
@@ -3896,11 +3897,11 @@ const J = /* @__PURE__ */ M({
|
|
|
3896
3897
|
} = e, u = q({
|
|
3897
3898
|
scrollAuto: e.scrollAuto
|
|
3898
3899
|
});
|
|
3899
|
-
|
|
3900
|
-
const [c, f] =
|
|
3900
|
+
$o(e, l), wo(e), To(e);
|
|
3901
|
+
const [c, f] = So(e, l), [h, p] = xo(e);
|
|
3901
3902
|
return Se(() => {
|
|
3902
3903
|
k.clear(o);
|
|
3903
|
-
}),
|
|
3904
|
+
}), Eo(e, l, h, c, f), () => {
|
|
3904
3905
|
var y;
|
|
3905
3906
|
const v = W({
|
|
3906
3907
|
props: e,
|
|
@@ -3913,7 +3914,7 @@ const J = /* @__PURE__ */ M({
|
|
|
3913
3914
|
id: o,
|
|
3914
3915
|
class: [s, e.class, e.theme === "dark" && `${s}-dark`, c.fullscreen || c.pageFullscreen ? `${s}-fullscreen` : "", t && `${s}-previewOnly`],
|
|
3915
3916
|
style: e.style
|
|
3916
|
-
}, [!t && i(
|
|
3917
|
+
}, [!t && i(kl, {
|
|
3917
3918
|
noPrettier: a,
|
|
3918
3919
|
toolbars: e.toolbars,
|
|
3919
3920
|
toolbarsExclude: e.toolbarsExclude,
|
|
@@ -3922,7 +3923,7 @@ const J = /* @__PURE__ */ M({
|
|
|
3922
3923
|
tableShape: e.tableShape,
|
|
3923
3924
|
defToolbars: v,
|
|
3924
3925
|
noUploadImg: d
|
|
3925
|
-
}, null), i(
|
|
3926
|
+
}, null), i(mo, {
|
|
3926
3927
|
value: e.modelValue,
|
|
3927
3928
|
setting: c,
|
|
3928
3929
|
mdHeadingId: e.mdHeadingId,
|
|
@@ -3954,7 +3955,7 @@ const J = /* @__PURE__ */ M({
|
|
|
3954
3955
|
onFocus: (C) => {
|
|
3955
3956
|
e.onFocus ? e.onFocus(C) : l.emit("onFocus", C);
|
|
3956
3957
|
}
|
|
3957
|
-
}, null), !t && ((y = e.footers) == null ? void 0 : y.length) > 0 && i(
|
|
3958
|
+
}, null), !t && ((y = e.footers) == null ? void 0 : y.length) > 0 && i(ko, {
|
|
3958
3959
|
modelValue: e.modelValue,
|
|
3959
3960
|
footers: e.footers,
|
|
3960
3961
|
defFooters: b,
|
|
@@ -3971,7 +3972,7 @@ const J = /* @__PURE__ */ M({
|
|
|
3971
3972
|
}, null)]);
|
|
3972
3973
|
};
|
|
3973
3974
|
}
|
|
3974
|
-
}),
|
|
3975
|
+
}), Ho = {
|
|
3975
3976
|
title: {
|
|
3976
3977
|
type: String,
|
|
3977
3978
|
default: ""
|
|
@@ -3985,7 +3986,7 @@ const J = /* @__PURE__ */ M({
|
|
|
3985
3986
|
}
|
|
3986
3987
|
}, $e = /* @__PURE__ */ M({
|
|
3987
3988
|
name: "NormalToolbar",
|
|
3988
|
-
props:
|
|
3989
|
+
props: Ho,
|
|
3989
3990
|
emits: ["onClick"],
|
|
3990
3991
|
setup(e, l) {
|
|
3991
3992
|
return () => {
|
|
@@ -4002,7 +4003,7 @@ const J = /* @__PURE__ */ M({
|
|
|
4002
4003
|
}, [o]);
|
|
4003
4004
|
};
|
|
4004
4005
|
}
|
|
4005
|
-
}),
|
|
4006
|
+
}), Fo = {
|
|
4006
4007
|
title: {
|
|
4007
4008
|
type: String,
|
|
4008
4009
|
default: ""
|
|
@@ -4023,7 +4024,7 @@ const J = /* @__PURE__ */ M({
|
|
|
4023
4024
|
}
|
|
4024
4025
|
}, we = /* @__PURE__ */ M({
|
|
4025
4026
|
name: "DropdownToolbar",
|
|
4026
|
-
props:
|
|
4027
|
+
props: Fo,
|
|
4027
4028
|
emits: ["onChange"],
|
|
4028
4029
|
setup(e, l) {
|
|
4029
4030
|
const o = x("editorId");
|
|
@@ -4051,10 +4052,10 @@ const J = /* @__PURE__ */ M({
|
|
|
4051
4052
|
};
|
|
4052
4053
|
}
|
|
4053
4054
|
});
|
|
4054
|
-
function
|
|
4055
|
+
function Mo(e) {
|
|
4055
4056
|
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !xt(e);
|
|
4056
4057
|
}
|
|
4057
|
-
const
|
|
4058
|
+
const Bo = {
|
|
4058
4059
|
title: {
|
|
4059
4060
|
type: String,
|
|
4060
4061
|
default: ""
|
|
@@ -4100,7 +4101,7 @@ const Mo = {
|
|
|
4100
4101
|
}
|
|
4101
4102
|
}, Te = /* @__PURE__ */ M({
|
|
4102
4103
|
name: "ModalToolbar",
|
|
4103
|
-
props:
|
|
4104
|
+
props: Bo,
|
|
4104
4105
|
emits: ["onClick", "onClose", "onAdjust"],
|
|
4105
4106
|
setup(e, l) {
|
|
4106
4107
|
return () => {
|
|
@@ -4130,7 +4131,7 @@ const Mo = {
|
|
|
4130
4131
|
onAdjust: (r) => {
|
|
4131
4132
|
e.onAdjust instanceof Function ? e.onAdjust(r) : l.emit("onAdjust", r);
|
|
4132
4133
|
}
|
|
4133
|
-
},
|
|
4134
|
+
}, Mo(t) ? t : {
|
|
4134
4135
|
default: () => [t]
|
|
4135
4136
|
})]);
|
|
4136
4137
|
};
|
|
@@ -4141,7 +4142,7 @@ J.NormalToolbar = $e;
|
|
|
4141
4142
|
J.DropdownToolbar = we;
|
|
4142
4143
|
J.MdCatalog = he;
|
|
4143
4144
|
J.ModalToolbar = Te;
|
|
4144
|
-
J.config =
|
|
4145
|
+
J.config = Jt;
|
|
4145
4146
|
export {
|
|
4146
4147
|
J as default
|
|
4147
4148
|
};
|