md-editor-v3 3.0.0-beta.0 → 3.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/md-editor-v3.cjs +5 -5
- package/lib/md-editor-v3.mjs +251 -257
- package/lib/md-editor-v3.umd.js +25 -25
- package/package.json +1 -1
package/lib/md-editor-v3.mjs
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var U = (e, t, o) => (
|
|
4
|
-
import { defineComponent as M, createVNode as i, reactive as N, ref as F, watch as T, onMounted as A, onBeforeUnmount as ye, cloneVNode as
|
|
5
|
-
import { minimalSetup as
|
|
6
|
-
import { EditorSelection as fe, EditorState as
|
|
7
|
-
import { EditorView as $e, placeholder as
|
|
8
|
-
import { languages as
|
|
9
|
-
import { markdown as
|
|
10
|
-
import { deleteLine as
|
|
11
|
-
import { HighlightStyle as
|
|
1
|
+
var St = Object.defineProperty;
|
|
2
|
+
var xt = (e, t, o) => t in e ? St(e, t, { enumerable: !0, configurable: !0, writable: !0, value: o }) : e[t] = o;
|
|
3
|
+
var U = (e, t, o) => (xt(e, typeof t != "symbol" ? t + "" : t, o), o);
|
|
4
|
+
import { defineComponent as M, createVNode as i, reactive as N, ref as F, watch as T, onMounted as A, onBeforeUnmount as ye, cloneVNode as Et, inject as x, computed as D, nextTick as z, Fragment as Ce, toRef as Q, shallowRef as de, provide as W, isVNode as Lt } from "vue";
|
|
5
|
+
import { minimalSetup as Ht, EditorView as ae } from "codemirror";
|
|
6
|
+
import { EditorSelection as fe, EditorState as ce, Compartment as It, StateEffect as At } from "@codemirror/state";
|
|
7
|
+
import { EditorView as $e, placeholder as Ft, keymap as Mt } from "@codemirror/view";
|
|
8
|
+
import { languages as Rt } from "@codemirror/language-data";
|
|
9
|
+
import { markdown as jt } from "@codemirror/lang-markdown";
|
|
10
|
+
import { deleteLine as Bt, indentWithTab as Pt, undo as Ot, redo as Dt } from "@codemirror/commands";
|
|
11
|
+
import { HighlightStyle as bt, syntaxHighlighting as kt, indentUnit as Nt } from "@codemirror/language";
|
|
12
12
|
import { tags as g } from "@lezer/highlight";
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
const s = "md-editor",
|
|
13
|
+
import _t from "medium-zoom";
|
|
14
|
+
import Vt from "copy-to-clipboard";
|
|
15
|
+
import Ut from "markdown-it";
|
|
16
|
+
import qt from "markdown-it-image-figures";
|
|
17
|
+
import Wt from "markdown-it-task-lists";
|
|
18
|
+
import Gt from "lru-cache";
|
|
19
|
+
const s = "md-editor", zt = "md-editor-v3", Kt = "https://at.alicdn.com/t/c/font_2605852_u82y61ve02.js", H = "https://cdnjs.cloudflare.com/ajax/libs", Xt = `${H}/highlight.js/11.7.0/highlight.min.js`, Ke = {
|
|
20
20
|
main: `${H}/prettier/2.8.0/standalone.js`,
|
|
21
21
|
markdown: `${H}/prettier/2.8.0/parser-markdown.js`
|
|
22
22
|
}, Xe = {
|
|
23
23
|
css: `${H}/cropperjs/1.5.13/cropper.min.css`,
|
|
24
24
|
js: `${H}/cropperjs/1.5.13/cropper.min.js`
|
|
25
|
-
},
|
|
25
|
+
}, Zt = `${H}/screenfull.js/5.2.0/screenfull.min.js`, yt = [
|
|
26
26
|
"bold",
|
|
27
27
|
"underline",
|
|
28
28
|
"italic",
|
|
@@ -55,7 +55,7 @@ const s = "md-editor", Xt = "md-editor-v3", Zt = "https://at.alicdn.com/t/c/font
|
|
|
55
55
|
"htmlPreview",
|
|
56
56
|
"catalog",
|
|
57
57
|
"github"
|
|
58
|
-
],
|
|
58
|
+
], Ct = ["markdownTotal", "=", "scrollSwitch"], Ze = {
|
|
59
59
|
"zh-CN": {
|
|
60
60
|
toolbarTips: {
|
|
61
61
|
bold: "加粗",
|
|
@@ -218,7 +218,7 @@ const s = "md-editor", Xt = "md-editor-v3", Zt = "https://at.alicdn.com/t/c/font
|
|
|
218
218
|
scrollAuto: "Scroll Auto"
|
|
219
219
|
}
|
|
220
220
|
}
|
|
221
|
-
},
|
|
221
|
+
}, Jt = `${H}/mermaid/9.4.0/mermaid.min.js`, Je = {
|
|
222
222
|
js: `${H}/KaTeX/0.16.3/katex.min.js`,
|
|
223
223
|
css: `${H}/KaTeX/0.16.3/katex.min.css`
|
|
224
224
|
}, Ye = {
|
|
@@ -263,14 +263,14 @@ const s = "md-editor", Xt = "md-editor-v3", Zt = "https://at.alicdn.com/t/c/font
|
|
|
263
263
|
codeMirrorExtensions: (e, t) => t,
|
|
264
264
|
markdownItConfig: () => {
|
|
265
265
|
}
|
|
266
|
-
},
|
|
266
|
+
}, Yt = (e) => {
|
|
267
267
|
if (e)
|
|
268
268
|
for (const t in e) {
|
|
269
269
|
const o = e[t];
|
|
270
270
|
o && (I[t] = o);
|
|
271
271
|
}
|
|
272
272
|
};
|
|
273
|
-
const
|
|
273
|
+
const Qt = /* @__PURE__ */ M({
|
|
274
274
|
setup() {
|
|
275
275
|
return () => i("div", {
|
|
276
276
|
class: `${s}-divider`
|
|
@@ -284,7 +284,7 @@ const tl = /* @__PURE__ */ M({
|
|
|
284
284
|
const r = (e == null ? void 0 : e.$slots[l]) || (t == null ? void 0 : t.slots[l]);
|
|
285
285
|
return (r ? r(e) : "") || o[l];
|
|
286
286
|
};
|
|
287
|
-
const
|
|
287
|
+
const el = {
|
|
288
288
|
trigger: {
|
|
289
289
|
type: String,
|
|
290
290
|
default: "hover"
|
|
@@ -308,7 +308,7 @@ const ll = {
|
|
|
308
308
|
default: "html"
|
|
309
309
|
}
|
|
310
310
|
}, Y = /* @__PURE__ */ M({
|
|
311
|
-
props:
|
|
311
|
+
props: el,
|
|
312
312
|
setup(e, t) {
|
|
313
313
|
const o = `${s}-dropdown-hidden`, l = N({
|
|
314
314
|
overlayClass: [o],
|
|
@@ -350,7 +350,7 @@ const ll = {
|
|
|
350
350
|
}), h = _({
|
|
351
351
|
props: e,
|
|
352
352
|
ctx: t
|
|
353
|
-
}, "overlay"), v =
|
|
353
|
+
}, "overlay"), v = Et(f instanceof Array ? f[0] : f, {
|
|
354
354
|
ref: r
|
|
355
355
|
}), b = i("div", {
|
|
356
356
|
class: [`${s}-dropdown`, l.overlayClass],
|
|
@@ -363,7 +363,7 @@ const ll = {
|
|
|
363
363
|
};
|
|
364
364
|
}
|
|
365
365
|
});
|
|
366
|
-
class
|
|
366
|
+
class tl {
|
|
367
367
|
constructor() {
|
|
368
368
|
// 事件池
|
|
369
369
|
U(this, "pools", {});
|
|
@@ -394,14 +394,14 @@ class ol {
|
|
|
394
394
|
});
|
|
395
395
|
}
|
|
396
396
|
}
|
|
397
|
-
const C = new
|
|
397
|
+
const C = new tl(), ll = (e, t = {
|
|
398
398
|
newWindow: !0,
|
|
399
399
|
nofollow: !0
|
|
400
400
|
}) => {
|
|
401
401
|
e || console.error("error link!");
|
|
402
402
|
const o = document.createElement("a");
|
|
403
403
|
o.href = e, o.style.display = "none", t.newWindow && (o.target = "_blank"), t.nofollow && (o.rel = "noopener noreferrer"), document.body.appendChild(o), o.click(), document.body.removeChild(o);
|
|
404
|
-
},
|
|
404
|
+
}, ol = (e, t = "image.png") => {
|
|
405
405
|
const o = e.split(","), l = o[0].match(/:(.*?);/);
|
|
406
406
|
if (l) {
|
|
407
407
|
const r = l[1], n = atob(o[1]);
|
|
@@ -412,7 +412,7 @@ const C = new ol(), nl = (e, t = {
|
|
|
412
412
|
return new File([c], t, { type: r });
|
|
413
413
|
}
|
|
414
414
|
return null;
|
|
415
|
-
},
|
|
415
|
+
}, nl = (e) => {
|
|
416
416
|
if (!e)
|
|
417
417
|
return e;
|
|
418
418
|
const t = e.split(`
|
|
@@ -420,14 +420,14 @@ const C = new ol(), nl = (e, t = {
|
|
|
420
420
|
return t.forEach(() => {
|
|
421
421
|
o.push("<span></span>");
|
|
422
422
|
}), o.push("</span>"), `<span class="code-block">${e}</span>${o.join("")}`;
|
|
423
|
-
},
|
|
423
|
+
}, ee = (e, t = 200) => {
|
|
424
424
|
let o = 0;
|
|
425
425
|
return (...l) => new Promise((r) => {
|
|
426
426
|
o && (clearTimeout(o), r("cancel")), o = window.setTimeout(() => {
|
|
427
427
|
e.apply(void 0, l), o = 0, r("done");
|
|
428
428
|
}, t);
|
|
429
429
|
});
|
|
430
|
-
},
|
|
430
|
+
}, rl = (e, t = 200) => {
|
|
431
431
|
let o = 0, l = null;
|
|
432
432
|
return (...r) => {
|
|
433
433
|
const n = (a) => {
|
|
@@ -435,13 +435,13 @@ const C = new ol(), nl = (e, t = {
|
|
|
435
435
|
};
|
|
436
436
|
l === null && window.requestAnimationFrame(n), l = r;
|
|
437
437
|
};
|
|
438
|
-
},
|
|
438
|
+
}, il = (e, t) => {
|
|
439
439
|
const o = e == null ? void 0 : e.getBoundingClientRect();
|
|
440
440
|
if (t === document.documentElement)
|
|
441
441
|
return o.top - t.clientTop;
|
|
442
442
|
const l = t == null ? void 0 : t.getBoundingClientRect();
|
|
443
443
|
return o.top - l.top;
|
|
444
|
-
},
|
|
444
|
+
}, al = () => `${Date.now().toString(36)}${Math.random().toString(36).substring(2)}`, sl = {
|
|
445
445
|
noPrettier: {
|
|
446
446
|
type: Boolean
|
|
447
447
|
},
|
|
@@ -482,7 +482,7 @@ const C = new ol(), nl = (e, t = {
|
|
|
482
482
|
noUploadImg: {
|
|
483
483
|
type: Boolean
|
|
484
484
|
}
|
|
485
|
-
}, me = "onSave", we = "changeCatalogVisible",
|
|
485
|
+
}, me = "onSave", we = "changeCatalogVisible", $t = "changeFullscreen", Qe = "pageFullscreenChanged", et = "fullscreenChanged", ve = "previewChanged", tt = "htmlPreviewChanged", lt = "catalogVisibleChanged", wt = "textareaFocus", ot = (e, t) => {
|
|
486
486
|
const o = (l) => {
|
|
487
487
|
const r = e.parentElement || document.body, n = r.offsetWidth, a = r.offsetHeight, { clientWidth: c } = document.documentElement, { clientHeight: m } = document.documentElement, u = l.offsetX, d = l.offsetY, f = (v) => {
|
|
488
488
|
let b = v.x + document.body.scrollLeft - document.body.clientLeft - u, k = v.y + document.body.scrollTop - document.body.clientTop - d;
|
|
@@ -502,10 +502,10 @@ const C = new ol(), nl = (e, t = {
|
|
|
502
502
|
typeof e.onload == "function" && e.onload(r), e.removeEventListener("load", l);
|
|
503
503
|
};
|
|
504
504
|
o ? t !== "" && typeof e.onload == "function" && (Reflect.get(window, t) ? e.dispatchEvent(new Event("load")) : o.addEventListener("load", l)) : (e.addEventListener("load", l), document.head.appendChild(e));
|
|
505
|
-
},
|
|
505
|
+
}, cl = ee((e, t, o) => {
|
|
506
506
|
const l = document.getElementById(e);
|
|
507
507
|
l && l.setAttribute(t, o);
|
|
508
|
-
}, 10),
|
|
508
|
+
}, 10), dl = (e) => {
|
|
509
509
|
var m, u, d, f;
|
|
510
510
|
const t = x("editorId");
|
|
511
511
|
let o = (u = (m = I.editorExtensions) == null ? void 0 : m.screenfull) == null ? void 0 : u.instance;
|
|
@@ -528,15 +528,15 @@ const C = new ol(), nl = (e, t = {
|
|
|
528
528
|
return A(() => {
|
|
529
529
|
if (a(), !o) {
|
|
530
530
|
const h = document.createElement("script");
|
|
531
|
-
h.src = l ||
|
|
531
|
+
h.src = l || Zt, h.onload = c, h.id = `${s}-screenfull`, O(h, "screenfull");
|
|
532
532
|
}
|
|
533
533
|
}), A(() => {
|
|
534
534
|
C.on(t, {
|
|
535
|
-
name:
|
|
535
|
+
name: $t,
|
|
536
536
|
callback: n
|
|
537
537
|
});
|
|
538
538
|
}), { fullscreenHandler: n };
|
|
539
|
-
},
|
|
539
|
+
}, ul = {
|
|
540
540
|
tableShape: {
|
|
541
541
|
type: Array,
|
|
542
542
|
default: () => [6, 4]
|
|
@@ -546,9 +546,9 @@ const C = new ol(), nl = (e, t = {
|
|
|
546
546
|
default: () => {
|
|
547
547
|
}
|
|
548
548
|
}
|
|
549
|
-
},
|
|
549
|
+
}, ml = /* @__PURE__ */ M({
|
|
550
550
|
name: "TableShape",
|
|
551
|
-
props:
|
|
551
|
+
props: ul,
|
|
552
552
|
setup(e) {
|
|
553
553
|
const t = N({
|
|
554
554
|
x: -1,
|
|
@@ -576,7 +576,7 @@ const C = new ol(), nl = (e, t = {
|
|
|
576
576
|
}, null)]))]))]);
|
|
577
577
|
}
|
|
578
578
|
});
|
|
579
|
-
const
|
|
579
|
+
const fl = {
|
|
580
580
|
title: {
|
|
581
581
|
type: String,
|
|
582
582
|
default: ""
|
|
@@ -615,7 +615,7 @@ const hl = {
|
|
|
615
615
|
type: String
|
|
616
616
|
}
|
|
617
617
|
}, Te = /* @__PURE__ */ M({
|
|
618
|
-
props:
|
|
618
|
+
props: fl,
|
|
619
619
|
setup(e, t) {
|
|
620
620
|
const o = F(e.visible), l = F([`${s}-modal`]), r = F(), n = F();
|
|
621
621
|
let a = () => {
|
|
@@ -647,7 +647,7 @@ const hl = {
|
|
|
647
647
|
c.initPos.left = d + "px", c.initPos.top = f + "px";
|
|
648
648
|
});
|
|
649
649
|
}), T(() => e.visible, (u) => {
|
|
650
|
-
u ? (l.value.push("zoom-in"), o.value = u,
|
|
650
|
+
u ? (l.value.push("zoom-in"), o.value = u, z(() => {
|
|
651
651
|
const d = r.value.offsetWidth / 2, f = r.value.offsetHeight / 2, h = document.documentElement.clientWidth / 2, v = document.documentElement.clientHeight / 2;
|
|
652
652
|
c.initPos.left = h - d + "px", c.initPos.top = v - f + "px";
|
|
653
653
|
}), setTimeout(() => {
|
|
@@ -710,7 +710,7 @@ const hl = {
|
|
|
710
710
|
}, null)])])])])]);
|
|
711
711
|
};
|
|
712
712
|
}
|
|
713
|
-
}),
|
|
713
|
+
}), gl = {
|
|
714
714
|
type: {
|
|
715
715
|
type: String,
|
|
716
716
|
default: "link"
|
|
@@ -729,8 +729,8 @@ const hl = {
|
|
|
729
729
|
default: () => {
|
|
730
730
|
}
|
|
731
731
|
}
|
|
732
|
-
},
|
|
733
|
-
props:
|
|
732
|
+
}, hl = /* @__PURE__ */ M({
|
|
733
|
+
props: gl,
|
|
734
734
|
setup(e) {
|
|
735
735
|
const t = x("usedLanguageText"), o = x("editorId"), l = D(() => {
|
|
736
736
|
var n, a;
|
|
@@ -800,7 +800,7 @@ const hl = {
|
|
|
800
800
|
});
|
|
801
801
|
}
|
|
802
802
|
});
|
|
803
|
-
const
|
|
803
|
+
const vl = {
|
|
804
804
|
visible: {
|
|
805
805
|
type: Boolean,
|
|
806
806
|
default: !1
|
|
@@ -815,8 +815,8 @@ const bl = {
|
|
|
815
815
|
default: () => {
|
|
816
816
|
}
|
|
817
817
|
}
|
|
818
|
-
},
|
|
819
|
-
props:
|
|
818
|
+
}, pl = /* @__PURE__ */ M({
|
|
819
|
+
props: vl,
|
|
820
820
|
setup(e) {
|
|
821
821
|
var d, f;
|
|
822
822
|
const t = x("usedLanguageText"), o = x("editorId");
|
|
@@ -842,7 +842,7 @@ const bl = {
|
|
|
842
842
|
if (c.imgSelected = !0, (h == null ? void 0 : h.length) > 0) {
|
|
843
843
|
const v = new FileReader();
|
|
844
844
|
v.onload = (b) => {
|
|
845
|
-
c.imgSrc = b.target.result,
|
|
845
|
+
c.imgSrc = b.target.result, z(() => {
|
|
846
846
|
m = new l(n.value, {
|
|
847
847
|
viewMode: 2,
|
|
848
848
|
preview: `.${s}-clip-preview-target`
|
|
@@ -855,7 +855,7 @@ const bl = {
|
|
|
855
855
|
}), T(() => [c.imgSelected], () => {
|
|
856
856
|
a.value.style = "";
|
|
857
857
|
}), T(() => c.isFullscreen, () => {
|
|
858
|
-
|
|
858
|
+
z(() => {
|
|
859
859
|
m == null || m.destroy(), a.value.style = "", n.value && (m = new l(n.value, {
|
|
860
860
|
viewMode: 2,
|
|
861
861
|
preview: `.${s}-clip-preview-target`
|
|
@@ -927,7 +927,7 @@ const bl = {
|
|
|
927
927
|
onClick: () => {
|
|
928
928
|
if (m) {
|
|
929
929
|
const k = m.getCroppedCanvas();
|
|
930
|
-
C.emit(o, "uploadImage", [
|
|
930
|
+
C.emit(o, "uploadImage", [ol(k.toDataURL("image/png"))], e.onOk), u();
|
|
931
931
|
}
|
|
932
932
|
}
|
|
933
933
|
}, [((v = t.value.clipModalTips) == null ? void 0 : v.buttonUpload) || ((b = t.value.linkModalTips) == null ? void 0 : b.buttonOK)])]), i("input", {
|
|
@@ -943,7 +943,7 @@ const bl = {
|
|
|
943
943
|
});
|
|
944
944
|
};
|
|
945
945
|
}
|
|
946
|
-
}),
|
|
946
|
+
}), bl = {
|
|
947
947
|
type: {
|
|
948
948
|
type: String,
|
|
949
949
|
default: "link"
|
|
@@ -966,27 +966,27 @@ const bl = {
|
|
|
966
966
|
default: () => {
|
|
967
967
|
}
|
|
968
968
|
}
|
|
969
|
-
},
|
|
970
|
-
props:
|
|
969
|
+
}, kl = /* @__PURE__ */ M({
|
|
970
|
+
props: bl,
|
|
971
971
|
setup(e) {
|
|
972
|
-
return () => i(Ce, null, [i(
|
|
972
|
+
return () => i(Ce, null, [i(hl, {
|
|
973
973
|
type: e.type,
|
|
974
974
|
visible: e.linkVisible,
|
|
975
975
|
onOk: e.onOk,
|
|
976
976
|
onCancel: e.onCancel
|
|
977
|
-
}, null), i(
|
|
977
|
+
}, null), i(pl, {
|
|
978
978
|
visible: e.clipVisible,
|
|
979
979
|
onOk: e.onOk,
|
|
980
980
|
onCancel: e.onCancel
|
|
981
981
|
}, null)]);
|
|
982
982
|
}
|
|
983
|
-
}),
|
|
983
|
+
}), yl = /* @__PURE__ */ M({
|
|
984
984
|
name: "MDEditorToolbar",
|
|
985
|
-
props:
|
|
985
|
+
props: sl,
|
|
986
986
|
setup(e) {
|
|
987
987
|
const t = x("editorId"), o = x("usedLanguageText"), {
|
|
988
988
|
fullscreenHandler: l
|
|
989
|
-
} =
|
|
989
|
+
} = dl(e), r = `${t}-toolbar-wrapper`, n = N({
|
|
990
990
|
title: !1,
|
|
991
991
|
catalog: !1,
|
|
992
992
|
// 图片上传下拉
|
|
@@ -1021,11 +1021,11 @@ const bl = {
|
|
|
1021
1021
|
d.value.addEventListener("change", f);
|
|
1022
1022
|
});
|
|
1023
1023
|
const h = (v) => {
|
|
1024
|
-
var b, k, p, y, $, w, L, S,
|
|
1025
|
-
if (
|
|
1024
|
+
var b, k, p, y, $, w, L, S, j, B, q, te, Z, K, P, X, R, V, le, ie, Se, xe, Ee, Le, He, Ie, Ae, Fe, Me, Re, je, Be, Pe, Oe, De, Ne, _e, Ve, Ue, qe, We, Ge, ze;
|
|
1025
|
+
if (yt.includes(v))
|
|
1026
1026
|
switch (v) {
|
|
1027
1027
|
case "-":
|
|
1028
|
-
return i(
|
|
1028
|
+
return i(Qt, null, null);
|
|
1029
1029
|
case "bold":
|
|
1030
1030
|
return i("div", {
|
|
1031
1031
|
class: `${s}-toolbar-item`,
|
|
@@ -1115,12 +1115,12 @@ const bl = {
|
|
|
1115
1115
|
onClick: () => {
|
|
1116
1116
|
a("h5");
|
|
1117
1117
|
}
|
|
1118
|
-
}, [(
|
|
1118
|
+
}, [(j = o.value.titleItem) == null ? void 0 : j.h5]), i("li", {
|
|
1119
1119
|
class: `${s}-menu-item`,
|
|
1120
1120
|
onClick: () => {
|
|
1121
1121
|
a("h6");
|
|
1122
1122
|
}
|
|
1123
|
-
}, [(
|
|
1123
|
+
}, [(B = o.value.titleItem) == null ? void 0 : B.h6])])
|
|
1124
1124
|
}, {
|
|
1125
1125
|
default: () => {
|
|
1126
1126
|
var E;
|
|
@@ -1138,7 +1138,7 @@ const bl = {
|
|
|
1138
1138
|
case "sub":
|
|
1139
1139
|
return i("div", {
|
|
1140
1140
|
class: `${s}-toolbar-item`,
|
|
1141
|
-
title: (
|
|
1141
|
+
title: (q = o.value.toolbarTips) == null ? void 0 : q.sub,
|
|
1142
1142
|
onClick: () => {
|
|
1143
1143
|
a("sub");
|
|
1144
1144
|
}
|
|
@@ -1151,7 +1151,7 @@ const bl = {
|
|
|
1151
1151
|
case "sup":
|
|
1152
1152
|
return i("div", {
|
|
1153
1153
|
class: `${s}-toolbar-item`,
|
|
1154
|
-
title: (
|
|
1154
|
+
title: (te = o.value.toolbarTips) == null ? void 0 : te.sup,
|
|
1155
1155
|
onClick: () => {
|
|
1156
1156
|
a("sup");
|
|
1157
1157
|
}
|
|
@@ -1190,7 +1190,7 @@ const bl = {
|
|
|
1190
1190
|
case "orderedList":
|
|
1191
1191
|
return i("div", {
|
|
1192
1192
|
class: `${s}-toolbar-item`,
|
|
1193
|
-
title: (
|
|
1193
|
+
title: (P = o.value.toolbarTips) == null ? void 0 : P.orderedList,
|
|
1194
1194
|
onClick: () => {
|
|
1195
1195
|
a("orderedList");
|
|
1196
1196
|
}
|
|
@@ -1216,7 +1216,7 @@ const bl = {
|
|
|
1216
1216
|
case "codeRow":
|
|
1217
1217
|
return i("div", {
|
|
1218
1218
|
class: `${s}-toolbar-item`,
|
|
1219
|
-
title: (
|
|
1219
|
+
title: (R = o.value.toolbarTips) == null ? void 0 : R.codeRow,
|
|
1220
1220
|
onClick: () => {
|
|
1221
1221
|
a("codeRow");
|
|
1222
1222
|
}
|
|
@@ -1242,7 +1242,7 @@ const bl = {
|
|
|
1242
1242
|
case "link":
|
|
1243
1243
|
return i("div", {
|
|
1244
1244
|
class: `${s}-toolbar-item`,
|
|
1245
|
-
title: (
|
|
1245
|
+
title: (le = o.value.toolbarTips) == null ? void 0 : le.link,
|
|
1246
1246
|
onClick: () => {
|
|
1247
1247
|
c.type = "link", c.linkVisible = !0;
|
|
1248
1248
|
}
|
|
@@ -1255,7 +1255,7 @@ const bl = {
|
|
|
1255
1255
|
case "image":
|
|
1256
1256
|
return e.noUploadImg ? i("div", {
|
|
1257
1257
|
class: `${s}-toolbar-item`,
|
|
1258
|
-
title: (
|
|
1258
|
+
title: (ie = o.value.toolbarTips) == null ? void 0 : ie.image,
|
|
1259
1259
|
onClick: () => {
|
|
1260
1260
|
c.type = "image", c.linkVisible = !0;
|
|
1261
1261
|
}
|
|
@@ -1313,7 +1313,7 @@ const bl = {
|
|
|
1313
1313
|
n.table = E;
|
|
1314
1314
|
},
|
|
1315
1315
|
key: "bar-table",
|
|
1316
|
-
overlay: i(
|
|
1316
|
+
overlay: i(ml, {
|
|
1317
1317
|
tableShape: e.tableShape,
|
|
1318
1318
|
onSelected: (E) => {
|
|
1319
1319
|
a("table", {
|
|
@@ -1416,7 +1416,7 @@ const bl = {
|
|
|
1416
1416
|
case "preview":
|
|
1417
1417
|
return i("div", {
|
|
1418
1418
|
class: `${s}-toolbar-item`,
|
|
1419
|
-
title: (
|
|
1419
|
+
title: (Re = o.value.toolbarTips) == null ? void 0 : Re.preview,
|
|
1420
1420
|
onClick: () => {
|
|
1421
1421
|
e.updateSetting("preview");
|
|
1422
1422
|
}
|
|
@@ -1429,7 +1429,7 @@ const bl = {
|
|
|
1429
1429
|
case "htmlPreview":
|
|
1430
1430
|
return i("div", {
|
|
1431
1431
|
class: `${s}-toolbar-item`,
|
|
1432
|
-
title: (
|
|
1432
|
+
title: (je = o.value.toolbarTips) == null ? void 0 : je.htmlPreview,
|
|
1433
1433
|
onClick: () => {
|
|
1434
1434
|
e.updateSetting("htmlPreview");
|
|
1435
1435
|
}
|
|
@@ -1442,7 +1442,7 @@ const bl = {
|
|
|
1442
1442
|
case "catalog":
|
|
1443
1443
|
return i("div", {
|
|
1444
1444
|
class: `${s}-toolbar-item`,
|
|
1445
|
-
title: (
|
|
1445
|
+
title: (Be = o.value.toolbarTips) == null ? void 0 : Be.catalog,
|
|
1446
1446
|
onClick: () => {
|
|
1447
1447
|
C.emit(t, we);
|
|
1448
1448
|
},
|
|
@@ -1456,8 +1456,8 @@ const bl = {
|
|
|
1456
1456
|
case "github":
|
|
1457
1457
|
return i("div", {
|
|
1458
1458
|
class: `${s}-toolbar-item`,
|
|
1459
|
-
title: (
|
|
1460
|
-
onClick: () =>
|
|
1459
|
+
title: (Pe = o.value.toolbarTips) == null ? void 0 : Pe.github,
|
|
1460
|
+
onClick: () => ll("https://github.com/imzbf/md-editor-v3")
|
|
1461
1461
|
}, [i("svg", {
|
|
1462
1462
|
class: `${s}-icon`,
|
|
1463
1463
|
"aria-hidden": "true"
|
|
@@ -1594,7 +1594,7 @@ const bl = {
|
|
|
1594
1594
|
style: {
|
|
1595
1595
|
display: "none"
|
|
1596
1596
|
}
|
|
1597
|
-
}, null), i(
|
|
1597
|
+
}, null), i(kl, {
|
|
1598
1598
|
linkVisible: c.linkVisible,
|
|
1599
1599
|
clipVisible: c.clipVisible,
|
|
1600
1600
|
type: c.type,
|
|
@@ -1610,18 +1610,18 @@ const bl = {
|
|
|
1610
1610
|
}, null)]);
|
|
1611
1611
|
};
|
|
1612
1612
|
}
|
|
1613
|
-
}),
|
|
1613
|
+
}), oe = (e, t, o) => {
|
|
1614
1614
|
let l = e.scrollTop;
|
|
1615
1615
|
const r = () => {
|
|
1616
1616
|
const n = t - l;
|
|
1617
1617
|
l = l + n / 5, Math.abs(n) < 1 ? (e.scrollTo(0, t), o && o()) : (e.scrollTo(0, l), requestAnimationFrame(r));
|
|
1618
1618
|
};
|
|
1619
1619
|
r();
|
|
1620
|
-
},
|
|
1620
|
+
}, se = (e) => {
|
|
1621
1621
|
const { marginTop: t } = getComputedStyle(e);
|
|
1622
1622
|
return e.offsetTop - parseFloat(t);
|
|
1623
|
-
},
|
|
1624
|
-
const o =
|
|
1623
|
+
}, Cl = (e, t) => {
|
|
1624
|
+
const o = ee(() => {
|
|
1625
1625
|
e.removeEventListener("scroll", l), e.addEventListener("scroll", l), t.removeEventListener("scroll", l), t.addEventListener("scroll", l);
|
|
1626
1626
|
}, 50), l = (r) => {
|
|
1627
1627
|
const n = e.clientHeight, a = t.clientHeight, c = e.scrollHeight, m = t.scrollHeight, u = (c - n) / (m - a);
|
|
@@ -1643,10 +1643,10 @@ const bl = {
|
|
|
1643
1643
|
e.removeEventListener("scroll", l), t.removeEventListener("scroll", l);
|
|
1644
1644
|
}
|
|
1645
1645
|
];
|
|
1646
|
-
},
|
|
1646
|
+
}, $l = (e, t, o, l) => {
|
|
1647
1647
|
const { view: r } = o;
|
|
1648
1648
|
let n = 0;
|
|
1649
|
-
const a =
|
|
1649
|
+
const a = ee(() => {
|
|
1650
1650
|
e.removeEventListener("scroll", u), e.addEventListener("scroll", u), t.removeEventListener("scroll", u), t.addEventListener("scroll", u);
|
|
1651
1651
|
}, 50);
|
|
1652
1652
|
let c = [];
|
|
@@ -1666,7 +1666,7 @@ const bl = {
|
|
|
1666
1666
|
};
|
|
1667
1667
|
c.push($);
|
|
1668
1668
|
}), k.remove();
|
|
1669
|
-
}, u =
|
|
1669
|
+
}, u = ee((d) => {
|
|
1670
1670
|
var b, k;
|
|
1671
1671
|
n++;
|
|
1672
1672
|
const f = r.lineBlockAtHeight(r.scrollDOM.scrollTop), h = r.state.doc.lineAt(f.from), v = Array.from(t.children[0].children).filter(
|
|
@@ -1674,19 +1674,19 @@ const bl = {
|
|
|
1674
1674
|
);
|
|
1675
1675
|
if (d.target === e) {
|
|
1676
1676
|
if (t.removeEventListener("scroll", u), e.scrollTop + e.clientHeight >= e.scrollHeight) {
|
|
1677
|
-
|
|
1677
|
+
oe(t, t.scrollHeight - t.clientHeight, () => {
|
|
1678
1678
|
--n === 0 && a();
|
|
1679
1679
|
});
|
|
1680
1680
|
return;
|
|
1681
1681
|
}
|
|
1682
1682
|
const { number: p } = h;
|
|
1683
1683
|
let y = (b = t.firstElementChild) == null ? void 0 : b.firstElementChild, $ = 1, w = v.length === 0 ? (k = t.firstElementChild) == null ? void 0 : k.lastElementChild : v[0], L = v.length === 0 ? 0 : Number(v[0].dataset.line);
|
|
1684
|
-
for (let
|
|
1685
|
-
const X = Number(v[
|
|
1686
|
-
|
|
1684
|
+
for (let P = 0; P < v.length; P++) {
|
|
1685
|
+
const X = Number(v[P].dataset.line) + 1, R = Number(
|
|
1686
|
+
P + 1 >= v.length ? -2 : v[P + 1].dataset.line
|
|
1687
1687
|
);
|
|
1688
|
-
if (p >= X && p <=
|
|
1689
|
-
y = v[
|
|
1688
|
+
if (p >= X && p <= R) {
|
|
1689
|
+
y = v[P], w = v[P + 1], $ = X, L = R;
|
|
1690
1690
|
break;
|
|
1691
1691
|
}
|
|
1692
1692
|
}
|
|
@@ -1694,18 +1694,18 @@ const bl = {
|
|
|
1694
1694
|
n--;
|
|
1695
1695
|
return;
|
|
1696
1696
|
}
|
|
1697
|
-
const S = (r.scrollDOM.scrollTop - c[$ - 1].scrollHeight + c[$ - 1].lineHeight) / (c[L - 1].scrollHeight - c[$ - 1].scrollHeight + c[$ - 1].lineHeight), { marginTop:
|
|
1698
|
-
|
|
1697
|
+
const S = (r.scrollDOM.scrollTop - c[$ - 1].scrollHeight + c[$ - 1].lineHeight) / (c[L - 1].scrollHeight - c[$ - 1].scrollHeight + c[$ - 1].lineHeight), { marginTop: j } = getComputedStyle(y), B = y.offsetTop - parseFloat(j), { marginTop: q } = getComputedStyle(w), Z = w.offsetTop - parseFloat(q) - B, K = B + Z * S;
|
|
1698
|
+
oe(t, K, () => {
|
|
1699
1699
|
--n === 0 && a();
|
|
1700
1700
|
});
|
|
1701
1701
|
} else {
|
|
1702
1702
|
if (e.removeEventListener("scroll", u), t.scrollTop === 0) {
|
|
1703
|
-
|
|
1703
|
+
oe(e, 0, () => {
|
|
1704
1704
|
--n === 0 && a();
|
|
1705
1705
|
});
|
|
1706
1706
|
return;
|
|
1707
1707
|
} else if (t.scrollTop + t.clientHeight >= t.scrollHeight) {
|
|
1708
|
-
|
|
1708
|
+
oe(e, e.scrollHeight - e.clientHeight, () => {
|
|
1709
1709
|
--n === 0 && a();
|
|
1710
1710
|
});
|
|
1711
1711
|
return;
|
|
@@ -1714,10 +1714,10 @@ const bl = {
|
|
|
1714
1714
|
let $ = Math.floor(
|
|
1715
1715
|
Number(v[v.length - 1].dataset.line) * (p / y)
|
|
1716
1716
|
), w;
|
|
1717
|
-
for (let
|
|
1718
|
-
const V = t.querySelector(`[data-line="${
|
|
1717
|
+
for (let R = $; R >= 0; R--) {
|
|
1718
|
+
const V = t.querySelector(`[data-line="${R}"]`);
|
|
1719
1719
|
if (V) {
|
|
1720
|
-
w = V, $ =
|
|
1720
|
+
w = V, $ = R;
|
|
1721
1721
|
break;
|
|
1722
1722
|
}
|
|
1723
1723
|
}
|
|
@@ -1727,24 +1727,24 @@ const bl = {
|
|
|
1727
1727
|
}
|
|
1728
1728
|
let L, S;
|
|
1729
1729
|
for (; ; ) {
|
|
1730
|
-
const
|
|
1731
|
-
if (
|
|
1732
|
-
if (
|
|
1730
|
+
const R = v.indexOf(w), V = v[R + 1], le = se(w);
|
|
1731
|
+
if (le > p) {
|
|
1732
|
+
if (R === 0) {
|
|
1733
1733
|
L = w, S = V;
|
|
1734
1734
|
break;
|
|
1735
1735
|
}
|
|
1736
|
-
w = v[
|
|
1736
|
+
w = v[R - 1];
|
|
1737
1737
|
continue;
|
|
1738
1738
|
}
|
|
1739
|
-
const
|
|
1740
|
-
if (
|
|
1739
|
+
const ie = se(V);
|
|
1740
|
+
if (le <= p && ie > p) {
|
|
1741
1741
|
L = w, S = V;
|
|
1742
1742
|
break;
|
|
1743
1743
|
}
|
|
1744
1744
|
w = V;
|
|
1745
1745
|
}
|
|
1746
|
-
const
|
|
1747
|
-
|
|
1746
|
+
const j = se(L), B = se(S), q = (p - j) / (B - j), te = Number(L.dataset.line), Z = Number(S.dataset.line), K = c[te].scrollHeight, X = c[Z].scrollHeight - K;
|
|
1747
|
+
oe(e, K + X * q, () => {
|
|
1748
1748
|
--n === 0 && a();
|
|
1749
1749
|
});
|
|
1750
1750
|
}
|
|
@@ -1765,38 +1765,32 @@ const bl = {
|
|
|
1765
1765
|
}, c = () => {
|
|
1766
1766
|
};
|
|
1767
1767
|
const m = () => {
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
d && !n && q(() => {
|
|
1773
|
-
a();
|
|
1774
|
-
const f = document.querySelector(".cm-scroller");
|
|
1775
|
-
[c, a] = (o.value ? rt : nt)(
|
|
1776
|
-
f,
|
|
1777
|
-
o.value || l.value,
|
|
1778
|
-
r.value,
|
|
1779
|
-
e.value
|
|
1780
|
-
), c();
|
|
1781
|
-
});
|
|
1782
|
-
};
|
|
1783
|
-
T(() => t.value, m), T(() => e.setting.preview, u), T(() => e.setting.htmlPreview, u), T(
|
|
1784
|
-
[ce(e.setting, "fullscreen"), ce(e.setting, "pageFullscreen")],
|
|
1785
|
-
m
|
|
1786
|
-
), T(
|
|
1787
|
-
() => e.scrollAuto,
|
|
1788
|
-
(d) => {
|
|
1789
|
-
d ? c() : a();
|
|
1790
|
-
}
|
|
1791
|
-
), A(() => {
|
|
1792
|
-
const d = document.querySelector(".cm-scroller");
|
|
1793
|
-
!n && (o.value || l.value) && ([c, a] = (o.value ? rt : nt)(
|
|
1794
|
-
d,
|
|
1768
|
+
a();
|
|
1769
|
+
const u = document.querySelector(".cm-scroller");
|
|
1770
|
+
!n && (o.value || l.value) && ([c, a] = (o.value ? $l : Cl)(
|
|
1771
|
+
u,
|
|
1795
1772
|
o.value || l.value,
|
|
1796
1773
|
r.value,
|
|
1797
1774
|
e.value
|
|
1798
1775
|
)), e.scrollAuto && c();
|
|
1799
|
-
}
|
|
1776
|
+
};
|
|
1777
|
+
T(
|
|
1778
|
+
[
|
|
1779
|
+
t,
|
|
1780
|
+
Q(e.setting, "preview"),
|
|
1781
|
+
Q(e.setting, "htmlPreview"),
|
|
1782
|
+
Q(e.setting, "fullscreen"),
|
|
1783
|
+
Q(e.setting, "pageFullscreen")
|
|
1784
|
+
],
|
|
1785
|
+
() => {
|
|
1786
|
+
z(m);
|
|
1787
|
+
}
|
|
1788
|
+
), T(
|
|
1789
|
+
() => e.scrollAuto,
|
|
1790
|
+
(u) => {
|
|
1791
|
+
u ? c() : a();
|
|
1792
|
+
}
|
|
1793
|
+
), A(m);
|
|
1800
1794
|
}, Tl = (e, t, o) => {
|
|
1801
1795
|
var d, f, h, v, b, k;
|
|
1802
1796
|
let l = "", r = 0, n = 0, a = !0, c = !1;
|
|
@@ -2009,18 +2003,18 @@ $$
|
|
|
2009
2003
|
replaceAll: c
|
|
2010
2004
|
}
|
|
2011
2005
|
};
|
|
2012
|
-
}, Sl = "#e5c07b",
|
|
2006
|
+
}, Sl = "#e5c07b", nt = "var(--md-color)", xl = "#56b6c2", El = "#ffffff", ne = "var(--md-color)", rt = "#e5c07b", Ll = "#e5c07b", Hl = "var(--md-color)", it = "#d19a66", Il = "#c678dd", Al = "#21252b", at = "#2c313a", st = "#000", ge = "#353a42", Fl = "#ceedfa33", ct = "#528bff", Ml = $e.theme(
|
|
2013
2007
|
{
|
|
2014
2008
|
"&": {
|
|
2015
|
-
color:
|
|
2016
|
-
backgroundColor:
|
|
2009
|
+
color: ne,
|
|
2010
|
+
backgroundColor: st
|
|
2017
2011
|
},
|
|
2018
2012
|
".cm-content": {
|
|
2019
|
-
caretColor:
|
|
2013
|
+
caretColor: ct
|
|
2020
2014
|
},
|
|
2021
|
-
".cm-cursor, .cm-dropCursor": { borderLeftColor:
|
|
2015
|
+
".cm-cursor, .cm-dropCursor": { borderLeftColor: ct },
|
|
2022
2016
|
"&.cm-focused .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection": { backgroundColor: Fl },
|
|
2023
|
-
".cm-panels": { backgroundColor: Al, color:
|
|
2017
|
+
".cm-panels": { backgroundColor: Al, color: ne },
|
|
2024
2018
|
".cm-panels.cm-panels-top": { borderBottom: "2px solid black" },
|
|
2025
2019
|
".cm-panels.cm-panels-bottom": { borderTop: "2px solid black" },
|
|
2026
2020
|
".cm-searchMatch": {
|
|
@@ -2036,13 +2030,13 @@ $$
|
|
|
2036
2030
|
backgroundColor: "#bad0f847"
|
|
2037
2031
|
},
|
|
2038
2032
|
".cm-gutters": {
|
|
2039
|
-
backgroundColor:
|
|
2040
|
-
color:
|
|
2033
|
+
backgroundColor: st,
|
|
2034
|
+
color: ne,
|
|
2041
2035
|
borderRight: "1px solid",
|
|
2042
2036
|
borderColor: "var(--md-border-color)"
|
|
2043
2037
|
},
|
|
2044
2038
|
".cm-activeLineGutter": {
|
|
2045
|
-
backgroundColor:
|
|
2039
|
+
backgroundColor: at
|
|
2046
2040
|
},
|
|
2047
2041
|
".cm-foldPlaceholder": {
|
|
2048
2042
|
backgroundColor: "transparent",
|
|
@@ -2063,18 +2057,18 @@ $$
|
|
|
2063
2057
|
},
|
|
2064
2058
|
".cm-tooltip-autocomplete": {
|
|
2065
2059
|
"& > ul > li[aria-selected]": {
|
|
2066
|
-
backgroundColor:
|
|
2067
|
-
color:
|
|
2060
|
+
backgroundColor: at,
|
|
2061
|
+
color: ne
|
|
2068
2062
|
}
|
|
2069
2063
|
}
|
|
2070
2064
|
},
|
|
2071
2065
|
{ dark: !0 }
|
|
2072
|
-
),
|
|
2066
|
+
), Rl = bt.define([
|
|
2073
2067
|
{ tag: g.keyword, color: Il },
|
|
2074
|
-
{ tag: [g.name, g.deleted, g.character, g.propertyName, g.macroName], color:
|
|
2068
|
+
{ tag: [g.name, g.deleted, g.character, g.propertyName, g.macroName], color: nt },
|
|
2075
2069
|
{ tag: [g.function(g.variableName), g.labelName], color: Ll },
|
|
2076
|
-
{ tag: [g.color, g.constant(g.name), g.standard(g.name)], color:
|
|
2077
|
-
{ tag: [g.definition(g.name), g.separator], color:
|
|
2070
|
+
{ tag: [g.color, g.constant(g.name), g.standard(g.name)], color: it },
|
|
2071
|
+
{ tag: [g.definition(g.name), g.separator], color: ne },
|
|
2078
2072
|
{
|
|
2079
2073
|
tag: [
|
|
2080
2074
|
g.typeName,
|
|
@@ -2100,30 +2094,30 @@ $$
|
|
|
2100
2094
|
],
|
|
2101
2095
|
color: xl
|
|
2102
2096
|
},
|
|
2103
|
-
{ tag: [g.meta, g.comment], color:
|
|
2097
|
+
{ tag: [g.meta, g.comment], color: rt },
|
|
2104
2098
|
{ tag: g.strong, fontWeight: "bold" },
|
|
2105
2099
|
{ tag: g.emphasis, fontStyle: "italic" },
|
|
2106
2100
|
{ tag: g.strikethrough, textDecoration: "line-through" },
|
|
2107
|
-
{ tag: g.link, color:
|
|
2108
|
-
{ tag: g.heading, fontWeight: "bold", color:
|
|
2109
|
-
{ tag: [g.atom, g.bool, g.special(g.variableName)], color:
|
|
2101
|
+
{ tag: g.link, color: rt, textDecoration: "underline" },
|
|
2102
|
+
{ tag: g.heading, fontWeight: "bold", color: nt },
|
|
2103
|
+
{ tag: [g.atom, g.bool, g.special(g.variableName)], color: it },
|
|
2110
2104
|
{ tag: [g.processingInstruction, g.string, g.inserted], color: Hl },
|
|
2111
2105
|
{ tag: g.invalid, color: El }
|
|
2112
|
-
]),
|
|
2106
|
+
]), jl = [
|
|
2113
2107
|
Ml,
|
|
2114
|
-
|
|
2115
|
-
],
|
|
2108
|
+
kt(Rl)
|
|
2109
|
+
], Bl = "#e5c07b", dt = "#3f4a54", Pl = "#56b6c2", Ol = "#fff", re = "#3f4a54", ut = "#2d8cf0", Dl = "#2d8cf0", Nl = "#3f4a54", mt = "#d19a66", _l = "#c678dd", Vl = "#21252b", ft = "#2c313a", gt = "#fff", he = "#353a42", Ul = "#bad5fa", ht = "#3f4a54", ql = $e.theme(
|
|
2116
2110
|
{
|
|
2117
2111
|
"&": {
|
|
2118
|
-
color:
|
|
2119
|
-
backgroundColor:
|
|
2112
|
+
color: re,
|
|
2113
|
+
backgroundColor: gt
|
|
2120
2114
|
},
|
|
2121
2115
|
".cm-content": {
|
|
2122
|
-
caretColor:
|
|
2116
|
+
caretColor: ht
|
|
2123
2117
|
},
|
|
2124
|
-
".cm-cursor, .cm-dropCursor": { borderLeftColor:
|
|
2118
|
+
".cm-cursor, .cm-dropCursor": { borderLeftColor: ht },
|
|
2125
2119
|
"&.cm-focused .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection": { backgroundColor: Ul },
|
|
2126
|
-
".cm-panels": { backgroundColor: Vl, color:
|
|
2120
|
+
".cm-panels": { backgroundColor: Vl, color: re },
|
|
2127
2121
|
".cm-panels.cm-panels-top": { borderBottom: "2px solid black" },
|
|
2128
2122
|
".cm-panels.cm-panels-bottom": { borderTop: "2px solid black" },
|
|
2129
2123
|
".cm-searchMatch": {
|
|
@@ -2139,13 +2133,13 @@ $$
|
|
|
2139
2133
|
backgroundColor: "#bad0f847"
|
|
2140
2134
|
},
|
|
2141
2135
|
".cm-gutters": {
|
|
2142
|
-
backgroundColor:
|
|
2143
|
-
color:
|
|
2136
|
+
backgroundColor: gt,
|
|
2137
|
+
color: re,
|
|
2144
2138
|
borderRight: "1px solid",
|
|
2145
2139
|
borderColor: "var(--md-border-color)"
|
|
2146
2140
|
},
|
|
2147
2141
|
".cm-activeLineGutter": {
|
|
2148
|
-
backgroundColor:
|
|
2142
|
+
backgroundColor: ft
|
|
2149
2143
|
},
|
|
2150
2144
|
".cm-foldPlaceholder": {
|
|
2151
2145
|
backgroundColor: "transparent",
|
|
@@ -2166,18 +2160,18 @@ $$
|
|
|
2166
2160
|
},
|
|
2167
2161
|
".cm-tooltip-autocomplete": {
|
|
2168
2162
|
"& > ul > li[aria-selected]": {
|
|
2169
|
-
backgroundColor:
|
|
2170
|
-
color:
|
|
2163
|
+
backgroundColor: ft,
|
|
2164
|
+
color: re
|
|
2171
2165
|
}
|
|
2172
2166
|
}
|
|
2173
2167
|
},
|
|
2174
2168
|
{ dark: !0 }
|
|
2175
|
-
), Wl =
|
|
2169
|
+
), Wl = bt.define([
|
|
2176
2170
|
{ tag: g.keyword, color: _l },
|
|
2177
|
-
{ tag: [g.name, g.deleted, g.character, g.propertyName, g.macroName], color:
|
|
2171
|
+
{ tag: [g.name, g.deleted, g.character, g.propertyName, g.macroName], color: dt },
|
|
2178
2172
|
{ tag: [g.function(g.variableName), g.labelName], color: Dl },
|
|
2179
|
-
{ tag: [g.color, g.constant(g.name), g.standard(g.name)], color:
|
|
2180
|
-
{ tag: [g.definition(g.name), g.separator], color:
|
|
2173
|
+
{ tag: [g.color, g.constant(g.name), g.standard(g.name)], color: mt },
|
|
2174
|
+
{ tag: [g.definition(g.name), g.separator], color: re },
|
|
2181
2175
|
{
|
|
2182
2176
|
tag: [
|
|
2183
2177
|
g.typeName,
|
|
@@ -2189,7 +2183,7 @@ $$
|
|
|
2189
2183
|
g.self,
|
|
2190
2184
|
g.namespace
|
|
2191
2185
|
],
|
|
2192
|
-
color:
|
|
2186
|
+
color: Bl
|
|
2193
2187
|
},
|
|
2194
2188
|
{
|
|
2195
2189
|
tag: [
|
|
@@ -2201,24 +2195,24 @@ $$
|
|
|
2201
2195
|
g.link,
|
|
2202
2196
|
g.special(g.string)
|
|
2203
2197
|
],
|
|
2204
|
-
color:
|
|
2198
|
+
color: Pl
|
|
2205
2199
|
},
|
|
2206
|
-
{ tag: [g.meta, g.comment], color:
|
|
2200
|
+
{ tag: [g.meta, g.comment], color: ut },
|
|
2207
2201
|
{ tag: g.strong, fontWeight: "bold" },
|
|
2208
2202
|
{ tag: g.emphasis, fontStyle: "italic" },
|
|
2209
2203
|
{ tag: g.strikethrough, textDecoration: "line-through" },
|
|
2210
|
-
{ tag: g.link, color:
|
|
2211
|
-
{ tag: g.heading, fontWeight: "bold", color:
|
|
2212
|
-
{ tag: [g.atom, g.bool, g.special(g.variableName)], color:
|
|
2204
|
+
{ tag: g.link, color: ut, textDecoration: "underline" },
|
|
2205
|
+
{ tag: g.heading, fontWeight: "bold", color: dt },
|
|
2206
|
+
{ tag: [g.atom, g.bool, g.special(g.variableName)], color: mt },
|
|
2213
2207
|
{ tag: [g.processingInstruction, g.string, g.inserted], color: Nl },
|
|
2214
2208
|
{ tag: g.invalid, color: Ol }
|
|
2215
2209
|
]), Gl = [
|
|
2216
2210
|
ql,
|
|
2217
|
-
|
|
2211
|
+
kt(Wl)
|
|
2218
2212
|
], J = (e) => {
|
|
2219
|
-
const t = new
|
|
2213
|
+
const t = new It();
|
|
2220
2214
|
return (l) => (t.get(e.state) ? e.dispatch({ effects: t.reconfigure(l) }) : e.dispatch({
|
|
2221
|
-
effects:
|
|
2215
|
+
effects: At.appendConfig.of(t.of(l))
|
|
2222
2216
|
}), !0);
|
|
2223
2217
|
};
|
|
2224
2218
|
class zl {
|
|
@@ -2303,8 +2297,8 @@ class zl {
|
|
|
2303
2297
|
*/
|
|
2304
2298
|
setTabSize(t) {
|
|
2305
2299
|
this.toggleTabSize([
|
|
2306
|
-
|
|
2307
|
-
|
|
2300
|
+
ce.tabSize.of(t),
|
|
2301
|
+
Nt.of(" ".repeat(t))
|
|
2308
2302
|
]);
|
|
2309
2303
|
}
|
|
2310
2304
|
/**
|
|
@@ -2313,7 +2307,7 @@ class zl {
|
|
|
2313
2307
|
* @param t 目标内容
|
|
2314
2308
|
*/
|
|
2315
2309
|
setPlaceholder(t) {
|
|
2316
|
-
this.togglePlaceholder(
|
|
2310
|
+
this.togglePlaceholder(Ft(t));
|
|
2317
2311
|
}
|
|
2318
2312
|
foucs() {
|
|
2319
2313
|
this.view.focus();
|
|
@@ -2322,11 +2316,11 @@ class zl {
|
|
|
2322
2316
|
this.toggleDisabled([$e.editable.of(!t)]);
|
|
2323
2317
|
}
|
|
2324
2318
|
setReadOnly(t) {
|
|
2325
|
-
this.toggleReadOnly([
|
|
2319
|
+
this.toggleReadOnly([ce.readOnly.of(t)]);
|
|
2326
2320
|
}
|
|
2327
2321
|
setMaxLength(t) {
|
|
2328
2322
|
this.toggleMaxlength([
|
|
2329
|
-
|
|
2323
|
+
ce.changeFilter.of((o) => o.newDoc.length <= t)
|
|
2330
2324
|
]);
|
|
2331
2325
|
}
|
|
2332
2326
|
}
|
|
@@ -2355,7 +2349,7 @@ const Kl = (e) => {
|
|
|
2355
2349
|
const t = x("editorId");
|
|
2356
2350
|
A(() => {
|
|
2357
2351
|
C.on(t, {
|
|
2358
|
-
name:
|
|
2352
|
+
name: wt,
|
|
2359
2353
|
callback() {
|
|
2360
2354
|
var o;
|
|
2361
2355
|
(o = e.value) == null || o.foucs();
|
|
@@ -2371,7 +2365,7 @@ const Kl = (e) => {
|
|
|
2371
2365
|
{
|
|
2372
2366
|
key: "Ctrl-d",
|
|
2373
2367
|
mac: "Cmd-d",
|
|
2374
|
-
run:
|
|
2368
|
+
run: Bt,
|
|
2375
2369
|
preventDefault: !0
|
|
2376
2370
|
},
|
|
2377
2371
|
{
|
|
@@ -2460,15 +2454,15 @@ const Kl = (e) => {
|
|
|
2460
2454
|
}
|
|
2461
2455
|
], Jl = (e) => {
|
|
2462
2456
|
const t = x("tabWidth"), o = x("editorId"), l = x("theme"), r = F(), n = F(), a = Zl(o, e), c = Kl(e), m = [
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2457
|
+
Mt.of([...a, Pt]),
|
|
2458
|
+
Ht,
|
|
2459
|
+
jt({ codeLanguages: Rt }),
|
|
2466
2460
|
// 横向换行
|
|
2467
|
-
|
|
2468
|
-
|
|
2461
|
+
ae.lineWrapping,
|
|
2462
|
+
ae.updateListener.of((d) => {
|
|
2469
2463
|
e.onChange(d.state.doc.toString());
|
|
2470
2464
|
}),
|
|
2471
|
-
|
|
2465
|
+
ae.domEventHandlers({
|
|
2472
2466
|
paste: c,
|
|
2473
2467
|
blur: e.onBlur,
|
|
2474
2468
|
focus: e.onFocus
|
|
@@ -2479,25 +2473,25 @@ const Kl = (e) => {
|
|
|
2479
2473
|
a
|
|
2480
2474
|
) : I.codeMirrorExtensions(
|
|
2481
2475
|
l.value,
|
|
2482
|
-
[...m,
|
|
2476
|
+
[...m, jl],
|
|
2483
2477
|
a
|
|
2484
2478
|
);
|
|
2485
2479
|
return A(() => {
|
|
2486
|
-
const d =
|
|
2480
|
+
const d = ce.create({
|
|
2487
2481
|
doc: e.value
|
|
2488
|
-
}), f = new
|
|
2482
|
+
}), f = new ae({
|
|
2489
2483
|
state: d,
|
|
2490
2484
|
parent: r.value
|
|
2491
2485
|
});
|
|
2492
2486
|
n.value = new zl(f), n.value.setTabSize(t), 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), C.on(o, {
|
|
2493
2487
|
name: "ctrlZ",
|
|
2494
2488
|
callback() {
|
|
2495
|
-
|
|
2489
|
+
Ot(f);
|
|
2496
2490
|
}
|
|
2497
2491
|
}), C.on(o, {
|
|
2498
2492
|
name: "ctrlShiftZ",
|
|
2499
2493
|
callback() {
|
|
2500
|
-
|
|
2494
|
+
Dt(f);
|
|
2501
2495
|
}
|
|
2502
2496
|
}), C.on(o, {
|
|
2503
2497
|
name: "replace",
|
|
@@ -2548,13 +2542,13 @@ const Kl = (e) => {
|
|
|
2548
2542
|
codeMirrorUt: n
|
|
2549
2543
|
};
|
|
2550
2544
|
}, Yl = (e, t) => {
|
|
2551
|
-
const o = x("editorId"), l =
|
|
2545
|
+
const o = x("editorId"), l = ee(() => {
|
|
2552
2546
|
const r = document.querySelectorAll(`#${o}-preview img`);
|
|
2553
|
-
r.length !== 0 &&
|
|
2547
|
+
r.length !== 0 && _t(r, {
|
|
2554
2548
|
background: "#00000073"
|
|
2555
2549
|
});
|
|
2556
2550
|
});
|
|
2557
|
-
A(l), T([t,
|
|
2551
|
+
A(l), T([t, Q(e.setting, "preview")], l);
|
|
2558
2552
|
}, Ql = (e, t) => {
|
|
2559
2553
|
const o = x("editorId"), l = x("usedLanguageText"), r = () => {
|
|
2560
2554
|
document.querySelectorAll(`#${o}-preview pre`).forEach((c) => {
|
|
@@ -2565,16 +2559,16 @@ const Kl = (e) => {
|
|
|
2565
2559
|
d.setAttribute("class", "copy-button"), d.dataset.tips = u, d.innerHTML = `<svg class="${s}-icon" aria-hidden="true"><use xlink:href="#${s}-icon-copy"></use></svg>`, d.addEventListener("click", () => {
|
|
2566
2560
|
var y, $;
|
|
2567
2561
|
clearTimeout(m);
|
|
2568
|
-
const v = c.querySelector("code").innerText, b =
|
|
2562
|
+
const v = c.querySelector("code").innerText, b = Vt(e.formatCopiedText(v)), k = ((y = l.value.copyCode) == null ? void 0 : y.successTips) || "已复制!", p = (($ = l.value.copyCode) == null ? void 0 : $.failTips) || "已复制!";
|
|
2569
2563
|
d.dataset.tips = b ? k : p, m = window.setTimeout(() => {
|
|
2570
2564
|
d.dataset.tips = u;
|
|
2571
2565
|
}, 1500);
|
|
2572
2566
|
}), c.appendChild(d);
|
|
2573
2567
|
});
|
|
2574
2568
|
}, n = () => {
|
|
2575
|
-
|
|
2569
|
+
z(r);
|
|
2576
2570
|
}, a = (c) => {
|
|
2577
|
-
c &&
|
|
2571
|
+
c && z(r);
|
|
2578
2572
|
};
|
|
2579
2573
|
T(() => t.value, n), T(() => e.setting.preview, a), T(() => e.setting.htmlPreview, a), T(() => l.value, r), A(r);
|
|
2580
2574
|
}, eo = (e) => {
|
|
@@ -2594,11 +2588,11 @@ const Kl = (e) => {
|
|
|
2594
2588
|
}), T(
|
|
2595
2589
|
() => l.value.css,
|
|
2596
2590
|
(a) => {
|
|
2597
|
-
|
|
2591
|
+
cl(`${s}-hlCss`, "href", a);
|
|
2598
2592
|
}
|
|
2599
2593
|
), r;
|
|
2600
2594
|
}, to = (e) => {
|
|
2601
|
-
const t = x("theme"), { editorExtensions: o } = I, l = o == null ? void 0 : o.mermaid, r = de(l == null ? void 0 : l.instance), n = de(!1), a = new
|
|
2595
|
+
const t = x("theme"), { editorExtensions: o } = I, l = o == null ? void 0 : o.mermaid, r = de(l == null ? void 0 : l.instance), n = de(!1), a = new Gt({
|
|
2602
2596
|
max: 1e3,
|
|
2603
2597
|
// 缓存10分钟
|
|
2604
2598
|
ttl: 6e5
|
|
@@ -2618,19 +2612,19 @@ const Kl = (e) => {
|
|
|
2618
2612
|
if (!e.noMermaid && !(l != null && l.instance)) {
|
|
2619
2613
|
const u = document.createElement("script");
|
|
2620
2614
|
u.id = `${s}-mermaid`;
|
|
2621
|
-
const d = (l == null ? void 0 : l.js) ||
|
|
2615
|
+
const d = (l == null ? void 0 : l.js) || Jt;
|
|
2622
2616
|
/\.mjs/.test(d) ? (u.setAttribute("type", "module"), u.innerHTML = `import mermaid from "${d}";window.mermaid=mermaid;document.getElementById('${s}-mermaid').dispatchEvent(new Event('load'));`) : u.src = d, u.onload = () => {
|
|
2623
2617
|
r.value = window.mermaid, c();
|
|
2624
2618
|
}, O(u, "mermaid");
|
|
2625
2619
|
}
|
|
2626
2620
|
}), { mermaidRef: r, reRenderRef: n, replaceMermaid: () => {
|
|
2627
|
-
|
|
2621
|
+
z(() => {
|
|
2628
2622
|
!e.noMermaid && r.value && document.querySelectorAll(
|
|
2629
2623
|
`div.${s}-mermaid`
|
|
2630
2624
|
).forEach(async (d) => {
|
|
2631
2625
|
let f = a.get(d.innerText);
|
|
2632
2626
|
if (!f) {
|
|
2633
|
-
const v =
|
|
2627
|
+
const v = al(), k = await (r.value.renderAsync || r.value.render)(v, d.innerText);
|
|
2634
2628
|
f = typeof k == "string" ? k : k.svg, a.set(d.innerText, f);
|
|
2635
2629
|
}
|
|
2636
2630
|
const h = document.createElement("p");
|
|
@@ -2657,7 +2651,7 @@ const Kl = (e) => {
|
|
|
2657
2651
|
const m = l[r], u = m.content.trim();
|
|
2658
2652
|
return m.info === "mermaid" ? `<div class="${s}-mermaid" data-mermaid-theme=${t.themeRef.value}>${u}</div>` : o(l, r, n, a, c);
|
|
2659
2653
|
};
|
|
2660
|
-
},
|
|
2654
|
+
}, vt = (e, t) => {
|
|
2661
2655
|
let o = !0, l = !0;
|
|
2662
2656
|
const r = e.posMax, n = t > 0 ? e.src.charCodeAt(t - 1) : -1, a = t + 1 <= r ? e.src.charCodeAt(t + 1) : -1;
|
|
2663
2657
|
return (n === 32 || n === 9 || a >= 48 && a <= 57) && (l = !1), (a === 32 || a === 9) && (o = !1), {
|
|
@@ -2668,7 +2662,7 @@ const Kl = (e) => {
|
|
|
2668
2662
|
let o, l, r, n;
|
|
2669
2663
|
if (e.src[e.pos] !== "$")
|
|
2670
2664
|
return !1;
|
|
2671
|
-
if (r =
|
|
2665
|
+
if (r = vt(e, e.pos), !r.can_open)
|
|
2672
2666
|
return t || (e.pending += "$"), e.pos += 1, !0;
|
|
2673
2667
|
const a = e.pos + 1;
|
|
2674
2668
|
for (o = a; (o = e.src.indexOf("$", o)) !== -1; ) {
|
|
@@ -2678,7 +2672,7 @@ const Kl = (e) => {
|
|
|
2678
2672
|
break;
|
|
2679
2673
|
o += 1;
|
|
2680
2674
|
}
|
|
2681
|
-
return o === -1 ? (t || (e.pending += "$"), e.pos = a, !0) : o - a === 0 ? (t || (e.pending += "$$"), e.pos = a + 1, !0) : (r =
|
|
2675
|
+
return o === -1 ? (t || (e.pending += "$"), e.pos = a, !0) : o - a === 0 ? (t || (e.pending += "$$"), e.pos = a + 1, !0) : (r = vt(e, o), r.can_close ? (t || (l = e.push("math_inline", "math", 0), l.markup = "$", l.content = e.src.slice(a, o)), e.pos = o + 1, !0) : (t || (e.pending += "$"), e.pos = a, !0));
|
|
2682
2676
|
}, ro = (e, t, o, l) => {
|
|
2683
2677
|
let r, n, a, c, m = !1, u = e.bMarks[t] + e.tShift[t], d = e.eMarks[t];
|
|
2684
2678
|
if (u + 2 > d || e.src.slice(u, u + 2) !== "$$")
|
|
@@ -2741,8 +2735,8 @@ const Kl = (e) => {
|
|
|
2741
2735
|
if (L !== o)
|
|
2742
2736
|
return !1;
|
|
2743
2737
|
b -= (b - $) % n;
|
|
2744
|
-
const S = d.src.slice($, b),
|
|
2745
|
-
if (u(
|
|
2738
|
+
const S = d.src.slice($, b), j = d.src.slice(b, w);
|
|
2739
|
+
if (u(j), v)
|
|
2746
2740
|
return !0;
|
|
2747
2741
|
for (k = f; k++, !(k >= h || ($ = d.bMarks[k] + d.tShift[k], w = d.eMarks[k], $ < w && d.sCount[k] < d.blkIndent)); )
|
|
2748
2742
|
if (r === d.src.charCodeAt($) && !(d.sCount[k] - d.blkIndent >= 4)) {
|
|
@@ -2753,8 +2747,8 @@ const Kl = (e) => {
|
|
|
2753
2747
|
break;
|
|
2754
2748
|
}
|
|
2755
2749
|
}
|
|
2756
|
-
const
|
|
2757
|
-
return d.parentType = "root", d.lineMax = k, p = d.push("admonition_open", "div", 1), p.markup = S, p.block = !0, p.info = a, p.map = [f, k], p = d.push("admonition_title_open", "p", 1), p.markup = S + " " + a, p.map = [f, k], p = d.push("inline", "", 0), p.content = c, p.map = [f, d.line - 1], p.children = [], p = d.push("admonition_title_close", "p", -1), p.markup = S + " " + a, d.md.block.tokenize(d, f + 1, k), p = d.push("admonition_close", "div", -1), p.markup = d.src.slice($, b), p.block = !0, d.parentType =
|
|
2750
|
+
const B = d.parentType, q = d.lineMax;
|
|
2751
|
+
return d.parentType = "root", d.lineMax = k, p = d.push("admonition_open", "div", 1), p.markup = S, p.block = !0, p.info = a, p.map = [f, k], p = d.push("admonition_title_open", "p", 1), p.markup = S + " " + a, p.map = [f, k], p = d.push("inline", "", 0), p.content = c, p.map = [f, d.line - 1], p.children = [], p = d.push("admonition_title_close", "p", -1), p.markup = S + " " + a, d.md.block.tokenize(d, f + 1, k), p = d.push("admonition_close", "div", -1), p.markup = d.src.slice($, b), p.block = !0, d.parentType = B, d.lineMax = q, d.line = k + (y ? 1 : 0), !0;
|
|
2758
2752
|
},
|
|
2759
2753
|
{
|
|
2760
2754
|
alt: ["paragraph", "reference", "blockquote", "list"]
|
|
@@ -2774,15 +2768,15 @@ const Kl = (e) => {
|
|
|
2774
2768
|
t.mdHeadingId(a, c, t.headsRef.value.length)
|
|
2775
2769
|
)), e.renderer.renderToken(l, r, t);
|
|
2776
2770
|
}, e.renderer.rules.heading_close = (l, r, n, a, c) => c.renderToken(l, r, n);
|
|
2777
|
-
},
|
|
2771
|
+
}, pt = (e) => e.replace(
|
|
2778
2772
|
/<pre><code\sclass="language-([^>]*)">/g,
|
|
2779
2773
|
'<pre><code class="language-$1" language="$1">'
|
|
2780
2774
|
), co = (e) => {
|
|
2781
|
-
const { editorConfig: t, markdownItConfig: o } = I, l = x("editorId"), r = x("showCodeRowNumber"), n = x("previewOnly"), a = x("theme"), c = F([]), m = eo(e), u = lo(e), { reRenderRef: d, replaceMermaid: f } = to(e), h =
|
|
2775
|
+
const { editorConfig: t, markdownItConfig: o } = I, l = x("editorId"), r = x("showCodeRowNumber"), n = x("previewOnly"), a = x("theme"), c = F([]), m = eo(e), u = lo(e), { reRenderRef: d, replaceMermaid: f } = to(e), h = Ut({
|
|
2782
2776
|
html: !0,
|
|
2783
2777
|
breaks: !0
|
|
2784
2778
|
});
|
|
2785
|
-
h.use(oo, { themeRef: a }), h.use(io, { katexRef: u }), h.use(
|
|
2779
|
+
h.use(oo, { themeRef: a }), h.use(io, { katexRef: u }), h.use(qt, { figcaption: !0 }), h.use(ao), h.use(Wt), h.use(so, { mdHeadingId: e.mdHeadingId, headsRef: c }), h.renderer.rules.paragraph_open = h.renderer.rules.table_open = (p, y, $, w, L) => {
|
|
2786
2780
|
let S;
|
|
2787
2781
|
return p[y].map && p[y].level === 0 && (S = p[y].map[0], p[y].attrSet("data-line", String(S))), L.renderToken(p, y, $);
|
|
2788
2782
|
}, h.set({
|
|
@@ -2794,16 +2788,16 @@ const Kl = (e) => {
|
|
|
2794
2788
|
return $ ? w = m.value.highlight(p, {
|
|
2795
2789
|
language: y,
|
|
2796
2790
|
ignoreIllegals: !0
|
|
2797
|
-
}).value : w = m.value.highlightAuto(p).value, r ?
|
|
2791
|
+
}).value : w = m.value.highlightAuto(p).value, r ? nl(w.trim()) : `<span class="code-block">${w.trim()}</span>`;
|
|
2798
2792
|
}
|
|
2799
2793
|
}), o(h);
|
|
2800
|
-
const v = F(e.sanitize(
|
|
2794
|
+
const v = F(e.sanitize(pt(h.render(e.value)))), b = ee(
|
|
2801
2795
|
async () => {
|
|
2802
|
-
c.value = [], v.value = e.sanitize(
|
|
2796
|
+
c.value = [], v.value = e.sanitize(pt(h.render(e.value))), C.emit(l, "buildFinished", v.value), e.onHtmlChanged(v.value), f();
|
|
2803
2797
|
},
|
|
2804
2798
|
(t == null ? void 0 : t.renderDelay) !== void 0 ? t == null ? void 0 : t.renderDelay : n ? 0 : 500
|
|
2805
2799
|
), k = D(() => e.noHighlight || m.value);
|
|
2806
|
-
return T([
|
|
2800
|
+
return T([Q(e, "value"), k, d], b), T(
|
|
2807
2801
|
() => c.value,
|
|
2808
2802
|
(p) => {
|
|
2809
2803
|
e.onGetCatalog(p), C.emit(l, "catalogChanged", p);
|
|
@@ -3033,7 +3027,7 @@ const go = {
|
|
|
3033
3027
|
const l = e.footers.indexOf("="), r = l === -1 ? e.footers : e.footers.slice(0, l), n = l === -1 ? [] : e.footers.slice(l, Number.MAX_SAFE_INTEGER);
|
|
3034
3028
|
return [r, n];
|
|
3035
3029
|
}), o = (l) => {
|
|
3036
|
-
if (
|
|
3030
|
+
if (Ct.includes(l))
|
|
3037
3031
|
switch (l) {
|
|
3038
3032
|
case "markdownTotal":
|
|
3039
3033
|
return i(fo, {
|
|
@@ -3082,7 +3076,7 @@ const go = {
|
|
|
3082
3076
|
type: Number,
|
|
3083
3077
|
default: 0
|
|
3084
3078
|
}
|
|
3085
|
-
},
|
|
3079
|
+
}, Tt = /* @__PURE__ */ M({
|
|
3086
3080
|
props: yo,
|
|
3087
3081
|
setup(e) {
|
|
3088
3082
|
return () => {
|
|
@@ -3113,7 +3107,7 @@ const go = {
|
|
|
3113
3107
|
title: t.text
|
|
3114
3108
|
}, [t.text]), i("div", {
|
|
3115
3109
|
class: `${s}-catalog-wrapper`
|
|
3116
|
-
}, [t.children && t.children.map((a) => i(
|
|
3110
|
+
}, [t.children && t.children.map((a) => i(Tt, {
|
|
3117
3111
|
mdHeadingId: o,
|
|
3118
3112
|
key: `${t.text}-link-${a.level}-${a.text}`,
|
|
3119
3113
|
tocItem: a,
|
|
@@ -3234,7 +3228,7 @@ const Co = {
|
|
|
3234
3228
|
const n = () => {
|
|
3235
3229
|
var c;
|
|
3236
3230
|
const a = l.scrollElement instanceof HTMLElement ? l.scrollElement : document.querySelector(l.scrollElement);
|
|
3237
|
-
(c = a === document.documentElement ? window : a) == null || c.addEventListener("scroll",
|
|
3231
|
+
(c = a === document.documentElement ? window : a) == null || c.addEventListener("scroll", rl(() => {
|
|
3238
3232
|
if (l.list.length === 0)
|
|
3239
3233
|
return !1;
|
|
3240
3234
|
const {
|
|
@@ -3242,7 +3236,7 @@ const Co = {
|
|
|
3242
3236
|
} = l.list.reduce((u, d, f) => {
|
|
3243
3237
|
const h = document.getElementById(e.mdHeadingId(d.text, d.level, f + 1));
|
|
3244
3238
|
if (h instanceof HTMLElement) {
|
|
3245
|
-
const v =
|
|
3239
|
+
const v = il(h, a);
|
|
3246
3240
|
if (v < e.offsetTop && v > u.minTop)
|
|
3247
3241
|
return {
|
|
3248
3242
|
activeHead: d,
|
|
@@ -3267,12 +3261,12 @@ const Co = {
|
|
|
3267
3261
|
n(), C.on(o, {
|
|
3268
3262
|
name: ve,
|
|
3269
3263
|
callback(a) {
|
|
3270
|
-
a &&
|
|
3264
|
+
a && z(n);
|
|
3271
3265
|
}
|
|
3272
3266
|
});
|
|
3273
3267
|
}), () => i("div", {
|
|
3274
3268
|
class: `${s}-catalog${e.theme === "dark" ? "-dark" : ""} ${e.class}`
|
|
3275
|
-
}, [r.value.map((a) => i(
|
|
3269
|
+
}, [r.value.map((a) => i(Tt, {
|
|
3276
3270
|
mdHeadingId: e.mdHeadingId,
|
|
3277
3271
|
tocItem: a,
|
|
3278
3272
|
key: `link-${a.level}-${a.text}`,
|
|
@@ -3324,10 +3318,10 @@ const Co = {
|
|
|
3324
3318
|
}, wo = (e) => {
|
|
3325
3319
|
var n;
|
|
3326
3320
|
const { editorId: t, previewOnly: o } = e, l = (n = I == null ? void 0 : I.editorExtensions) == null ? void 0 : n.highlight;
|
|
3327
|
-
|
|
3321
|
+
W("editorId", t), W("tabWidth", e.tabWidth), W(
|
|
3328
3322
|
"theme",
|
|
3329
3323
|
D(() => e.theme)
|
|
3330
|
-
),
|
|
3324
|
+
), W(
|
|
3331
3325
|
"highlight",
|
|
3332
3326
|
D(() => {
|
|
3333
3327
|
const a = {
|
|
@@ -3335,11 +3329,11 @@ const Co = {
|
|
|
3335
3329
|
...l == null ? void 0 : l.css
|
|
3336
3330
|
}, c = e.codeStyleReverse && e.codeStyleReverseList.includes(e.previewTheme) ? "dark" : e.theme;
|
|
3337
3331
|
return {
|
|
3338
|
-
js: (l == null ? void 0 : l.js) ||
|
|
3332
|
+
js: (l == null ? void 0 : l.js) || Xt,
|
|
3339
3333
|
css: a[e.codeTheme] ? a[e.codeTheme][c] : Ye.atom[c]
|
|
3340
3334
|
};
|
|
3341
3335
|
})
|
|
3342
|
-
),
|
|
3336
|
+
), W("previewOnly", o), W("showCodeRowNumber", e.showCodeRowNumber);
|
|
3343
3337
|
const r = D(() => {
|
|
3344
3338
|
var c;
|
|
3345
3339
|
const a = {
|
|
@@ -3348,7 +3342,7 @@ const Co = {
|
|
|
3348
3342
|
};
|
|
3349
3343
|
return a[e.language] ? a[e.language] : Ze["zh-CN"];
|
|
3350
3344
|
});
|
|
3351
|
-
|
|
3345
|
+
W("usedLanguageText", r), W(
|
|
3352
3346
|
"previewTheme",
|
|
3353
3347
|
D(() => e.previewTheme)
|
|
3354
3348
|
);
|
|
@@ -3356,15 +3350,15 @@ const Co = {
|
|
|
3356
3350
|
var u, d, f, h, v, b;
|
|
3357
3351
|
const { noPrettier: t, previewOnly: o, noIconfont: l, noUploadImg: r } = e, { editorExtensions: n } = I, a = t || !!((d = (u = I.editorExtensions) == null ? void 0 : u.prettier) != null && d.prettierInstance), c = t || !!((h = (f = I.editorExtensions) == null ? void 0 : f.prettier) != null && h.parserMarkdownInstance), m = r || !!((b = (v = I.editorExtensions) == null ? void 0 : v.cropper) != null && b.instance);
|
|
3358
3352
|
A(() => {
|
|
3359
|
-
var L, S,
|
|
3353
|
+
var L, S, j, B;
|
|
3360
3354
|
const k = document.createElement("script");
|
|
3361
|
-
k.src = (n == null ? void 0 : n.iconfont) ||
|
|
3355
|
+
k.src = (n == null ? void 0 : n.iconfont) || Kt, k.id = `${s}-icon`;
|
|
3362
3356
|
const p = document.createElement("script"), y = document.createElement("script");
|
|
3363
3357
|
p.src = ((L = n == null ? void 0 : n.prettier) == null ? void 0 : L.standaloneJs) || Ke.main, p.id = `${s}-prettier`, y.src = ((S = n == null ? void 0 : n.prettier) == null ? void 0 : S.parserMarkdownJs) || Ke.markdown, y.id = `${s}-prettierMD`;
|
|
3364
3358
|
const $ = document.createElement("link");
|
|
3365
|
-
$.rel = "stylesheet", $.href = ((
|
|
3359
|
+
$.rel = "stylesheet", $.href = ((j = n == null ? void 0 : n.cropper) == null ? void 0 : j.css) || Xe.css, $.id = `${s}-cropperCss`;
|
|
3366
3360
|
const w = document.createElement("script");
|
|
3367
|
-
w.src = ((
|
|
3361
|
+
w.src = ((B = n == null ? void 0 : n.cropper) == null ? void 0 : B.js) || Xe.js, w.id = `${s}-cropper`, l || O(k), o || (m || (O($), O(w)), a || O(p), c || O(y));
|
|
3368
3362
|
});
|
|
3369
3363
|
}, So = (e, t) => {
|
|
3370
3364
|
const { editorId: o, previewOnly: l } = e, r = N({
|
|
@@ -3484,7 +3478,7 @@ const Co = {
|
|
|
3484
3478
|
r("pageFullscreen", c);
|
|
3485
3479
|
},
|
|
3486
3480
|
toggleFullscreen(c) {
|
|
3487
|
-
C.emit(n,
|
|
3481
|
+
C.emit(n, $t, c);
|
|
3488
3482
|
},
|
|
3489
3483
|
togglePreview(c) {
|
|
3490
3484
|
r("preview", c);
|
|
@@ -3502,7 +3496,7 @@ const Co = {
|
|
|
3502
3496
|
C.emit(n, "replace", "universal", { generate: c });
|
|
3503
3497
|
},
|
|
3504
3498
|
focus() {
|
|
3505
|
-
C.emit(n,
|
|
3499
|
+
C.emit(n, wt);
|
|
3506
3500
|
}
|
|
3507
3501
|
};
|
|
3508
3502
|
t.expose(a);
|
|
@@ -3604,7 +3598,7 @@ const Co = {
|
|
|
3604
3598
|
*/
|
|
3605
3599
|
toolbars: {
|
|
3606
3600
|
type: Array,
|
|
3607
|
-
default:
|
|
3601
|
+
default: yt
|
|
3608
3602
|
},
|
|
3609
3603
|
/**
|
|
3610
3604
|
* 工具栏选择不显示
|
|
@@ -3643,7 +3637,7 @@ const Co = {
|
|
|
3643
3637
|
*/
|
|
3644
3638
|
editorId: {
|
|
3645
3639
|
type: String,
|
|
3646
|
-
default:
|
|
3640
|
+
default: zt
|
|
3647
3641
|
},
|
|
3648
3642
|
/**
|
|
3649
3643
|
* 一个tab等于空格数
|
|
@@ -3761,7 +3755,7 @@ const Co = {
|
|
|
3761
3755
|
*/
|
|
3762
3756
|
footers: {
|
|
3763
3757
|
type: Array,
|
|
3764
|
-
default:
|
|
3758
|
+
default: Ct
|
|
3765
3759
|
},
|
|
3766
3760
|
/**
|
|
3767
3761
|
* 是否默认激活输入框和预览框同步滚动
|
|
@@ -3888,7 +3882,7 @@ const Co = {
|
|
|
3888
3882
|
"onBlur",
|
|
3889
3883
|
"onFocus"
|
|
3890
3884
|
];
|
|
3891
|
-
const
|
|
3885
|
+
const G = /* @__PURE__ */ M({
|
|
3892
3886
|
name: "MdEditorV3",
|
|
3893
3887
|
props: Ho,
|
|
3894
3888
|
emits: Io,
|
|
@@ -3921,7 +3915,7 @@ const z = /* @__PURE__ */ M({
|
|
|
3921
3915
|
id: o,
|
|
3922
3916
|
class: [s, e.class, e.theme === "dark" && `${s}-dark`, d.fullscreen || d.pageFullscreen ? `${s}-fullscreen` : "", l && `${s}-previewOnly`],
|
|
3923
3917
|
style: e.style
|
|
3924
|
-
}, [!l && i(
|
|
3918
|
+
}, [!l && i(yl, {
|
|
3925
3919
|
noPrettier: a,
|
|
3926
3920
|
toolbars: e.toolbars,
|
|
3927
3921
|
toolbarsExclude: e.toolbarsExclude,
|
|
@@ -4060,9 +4054,9 @@ const z = /* @__PURE__ */ M({
|
|
|
4060
4054
|
}
|
|
4061
4055
|
});
|
|
4062
4056
|
function Mo(e) {
|
|
4063
|
-
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !
|
|
4057
|
+
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !Lt(e);
|
|
4064
4058
|
}
|
|
4065
|
-
const
|
|
4059
|
+
const Ro = {
|
|
4066
4060
|
title: {
|
|
4067
4061
|
type: String,
|
|
4068
4062
|
default: ""
|
|
@@ -4108,7 +4102,7 @@ const jo = {
|
|
|
4108
4102
|
}
|
|
4109
4103
|
}, ke = /* @__PURE__ */ M({
|
|
4110
4104
|
name: "ModalToolbar",
|
|
4111
|
-
props:
|
|
4105
|
+
props: Ro,
|
|
4112
4106
|
emits: ["onClick", "onClose", "onAdjust"],
|
|
4113
4107
|
setup(e, t) {
|
|
4114
4108
|
return () => {
|
|
@@ -4144,12 +4138,12 @@ const jo = {
|
|
|
4144
4138
|
};
|
|
4145
4139
|
}
|
|
4146
4140
|
});
|
|
4147
|
-
|
|
4148
|
-
|
|
4149
|
-
|
|
4150
|
-
|
|
4151
|
-
|
|
4152
|
-
|
|
4141
|
+
G.install = (e) => (e.component(G.name, G), e.component(pe.name, pe), e.component(be.name, be), e.component(ue.name, ue), e.component(ke.name, ke), e);
|
|
4142
|
+
G.NormalToolbar = pe;
|
|
4143
|
+
G.DropdownToolbar = be;
|
|
4144
|
+
G.MdCatalog = ue;
|
|
4145
|
+
G.ModalToolbar = ke;
|
|
4146
|
+
G.config = Yt;
|
|
4153
4147
|
export {
|
|
4154
|
-
|
|
4148
|
+
G as default
|
|
4155
4149
|
};
|