md-editor-v3 3.0.0-beta.4 → 3.0.0
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 +170 -171
- package/lib/md-editor-v3.umd.js +22 -17
- 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 = 2, n = -2;
|
|
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,12 +2450,12 @@ const Gl = (e) => {
|
|
|
2449
2450
|
})
|
|
2450
2451
|
], u = () => t.value === "light" ? A.codeMirrorExtensions(
|
|
2451
2452
|
t.value,
|
|
2452
|
-
[...m,
|
|
2453
|
-
a
|
|
2453
|
+
[...m, Wl],
|
|
2454
|
+
[...a]
|
|
2454
2455
|
) : A.codeMirrorExtensions(
|
|
2455
2456
|
t.value,
|
|
2456
|
-
[...m,
|
|
2457
|
-
a
|
|
2457
|
+
[...m, Bl],
|
|
2458
|
+
[...a]
|
|
2458
2459
|
);
|
|
2459
2460
|
return H(() => {
|
|
2460
2461
|
const c = ge.create({
|
|
@@ -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,28 +2552,26 @@ 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(() => {
|
|
2558
|
-
if (e.noHighlight)
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
const d = document.createElement("script");
|
|
2562
|
-
d.src = t.value.js, d.onload = () => {
|
|
2559
|
+
if (!e.noHighlight && !r.value) {
|
|
2560
|
+
const a = document.createElement("script");
|
|
2561
|
+
a.src = t.value.js, a.onload = () => {
|
|
2563
2562
|
r.value = window.hljs;
|
|
2564
|
-
},
|
|
2563
|
+
}, a.id = `${s}-hljs`, V(a, "hljs");
|
|
2564
|
+
const d = document.createElement("link");
|
|
2565
|
+
d.rel = "stylesheet", d.href = t.value.css, d.id = `${s}-hlCss`, V(d);
|
|
2565
2566
|
}
|
|
2566
|
-
const a = document.createElement("link");
|
|
2567
|
-
a.rel = "stylesheet", a.href = t.value.css, a.id = `${s}-hlCss`, V(a);
|
|
2568
2567
|
}), S(
|
|
2569
2568
|
() => t.value.css,
|
|
2570
2569
|
(a) => {
|
|
2571
|
-
|
|
2570
|
+
sl(`${s}-hlCss`, "href", a);
|
|
2572
2571
|
}
|
|
2573
2572
|
), 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
|
|
2573
|
+
}, eo = (e) => {
|
|
2574
|
+
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
2575
|
max: 1e3,
|
|
2577
2576
|
// 缓存10分钟
|
|
2578
2577
|
ttl: 6e5
|
|
@@ -2592,7 +2591,7 @@ const Gl = (e) => {
|
|
|
2592
2591
|
if (!e.noMermaid && !(t != null && t.instance)) {
|
|
2593
2592
|
const u = document.createElement("script");
|
|
2594
2593
|
u.id = `${s}-mermaid`;
|
|
2595
|
-
const c = (t == null ? void 0 : t.js) ||
|
|
2594
|
+
const c = (t == null ? void 0 : t.js) || Zt;
|
|
2596
2595
|
/\.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
2596
|
r.value = window.mermaid, d();
|
|
2598
2597
|
}, V(u, "mermaid");
|
|
@@ -2604,7 +2603,7 @@ const Gl = (e) => {
|
|
|
2604
2603
|
).forEach(async (c) => {
|
|
2605
2604
|
let f = a.get(c.innerText);
|
|
2606
2605
|
if (!f) {
|
|
2607
|
-
const p =
|
|
2606
|
+
const p = il(), b = await (r.value.renderAsync || r.value.render)(p, c.innerText);
|
|
2608
2607
|
f = typeof b == "string" ? b : b.svg, a.set(c.innerText, f);
|
|
2609
2608
|
}
|
|
2610
2609
|
const h = document.createElement("p");
|
|
@@ -2612,7 +2611,7 @@ const Gl = (e) => {
|
|
|
2612
2611
|
});
|
|
2613
2612
|
});
|
|
2614
2613
|
} };
|
|
2615
|
-
},
|
|
2614
|
+
}, to = (e) => {
|
|
2616
2615
|
var r;
|
|
2617
2616
|
const l = (r = A.editorExtensions) == null ? void 0 : r.katex, o = l == null ? void 0 : l.instance, t = de(o);
|
|
2618
2617
|
return H(() => {
|
|
@@ -2625,7 +2624,7 @@ const Gl = (e) => {
|
|
|
2625
2624
|
a.rel = "stylesheet", a.href = (l == null ? void 0 : l.css) || Xe.css, a.id = `${s}-katexCss`, V(n, "katex"), V(a);
|
|
2626
2625
|
}
|
|
2627
2626
|
}), t;
|
|
2628
|
-
},
|
|
2627
|
+
}, lo = (e, l) => {
|
|
2629
2628
|
const o = e.renderer.rules.fence.bind(e.renderer.rules);
|
|
2630
2629
|
e.renderer.rules.fence = (t, r, n, a, d) => {
|
|
2631
2630
|
const m = t[r], u = m.content.trim();
|
|
@@ -2642,7 +2641,7 @@ const Gl = (e) => {
|
|
|
2642
2641
|
can_open: o,
|
|
2643
2642
|
can_close: t
|
|
2644
2643
|
};
|
|
2645
|
-
},
|
|
2644
|
+
}, oo = (e, l) => {
|
|
2646
2645
|
let o, t, r, n;
|
|
2647
2646
|
if (e.src[e.pos] !== "$")
|
|
2648
2647
|
return !1;
|
|
@@ -2657,7 +2656,7 @@ const Gl = (e) => {
|
|
|
2657
2656
|
o += 1;
|
|
2658
2657
|
}
|
|
2659
2658
|
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
|
-
},
|
|
2659
|
+
}, no = (e, l, o, t) => {
|
|
2661
2660
|
let r, n, a, d, m = !1, u = e.bMarks[l] + e.tShift[l], c = e.eMarks[l];
|
|
2662
2661
|
if (u + 2 > c || e.src.slice(u, u + 2) !== "$$")
|
|
2663
2662
|
return !1;
|
|
@@ -2669,7 +2668,7 @@ const Gl = (e) => {
|
|
|
2669
2668
|
const f = e.push("math_block", "math", 0);
|
|
2670
2669
|
return f.block = !0, f.content = (r && r.trim() ? r + `
|
|
2671
2670
|
` : "") + e.getLines(l + 1, a, e.tShift[l], !0) + (n && n.trim() ? n : ""), f.map = [l, e.line], f.markup = "$$", !0;
|
|
2672
|
-
},
|
|
2671
|
+
}, ro = (e, l) => {
|
|
2673
2672
|
const o = (r) => {
|
|
2674
2673
|
if (l.katexRef.value) {
|
|
2675
2674
|
const n = l.katexRef.value.renderToString(r, {
|
|
@@ -2688,11 +2687,11 @@ const Gl = (e) => {
|
|
|
2688
2687
|
} else
|
|
2689
2688
|
return `<p class="${s}-katex-block" data-line=${n}>${r}</p>`;
|
|
2690
2689
|
};
|
|
2691
|
-
e.inline.ruler.after("escape", "math_inline",
|
|
2690
|
+
e.inline.ruler.after("escape", "math_inline", oo), e.block.ruler.after("blockquote", "math_block", no, {
|
|
2692
2691
|
alt: ["paragraph", "reference", "blockquote", "list"]
|
|
2693
2692
|
}), 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
2693
|
`;
|
|
2695
|
-
},
|
|
2694
|
+
}, io = (e, l) => {
|
|
2696
2695
|
l = l || {};
|
|
2697
2696
|
const o = 3, t = l.marker || "!", r = t.charCodeAt(0), n = t.length;
|
|
2698
2697
|
let a = "", d = "";
|
|
@@ -2738,7 +2737,7 @@ const Gl = (e) => {
|
|
|
2738
2737
|
alt: ["paragraph", "reference", "blockquote", "list"]
|
|
2739
2738
|
}
|
|
2740
2739
|
), 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
|
-
},
|
|
2740
|
+
}, ao = (e, l) => {
|
|
2742
2741
|
let o;
|
|
2743
2742
|
e.core.ruler.push("headingLinks", (t) => {
|
|
2744
2743
|
o || (o = t.Token);
|
|
@@ -2752,7 +2751,7 @@ const Gl = (e) => {
|
|
|
2752
2751
|
l.mdHeadingId(a, d, l.headsRef.value.length)
|
|
2753
2752
|
)), e.renderer.renderToken(t, r, l);
|
|
2754
2753
|
}, e.renderer.rules.heading_close = (t, r, n, a, d) => d.renderToken(t, r, n);
|
|
2755
|
-
},
|
|
2754
|
+
}, so = (e) => {
|
|
2756
2755
|
[
|
|
2757
2756
|
"paragraph_open",
|
|
2758
2757
|
"table_open",
|
|
@@ -2773,22 +2772,22 @@ const Gl = (e) => {
|
|
|
2773
2772
|
return t[r].map && t[r].level === 0 ? (m = t[r].map[0], u.replace(/^(<[^>]*)/, `$1 data-line="${m}"`)) : u;
|
|
2774
2773
|
};
|
|
2775
2774
|
});
|
|
2776
|
-
},
|
|
2777
|
-
const { editorConfig: l, markdownItConfig: o } = A, t = x("editorId"), r = x("showCodeRowNumber"), n = x("previewOnly"), a = x("theme"), d = B([]), m =
|
|
2775
|
+
}, co = (e) => {
|
|
2776
|
+
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
2777
|
html: !0,
|
|
2779
2778
|
breaks: !0
|
|
2780
2779
|
});
|
|
2781
|
-
h.use(
|
|
2780
|
+
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
2781
|
highlight: (y, C) => {
|
|
2783
2782
|
let $;
|
|
2784
2783
|
!e.noHighlight && m.value ? m.value.getLanguage(C) ? $ = m.value.highlight(y, {
|
|
2785
2784
|
language: C,
|
|
2786
2785
|
ignoreIllegals: !0
|
|
2787
2786
|
}).value : $ = m.value.highlightAuto(y).value : $ = h.utils.escapeHtml(y);
|
|
2788
|
-
const T = r ?
|
|
2787
|
+
const T = r ? ol($.trim()) : `<span class="code-block">${$.trim()}</span>`;
|
|
2789
2788
|
return `<pre><code class="language-${C}" language=${C}>${T}</code></pre>`;
|
|
2790
2789
|
}
|
|
2791
|
-
}),
|
|
2790
|
+
}), so(h), o(h);
|
|
2792
2791
|
const p = B(e.sanitize(h.render(e.value))), v = ve(
|
|
2793
2792
|
async () => {
|
|
2794
2793
|
d.value = [], p.value = e.sanitize(h.render(e.value)), k.emit(t, "buildFinished", p.value), e.onHtmlChanged(p.value), f();
|
|
@@ -2808,7 +2807,7 @@ const Gl = (e) => {
|
|
|
2808
2807
|
}
|
|
2809
2808
|
});
|
|
2810
2809
|
}), { html: p };
|
|
2811
|
-
},
|
|
2810
|
+
}, uo = {
|
|
2812
2811
|
value: {
|
|
2813
2812
|
type: String,
|
|
2814
2813
|
default: ""
|
|
@@ -2898,17 +2897,17 @@ const Gl = (e) => {
|
|
|
2898
2897
|
type: Boolean,
|
|
2899
2898
|
default: !1
|
|
2900
2899
|
}
|
|
2901
|
-
},
|
|
2900
|
+
}, mo = /* @__PURE__ */ M({
|
|
2902
2901
|
name: "MDEditorContent",
|
|
2903
|
-
props:
|
|
2902
|
+
props: uo,
|
|
2904
2903
|
setup(e) {
|
|
2905
2904
|
const l = x("previewOnly"), o = x("showCodeRowNumber"), t = x("previewTheme"), r = x("editorId"), n = B(), a = B(), {
|
|
2906
2905
|
inputWrapperRef: d,
|
|
2907
2906
|
codeMirrorUt: m
|
|
2908
|
-
} =
|
|
2907
|
+
} = Zl(e), {
|
|
2909
2908
|
html: u
|
|
2910
|
-
} =
|
|
2911
|
-
return
|
|
2909
|
+
} = co(e);
|
|
2910
|
+
return $l(e, u, n, a, m), Yl(e, u), Jl(e, u), () => i("div", {
|
|
2912
2911
|
class: `${s}-content`
|
|
2913
2912
|
}, [!l && i("div", {
|
|
2914
2913
|
class: `${s}-input-wrapper`,
|
|
@@ -2930,7 +2929,7 @@ const Gl = (e) => {
|
|
|
2930
2929
|
class: `${s}-html`
|
|
2931
2930
|
}, [u.value])])]);
|
|
2932
2931
|
}
|
|
2933
|
-
}),
|
|
2932
|
+
}), fo = /* @__PURE__ */ M({
|
|
2934
2933
|
props: {
|
|
2935
2934
|
modelValue: {
|
|
2936
2935
|
type: String,
|
|
@@ -2949,7 +2948,7 @@ const Gl = (e) => {
|
|
|
2949
2948
|
};
|
|
2950
2949
|
}
|
|
2951
2950
|
});
|
|
2952
|
-
const
|
|
2951
|
+
const go = {
|
|
2953
2952
|
checked: {
|
|
2954
2953
|
type: Boolean,
|
|
2955
2954
|
default: !1
|
|
@@ -2959,8 +2958,8 @@ const fo = {
|
|
|
2959
2958
|
default: () => {
|
|
2960
2959
|
}
|
|
2961
2960
|
}
|
|
2962
|
-
},
|
|
2963
|
-
props:
|
|
2961
|
+
}, ho = /* @__PURE__ */ M({
|
|
2962
|
+
props: go,
|
|
2964
2963
|
setup(e) {
|
|
2965
2964
|
return () => i("div", {
|
|
2966
2965
|
class: [`${s}-checkbox`, e.checked && `${s}-checkbox-checked`],
|
|
@@ -2969,7 +2968,7 @@ const fo = {
|
|
|
2969
2968
|
}
|
|
2970
2969
|
}, null);
|
|
2971
2970
|
}
|
|
2972
|
-
}),
|
|
2971
|
+
}), vo = {
|
|
2973
2972
|
scrollAuto: {
|
|
2974
2973
|
type: Boolean
|
|
2975
2974
|
},
|
|
@@ -2978,8 +2977,8 @@ const fo = {
|
|
|
2978
2977
|
default: () => {
|
|
2979
2978
|
}
|
|
2980
2979
|
}
|
|
2981
|
-
},
|
|
2982
|
-
props:
|
|
2980
|
+
}, po = /* @__PURE__ */ M({
|
|
2981
|
+
props: vo,
|
|
2983
2982
|
setup(e) {
|
|
2984
2983
|
const l = x("usedLanguageText");
|
|
2985
2984
|
return () => {
|
|
@@ -2991,13 +2990,13 @@ const fo = {
|
|
|
2991
2990
|
onClick: () => {
|
|
2992
2991
|
e.onScrollAutoChange(!e.scrollAuto);
|
|
2993
2992
|
}
|
|
2994
|
-
}, [(o = l.value.footer) == null ? void 0 : o.scrollAuto]), i(
|
|
2993
|
+
}, [(o = l.value.footer) == null ? void 0 : o.scrollAuto]), i(ho, {
|
|
2995
2994
|
checked: e.scrollAuto,
|
|
2996
2995
|
onChange: e.onScrollAutoChange
|
|
2997
2996
|
}, null)]);
|
|
2998
2997
|
};
|
|
2999
2998
|
}
|
|
3000
|
-
}),
|
|
2999
|
+
}), bo = {
|
|
3001
3000
|
modelValue: {
|
|
3002
3001
|
type: String,
|
|
3003
3002
|
default: ""
|
|
@@ -3017,9 +3016,9 @@ const fo = {
|
|
|
3017
3016
|
defFooters: {
|
|
3018
3017
|
type: Object
|
|
3019
3018
|
}
|
|
3020
|
-
},
|
|
3019
|
+
}, ko = /* @__PURE__ */ M({
|
|
3021
3020
|
name: "MDEditorFooter",
|
|
3022
|
-
props:
|
|
3021
|
+
props: bo,
|
|
3023
3022
|
setup(e) {
|
|
3024
3023
|
const l = U(() => {
|
|
3025
3024
|
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 +3027,11 @@ const fo = {
|
|
|
3028
3027
|
if (kt.includes(t))
|
|
3029
3028
|
switch (t) {
|
|
3030
3029
|
case "markdownTotal":
|
|
3031
|
-
return i(
|
|
3030
|
+
return i(fo, {
|
|
3032
3031
|
modelValue: e.modelValue
|
|
3033
3032
|
}, null);
|
|
3034
3033
|
case "scrollSwitch":
|
|
3035
|
-
return i(
|
|
3034
|
+
return i(po, {
|
|
3036
3035
|
scrollAuto: e.scrollAuto,
|
|
3037
3036
|
onScrollAutoChange: e.onScrollAutoChange
|
|
3038
3037
|
}, null);
|
|
@@ -3051,7 +3050,7 @@ const fo = {
|
|
|
3051
3050
|
}, [r])]);
|
|
3052
3051
|
};
|
|
3053
3052
|
}
|
|
3054
|
-
}),
|
|
3053
|
+
}), yo = {
|
|
3055
3054
|
tocItem: {
|
|
3056
3055
|
type: Object,
|
|
3057
3056
|
default: () => ({})
|
|
@@ -3075,7 +3074,7 @@ const fo = {
|
|
|
3075
3074
|
default: 0
|
|
3076
3075
|
}
|
|
3077
3076
|
}, $t = /* @__PURE__ */ M({
|
|
3078
|
-
props:
|
|
3077
|
+
props: yo,
|
|
3079
3078
|
setup(e) {
|
|
3080
3079
|
return () => {
|
|
3081
3080
|
const {
|
|
@@ -3116,7 +3115,7 @@ const fo = {
|
|
|
3116
3115
|
};
|
|
3117
3116
|
}
|
|
3118
3117
|
});
|
|
3119
|
-
const
|
|
3118
|
+
const Co = {
|
|
3120
3119
|
/**
|
|
3121
3120
|
* 编辑器的Id,务必与需要绑定的编辑器Id相同
|
|
3122
3121
|
*/
|
|
@@ -3167,7 +3166,7 @@ const yo = {
|
|
|
3167
3166
|
}
|
|
3168
3167
|
}, he = /* @__PURE__ */ M({
|
|
3169
3168
|
name: "MdCatalog",
|
|
3170
|
-
props:
|
|
3169
|
+
props: Co,
|
|
3171
3170
|
emits: ["onClick"],
|
|
3172
3171
|
setup(e, l) {
|
|
3173
3172
|
const o = e.editorId, t = q({
|
|
@@ -3226,7 +3225,7 @@ const yo = {
|
|
|
3226
3225
|
const n = () => {
|
|
3227
3226
|
var d;
|
|
3228
3227
|
const a = t.scrollElement instanceof HTMLElement ? t.scrollElement : document.querySelector(t.scrollElement);
|
|
3229
|
-
(d = a === document.documentElement ? window : a) == null || d.addEventListener("scroll",
|
|
3228
|
+
(d = a === document.documentElement ? window : a) == null || d.addEventListener("scroll", nl(() => {
|
|
3230
3229
|
if (t.list.length === 0)
|
|
3231
3230
|
return !1;
|
|
3232
3231
|
const {
|
|
@@ -3234,7 +3233,7 @@ const yo = {
|
|
|
3234
3233
|
} = t.list.reduce((u, c, f) => {
|
|
3235
3234
|
const h = document.getElementById(e.mdHeadingId(c.text, c.level, f + 1));
|
|
3236
3235
|
if (h instanceof HTMLElement) {
|
|
3237
|
-
const p =
|
|
3236
|
+
const p = rl(h, a);
|
|
3238
3237
|
if (p < e.offsetTop && p > u.minTop)
|
|
3239
3238
|
return {
|
|
3240
3239
|
activeHead: c,
|
|
@@ -3275,7 +3274,7 @@ const yo = {
|
|
|
3275
3274
|
scrollElementOffsetTop: e.scrollElementOffsetTop
|
|
3276
3275
|
}, null))]);
|
|
3277
3276
|
}
|
|
3278
|
-
}),
|
|
3277
|
+
}), $o = (e, l) => {
|
|
3279
3278
|
const { editorId: o, previewOnly: t } = e, r = q({
|
|
3280
3279
|
// 是否已编译成html
|
|
3281
3280
|
buildFinished: !1,
|
|
@@ -3313,7 +3312,7 @@ const yo = {
|
|
|
3313
3312
|
}
|
|
3314
3313
|
}));
|
|
3315
3314
|
});
|
|
3316
|
-
},
|
|
3315
|
+
}, wo = (e) => {
|
|
3317
3316
|
var n;
|
|
3318
3317
|
const { editorId: l, previewOnly: o } = e, t = (n = A == null ? void 0 : A.editorExtensions) == null ? void 0 : n.highlight;
|
|
3319
3318
|
Z("editorId", l), Z("tabWidth", e.tabWidth), Z(
|
|
@@ -3327,7 +3326,7 @@ const yo = {
|
|
|
3327
3326
|
...t == null ? void 0 : t.css
|
|
3328
3327
|
}, d = e.codeStyleReverse && e.codeStyleReverseList.includes(e.previewTheme) ? "dark" : e.theme;
|
|
3329
3328
|
return {
|
|
3330
|
-
js: (t == null ? void 0 : t.js) ||
|
|
3329
|
+
js: (t == null ? void 0 : t.js) || zt,
|
|
3331
3330
|
css: a[e.codeTheme] ? a[e.codeTheme][d] : Ze.atom[d]
|
|
3332
3331
|
};
|
|
3333
3332
|
})
|
|
@@ -3344,13 +3343,13 @@ const yo = {
|
|
|
3344
3343
|
"previewTheme",
|
|
3345
3344
|
U(() => e.previewTheme)
|
|
3346
3345
|
);
|
|
3347
|
-
},
|
|
3346
|
+
}, To = (e) => {
|
|
3348
3347
|
var u, c, f, h, p, v;
|
|
3349
3348
|
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
3349
|
H(() => {
|
|
3351
3350
|
var I, w, F, j;
|
|
3352
3351
|
const b = document.createElement("script");
|
|
3353
|
-
b.src = (n == null ? void 0 : n.iconfont) ||
|
|
3352
|
+
b.src = (n == null ? void 0 : n.iconfont) || Kt, b.id = `${s}-icon`;
|
|
3354
3353
|
const y = document.createElement("script"), C = document.createElement("script");
|
|
3355
3354
|
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
3355
|
const $ = document.createElement("link");
|
|
@@ -3358,7 +3357,7 @@ const yo = {
|
|
|
3358
3357
|
const T = document.createElement("script");
|
|
3359
3358
|
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
3359
|
});
|
|
3361
|
-
},
|
|
3360
|
+
}, So = (e, l) => {
|
|
3362
3361
|
const { editorId: o, previewOnly: t } = e, r = q({
|
|
3363
3362
|
pageFullscreen: e.pageFullscreen,
|
|
3364
3363
|
fullscreen: !1,
|
|
@@ -3385,7 +3384,7 @@ const yo = {
|
|
|
3385
3384
|
}
|
|
3386
3385
|
}), a = document.body.style.overflow, d();
|
|
3387
3386
|
}), [r, n];
|
|
3388
|
-
},
|
|
3387
|
+
}, xo = (e) => {
|
|
3389
3388
|
const { editorId: l } = e, o = B(!1);
|
|
3390
3389
|
H(() => {
|
|
3391
3390
|
k.on(l, {
|
|
@@ -3397,7 +3396,7 @@ const yo = {
|
|
|
3397
3396
|
});
|
|
3398
3397
|
const t = U(() => !e.toolbarsExclude.includes("catalog") && e.toolbars.includes("catalog"));
|
|
3399
3398
|
return [o, t];
|
|
3400
|
-
},
|
|
3399
|
+
}, Eo = (e, l, o, t, r) => {
|
|
3401
3400
|
const { editorId: n } = e;
|
|
3402
3401
|
S(
|
|
3403
3402
|
() => t.pageFullscreen,
|
|
@@ -3498,7 +3497,7 @@ const yo = {
|
|
|
3498
3497
|
}
|
|
3499
3498
|
};
|
|
3500
3499
|
l.expose(a);
|
|
3501
|
-
},
|
|
3500
|
+
}, Lo = (e) => e, Ao = {
|
|
3502
3501
|
/**
|
|
3503
3502
|
* 主题
|
|
3504
3503
|
*
|
|
@@ -3635,7 +3634,7 @@ const yo = {
|
|
|
3635
3634
|
*/
|
|
3636
3635
|
editorId: {
|
|
3637
3636
|
type: String,
|
|
3638
|
-
default:
|
|
3637
|
+
default: Gt
|
|
3639
3638
|
},
|
|
3640
3639
|
/**
|
|
3641
3640
|
* 一个tab等于空格数
|
|
@@ -3678,7 +3677,7 @@ const yo = {
|
|
|
3678
3677
|
*/
|
|
3679
3678
|
mdHeadingId: {
|
|
3680
3679
|
type: Function,
|
|
3681
|
-
default:
|
|
3680
|
+
default: Lo
|
|
3682
3681
|
},
|
|
3683
3682
|
/**
|
|
3684
3683
|
* 表格预设格子数
|
|
@@ -3869,7 +3868,7 @@ const yo = {
|
|
|
3869
3868
|
type: Boolean,
|
|
3870
3869
|
default: !1
|
|
3871
3870
|
}
|
|
3872
|
-
},
|
|
3871
|
+
}, Io = [
|
|
3873
3872
|
"onChange",
|
|
3874
3873
|
"onSave",
|
|
3875
3874
|
"onUploadImg",
|
|
@@ -3882,8 +3881,8 @@ const yo = {
|
|
|
3882
3881
|
];
|
|
3883
3882
|
const J = /* @__PURE__ */ M({
|
|
3884
3883
|
name: "MdEditorV3",
|
|
3885
|
-
props:
|
|
3886
|
-
emits:
|
|
3884
|
+
props: Ao,
|
|
3885
|
+
emits: Io,
|
|
3887
3886
|
setup(e, l) {
|
|
3888
3887
|
const {
|
|
3889
3888
|
editorId: o,
|
|
@@ -3896,11 +3895,11 @@ const J = /* @__PURE__ */ M({
|
|
|
3896
3895
|
} = e, u = q({
|
|
3897
3896
|
scrollAuto: e.scrollAuto
|
|
3898
3897
|
});
|
|
3899
|
-
|
|
3900
|
-
const [c, f] =
|
|
3898
|
+
$o(e, l), wo(e), To(e);
|
|
3899
|
+
const [c, f] = So(e, l), [h, p] = xo(e);
|
|
3901
3900
|
return Se(() => {
|
|
3902
3901
|
k.clear(o);
|
|
3903
|
-
}),
|
|
3902
|
+
}), Eo(e, l, h, c, f), () => {
|
|
3904
3903
|
var y;
|
|
3905
3904
|
const v = W({
|
|
3906
3905
|
props: e,
|
|
@@ -3913,7 +3912,7 @@ const J = /* @__PURE__ */ M({
|
|
|
3913
3912
|
id: o,
|
|
3914
3913
|
class: [s, e.class, e.theme === "dark" && `${s}-dark`, c.fullscreen || c.pageFullscreen ? `${s}-fullscreen` : "", t && `${s}-previewOnly`],
|
|
3915
3914
|
style: e.style
|
|
3916
|
-
}, [!t && i(
|
|
3915
|
+
}, [!t && i(kl, {
|
|
3917
3916
|
noPrettier: a,
|
|
3918
3917
|
toolbars: e.toolbars,
|
|
3919
3918
|
toolbarsExclude: e.toolbarsExclude,
|
|
@@ -3922,7 +3921,7 @@ const J = /* @__PURE__ */ M({
|
|
|
3922
3921
|
tableShape: e.tableShape,
|
|
3923
3922
|
defToolbars: v,
|
|
3924
3923
|
noUploadImg: d
|
|
3925
|
-
}, null), i(
|
|
3924
|
+
}, null), i(mo, {
|
|
3926
3925
|
value: e.modelValue,
|
|
3927
3926
|
setting: c,
|
|
3928
3927
|
mdHeadingId: e.mdHeadingId,
|
|
@@ -3954,7 +3953,7 @@ const J = /* @__PURE__ */ M({
|
|
|
3954
3953
|
onFocus: (C) => {
|
|
3955
3954
|
e.onFocus ? e.onFocus(C) : l.emit("onFocus", C);
|
|
3956
3955
|
}
|
|
3957
|
-
}, null), !t && ((y = e.footers) == null ? void 0 : y.length) > 0 && i(
|
|
3956
|
+
}, null), !t && ((y = e.footers) == null ? void 0 : y.length) > 0 && i(ko, {
|
|
3958
3957
|
modelValue: e.modelValue,
|
|
3959
3958
|
footers: e.footers,
|
|
3960
3959
|
defFooters: b,
|
|
@@ -3971,7 +3970,7 @@ const J = /* @__PURE__ */ M({
|
|
|
3971
3970
|
}, null)]);
|
|
3972
3971
|
};
|
|
3973
3972
|
}
|
|
3974
|
-
}),
|
|
3973
|
+
}), Ho = {
|
|
3975
3974
|
title: {
|
|
3976
3975
|
type: String,
|
|
3977
3976
|
default: ""
|
|
@@ -3985,7 +3984,7 @@ const J = /* @__PURE__ */ M({
|
|
|
3985
3984
|
}
|
|
3986
3985
|
}, $e = /* @__PURE__ */ M({
|
|
3987
3986
|
name: "NormalToolbar",
|
|
3988
|
-
props:
|
|
3987
|
+
props: Ho,
|
|
3989
3988
|
emits: ["onClick"],
|
|
3990
3989
|
setup(e, l) {
|
|
3991
3990
|
return () => {
|
|
@@ -4002,7 +4001,7 @@ const J = /* @__PURE__ */ M({
|
|
|
4002
4001
|
}, [o]);
|
|
4003
4002
|
};
|
|
4004
4003
|
}
|
|
4005
|
-
}),
|
|
4004
|
+
}), Fo = {
|
|
4006
4005
|
title: {
|
|
4007
4006
|
type: String,
|
|
4008
4007
|
default: ""
|
|
@@ -4023,7 +4022,7 @@ const J = /* @__PURE__ */ M({
|
|
|
4023
4022
|
}
|
|
4024
4023
|
}, we = /* @__PURE__ */ M({
|
|
4025
4024
|
name: "DropdownToolbar",
|
|
4026
|
-
props:
|
|
4025
|
+
props: Fo,
|
|
4027
4026
|
emits: ["onChange"],
|
|
4028
4027
|
setup(e, l) {
|
|
4029
4028
|
const o = x("editorId");
|
|
@@ -4051,10 +4050,10 @@ const J = /* @__PURE__ */ M({
|
|
|
4051
4050
|
};
|
|
4052
4051
|
}
|
|
4053
4052
|
});
|
|
4054
|
-
function
|
|
4053
|
+
function Mo(e) {
|
|
4055
4054
|
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !xt(e);
|
|
4056
4055
|
}
|
|
4057
|
-
const
|
|
4056
|
+
const Bo = {
|
|
4058
4057
|
title: {
|
|
4059
4058
|
type: String,
|
|
4060
4059
|
default: ""
|
|
@@ -4100,7 +4099,7 @@ const Mo = {
|
|
|
4100
4099
|
}
|
|
4101
4100
|
}, Te = /* @__PURE__ */ M({
|
|
4102
4101
|
name: "ModalToolbar",
|
|
4103
|
-
props:
|
|
4102
|
+
props: Bo,
|
|
4104
4103
|
emits: ["onClick", "onClose", "onAdjust"],
|
|
4105
4104
|
setup(e, l) {
|
|
4106
4105
|
return () => {
|
|
@@ -4130,7 +4129,7 @@ const Mo = {
|
|
|
4130
4129
|
onAdjust: (r) => {
|
|
4131
4130
|
e.onAdjust instanceof Function ? e.onAdjust(r) : l.emit("onAdjust", r);
|
|
4132
4131
|
}
|
|
4133
|
-
},
|
|
4132
|
+
}, Mo(t) ? t : {
|
|
4134
4133
|
default: () => [t]
|
|
4135
4134
|
})]);
|
|
4136
4135
|
};
|
|
@@ -4141,7 +4140,7 @@ J.NormalToolbar = $e;
|
|
|
4141
4140
|
J.DropdownToolbar = we;
|
|
4142
4141
|
J.MdCatalog = he;
|
|
4143
4142
|
J.ModalToolbar = Te;
|
|
4144
|
-
J.config =
|
|
4143
|
+
J.config = Jt;
|
|
4145
4144
|
export {
|
|
4146
4145
|
J as default
|
|
4147
4146
|
};
|