md-editor-v3 3.0.0-beta.0 → 3.0.0-beta.2
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 +6 -6
- package/lib/md-editor-v3.mjs +462 -461
- package/lib/md-editor-v3.umd.js +31 -31
- package/lib/style.css +1 -1
- package/package.json +2 -2
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
|
|
5
|
-
import { minimalSetup as
|
|
6
|
-
import { EditorSelection as
|
|
7
|
-
import { EditorView as
|
|
8
|
-
import { languages as
|
|
1
|
+
var Tt = Object.defineProperty;
|
|
2
|
+
var St = (e, t, o) => t in e ? Tt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: o }) : e[t] = o;
|
|
3
|
+
var U = (e, t, o) => (St(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 ke, cloneVNode as xt, inject as x, computed as D, nextTick as z, Fragment as ye, toRef as Q, shallowRef as se, provide as W, isVNode as Et } from "vue";
|
|
5
|
+
import { minimalSetup as Lt, EditorView as re } from "codemirror";
|
|
6
|
+
import { EditorSelection as me, EditorState as ae, Compartment as Ht, StateEffect as It } from "@codemirror/state";
|
|
7
|
+
import { EditorView as Ce, placeholder as At, keymap as Ft } from "@codemirror/view";
|
|
8
|
+
import { languages as Mt } from "@codemirror/language-data";
|
|
9
9
|
import { markdown as Rt } from "@codemirror/lang-markdown";
|
|
10
|
-
import { deleteLine as
|
|
11
|
-
import { HighlightStyle as
|
|
10
|
+
import { deleteLine as jt, indentWithTab as Bt, undo as Pt, redo as Ot } from "@codemirror/commands";
|
|
11
|
+
import { HighlightStyle as pt, syntaxHighlighting as bt, indentUnit as Dt } 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 Nt from "medium-zoom";
|
|
14
|
+
import _t from "copy-to-clipboard";
|
|
15
|
+
import Vt from "markdown-it";
|
|
16
|
+
import Ut from "markdown-it-image-figures";
|
|
17
|
+
import qt from "markdown-it-task-lists";
|
|
18
|
+
import Wt from "lru-cache";
|
|
19
|
+
const s = "md-editor", Gt = "md-editor-v3", zt = "https://at.alicdn.com/t/c/font_2605852_u82y61ve02.js", H = "https://cdnjs.cloudflare.com/ajax/libs", Kt = `${H}/highlight.js/11.7.0/highlight.min.js`, ze = {
|
|
20
20
|
main: `${H}/prettier/2.8.0/standalone.js`,
|
|
21
21
|
markdown: `${H}/prettier/2.8.0/parser-markdown.js`
|
|
22
|
-
},
|
|
22
|
+
}, Ke = {
|
|
23
23
|
css: `${H}/cropperjs/1.5.13/cropper.min.css`,
|
|
24
24
|
js: `${H}/cropperjs/1.5.13/cropper.min.js`
|
|
25
|
-
},
|
|
25
|
+
}, Xt = `${H}/screenfull.js/5.2.0/screenfull.min.js`, kt = [
|
|
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
|
+
], yt = ["markdownTotal", "=", "scrollSwitch"], Xe = {
|
|
59
59
|
"zh-CN": {
|
|
60
60
|
toolbarTips: {
|
|
61
61
|
bold: "加粗",
|
|
@@ -218,10 +218,10 @@ 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
|
+
}, Zt = `${H}/mermaid/9.4.0/mermaid.min.js`, Ze = {
|
|
222
222
|
js: `${H}/KaTeX/0.16.3/katex.min.js`,
|
|
223
223
|
css: `${H}/KaTeX/0.16.3/katex.min.css`
|
|
224
|
-
},
|
|
224
|
+
}, Je = {
|
|
225
225
|
a11y: {
|
|
226
226
|
light: `${H}/highlight.js/11.7.0/styles/a11y-light.min.css`,
|
|
227
227
|
dark: `${H}/highlight.js/11.7.0/styles/a11y-dark.min.css`
|
|
@@ -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
|
+
}, Jt = (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 Yt = /* @__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 Qt = {
|
|
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: Qt,
|
|
312
312
|
setup(e, t) {
|
|
313
313
|
const o = `${s}-dropdown-hidden`, l = N({
|
|
314
314
|
overlayClass: [o],
|
|
@@ -342,7 +342,7 @@ const ll = {
|
|
|
342
342
|
};
|
|
343
343
|
return A(() => {
|
|
344
344
|
e.trigger === "click" ? (r.value.addEventListener("click", a), document.addEventListener("click", m)) : (r.value.addEventListener("mouseenter", a), r.value.addEventListener("mouseleave", d), n.value.addEventListener("mouseenter", c), n.value.addEventListener("mouseleave", d));
|
|
345
|
-
}),
|
|
345
|
+
}), ke(() => {
|
|
346
346
|
e.trigger === "click" ? (r.value.removeEventListener("click", a), document.removeEventListener("click", m)) : (r.value.removeEventListener("mouseenter", a), r.value.removeEventListener("mouseleave", d), n.value.removeEventListener("mouseenter", c), n.value.removeEventListener("mouseleave", d));
|
|
347
347
|
}), () => {
|
|
348
348
|
const f = _({
|
|
@@ -350,7 +350,7 @@ const ll = {
|
|
|
350
350
|
}), h = _({
|
|
351
351
|
props: e,
|
|
352
352
|
ctx: t
|
|
353
|
-
}, "overlay"), v =
|
|
353
|
+
}, "overlay"), v = xt(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 el {
|
|
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 el(), tl = (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
|
+
}, ll = (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
|
+
}, ol = (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
|
+
}, de = (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
|
+
}, nl = (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
|
+
}, rl = (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
|
+
}, il = () => `${Date.now().toString(36)}${Math.random().toString(36).substring(2)}`, al = {
|
|
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
|
-
},
|
|
485
|
+
}, ue = "onSave", $e = "changeCatalogVisible", Ct = "changeFullscreen", Ye = "pageFullscreenChanged", Qe = "fullscreenChanged", he = "previewChanged", et = "htmlPreviewChanged", tt = "catalogVisibleChanged", $t = "textareaFocus", lt = (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;
|
|
@@ -498,14 +498,16 @@ const C = new ol(), nl = (e, t = {
|
|
|
498
498
|
e.removeEventListener("mousedown", o);
|
|
499
499
|
};
|
|
500
500
|
}, O = (e, t = "") => {
|
|
501
|
-
const o = document.getElementById(e.id), l =
|
|
502
|
-
|
|
501
|
+
const o = document.getElementById(e.id), l = e.onload;
|
|
502
|
+
e.onload = null;
|
|
503
|
+
const r = function(n) {
|
|
504
|
+
typeof l == "function" && l.bind(this)(n), e.removeEventListener("load", r);
|
|
503
505
|
};
|
|
504
|
-
o ? t !== "" &&
|
|
505
|
-
},
|
|
506
|
+
o ? t !== "" && (o.addEventListener("load", r), Reflect.get(window, t) && o.dispatchEvent(new Event("load"))) : (e.addEventListener("load", r), document.head.appendChild(e));
|
|
507
|
+
}, sl = de((e, t, o) => {
|
|
506
508
|
const l = document.getElementById(e);
|
|
507
509
|
l && l.setAttribute(t, o);
|
|
508
|
-
}, 10),
|
|
510
|
+
}, 10), cl = (e) => {
|
|
509
511
|
var m, u, d, f;
|
|
510
512
|
const t = x("editorId");
|
|
511
513
|
let o = (u = (m = I.editorExtensions) == null ? void 0 : m.screenfull) == null ? void 0 : u.instance;
|
|
@@ -528,15 +530,15 @@ const C = new ol(), nl = (e, t = {
|
|
|
528
530
|
return A(() => {
|
|
529
531
|
if (a(), !o) {
|
|
530
532
|
const h = document.createElement("script");
|
|
531
|
-
h.src = l ||
|
|
533
|
+
h.src = l || Xt, h.onload = c, h.id = `${s}-screenfull`, O(h, "screenfull");
|
|
532
534
|
}
|
|
533
535
|
}), A(() => {
|
|
534
536
|
C.on(t, {
|
|
535
|
-
name:
|
|
537
|
+
name: Ct,
|
|
536
538
|
callback: n
|
|
537
539
|
});
|
|
538
540
|
}), { fullscreenHandler: n };
|
|
539
|
-
},
|
|
541
|
+
}, dl = {
|
|
540
542
|
tableShape: {
|
|
541
543
|
type: Array,
|
|
542
544
|
default: () => [6, 4]
|
|
@@ -546,9 +548,9 @@ const C = new ol(), nl = (e, t = {
|
|
|
546
548
|
default: () => {
|
|
547
549
|
}
|
|
548
550
|
}
|
|
549
|
-
},
|
|
551
|
+
}, ul = /* @__PURE__ */ M({
|
|
550
552
|
name: "TableShape",
|
|
551
|
-
props:
|
|
553
|
+
props: dl,
|
|
552
554
|
setup(e) {
|
|
553
555
|
const t = N({
|
|
554
556
|
x: -1,
|
|
@@ -576,7 +578,7 @@ const C = new ol(), nl = (e, t = {
|
|
|
576
578
|
}, null)]))]))]);
|
|
577
579
|
}
|
|
578
580
|
});
|
|
579
|
-
const
|
|
581
|
+
const ml = {
|
|
580
582
|
title: {
|
|
581
583
|
type: String,
|
|
582
584
|
default: ""
|
|
@@ -614,8 +616,8 @@ const hl = {
|
|
|
614
616
|
class: {
|
|
615
617
|
type: String
|
|
616
618
|
}
|
|
617
|
-
},
|
|
618
|
-
props:
|
|
619
|
+
}, we = /* @__PURE__ */ M({
|
|
620
|
+
props: ml,
|
|
619
621
|
setup(e, t) {
|
|
620
622
|
const o = F(e.visible), l = F([`${s}-modal`]), r = F(), n = F();
|
|
621
623
|
let a = () => {
|
|
@@ -637,17 +639,17 @@ const hl = {
|
|
|
637
639
|
height: e.height
|
|
638
640
|
});
|
|
639
641
|
return A(() => {
|
|
640
|
-
a =
|
|
642
|
+
a = lt(n.value, (u, d) => {
|
|
641
643
|
c.initPos.left = u + "px", c.initPos.top = d + "px";
|
|
642
644
|
});
|
|
643
|
-
}),
|
|
645
|
+
}), ke(() => {
|
|
644
646
|
a();
|
|
645
647
|
}), T(() => e.isFullscreen, (u) => {
|
|
646
|
-
u ? a() : a =
|
|
648
|
+
u ? a() : a = lt(n.value, (d, f) => {
|
|
647
649
|
c.initPos.left = d + "px", c.initPos.top = f + "px";
|
|
648
650
|
});
|
|
649
651
|
}), T(() => e.visible, (u) => {
|
|
650
|
-
u ? (l.value.push("zoom-in"), o.value = u,
|
|
652
|
+
u ? (l.value.push("zoom-in"), o.value = u, z(() => {
|
|
651
653
|
const d = r.value.offsetWidth / 2, f = r.value.offsetHeight / 2, h = document.documentElement.clientWidth / 2, v = document.documentElement.clientHeight / 2;
|
|
652
654
|
c.initPos.left = h - d + "px", c.initPos.top = v - f + "px";
|
|
653
655
|
}), setTimeout(() => {
|
|
@@ -710,7 +712,7 @@ const hl = {
|
|
|
710
712
|
}, null)])])])])]);
|
|
711
713
|
};
|
|
712
714
|
}
|
|
713
|
-
}),
|
|
715
|
+
}), fl = {
|
|
714
716
|
type: {
|
|
715
717
|
type: String,
|
|
716
718
|
default: "link"
|
|
@@ -729,8 +731,8 @@ const hl = {
|
|
|
729
731
|
default: () => {
|
|
730
732
|
}
|
|
731
733
|
}
|
|
732
|
-
},
|
|
733
|
-
props:
|
|
734
|
+
}, gl = /* @__PURE__ */ M({
|
|
735
|
+
props: fl,
|
|
734
736
|
setup(e) {
|
|
735
737
|
const t = x("usedLanguageText"), o = x("editorId"), l = D(() => {
|
|
736
738
|
var n, a;
|
|
@@ -750,7 +752,7 @@ const hl = {
|
|
|
750
752
|
n || setTimeout(() => {
|
|
751
753
|
r.desc = "", r.url = "";
|
|
752
754
|
}, 200);
|
|
753
|
-
}), () => i(
|
|
755
|
+
}), () => i(we, {
|
|
754
756
|
title: l.value,
|
|
755
757
|
visible: e.visible,
|
|
756
758
|
onClose: e.onCancel
|
|
@@ -800,7 +802,7 @@ const hl = {
|
|
|
800
802
|
});
|
|
801
803
|
}
|
|
802
804
|
});
|
|
803
|
-
const
|
|
805
|
+
const hl = {
|
|
804
806
|
visible: {
|
|
805
807
|
type: Boolean,
|
|
806
808
|
default: !1
|
|
@@ -815,8 +817,8 @@ const bl = {
|
|
|
815
817
|
default: () => {
|
|
816
818
|
}
|
|
817
819
|
}
|
|
818
|
-
},
|
|
819
|
-
props:
|
|
820
|
+
}, vl = /* @__PURE__ */ M({
|
|
821
|
+
props: hl,
|
|
820
822
|
setup(e) {
|
|
821
823
|
var d, f;
|
|
822
824
|
const t = x("usedLanguageText"), o = x("editorId");
|
|
@@ -842,7 +844,7 @@ const bl = {
|
|
|
842
844
|
if (c.imgSelected = !0, (h == null ? void 0 : h.length) > 0) {
|
|
843
845
|
const v = new FileReader();
|
|
844
846
|
v.onload = (b) => {
|
|
845
|
-
c.imgSrc = b.target.result,
|
|
847
|
+
c.imgSrc = b.target.result, z(() => {
|
|
846
848
|
m = new l(n.value, {
|
|
847
849
|
viewMode: 2,
|
|
848
850
|
preview: `.${s}-clip-preview-target`
|
|
@@ -855,7 +857,7 @@ const bl = {
|
|
|
855
857
|
}), T(() => [c.imgSelected], () => {
|
|
856
858
|
a.value.style = "";
|
|
857
859
|
}), T(() => c.isFullscreen, () => {
|
|
858
|
-
|
|
860
|
+
z(() => {
|
|
859
861
|
m == null || m.destroy(), a.value.style = "", n.value && (m = new l(n.value, {
|
|
860
862
|
viewMode: 2,
|
|
861
863
|
preview: `.${s}-clip-preview-target`
|
|
@@ -868,7 +870,7 @@ const bl = {
|
|
|
868
870
|
};
|
|
869
871
|
return () => {
|
|
870
872
|
var h;
|
|
871
|
-
return i(
|
|
873
|
+
return i(we, {
|
|
872
874
|
class: `${s}-modal-clip`,
|
|
873
875
|
title: (h = t.value.clipModalTips) == null ? void 0 : h.title,
|
|
874
876
|
visible: e.visible,
|
|
@@ -927,7 +929,7 @@ const bl = {
|
|
|
927
929
|
onClick: () => {
|
|
928
930
|
if (m) {
|
|
929
931
|
const k = m.getCroppedCanvas();
|
|
930
|
-
C.emit(o, "uploadImage", [
|
|
932
|
+
C.emit(o, "uploadImage", [ll(k.toDataURL("image/png"))], e.onOk), u();
|
|
931
933
|
}
|
|
932
934
|
}
|
|
933
935
|
}, [((v = t.value.clipModalTips) == null ? void 0 : v.buttonUpload) || ((b = t.value.linkModalTips) == null ? void 0 : b.buttonOK)])]), i("input", {
|
|
@@ -943,7 +945,7 @@ const bl = {
|
|
|
943
945
|
});
|
|
944
946
|
};
|
|
945
947
|
}
|
|
946
|
-
}),
|
|
948
|
+
}), pl = {
|
|
947
949
|
type: {
|
|
948
950
|
type: String,
|
|
949
951
|
default: "link"
|
|
@@ -966,27 +968,27 @@ const bl = {
|
|
|
966
968
|
default: () => {
|
|
967
969
|
}
|
|
968
970
|
}
|
|
969
|
-
},
|
|
970
|
-
props:
|
|
971
|
+
}, bl = /* @__PURE__ */ M({
|
|
972
|
+
props: pl,
|
|
971
973
|
setup(e) {
|
|
972
|
-
return () => i(
|
|
974
|
+
return () => i(ye, null, [i(gl, {
|
|
973
975
|
type: e.type,
|
|
974
976
|
visible: e.linkVisible,
|
|
975
977
|
onOk: e.onOk,
|
|
976
978
|
onCancel: e.onCancel
|
|
977
|
-
}, null), i(
|
|
979
|
+
}, null), i(vl, {
|
|
978
980
|
visible: e.clipVisible,
|
|
979
981
|
onOk: e.onOk,
|
|
980
982
|
onCancel: e.onCancel
|
|
981
983
|
}, null)]);
|
|
982
984
|
}
|
|
983
|
-
}),
|
|
985
|
+
}), kl = /* @__PURE__ */ M({
|
|
984
986
|
name: "MDEditorToolbar",
|
|
985
|
-
props:
|
|
987
|
+
props: al,
|
|
986
988
|
setup(e) {
|
|
987
989
|
const t = x("editorId"), o = x("usedLanguageText"), {
|
|
988
990
|
fullscreenHandler: l
|
|
989
|
-
} =
|
|
991
|
+
} = cl(e), r = `${t}-toolbar-wrapper`, n = N({
|
|
990
992
|
title: !1,
|
|
991
993
|
catalog: !1,
|
|
992
994
|
// 图片上传下拉
|
|
@@ -1021,11 +1023,11 @@ const bl = {
|
|
|
1021
1023
|
d.value.addEventListener("change", f);
|
|
1022
1024
|
});
|
|
1023
1025
|
const h = (v) => {
|
|
1024
|
-
var b, k, p, y, $, w, L, S,
|
|
1025
|
-
if (
|
|
1026
|
+
var b, k, p, y, $, w, L, S, j, B, q, ee, X, R, Z, K, P, V, te, ne, Te, Se, xe, Ee, Le, He, Ie, Ae, Fe, Me, Re, je, Be, Pe, Oe, De, Ne, _e, Ve, Ue, qe, We, Ge;
|
|
1027
|
+
if (kt.includes(v))
|
|
1026
1028
|
switch (v) {
|
|
1027
1029
|
case "-":
|
|
1028
|
-
return i(
|
|
1030
|
+
return i(Yt, null, null);
|
|
1029
1031
|
case "bold":
|
|
1030
1032
|
return i("div", {
|
|
1031
1033
|
class: `${s}-toolbar-item`,
|
|
@@ -1115,12 +1117,12 @@ const bl = {
|
|
|
1115
1117
|
onClick: () => {
|
|
1116
1118
|
a("h5");
|
|
1117
1119
|
}
|
|
1118
|
-
}, [(
|
|
1120
|
+
}, [(j = o.value.titleItem) == null ? void 0 : j.h5]), i("li", {
|
|
1119
1121
|
class: `${s}-menu-item`,
|
|
1120
1122
|
onClick: () => {
|
|
1121
1123
|
a("h6");
|
|
1122
1124
|
}
|
|
1123
|
-
}, [(
|
|
1125
|
+
}, [(B = o.value.titleItem) == null ? void 0 : B.h6])])
|
|
1124
1126
|
}, {
|
|
1125
1127
|
default: () => {
|
|
1126
1128
|
var E;
|
|
@@ -1138,7 +1140,7 @@ const bl = {
|
|
|
1138
1140
|
case "sub":
|
|
1139
1141
|
return i("div", {
|
|
1140
1142
|
class: `${s}-toolbar-item`,
|
|
1141
|
-
title: (
|
|
1143
|
+
title: (q = o.value.toolbarTips) == null ? void 0 : q.sub,
|
|
1142
1144
|
onClick: () => {
|
|
1143
1145
|
a("sub");
|
|
1144
1146
|
}
|
|
@@ -1164,7 +1166,7 @@ const bl = {
|
|
|
1164
1166
|
case "quote":
|
|
1165
1167
|
return i("div", {
|
|
1166
1168
|
class: `${s}-toolbar-item`,
|
|
1167
|
-
title: (
|
|
1169
|
+
title: (X = o.value.toolbarTips) == null ? void 0 : X.quote,
|
|
1168
1170
|
onClick: () => {
|
|
1169
1171
|
a("quote");
|
|
1170
1172
|
}
|
|
@@ -1177,7 +1179,7 @@ const bl = {
|
|
|
1177
1179
|
case "unorderedList":
|
|
1178
1180
|
return i("div", {
|
|
1179
1181
|
class: `${s}-toolbar-item`,
|
|
1180
|
-
title: (
|
|
1182
|
+
title: (R = o.value.toolbarTips) == null ? void 0 : R.unorderedList,
|
|
1181
1183
|
onClick: () => {
|
|
1182
1184
|
a("unorderedList");
|
|
1183
1185
|
}
|
|
@@ -1190,7 +1192,7 @@ const bl = {
|
|
|
1190
1192
|
case "orderedList":
|
|
1191
1193
|
return i("div", {
|
|
1192
1194
|
class: `${s}-toolbar-item`,
|
|
1193
|
-
title: (
|
|
1195
|
+
title: (Z = o.value.toolbarTips) == null ? void 0 : Z.orderedList,
|
|
1194
1196
|
onClick: () => {
|
|
1195
1197
|
a("orderedList");
|
|
1196
1198
|
}
|
|
@@ -1203,7 +1205,7 @@ const bl = {
|
|
|
1203
1205
|
case "task":
|
|
1204
1206
|
return i("div", {
|
|
1205
1207
|
class: `${s}-toolbar-item`,
|
|
1206
|
-
title: (
|
|
1208
|
+
title: (K = o.value.toolbarTips) == null ? void 0 : K.task,
|
|
1207
1209
|
onClick: () => {
|
|
1208
1210
|
a("task");
|
|
1209
1211
|
}
|
|
@@ -1216,7 +1218,7 @@ const bl = {
|
|
|
1216
1218
|
case "codeRow":
|
|
1217
1219
|
return i("div", {
|
|
1218
1220
|
class: `${s}-toolbar-item`,
|
|
1219
|
-
title: (
|
|
1221
|
+
title: (P = o.value.toolbarTips) == null ? void 0 : P.codeRow,
|
|
1220
1222
|
onClick: () => {
|
|
1221
1223
|
a("codeRow");
|
|
1222
1224
|
}
|
|
@@ -1255,7 +1257,7 @@ const bl = {
|
|
|
1255
1257
|
case "image":
|
|
1256
1258
|
return e.noUploadImg ? i("div", {
|
|
1257
1259
|
class: `${s}-toolbar-item`,
|
|
1258
|
-
title: (
|
|
1260
|
+
title: (ne = o.value.toolbarTips) == null ? void 0 : ne.image,
|
|
1259
1261
|
onClick: () => {
|
|
1260
1262
|
c.type = "image", c.linkVisible = !0;
|
|
1261
1263
|
}
|
|
@@ -1280,17 +1282,17 @@ const bl = {
|
|
|
1280
1282
|
onClick: () => {
|
|
1281
1283
|
c.type = "image", c.linkVisible = !0;
|
|
1282
1284
|
}
|
|
1283
|
-
}, [(
|
|
1285
|
+
}, [(Te = o.value.imgTitleItem) == null ? void 0 : Te.link]), i("li", {
|
|
1284
1286
|
class: `${s}-menu-item`,
|
|
1285
1287
|
onClick: () => {
|
|
1286
1288
|
d.value.click();
|
|
1287
1289
|
}
|
|
1288
|
-
}, [(
|
|
1290
|
+
}, [(Se = o.value.imgTitleItem) == null ? void 0 : Se.upload]), i("li", {
|
|
1289
1291
|
class: `${s}-menu-item`,
|
|
1290
1292
|
onClick: () => {
|
|
1291
1293
|
c.clipVisible = !0;
|
|
1292
1294
|
}
|
|
1293
|
-
}, [(
|
|
1295
|
+
}, [(xe = o.value.imgTitleItem) == null ? void 0 : xe.clip2upload])])
|
|
1294
1296
|
}, {
|
|
1295
1297
|
default: () => {
|
|
1296
1298
|
var E;
|
|
@@ -1313,7 +1315,7 @@ const bl = {
|
|
|
1313
1315
|
n.table = E;
|
|
1314
1316
|
},
|
|
1315
1317
|
key: "bar-table",
|
|
1316
|
-
overlay: i(
|
|
1318
|
+
overlay: i(ul, {
|
|
1317
1319
|
tableShape: e.tableShape,
|
|
1318
1320
|
onSelected: (E) => {
|
|
1319
1321
|
a("table", {
|
|
@@ -1338,7 +1340,7 @@ const bl = {
|
|
|
1338
1340
|
case "revoke":
|
|
1339
1341
|
return i("div", {
|
|
1340
1342
|
class: `${s}-toolbar-item`,
|
|
1341
|
-
title: (
|
|
1343
|
+
title: (Ee = o.value.toolbarTips) == null ? void 0 : Ee.revoke,
|
|
1342
1344
|
onClick: () => {
|
|
1343
1345
|
C.emit(t, "ctrlZ");
|
|
1344
1346
|
}
|
|
@@ -1351,7 +1353,7 @@ const bl = {
|
|
|
1351
1353
|
case "next":
|
|
1352
1354
|
return i("div", {
|
|
1353
1355
|
class: `${s}-toolbar-item`,
|
|
1354
|
-
title: (
|
|
1356
|
+
title: (Le = o.value.toolbarTips) == null ? void 0 : Le.next,
|
|
1355
1357
|
onClick: () => {
|
|
1356
1358
|
C.emit(t, "ctrlShiftZ");
|
|
1357
1359
|
}
|
|
@@ -1364,9 +1366,9 @@ const bl = {
|
|
|
1364
1366
|
case "save":
|
|
1365
1367
|
return i("div", {
|
|
1366
1368
|
class: `${s}-toolbar-item`,
|
|
1367
|
-
title: (
|
|
1369
|
+
title: (He = o.value.toolbarTips) == null ? void 0 : He.save,
|
|
1368
1370
|
onClick: () => {
|
|
1369
|
-
C.emit(t,
|
|
1371
|
+
C.emit(t, ue);
|
|
1370
1372
|
}
|
|
1371
1373
|
}, [i("svg", {
|
|
1372
1374
|
class: `${s}-icon`,
|
|
@@ -1377,7 +1379,7 @@ const bl = {
|
|
|
1377
1379
|
case "prettier":
|
|
1378
1380
|
return e.noPrettier ? "" : i("div", {
|
|
1379
1381
|
class: `${s}-toolbar-item`,
|
|
1380
|
-
title: (
|
|
1382
|
+
title: (Ie = o.value.toolbarTips) == null ? void 0 : Ie.prettier,
|
|
1381
1383
|
onClick: () => {
|
|
1382
1384
|
a("prettier");
|
|
1383
1385
|
}
|
|
@@ -1390,7 +1392,7 @@ const bl = {
|
|
|
1390
1392
|
case "pageFullscreen":
|
|
1391
1393
|
return !e.setting.fullscreen && i("div", {
|
|
1392
1394
|
class: `${s}-toolbar-item`,
|
|
1393
|
-
title: (
|
|
1395
|
+
title: (Ae = o.value.toolbarTips) == null ? void 0 : Ae.pageFullscreen,
|
|
1394
1396
|
onClick: () => {
|
|
1395
1397
|
e.updateSetting("pageFullscreen");
|
|
1396
1398
|
}
|
|
@@ -1403,7 +1405,7 @@ const bl = {
|
|
|
1403
1405
|
case "fullscreen":
|
|
1404
1406
|
return i("div", {
|
|
1405
1407
|
class: `${s}-toolbar-item`,
|
|
1406
|
-
title: (
|
|
1408
|
+
title: (Fe = o.value.toolbarTips) == null ? void 0 : Fe.fullscreen,
|
|
1407
1409
|
onClick: () => {
|
|
1408
1410
|
l();
|
|
1409
1411
|
}
|
|
@@ -1416,7 +1418,7 @@ const bl = {
|
|
|
1416
1418
|
case "preview":
|
|
1417
1419
|
return i("div", {
|
|
1418
1420
|
class: `${s}-toolbar-item`,
|
|
1419
|
-
title: (
|
|
1421
|
+
title: (Me = o.value.toolbarTips) == null ? void 0 : Me.preview,
|
|
1420
1422
|
onClick: () => {
|
|
1421
1423
|
e.updateSetting("preview");
|
|
1422
1424
|
}
|
|
@@ -1429,7 +1431,7 @@ const bl = {
|
|
|
1429
1431
|
case "htmlPreview":
|
|
1430
1432
|
return i("div", {
|
|
1431
1433
|
class: `${s}-toolbar-item`,
|
|
1432
|
-
title: (
|
|
1434
|
+
title: (Re = o.value.toolbarTips) == null ? void 0 : Re.htmlPreview,
|
|
1433
1435
|
onClick: () => {
|
|
1434
1436
|
e.updateSetting("htmlPreview");
|
|
1435
1437
|
}
|
|
@@ -1442,9 +1444,9 @@ const bl = {
|
|
|
1442
1444
|
case "catalog":
|
|
1443
1445
|
return i("div", {
|
|
1444
1446
|
class: `${s}-toolbar-item`,
|
|
1445
|
-
title: (
|
|
1447
|
+
title: (je = o.value.toolbarTips) == null ? void 0 : je.catalog,
|
|
1446
1448
|
onClick: () => {
|
|
1447
|
-
C.emit(t,
|
|
1449
|
+
C.emit(t, $e);
|
|
1448
1450
|
},
|
|
1449
1451
|
key: "bar-catalog"
|
|
1450
1452
|
}, [i("svg", {
|
|
@@ -1456,8 +1458,8 @@ const bl = {
|
|
|
1456
1458
|
case "github":
|
|
1457
1459
|
return i("div", {
|
|
1458
1460
|
class: `${s}-toolbar-item`,
|
|
1459
|
-
title: (
|
|
1460
|
-
onClick: () =>
|
|
1461
|
+
title: (Be = o.value.toolbarTips) == null ? void 0 : Be.github,
|
|
1462
|
+
onClick: () => tl("https://github.com/imzbf/md-editor-v3")
|
|
1461
1463
|
}, [i("svg", {
|
|
1462
1464
|
class: `${s}-icon`,
|
|
1463
1465
|
"aria-hidden": "true"
|
|
@@ -1481,42 +1483,42 @@ const bl = {
|
|
|
1481
1483
|
onClick: () => {
|
|
1482
1484
|
a("flow");
|
|
1483
1485
|
}
|
|
1484
|
-
}, [(
|
|
1486
|
+
}, [(Pe = o.value.mermaid) == null ? void 0 : Pe.flow]), i("li", {
|
|
1485
1487
|
class: `${s}-menu-item`,
|
|
1486
1488
|
onClick: () => {
|
|
1487
1489
|
a("sequence");
|
|
1488
1490
|
}
|
|
1489
|
-
}, [(
|
|
1491
|
+
}, [(Oe = o.value.mermaid) == null ? void 0 : Oe.sequence]), i("li", {
|
|
1490
1492
|
class: `${s}-menu-item`,
|
|
1491
1493
|
onClick: () => {
|
|
1492
1494
|
a("gantt");
|
|
1493
1495
|
}
|
|
1494
|
-
}, [(
|
|
1496
|
+
}, [(De = o.value.mermaid) == null ? void 0 : De.gantt]), i("li", {
|
|
1495
1497
|
class: `${s}-menu-item`,
|
|
1496
1498
|
onClick: () => {
|
|
1497
1499
|
a("class");
|
|
1498
1500
|
}
|
|
1499
|
-
}, [(
|
|
1501
|
+
}, [(Ne = o.value.mermaid) == null ? void 0 : Ne.class]), i("li", {
|
|
1500
1502
|
class: `${s}-menu-item`,
|
|
1501
1503
|
onClick: () => {
|
|
1502
1504
|
a("state");
|
|
1503
1505
|
}
|
|
1504
|
-
}, [(
|
|
1506
|
+
}, [(_e = o.value.mermaid) == null ? void 0 : _e.state]), i("li", {
|
|
1505
1507
|
class: `${s}-menu-item`,
|
|
1506
1508
|
onClick: () => {
|
|
1507
1509
|
a("pie");
|
|
1508
1510
|
}
|
|
1509
|
-
}, [(
|
|
1511
|
+
}, [(Ve = o.value.mermaid) == null ? void 0 : Ve.pie]), i("li", {
|
|
1510
1512
|
class: `${s}-menu-item`,
|
|
1511
1513
|
onClick: () => {
|
|
1512
1514
|
a("relationship");
|
|
1513
1515
|
}
|
|
1514
|
-
}, [(
|
|
1516
|
+
}, [(Ue = o.value.mermaid) == null ? void 0 : Ue.relationship]), i("li", {
|
|
1515
1517
|
class: `${s}-menu-item`,
|
|
1516
1518
|
onClick: () => {
|
|
1517
1519
|
a("journey");
|
|
1518
1520
|
}
|
|
1519
|
-
}, [(
|
|
1521
|
+
}, [(qe = o.value.mermaid) == null ? void 0 : qe.journey])]),
|
|
1520
1522
|
key: "bar-mermaid"
|
|
1521
1523
|
}, {
|
|
1522
1524
|
default: () => {
|
|
@@ -1549,12 +1551,12 @@ const bl = {
|
|
|
1549
1551
|
onClick: () => {
|
|
1550
1552
|
a("katexInline");
|
|
1551
1553
|
}
|
|
1552
|
-
}, [(
|
|
1554
|
+
}, [(We = o.value.katex) == null ? void 0 : We.inline]), i("li", {
|
|
1553
1555
|
class: `${s}-menu-item`,
|
|
1554
1556
|
onClick: () => {
|
|
1555
1557
|
a("katexBlock");
|
|
1556
1558
|
}
|
|
1557
|
-
}, [(
|
|
1559
|
+
}, [(Ge = o.value.katex) == null ? void 0 : Ge.block])]),
|
|
1558
1560
|
key: "bar-katex"
|
|
1559
1561
|
}, {
|
|
1560
1562
|
default: () => {
|
|
@@ -1576,7 +1578,7 @@ const bl = {
|
|
|
1576
1578
|
};
|
|
1577
1579
|
return () => {
|
|
1578
1580
|
const v = u.value[0].map((k) => h(k)), b = u.value[1].map((k) => h(k));
|
|
1579
|
-
return i(
|
|
1581
|
+
return i(ye, null, [e.toolbars.length > 0 && i("div", {
|
|
1580
1582
|
class: `${s}-toolbar-wrapper`,
|
|
1581
1583
|
id: r
|
|
1582
1584
|
}, [i("div", {
|
|
@@ -1594,7 +1596,7 @@ const bl = {
|
|
|
1594
1596
|
style: {
|
|
1595
1597
|
display: "none"
|
|
1596
1598
|
}
|
|
1597
|
-
}, null), i(
|
|
1599
|
+
}, null), i(bl, {
|
|
1598
1600
|
linkVisible: c.linkVisible,
|
|
1599
1601
|
clipVisible: c.clipVisible,
|
|
1600
1602
|
type: c.type,
|
|
@@ -1610,48 +1612,46 @@ const bl = {
|
|
|
1610
1612
|
}, null)]);
|
|
1611
1613
|
};
|
|
1612
1614
|
}
|
|
1613
|
-
}),
|
|
1614
|
-
let l = e.scrollTop;
|
|
1615
|
-
const r = () => {
|
|
1616
|
-
const n = t - l;
|
|
1617
|
-
l = l + n / 5, Math.abs(n) < 1 ? (e.scrollTo(0, t), o && o()) : (e.scrollTo(0, l), requestAnimationFrame(r));
|
|
1618
|
-
};
|
|
1619
|
-
r();
|
|
1620
|
-
}, ae = (e) => {
|
|
1615
|
+
}), ie = (e) => {
|
|
1621
1616
|
const { marginTop: t } = getComputedStyle(e);
|
|
1622
1617
|
return e.offsetTop - parseFloat(t);
|
|
1623
|
-
},
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
}, 50), l = (r) => {
|
|
1618
|
+
}, yl = (e, t) => {
|
|
1619
|
+
let o = !1;
|
|
1620
|
+
const l = (r) => {
|
|
1627
1621
|
const n = e.clientHeight, a = t.clientHeight, c = e.scrollHeight, m = t.scrollHeight, u = (c - n) / (m - a);
|
|
1628
|
-
r.target === e
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1622
|
+
if (r.target === e)
|
|
1623
|
+
o = !0, t.scrollTo({
|
|
1624
|
+
top: e.scrollTop / u
|
|
1625
|
+
// behavior: 'smooth'
|
|
1626
|
+
});
|
|
1627
|
+
else {
|
|
1628
|
+
if (o) {
|
|
1629
|
+
o = !1;
|
|
1630
|
+
return;
|
|
1631
|
+
}
|
|
1632
|
+
o = !0, e.scrollTo({
|
|
1633
|
+
top: t.scrollTop * u
|
|
1634
|
+
// behavior: 'smooth'
|
|
1635
|
+
});
|
|
1636
|
+
}
|
|
1635
1637
|
};
|
|
1636
1638
|
return [
|
|
1637
1639
|
() => {
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
})
|
|
1640
|
+
e.addEventListener("scroll", l, {
|
|
1641
|
+
passive: !0
|
|
1642
|
+
}), t.addEventListener("scroll", l, {
|
|
1643
|
+
passive: !0
|
|
1644
|
+
}), e.dispatchEvent(new Event("scroll"));
|
|
1641
1645
|
},
|
|
1642
1646
|
() => {
|
|
1643
1647
|
e.removeEventListener("scroll", l), t.removeEventListener("scroll", l);
|
|
1644
1648
|
}
|
|
1645
1649
|
];
|
|
1646
|
-
},
|
|
1650
|
+
}, Cl = (e, t, o, l) => {
|
|
1647
1651
|
const { view: r } = o;
|
|
1648
|
-
let n =
|
|
1649
|
-
const a =
|
|
1650
|
-
|
|
1651
|
-
}, 50);
|
|
1652
|
-
let c = [];
|
|
1653
|
-
const m = () => {
|
|
1654
|
-
c = [];
|
|
1652
|
+
let n = [];
|
|
1653
|
+
const a = () => {
|
|
1654
|
+
n = [];
|
|
1655
1655
|
const { width: d, lineHeight: f, fontFamily: h, fontSize: v, whiteSpace: b } = getComputedStyle(
|
|
1656
1656
|
document.querySelector(".cm-content")
|
|
1657
1657
|
), k = document.createElement("div");
|
|
@@ -1664,49 +1664,56 @@ const bl = {
|
|
|
1664
1664
|
lineHeight: k.offsetHeight,
|
|
1665
1665
|
scrollHeight: p
|
|
1666
1666
|
};
|
|
1667
|
-
|
|
1667
|
+
n.push($);
|
|
1668
1668
|
}), k.remove();
|
|
1669
|
-
}
|
|
1669
|
+
};
|
|
1670
|
+
let c = !1, m = !1;
|
|
1671
|
+
const u = de((d) => {
|
|
1670
1672
|
var b, k;
|
|
1671
|
-
n++;
|
|
1672
1673
|
const f = r.lineBlockAtHeight(r.scrollDOM.scrollTop), h = r.state.doc.lineAt(f.from), v = Array.from(t.children[0].children).filter(
|
|
1673
1674
|
(p) => p.hasAttribute("data-line")
|
|
1674
1675
|
);
|
|
1675
1676
|
if (d.target === e) {
|
|
1676
|
-
if (
|
|
1677
|
-
|
|
1678
|
-
|
|
1677
|
+
if (m) {
|
|
1678
|
+
m = !1;
|
|
1679
|
+
return;
|
|
1680
|
+
}
|
|
1681
|
+
if (e.scrollTop + e.clientHeight >= e.scrollHeight) {
|
|
1682
|
+
c = !0, t.scrollTo({
|
|
1683
|
+
top: t.scrollHeight - t.clientHeight
|
|
1679
1684
|
});
|
|
1680
1685
|
return;
|
|
1681
1686
|
}
|
|
1682
1687
|
const { number: p } = h;
|
|
1683
1688
|
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
1689
|
for (let R = 0; R < v.length; R++) {
|
|
1685
|
-
const
|
|
1690
|
+
const Z = Number(v[R].dataset.line) + 1, K = Number(
|
|
1686
1691
|
R + 1 >= v.length ? -2 : v[R + 1].dataset.line
|
|
1687
1692
|
);
|
|
1688
|
-
if (p >=
|
|
1689
|
-
y = v[R], w = v[R + 1], $ =
|
|
1693
|
+
if (p >= Z && p <= K) {
|
|
1694
|
+
y = v[R], w = v[R + 1], $ = Z, L = K;
|
|
1690
1695
|
break;
|
|
1691
1696
|
}
|
|
1692
1697
|
}
|
|
1693
|
-
if (!y)
|
|
1694
|
-
n--;
|
|
1698
|
+
if (!y)
|
|
1695
1699
|
return;
|
|
1696
|
-
}
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
--n === 0 && a();
|
|
1700
|
+
const S = (r.scrollDOM.scrollTop - n[$ - 1].scrollHeight + n[$ - 1].lineHeight) / (n[L - 1].scrollHeight - n[$ - 1].scrollHeight + n[$ - 1].lineHeight), { marginTop: j } = getComputedStyle(y), B = y.offsetTop - parseFloat(j), { marginTop: q } = getComputedStyle(w), X = w.offsetTop - parseFloat(q) - B;
|
|
1701
|
+
c = !0, t.scrollTo({
|
|
1702
|
+
top: B + X * S
|
|
1700
1703
|
});
|
|
1701
1704
|
} else {
|
|
1702
|
-
if (
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
+
if (c) {
|
|
1706
|
+
c = !1;
|
|
1707
|
+
return;
|
|
1708
|
+
}
|
|
1709
|
+
if (t.scrollTop === 0) {
|
|
1710
|
+
m = !0, e.scrollTo({
|
|
1711
|
+
top: 0
|
|
1705
1712
|
});
|
|
1706
1713
|
return;
|
|
1707
1714
|
} else if (t.scrollTop + t.clientHeight >= t.scrollHeight) {
|
|
1708
|
-
|
|
1709
|
-
|
|
1715
|
+
m = !0, e.scrollTo({
|
|
1716
|
+
top: e.scrollHeight - e.clientHeight
|
|
1710
1717
|
});
|
|
1711
1718
|
return;
|
|
1712
1719
|
}
|
|
@@ -1714,90 +1721,84 @@ const bl = {
|
|
|
1714
1721
|
let $ = Math.floor(
|
|
1715
1722
|
Number(v[v.length - 1].dataset.line) * (p / y)
|
|
1716
1723
|
), w;
|
|
1717
|
-
for (let
|
|
1718
|
-
const V = t.querySelector(`[data-line="${
|
|
1724
|
+
for (let P = $; P >= 0; P--) {
|
|
1725
|
+
const V = t.querySelector(`[data-line="${P}"]`);
|
|
1719
1726
|
if (V) {
|
|
1720
|
-
w = V, $ =
|
|
1727
|
+
w = V, $ = P;
|
|
1721
1728
|
break;
|
|
1722
1729
|
}
|
|
1723
1730
|
}
|
|
1724
|
-
if (!w)
|
|
1725
|
-
n--;
|
|
1731
|
+
if (!w)
|
|
1726
1732
|
return;
|
|
1727
|
-
}
|
|
1728
1733
|
let L, S;
|
|
1729
1734
|
for (; ; ) {
|
|
1730
|
-
const
|
|
1735
|
+
const P = v.indexOf(w), V = v[P + 1], te = ie(w);
|
|
1731
1736
|
if (te > p) {
|
|
1732
|
-
if (
|
|
1737
|
+
if (P === 0) {
|
|
1733
1738
|
L = w, S = V;
|
|
1734
1739
|
break;
|
|
1735
1740
|
}
|
|
1736
|
-
w = v[
|
|
1741
|
+
w = v[P - 1];
|
|
1737
1742
|
continue;
|
|
1738
1743
|
}
|
|
1739
|
-
const
|
|
1740
|
-
if (te <= p &&
|
|
1744
|
+
const ne = ie(V);
|
|
1745
|
+
if (te <= p && ne > p) {
|
|
1741
1746
|
L = w, S = V;
|
|
1742
1747
|
break;
|
|
1743
1748
|
}
|
|
1744
1749
|
w = V;
|
|
1745
1750
|
}
|
|
1746
|
-
const
|
|
1747
|
-
|
|
1748
|
-
|
|
1751
|
+
const j = ie(L), B = ie(S), q = (p - j) / (B - j), ee = Number(L.dataset.line), X = Number(S.dataset.line), R = n[ee].scrollHeight, K = n[X].scrollHeight - R;
|
|
1752
|
+
m = !0, e.scrollTo({
|
|
1753
|
+
top: R + K * q
|
|
1749
1754
|
});
|
|
1750
1755
|
}
|
|
1751
1756
|
}, 6);
|
|
1752
1757
|
return [
|
|
1753
1758
|
() => {
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
})
|
|
1759
|
+
a(), e.addEventListener("scroll", u, {
|
|
1760
|
+
passive: !0
|
|
1761
|
+
}), t.addEventListener("scroll", u, {
|
|
1762
|
+
passive: !0
|
|
1763
|
+
}), e.dispatchEvent(new Event("scroll"));
|
|
1757
1764
|
},
|
|
1758
1765
|
() => {
|
|
1759
|
-
|
|
1766
|
+
e.removeEventListener("scroll", u), t.removeEventListener("scroll", u);
|
|
1760
1767
|
}
|
|
1761
1768
|
];
|
|
1762
|
-
},
|
|
1769
|
+
}, $l = (e, t, o, l, r) => {
|
|
1763
1770
|
const n = x("previewOnly");
|
|
1764
1771
|
let a = () => {
|
|
1765
1772
|
}, c = () => {
|
|
1766
1773
|
};
|
|
1767
1774
|
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,
|
|
1775
|
+
a();
|
|
1776
|
+
const u = document.querySelector(".cm-scroller");
|
|
1777
|
+
!n && (o.value || l.value) && ([c, a] = (o.value ? Cl : yl)(
|
|
1778
|
+
u,
|
|
1795
1779
|
o.value || l.value,
|
|
1796
1780
|
r.value,
|
|
1797
1781
|
e.value
|
|
1798
1782
|
)), e.scrollAuto && c();
|
|
1799
|
-
}
|
|
1800
|
-
|
|
1783
|
+
};
|
|
1784
|
+
T(
|
|
1785
|
+
[
|
|
1786
|
+
t,
|
|
1787
|
+
Q(e.setting, "preview"),
|
|
1788
|
+
Q(e.setting, "htmlPreview"),
|
|
1789
|
+
Q(e.setting, "fullscreen"),
|
|
1790
|
+
Q(e.setting, "pageFullscreen")
|
|
1791
|
+
],
|
|
1792
|
+
() => {
|
|
1793
|
+
z(m);
|
|
1794
|
+
}
|
|
1795
|
+
), T(
|
|
1796
|
+
() => e.scrollAuto,
|
|
1797
|
+
(u) => {
|
|
1798
|
+
u ? c() : a();
|
|
1799
|
+
}
|
|
1800
|
+
), A(m);
|
|
1801
|
+
}, wl = (e, t, o) => {
|
|
1801
1802
|
var d, f, h, v, b, k;
|
|
1802
1803
|
let l = "", r = 0, n = 0, a = !0, c = !1;
|
|
1803
1804
|
const m = t.getSelectedText(), u = (d = I.editorConfig) == null ? void 0 : d.mermaidTemplate;
|
|
@@ -2009,18 +2010,18 @@ $$
|
|
|
2009
2010
|
replaceAll: c
|
|
2010
2011
|
}
|
|
2011
2012
|
};
|
|
2012
|
-
},
|
|
2013
|
+
}, Tl = "#e5c07b", ot = "var(--md-color)", Sl = "#56b6c2", xl = "#ffffff", le = "var(--md-color)", nt = "#e5c07b", El = "#e5c07b", Ll = "var(--md-color)", rt = "#d19a66", Hl = "#c678dd", Il = "#21252b", it = "#2c313a", at = "#000", fe = "#353a42", Al = "#ceedfa33", st = "#528bff", Fl = Ce.theme(
|
|
2013
2014
|
{
|
|
2014
2015
|
"&": {
|
|
2015
|
-
color:
|
|
2016
|
-
backgroundColor:
|
|
2016
|
+
color: le,
|
|
2017
|
+
backgroundColor: at
|
|
2017
2018
|
},
|
|
2018
2019
|
".cm-content": {
|
|
2019
|
-
caretColor:
|
|
2020
|
+
caretColor: st
|
|
2020
2021
|
},
|
|
2021
|
-
".cm-cursor, .cm-dropCursor": { borderLeftColor:
|
|
2022
|
-
"&.cm-focused .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection": { backgroundColor:
|
|
2023
|
-
".cm-panels": { backgroundColor:
|
|
2022
|
+
".cm-cursor, .cm-dropCursor": { borderLeftColor: st },
|
|
2023
|
+
"&.cm-focused .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection": { backgroundColor: Al },
|
|
2024
|
+
".cm-panels": { backgroundColor: Il, color: le },
|
|
2024
2025
|
".cm-panels.cm-panels-top": { borderBottom: "2px solid black" },
|
|
2025
2026
|
".cm-panels.cm-panels-bottom": { borderTop: "2px solid black" },
|
|
2026
2027
|
".cm-searchMatch": {
|
|
@@ -2036,13 +2037,13 @@ $$
|
|
|
2036
2037
|
backgroundColor: "#bad0f847"
|
|
2037
2038
|
},
|
|
2038
2039
|
".cm-gutters": {
|
|
2039
|
-
backgroundColor:
|
|
2040
|
-
color:
|
|
2040
|
+
backgroundColor: at,
|
|
2041
|
+
color: le,
|
|
2041
2042
|
borderRight: "1px solid",
|
|
2042
2043
|
borderColor: "var(--md-border-color)"
|
|
2043
2044
|
},
|
|
2044
2045
|
".cm-activeLineGutter": {
|
|
2045
|
-
backgroundColor:
|
|
2046
|
+
backgroundColor: it
|
|
2046
2047
|
},
|
|
2047
2048
|
".cm-foldPlaceholder": {
|
|
2048
2049
|
backgroundColor: "transparent",
|
|
@@ -2051,30 +2052,30 @@ $$
|
|
|
2051
2052
|
},
|
|
2052
2053
|
".cm-tooltip": {
|
|
2053
2054
|
border: "none",
|
|
2054
|
-
backgroundColor:
|
|
2055
|
+
backgroundColor: fe
|
|
2055
2056
|
},
|
|
2056
2057
|
".cm-tooltip .cm-tooltip-arrow:before": {
|
|
2057
2058
|
borderTopColor: "transparent",
|
|
2058
2059
|
borderBottomColor: "transparent"
|
|
2059
2060
|
},
|
|
2060
2061
|
".cm-tooltip .cm-tooltip-arrow:after": {
|
|
2061
|
-
borderTopColor:
|
|
2062
|
-
borderBottomColor:
|
|
2062
|
+
borderTopColor: fe,
|
|
2063
|
+
borderBottomColor: fe
|
|
2063
2064
|
},
|
|
2064
2065
|
".cm-tooltip-autocomplete": {
|
|
2065
2066
|
"& > ul > li[aria-selected]": {
|
|
2066
|
-
backgroundColor:
|
|
2067
|
-
color:
|
|
2067
|
+
backgroundColor: it,
|
|
2068
|
+
color: le
|
|
2068
2069
|
}
|
|
2069
2070
|
}
|
|
2070
2071
|
},
|
|
2071
2072
|
{ dark: !0 }
|
|
2072
|
-
),
|
|
2073
|
-
{ tag: g.keyword, color:
|
|
2074
|
-
{ tag: [g.name, g.deleted, g.character, g.propertyName, g.macroName], color:
|
|
2075
|
-
{ tag: [g.function(g.variableName), g.labelName], color:
|
|
2076
|
-
{ tag: [g.color, g.constant(g.name), g.standard(g.name)], color:
|
|
2077
|
-
{ tag: [g.definition(g.name), g.separator], color:
|
|
2073
|
+
), Ml = pt.define([
|
|
2074
|
+
{ tag: g.keyword, color: Hl },
|
|
2075
|
+
{ tag: [g.name, g.deleted, g.character, g.propertyName, g.macroName], color: ot },
|
|
2076
|
+
{ tag: [g.function(g.variableName), g.labelName], color: El },
|
|
2077
|
+
{ tag: [g.color, g.constant(g.name), g.standard(g.name)], color: rt },
|
|
2078
|
+
{ tag: [g.definition(g.name), g.separator], color: le },
|
|
2078
2079
|
{
|
|
2079
2080
|
tag: [
|
|
2080
2081
|
g.typeName,
|
|
@@ -2086,7 +2087,7 @@ $$
|
|
|
2086
2087
|
g.self,
|
|
2087
2088
|
g.namespace
|
|
2088
2089
|
],
|
|
2089
|
-
color:
|
|
2090
|
+
color: Tl
|
|
2090
2091
|
},
|
|
2091
2092
|
{
|
|
2092
2093
|
tag: [
|
|
@@ -2098,32 +2099,32 @@ $$
|
|
|
2098
2099
|
g.link,
|
|
2099
2100
|
g.special(g.string)
|
|
2100
2101
|
],
|
|
2101
|
-
color:
|
|
2102
|
+
color: Sl
|
|
2102
2103
|
},
|
|
2103
|
-
{ tag: [g.meta, g.comment], color:
|
|
2104
|
+
{ tag: [g.meta, g.comment], color: nt },
|
|
2104
2105
|
{ tag: g.strong, fontWeight: "bold" },
|
|
2105
2106
|
{ tag: g.emphasis, fontStyle: "italic" },
|
|
2106
2107
|
{ 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:
|
|
2110
|
-
{ tag: [g.processingInstruction, g.string, g.inserted], color:
|
|
2111
|
-
{ tag: g.invalid, color:
|
|
2112
|
-
]),
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
],
|
|
2108
|
+
{ tag: g.link, color: nt, textDecoration: "underline" },
|
|
2109
|
+
{ tag: g.heading, fontWeight: "bold", color: ot },
|
|
2110
|
+
{ tag: [g.atom, g.bool, g.special(g.variableName)], color: rt },
|
|
2111
|
+
{ tag: [g.processingInstruction, g.string, g.inserted], color: Ll },
|
|
2112
|
+
{ tag: g.invalid, color: xl }
|
|
2113
|
+
]), Rl = [
|
|
2114
|
+
Fl,
|
|
2115
|
+
bt(Ml)
|
|
2116
|
+
], jl = "#e5c07b", ct = "#3f4a54", Bl = "#56b6c2", Pl = "#fff", oe = "#3f4a54", dt = "#2d8cf0", Ol = "#2d8cf0", Dl = "#3f4a54", ut = "#d19a66", Nl = "#c678dd", _l = "#21252b", mt = "#2c313a", ft = "#fff", ge = "#353a42", Vl = "#bad5fa", gt = "#3f4a54", Ul = Ce.theme(
|
|
2116
2117
|
{
|
|
2117
2118
|
"&": {
|
|
2118
|
-
color:
|
|
2119
|
-
backgroundColor:
|
|
2119
|
+
color: oe,
|
|
2120
|
+
backgroundColor: ft
|
|
2120
2121
|
},
|
|
2121
2122
|
".cm-content": {
|
|
2122
|
-
caretColor:
|
|
2123
|
+
caretColor: gt
|
|
2123
2124
|
},
|
|
2124
|
-
".cm-cursor, .cm-dropCursor": { borderLeftColor:
|
|
2125
|
-
"&.cm-focused .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection": { backgroundColor:
|
|
2126
|
-
".cm-panels": { backgroundColor:
|
|
2125
|
+
".cm-cursor, .cm-dropCursor": { borderLeftColor: gt },
|
|
2126
|
+
"&.cm-focused .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection": { backgroundColor: Vl },
|
|
2127
|
+
".cm-panels": { backgroundColor: _l, color: oe },
|
|
2127
2128
|
".cm-panels.cm-panels-top": { borderBottom: "2px solid black" },
|
|
2128
2129
|
".cm-panels.cm-panels-bottom": { borderTop: "2px solid black" },
|
|
2129
2130
|
".cm-searchMatch": {
|
|
@@ -2139,13 +2140,13 @@ $$
|
|
|
2139
2140
|
backgroundColor: "#bad0f847"
|
|
2140
2141
|
},
|
|
2141
2142
|
".cm-gutters": {
|
|
2142
|
-
backgroundColor:
|
|
2143
|
-
color:
|
|
2143
|
+
backgroundColor: ft,
|
|
2144
|
+
color: oe,
|
|
2144
2145
|
borderRight: "1px solid",
|
|
2145
2146
|
borderColor: "var(--md-border-color)"
|
|
2146
2147
|
},
|
|
2147
2148
|
".cm-activeLineGutter": {
|
|
2148
|
-
backgroundColor:
|
|
2149
|
+
backgroundColor: mt
|
|
2149
2150
|
},
|
|
2150
2151
|
".cm-foldPlaceholder": {
|
|
2151
2152
|
backgroundColor: "transparent",
|
|
@@ -2154,30 +2155,30 @@ $$
|
|
|
2154
2155
|
},
|
|
2155
2156
|
".cm-tooltip": {
|
|
2156
2157
|
border: "none",
|
|
2157
|
-
backgroundColor:
|
|
2158
|
+
backgroundColor: ge
|
|
2158
2159
|
},
|
|
2159
2160
|
".cm-tooltip .cm-tooltip-arrow:before": {
|
|
2160
2161
|
borderTopColor: "transparent",
|
|
2161
2162
|
borderBottomColor: "transparent"
|
|
2162
2163
|
},
|
|
2163
2164
|
".cm-tooltip .cm-tooltip-arrow:after": {
|
|
2164
|
-
borderTopColor:
|
|
2165
|
-
borderBottomColor:
|
|
2165
|
+
borderTopColor: ge,
|
|
2166
|
+
borderBottomColor: ge
|
|
2166
2167
|
},
|
|
2167
2168
|
".cm-tooltip-autocomplete": {
|
|
2168
2169
|
"& > ul > li[aria-selected]": {
|
|
2169
|
-
backgroundColor:
|
|
2170
|
-
color:
|
|
2170
|
+
backgroundColor: mt,
|
|
2171
|
+
color: oe
|
|
2171
2172
|
}
|
|
2172
2173
|
}
|
|
2173
2174
|
},
|
|
2174
2175
|
{ dark: !0 }
|
|
2175
|
-
),
|
|
2176
|
-
{ tag: g.keyword, color:
|
|
2177
|
-
{ tag: [g.name, g.deleted, g.character, g.propertyName, g.macroName], color:
|
|
2178
|
-
{ tag: [g.function(g.variableName), g.labelName], color:
|
|
2179
|
-
{ tag: [g.color, g.constant(g.name), g.standard(g.name)], color:
|
|
2180
|
-
{ tag: [g.definition(g.name), g.separator], color:
|
|
2176
|
+
), ql = pt.define([
|
|
2177
|
+
{ tag: g.keyword, color: Nl },
|
|
2178
|
+
{ tag: [g.name, g.deleted, g.character, g.propertyName, g.macroName], color: ct },
|
|
2179
|
+
{ tag: [g.function(g.variableName), g.labelName], color: Ol },
|
|
2180
|
+
{ tag: [g.color, g.constant(g.name), g.standard(g.name)], color: ut },
|
|
2181
|
+
{ tag: [g.definition(g.name), g.separator], color: oe },
|
|
2181
2182
|
{
|
|
2182
2183
|
tag: [
|
|
2183
2184
|
g.typeName,
|
|
@@ -2189,7 +2190,7 @@ $$
|
|
|
2189
2190
|
g.self,
|
|
2190
2191
|
g.namespace
|
|
2191
2192
|
],
|
|
2192
|
-
color:
|
|
2193
|
+
color: jl
|
|
2193
2194
|
},
|
|
2194
2195
|
{
|
|
2195
2196
|
tag: [
|
|
@@ -2201,27 +2202,27 @@ $$
|
|
|
2201
2202
|
g.link,
|
|
2202
2203
|
g.special(g.string)
|
|
2203
2204
|
],
|
|
2204
|
-
color:
|
|
2205
|
+
color: Bl
|
|
2205
2206
|
},
|
|
2206
|
-
{ tag: [g.meta, g.comment], color:
|
|
2207
|
+
{ tag: [g.meta, g.comment], color: dt },
|
|
2207
2208
|
{ tag: g.strong, fontWeight: "bold" },
|
|
2208
2209
|
{ tag: g.emphasis, fontStyle: "italic" },
|
|
2209
2210
|
{ 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:
|
|
2213
|
-
{ tag: [g.processingInstruction, g.string, g.inserted], color:
|
|
2214
|
-
{ tag: g.invalid, color:
|
|
2215
|
-
]),
|
|
2216
|
-
|
|
2217
|
-
|
|
2211
|
+
{ tag: g.link, color: dt, textDecoration: "underline" },
|
|
2212
|
+
{ tag: g.heading, fontWeight: "bold", color: ct },
|
|
2213
|
+
{ tag: [g.atom, g.bool, g.special(g.variableName)], color: ut },
|
|
2214
|
+
{ tag: [g.processingInstruction, g.string, g.inserted], color: Dl },
|
|
2215
|
+
{ tag: g.invalid, color: Pl }
|
|
2216
|
+
]), Wl = [
|
|
2217
|
+
Ul,
|
|
2218
|
+
bt(ql)
|
|
2218
2219
|
], J = (e) => {
|
|
2219
|
-
const t = new
|
|
2220
|
+
const t = new Ht();
|
|
2220
2221
|
return (l) => (t.get(e.state) ? e.dispatch({ effects: t.reconfigure(l) }) : e.dispatch({
|
|
2221
|
-
effects:
|
|
2222
|
+
effects: It.appendConfig.of(t.of(l))
|
|
2222
2223
|
}), !0);
|
|
2223
2224
|
};
|
|
2224
|
-
class
|
|
2225
|
+
class Gl {
|
|
2225
2226
|
constructor(t) {
|
|
2226
2227
|
U(this, "view");
|
|
2227
2228
|
// 切换tabSize的执行方法。切换时,Compartment实例需要相同
|
|
@@ -2286,10 +2287,10 @@ class zl {
|
|
|
2286
2287
|
if (this.view.dispatch(this.view.state.replaceSelection(t)), o.select) {
|
|
2287
2288
|
const r = l + t.length + o.deviationEnd;
|
|
2288
2289
|
this.view.dispatch({
|
|
2289
|
-
selection:
|
|
2290
|
+
selection: me.create(
|
|
2290
2291
|
[
|
|
2291
|
-
|
|
2292
|
-
|
|
2292
|
+
me.range(l + o.deviationStart, r),
|
|
2293
|
+
me.cursor(r)
|
|
2293
2294
|
],
|
|
2294
2295
|
1
|
|
2295
2296
|
)
|
|
@@ -2303,8 +2304,8 @@ class zl {
|
|
|
2303
2304
|
*/
|
|
2304
2305
|
setTabSize(t) {
|
|
2305
2306
|
this.toggleTabSize([
|
|
2306
|
-
|
|
2307
|
-
|
|
2307
|
+
ae.tabSize.of(t),
|
|
2308
|
+
Dt.of(" ".repeat(t))
|
|
2308
2309
|
]);
|
|
2309
2310
|
}
|
|
2310
2311
|
/**
|
|
@@ -2313,24 +2314,24 @@ class zl {
|
|
|
2313
2314
|
* @param t 目标内容
|
|
2314
2315
|
*/
|
|
2315
2316
|
setPlaceholder(t) {
|
|
2316
|
-
this.togglePlaceholder(
|
|
2317
|
+
this.togglePlaceholder(At(t));
|
|
2317
2318
|
}
|
|
2318
|
-
|
|
2319
|
+
focus() {
|
|
2319
2320
|
this.view.focus();
|
|
2320
2321
|
}
|
|
2321
2322
|
setDisabled(t) {
|
|
2322
|
-
this.toggleDisabled([
|
|
2323
|
+
this.toggleDisabled([Ce.editable.of(!t)]);
|
|
2323
2324
|
}
|
|
2324
2325
|
setReadOnly(t) {
|
|
2325
|
-
this.toggleReadOnly([
|
|
2326
|
+
this.toggleReadOnly([ae.readOnly.of(t)]);
|
|
2326
2327
|
}
|
|
2327
2328
|
setMaxLength(t) {
|
|
2328
2329
|
this.toggleMaxlength([
|
|
2329
|
-
|
|
2330
|
+
ae.changeFilter.of((o) => o.newDoc.length <= t)
|
|
2330
2331
|
]);
|
|
2331
2332
|
}
|
|
2332
2333
|
}
|
|
2333
|
-
const
|
|
2334
|
+
const zl = (e) => {
|
|
2334
2335
|
const t = x("editorId");
|
|
2335
2336
|
return (l) => {
|
|
2336
2337
|
if (l.clipboardData) {
|
|
@@ -2351,18 +2352,18 @@ const Kl = (e) => {
|
|
|
2351
2352
|
}
|
|
2352
2353
|
}
|
|
2353
2354
|
};
|
|
2354
|
-
},
|
|
2355
|
+
}, Kl = (e) => {
|
|
2355
2356
|
const t = x("editorId");
|
|
2356
2357
|
A(() => {
|
|
2357
2358
|
C.on(t, {
|
|
2358
|
-
name:
|
|
2359
|
+
name: $t,
|
|
2359
2360
|
callback() {
|
|
2360
2361
|
var o;
|
|
2361
|
-
(o = e.value) == null || o.
|
|
2362
|
+
(o = e.value) == null || o.focus();
|
|
2362
2363
|
}
|
|
2363
2364
|
});
|
|
2364
2365
|
});
|
|
2365
|
-
},
|
|
2366
|
+
}, Xl = (e, t) => [
|
|
2366
2367
|
{
|
|
2367
2368
|
key: "Ctrl-b",
|
|
2368
2369
|
mac: "Cmd-b",
|
|
@@ -2371,13 +2372,13 @@ const Kl = (e) => {
|
|
|
2371
2372
|
{
|
|
2372
2373
|
key: "Ctrl-d",
|
|
2373
2374
|
mac: "Cmd-d",
|
|
2374
|
-
run:
|
|
2375
|
+
run: jt,
|
|
2375
2376
|
preventDefault: !0
|
|
2376
2377
|
},
|
|
2377
2378
|
{
|
|
2378
2379
|
key: "Ctrl-s",
|
|
2379
2380
|
mac: "Cmd-s",
|
|
2380
|
-
run: (L) => (C.emit(e,
|
|
2381
|
+
run: (L) => (C.emit(e, ue, L.state.doc.toString()), !0),
|
|
2381
2382
|
shift: () => (C.emit(e, "replace", "strikeThrough"), !0)
|
|
2382
2383
|
},
|
|
2383
2384
|
{
|
|
@@ -2458,52 +2459,52 @@ const Kl = (e) => {
|
|
|
2458
2459
|
{
|
|
2459
2460
|
any: (L, S) => (S.ctrlKey || S.metaKey) && S.altKey && S.shiftKey && S.code === "KeyT" ? (C.emit(e, "replace", "table"), !0) : !1
|
|
2460
2461
|
}
|
|
2461
|
-
],
|
|
2462
|
-
const t = x("tabWidth"), o = x("editorId"), l = x("theme"), r = F(), n = F(), a =
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
Rt({ codeLanguages:
|
|
2462
|
+
], Zl = (e) => {
|
|
2463
|
+
const t = x("tabWidth"), o = x("editorId"), l = x("theme"), r = F(), n = F(), a = Xl(o, e), c = zl(e), m = [
|
|
2464
|
+
Ft.of([...a, Bt]),
|
|
2465
|
+
Lt,
|
|
2466
|
+
Rt({ codeLanguages: Mt }),
|
|
2466
2467
|
// 横向换行
|
|
2467
|
-
|
|
2468
|
-
|
|
2468
|
+
re.lineWrapping,
|
|
2469
|
+
re.updateListener.of((d) => {
|
|
2469
2470
|
e.onChange(d.state.doc.toString());
|
|
2470
2471
|
}),
|
|
2471
|
-
|
|
2472
|
+
re.domEventHandlers({
|
|
2472
2473
|
paste: c,
|
|
2473
2474
|
blur: e.onBlur,
|
|
2474
2475
|
focus: e.onFocus
|
|
2475
2476
|
})
|
|
2476
2477
|
], u = () => l.value === "light" ? I.codeMirrorExtensions(
|
|
2477
2478
|
l.value,
|
|
2478
|
-
[...m,
|
|
2479
|
+
[...m, Wl],
|
|
2479
2480
|
a
|
|
2480
2481
|
) : I.codeMirrorExtensions(
|
|
2481
2482
|
l.value,
|
|
2482
|
-
[...m,
|
|
2483
|
+
[...m, Rl],
|
|
2483
2484
|
a
|
|
2484
2485
|
);
|
|
2485
2486
|
return A(() => {
|
|
2486
|
-
const d =
|
|
2487
|
+
const d = ae.create({
|
|
2487
2488
|
doc: e.value
|
|
2488
|
-
}), f = new
|
|
2489
|
+
}), f = new re({
|
|
2489
2490
|
state: d,
|
|
2490
2491
|
parent: r.value
|
|
2491
2492
|
});
|
|
2492
|
-
n.value = new
|
|
2493
|
+
n.value = new Gl(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
2494
|
name: "ctrlZ",
|
|
2494
2495
|
callback() {
|
|
2495
|
-
|
|
2496
|
+
Pt(f);
|
|
2496
2497
|
}
|
|
2497
2498
|
}), C.on(o, {
|
|
2498
2499
|
name: "ctrlShiftZ",
|
|
2499
2500
|
callback() {
|
|
2500
|
-
|
|
2501
|
+
Ot(f);
|
|
2501
2502
|
}
|
|
2502
2503
|
}), C.on(o, {
|
|
2503
2504
|
name: "replace",
|
|
2504
2505
|
callback(h, v = {}) {
|
|
2505
2506
|
var p;
|
|
2506
|
-
const { text: b, options: k } =
|
|
2507
|
+
const { text: b, options: k } = wl(h, n.value, v);
|
|
2507
2508
|
(p = n.value) == null || p.replaceSelectedText(b, k);
|
|
2508
2509
|
}
|
|
2509
2510
|
});
|
|
@@ -2543,19 +2544,19 @@ const Kl = (e) => {
|
|
|
2543
2544
|
var d;
|
|
2544
2545
|
e.maxlength && ((d = n.value) == null || d.setMaxLength(e.maxlength));
|
|
2545
2546
|
}
|
|
2546
|
-
),
|
|
2547
|
+
), Kl(n), {
|
|
2547
2548
|
inputWrapperRef: r,
|
|
2548
2549
|
codeMirrorUt: n
|
|
2549
2550
|
};
|
|
2550
|
-
},
|
|
2551
|
-
const o = x("editorId"), l =
|
|
2551
|
+
}, Jl = (e, t) => {
|
|
2552
|
+
const o = x("editorId"), l = de(() => {
|
|
2552
2553
|
const r = document.querySelectorAll(`#${o}-preview img`);
|
|
2553
|
-
r.length !== 0 &&
|
|
2554
|
+
r.length !== 0 && Nt(r, {
|
|
2554
2555
|
background: "#00000073"
|
|
2555
2556
|
});
|
|
2556
2557
|
});
|
|
2557
|
-
A(l), T([t,
|
|
2558
|
-
},
|
|
2558
|
+
A(l), T([t, Q(e.setting, "preview")], l);
|
|
2559
|
+
}, Yl = (e, t) => {
|
|
2559
2560
|
const o = x("editorId"), l = x("usedLanguageText"), r = () => {
|
|
2560
2561
|
document.querySelectorAll(`#${o}-preview pre`).forEach((c) => {
|
|
2561
2562
|
var f, h;
|
|
@@ -2565,21 +2566,21 @@ const Kl = (e) => {
|
|
|
2565
2566
|
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
2567
|
var y, $;
|
|
2567
2568
|
clearTimeout(m);
|
|
2568
|
-
const v = c.querySelector("code").innerText, b =
|
|
2569
|
+
const v = c.querySelector("code").innerText, b = _t(e.formatCopiedText(v)), k = ((y = l.value.copyCode) == null ? void 0 : y.successTips) || "已复制!", p = (($ = l.value.copyCode) == null ? void 0 : $.failTips) || "已复制!";
|
|
2569
2570
|
d.dataset.tips = b ? k : p, m = window.setTimeout(() => {
|
|
2570
2571
|
d.dataset.tips = u;
|
|
2571
2572
|
}, 1500);
|
|
2572
2573
|
}), c.appendChild(d);
|
|
2573
2574
|
});
|
|
2574
2575
|
}, n = () => {
|
|
2575
|
-
|
|
2576
|
+
z(r);
|
|
2576
2577
|
}, a = (c) => {
|
|
2577
|
-
c &&
|
|
2578
|
+
c && z(r);
|
|
2578
2579
|
};
|
|
2579
2580
|
T(() => t.value, n), T(() => e.setting.preview, a), T(() => e.setting.htmlPreview, a), T(() => l.value, r), A(r);
|
|
2580
|
-
},
|
|
2581
|
+
}, Ql = (e) => {
|
|
2581
2582
|
var n;
|
|
2582
|
-
const t = (n = I.editorExtensions) == null ? void 0 : n.highlight, o = t == null ? void 0 : t.instance, l = x("highlight"), r =
|
|
2583
|
+
const t = (n = I.editorExtensions) == null ? void 0 : n.highlight, o = t == null ? void 0 : t.instance, l = x("highlight"), r = se(o);
|
|
2583
2584
|
return A(() => {
|
|
2584
2585
|
if (e.noHighlight)
|
|
2585
2586
|
return;
|
|
@@ -2594,11 +2595,11 @@ const Kl = (e) => {
|
|
|
2594
2595
|
}), T(
|
|
2595
2596
|
() => l.value.css,
|
|
2596
2597
|
(a) => {
|
|
2597
|
-
|
|
2598
|
+
sl(`${s}-hlCss`, "href", a);
|
|
2598
2599
|
}
|
|
2599
2600
|
), r;
|
|
2600
|
-
},
|
|
2601
|
-
const t = x("theme"), { editorExtensions: o } = I, l = o == null ? void 0 : o.mermaid, r =
|
|
2601
|
+
}, eo = (e) => {
|
|
2602
|
+
const t = x("theme"), { editorExtensions: o } = I, l = o == null ? void 0 : o.mermaid, r = se(l == null ? void 0 : l.instance), n = se(!1), a = new Wt({
|
|
2602
2603
|
max: 1e3,
|
|
2603
2604
|
// 缓存10分钟
|
|
2604
2605
|
ttl: 6e5
|
|
@@ -2618,19 +2619,19 @@ const Kl = (e) => {
|
|
|
2618
2619
|
if (!e.noMermaid && !(l != null && l.instance)) {
|
|
2619
2620
|
const u = document.createElement("script");
|
|
2620
2621
|
u.id = `${s}-mermaid`;
|
|
2621
|
-
const d = (l == null ? void 0 : l.js) ||
|
|
2622
|
+
const d = (l == null ? void 0 : l.js) || Zt;
|
|
2622
2623
|
/\.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
2624
|
r.value = window.mermaid, c();
|
|
2624
2625
|
}, O(u, "mermaid");
|
|
2625
2626
|
}
|
|
2626
2627
|
}), { mermaidRef: r, reRenderRef: n, replaceMermaid: () => {
|
|
2627
|
-
|
|
2628
|
+
z(() => {
|
|
2628
2629
|
!e.noMermaid && r.value && document.querySelectorAll(
|
|
2629
2630
|
`div.${s}-mermaid`
|
|
2630
2631
|
).forEach(async (d) => {
|
|
2631
2632
|
let f = a.get(d.innerText);
|
|
2632
2633
|
if (!f) {
|
|
2633
|
-
const v =
|
|
2634
|
+
const v = il(), k = await (r.value.renderAsync || r.value.render)(v, d.innerText);
|
|
2634
2635
|
f = typeof k == "string" ? k : k.svg, a.set(d.innerText, f);
|
|
2635
2636
|
}
|
|
2636
2637
|
const h = document.createElement("p");
|
|
@@ -2638,37 +2639,37 @@ const Kl = (e) => {
|
|
|
2638
2639
|
});
|
|
2639
2640
|
});
|
|
2640
2641
|
} };
|
|
2641
|
-
},
|
|
2642
|
+
}, to = (e) => {
|
|
2642
2643
|
var r;
|
|
2643
|
-
const t = (r = I.editorExtensions) == null ? void 0 : r.katex, o = t == null ? void 0 : t.instance, l =
|
|
2644
|
+
const t = (r = I.editorExtensions) == null ? void 0 : r.katex, o = t == null ? void 0 : t.instance, l = se(o);
|
|
2644
2645
|
return A(() => {
|
|
2645
2646
|
if (!e.noKatex && !l.value) {
|
|
2646
2647
|
const n = document.createElement("script");
|
|
2647
|
-
n.src = (t == null ? void 0 : t.js) ||
|
|
2648
|
+
n.src = (t == null ? void 0 : t.js) || Ze.js, n.onload = () => {
|
|
2648
2649
|
l.value = window.katex;
|
|
2649
2650
|
}, n.id = `${s}-katex`;
|
|
2650
2651
|
const a = document.createElement("link");
|
|
2651
|
-
a.rel = "stylesheet", a.href = (t == null ? void 0 : t.css) ||
|
|
2652
|
+
a.rel = "stylesheet", a.href = (t == null ? void 0 : t.css) || Ze.css, a.id = `${s}-katexCss`, O(n, "katex"), O(a);
|
|
2652
2653
|
}
|
|
2653
2654
|
}), l;
|
|
2654
|
-
},
|
|
2655
|
+
}, lo = (e, t) => {
|
|
2655
2656
|
const o = e.renderer.rules.fence.bind(e.renderer.rules);
|
|
2656
2657
|
e.renderer.rules.fence = (l, r, n, a, c) => {
|
|
2657
2658
|
const m = l[r], u = m.content.trim();
|
|
2658
2659
|
return m.info === "mermaid" ? `<div class="${s}-mermaid" data-mermaid-theme=${t.themeRef.value}>${u}</div>` : o(l, r, n, a, c);
|
|
2659
2660
|
};
|
|
2660
|
-
},
|
|
2661
|
+
}, ht = (e, t) => {
|
|
2661
2662
|
let o = !0, l = !0;
|
|
2662
2663
|
const r = e.posMax, n = t > 0 ? e.src.charCodeAt(t - 1) : -1, a = t + 1 <= r ? e.src.charCodeAt(t + 1) : -1;
|
|
2663
2664
|
return (n === 32 || n === 9 || a >= 48 && a <= 57) && (l = !1), (a === 32 || a === 9) && (o = !1), {
|
|
2664
2665
|
can_open: o,
|
|
2665
2666
|
can_close: l
|
|
2666
2667
|
};
|
|
2667
|
-
},
|
|
2668
|
+
}, oo = (e, t) => {
|
|
2668
2669
|
let o, l, r, n;
|
|
2669
2670
|
if (e.src[e.pos] !== "$")
|
|
2670
2671
|
return !1;
|
|
2671
|
-
if (r =
|
|
2672
|
+
if (r = ht(e, e.pos), !r.can_open)
|
|
2672
2673
|
return t || (e.pending += "$"), e.pos += 1, !0;
|
|
2673
2674
|
const a = e.pos + 1;
|
|
2674
2675
|
for (o = a; (o = e.src.indexOf("$", o)) !== -1; ) {
|
|
@@ -2678,8 +2679,8 @@ const Kl = (e) => {
|
|
|
2678
2679
|
break;
|
|
2679
2680
|
o += 1;
|
|
2680
2681
|
}
|
|
2681
|
-
return o === -1 ? (t || (e.pending += "$"), e.pos = a, !0) : o - a === 0 ? (t || (e.pending += "$$"), e.pos = a + 1, !0) : (r =
|
|
2682
|
-
},
|
|
2682
|
+
return o === -1 ? (t || (e.pending += "$"), e.pos = a, !0) : o - a === 0 ? (t || (e.pending += "$$"), e.pos = a + 1, !0) : (r = ht(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));
|
|
2683
|
+
}, no = (e, t, o, l) => {
|
|
2683
2684
|
let r, n, a, c, m = !1, u = e.bMarks[t] + e.tShift[t], d = e.eMarks[t];
|
|
2684
2685
|
if (u + 2 > d || e.src.slice(u, u + 2) !== "$$")
|
|
2685
2686
|
return !1;
|
|
@@ -2691,7 +2692,7 @@ const Kl = (e) => {
|
|
|
2691
2692
|
const f = e.push("math_block", "math", 0);
|
|
2692
2693
|
return f.block = !0, f.content = (r && r.trim() ? r + `
|
|
2693
2694
|
` : "") + e.getLines(t + 1, a, e.tShift[t], !0) + (n && n.trim() ? n : ""), f.map = [t, e.line], f.markup = "$$", !0;
|
|
2694
|
-
},
|
|
2695
|
+
}, ro = (e, t) => {
|
|
2695
2696
|
const o = (r) => {
|
|
2696
2697
|
if (t.katexRef.value) {
|
|
2697
2698
|
const n = t.katexRef.value.renderToString(r, {
|
|
@@ -2710,11 +2711,11 @@ const Kl = (e) => {
|
|
|
2710
2711
|
} else
|
|
2711
2712
|
return `<p class="${s}-katex-block" data-line=${n}>${r}</p>`;
|
|
2712
2713
|
};
|
|
2713
|
-
e.inline.ruler.after("escape", "math_inline",
|
|
2714
|
+
e.inline.ruler.after("escape", "math_inline", oo), e.block.ruler.after("blockquote", "math_block", no, {
|
|
2714
2715
|
alt: ["paragraph", "reference", "blockquote", "list"]
|
|
2715
2716
|
}), e.renderer.rules.math_inline = (r, n) => o(r[n].content), e.renderer.rules.math_block = (r, n) => l(r[n].content, r[n].map[0]) + `
|
|
2716
2717
|
`;
|
|
2717
|
-
},
|
|
2718
|
+
}, io = (e, t) => {
|
|
2718
2719
|
t = t || {};
|
|
2719
2720
|
const o = 3, l = t.marker || "!", r = l.charCodeAt(0), n = l.length;
|
|
2720
2721
|
let a = "", c = "";
|
|
@@ -2741,8 +2742,8 @@ const Kl = (e) => {
|
|
|
2741
2742
|
if (L !== o)
|
|
2742
2743
|
return !1;
|
|
2743
2744
|
b -= (b - $) % n;
|
|
2744
|
-
const S = d.src.slice($, b),
|
|
2745
|
-
if (u(
|
|
2745
|
+
const S = d.src.slice($, b), j = d.src.slice(b, w);
|
|
2746
|
+
if (u(j), v)
|
|
2746
2747
|
return !0;
|
|
2747
2748
|
for (k = f; k++, !(k >= h || ($ = d.bMarks[k] + d.tShift[k], w = d.eMarks[k], $ < w && d.sCount[k] < d.blkIndent)); )
|
|
2748
2749
|
if (r === d.src.charCodeAt($) && !(d.sCount[k] - d.blkIndent >= 4)) {
|
|
@@ -2753,14 +2754,14 @@ const Kl = (e) => {
|
|
|
2753
2754
|
break;
|
|
2754
2755
|
}
|
|
2755
2756
|
}
|
|
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 =
|
|
2757
|
+
const B = d.parentType, q = d.lineMax;
|
|
2758
|
+
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
2759
|
},
|
|
2759
2760
|
{
|
|
2760
2761
|
alt: ["paragraph", "reference", "blockquote", "list"]
|
|
2761
2762
|
}
|
|
2762
2763
|
), 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;
|
|
2763
|
-
},
|
|
2764
|
+
}, ao = (e, t) => {
|
|
2764
2765
|
let o;
|
|
2765
2766
|
e.core.ruler.push("headingLinks", (l) => {
|
|
2766
2767
|
o || (o = l.Token);
|
|
@@ -2774,15 +2775,15 @@ const Kl = (e) => {
|
|
|
2774
2775
|
t.mdHeadingId(a, c, t.headsRef.value.length)
|
|
2775
2776
|
)), e.renderer.renderToken(l, r, t);
|
|
2776
2777
|
}, e.renderer.rules.heading_close = (l, r, n, a, c) => c.renderToken(l, r, n);
|
|
2777
|
-
},
|
|
2778
|
+
}, vt = (e) => e.replace(
|
|
2778
2779
|
/<pre><code\sclass="language-([^>]*)">/g,
|
|
2779
2780
|
'<pre><code class="language-$1" language="$1">'
|
|
2780
|
-
),
|
|
2781
|
-
const { editorConfig: t, markdownItConfig: o } = I, l = x("editorId"), r = x("showCodeRowNumber"), n = x("previewOnly"), a = x("theme"), c = F([]), m =
|
|
2781
|
+
), so = (e) => {
|
|
2782
|
+
const { editorConfig: t, markdownItConfig: o } = I, l = x("editorId"), r = x("showCodeRowNumber"), n = x("previewOnly"), a = x("theme"), c = F([]), m = Ql(e), u = to(e), { reRenderRef: d, replaceMermaid: f } = eo(e), h = Vt({
|
|
2782
2783
|
html: !0,
|
|
2783
2784
|
breaks: !0
|
|
2784
2785
|
});
|
|
2785
|
-
h.use(
|
|
2786
|
+
h.use(lo, { themeRef: a }), h.use(ro, { katexRef: u }), h.use(Ut, { figcaption: !0 }), h.use(io), h.use(qt), h.use(ao, { mdHeadingId: e.mdHeadingId, headsRef: c }), h.renderer.rules.paragraph_open = h.renderer.rules.table_open = (p, y, $, w, L) => {
|
|
2786
2787
|
let S;
|
|
2787
2788
|
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
2789
|
}, h.set({
|
|
@@ -2794,16 +2795,16 @@ const Kl = (e) => {
|
|
|
2794
2795
|
return $ ? w = m.value.highlight(p, {
|
|
2795
2796
|
language: y,
|
|
2796
2797
|
ignoreIllegals: !0
|
|
2797
|
-
}).value : w = m.value.highlightAuto(p).value, r ?
|
|
2798
|
+
}).value : w = m.value.highlightAuto(p).value, r ? ol(w.trim()) : `<span class="code-block">${w.trim()}</span>`;
|
|
2798
2799
|
}
|
|
2799
2800
|
}), o(h);
|
|
2800
|
-
const v = F(e.sanitize(
|
|
2801
|
+
const v = F(e.sanitize(vt(h.render(e.value)))), b = de(
|
|
2801
2802
|
async () => {
|
|
2802
|
-
c.value = [], v.value = e.sanitize(
|
|
2803
|
+
c.value = [], v.value = e.sanitize(vt(h.render(e.value))), C.emit(l, "buildFinished", v.value), e.onHtmlChanged(v.value), f();
|
|
2803
2804
|
},
|
|
2804
2805
|
(t == null ? void 0 : t.renderDelay) !== void 0 ? t == null ? void 0 : t.renderDelay : n ? 0 : 500
|
|
2805
2806
|
), k = D(() => e.noHighlight || m.value);
|
|
2806
|
-
return T([
|
|
2807
|
+
return T([Q(e, "value"), k, d], b), T(
|
|
2807
2808
|
() => c.value,
|
|
2808
2809
|
(p) => {
|
|
2809
2810
|
e.onGetCatalog(p), C.emit(l, "catalogChanged", p);
|
|
@@ -2816,7 +2817,7 @@ const Kl = (e) => {
|
|
|
2816
2817
|
}
|
|
2817
2818
|
});
|
|
2818
2819
|
}), { html: v };
|
|
2819
|
-
},
|
|
2820
|
+
}, co = {
|
|
2820
2821
|
value: {
|
|
2821
2822
|
type: String,
|
|
2822
2823
|
default: ""
|
|
@@ -2906,17 +2907,17 @@ const Kl = (e) => {
|
|
|
2906
2907
|
type: Boolean,
|
|
2907
2908
|
default: !1
|
|
2908
2909
|
}
|
|
2909
|
-
},
|
|
2910
|
+
}, uo = /* @__PURE__ */ M({
|
|
2910
2911
|
name: "MDEditorContent",
|
|
2911
|
-
props:
|
|
2912
|
+
props: co,
|
|
2912
2913
|
setup(e) {
|
|
2913
2914
|
const t = x("previewOnly"), o = x("showCodeRowNumber"), l = x("previewTheme"), r = x("editorId"), n = F(), a = F(), {
|
|
2914
2915
|
inputWrapperRef: c,
|
|
2915
2916
|
codeMirrorUt: m
|
|
2916
|
-
} =
|
|
2917
|
+
} = Zl(e), {
|
|
2917
2918
|
html: u
|
|
2918
|
-
} =
|
|
2919
|
-
return
|
|
2919
|
+
} = so(e);
|
|
2920
|
+
return $l(e, u, n, a, m), Yl(e, u), Jl(e, u), () => i("div", {
|
|
2920
2921
|
class: `${s}-content`
|
|
2921
2922
|
}, [!t && i("div", {
|
|
2922
2923
|
class: `${s}-input-wrapper`,
|
|
@@ -2938,7 +2939,7 @@ const Kl = (e) => {
|
|
|
2938
2939
|
class: `${s}-html`
|
|
2939
2940
|
}, [u.value])])]);
|
|
2940
2941
|
}
|
|
2941
|
-
}),
|
|
2942
|
+
}), mo = /* @__PURE__ */ M({
|
|
2942
2943
|
props: {
|
|
2943
2944
|
modelValue: {
|
|
2944
2945
|
type: String,
|
|
@@ -2957,7 +2958,7 @@ const Kl = (e) => {
|
|
|
2957
2958
|
};
|
|
2958
2959
|
}
|
|
2959
2960
|
});
|
|
2960
|
-
const
|
|
2961
|
+
const fo = {
|
|
2961
2962
|
checked: {
|
|
2962
2963
|
type: Boolean,
|
|
2963
2964
|
default: !1
|
|
@@ -2967,8 +2968,8 @@ const go = {
|
|
|
2967
2968
|
default: () => {
|
|
2968
2969
|
}
|
|
2969
2970
|
}
|
|
2970
|
-
},
|
|
2971
|
-
props:
|
|
2971
|
+
}, go = /* @__PURE__ */ M({
|
|
2972
|
+
props: fo,
|
|
2972
2973
|
setup(e) {
|
|
2973
2974
|
return () => i("div", {
|
|
2974
2975
|
class: [`${s}-checkbox`, e.checked && `${s}-checkbox-checked`],
|
|
@@ -2977,7 +2978,7 @@ const go = {
|
|
|
2977
2978
|
}
|
|
2978
2979
|
}, null);
|
|
2979
2980
|
}
|
|
2980
|
-
}),
|
|
2981
|
+
}), ho = {
|
|
2981
2982
|
scrollAuto: {
|
|
2982
2983
|
type: Boolean
|
|
2983
2984
|
},
|
|
@@ -2986,8 +2987,8 @@ const go = {
|
|
|
2986
2987
|
default: () => {
|
|
2987
2988
|
}
|
|
2988
2989
|
}
|
|
2989
|
-
},
|
|
2990
|
-
props:
|
|
2990
|
+
}, vo = /* @__PURE__ */ M({
|
|
2991
|
+
props: ho,
|
|
2991
2992
|
setup(e) {
|
|
2992
2993
|
const t = x("usedLanguageText");
|
|
2993
2994
|
return () => {
|
|
@@ -2999,13 +3000,13 @@ const go = {
|
|
|
2999
3000
|
onClick: () => {
|
|
3000
3001
|
e.onScrollAutoChange(!e.scrollAuto);
|
|
3001
3002
|
}
|
|
3002
|
-
}, [(o = t.value.footer) == null ? void 0 : o.scrollAuto]), i(
|
|
3003
|
+
}, [(o = t.value.footer) == null ? void 0 : o.scrollAuto]), i(go, {
|
|
3003
3004
|
checked: e.scrollAuto,
|
|
3004
3005
|
onChange: e.onScrollAutoChange
|
|
3005
3006
|
}, null)]);
|
|
3006
3007
|
};
|
|
3007
3008
|
}
|
|
3008
|
-
}),
|
|
3009
|
+
}), po = {
|
|
3009
3010
|
modelValue: {
|
|
3010
3011
|
type: String,
|
|
3011
3012
|
default: ""
|
|
@@ -3025,22 +3026,22 @@ const go = {
|
|
|
3025
3026
|
defFooters: {
|
|
3026
3027
|
type: Object
|
|
3027
3028
|
}
|
|
3028
|
-
},
|
|
3029
|
+
}, bo = /* @__PURE__ */ M({
|
|
3029
3030
|
name: "MDEditorFooter",
|
|
3030
|
-
props:
|
|
3031
|
+
props: po,
|
|
3031
3032
|
setup(e) {
|
|
3032
3033
|
const t = D(() => {
|
|
3033
3034
|
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
3035
|
return [r, n];
|
|
3035
3036
|
}), o = (l) => {
|
|
3036
|
-
if (
|
|
3037
|
+
if (yt.includes(l))
|
|
3037
3038
|
switch (l) {
|
|
3038
3039
|
case "markdownTotal":
|
|
3039
|
-
return i(
|
|
3040
|
+
return i(mo, {
|
|
3040
3041
|
modelValue: e.modelValue
|
|
3041
3042
|
}, null);
|
|
3042
3043
|
case "scrollSwitch":
|
|
3043
|
-
return i(
|
|
3044
|
+
return i(vo, {
|
|
3044
3045
|
scrollAuto: e.scrollAuto,
|
|
3045
3046
|
onScrollAutoChange: e.onScrollAutoChange
|
|
3046
3047
|
}, null);
|
|
@@ -3059,7 +3060,7 @@ const go = {
|
|
|
3059
3060
|
}, [r])]);
|
|
3060
3061
|
};
|
|
3061
3062
|
}
|
|
3062
|
-
}),
|
|
3063
|
+
}), ko = {
|
|
3063
3064
|
tocItem: {
|
|
3064
3065
|
type: Object,
|
|
3065
3066
|
default: () => ({})
|
|
@@ -3082,8 +3083,8 @@ const go = {
|
|
|
3082
3083
|
type: Number,
|
|
3083
3084
|
default: 0
|
|
3084
3085
|
}
|
|
3085
|
-
},
|
|
3086
|
-
props:
|
|
3086
|
+
}, wt = /* @__PURE__ */ M({
|
|
3087
|
+
props: ko,
|
|
3087
3088
|
setup(e) {
|
|
3088
3089
|
return () => {
|
|
3089
3090
|
const {
|
|
@@ -3113,7 +3114,7 @@ const go = {
|
|
|
3113
3114
|
title: t.text
|
|
3114
3115
|
}, [t.text]), i("div", {
|
|
3115
3116
|
class: `${s}-catalog-wrapper`
|
|
3116
|
-
}, [t.children && t.children.map((a) => i(
|
|
3117
|
+
}, [t.children && t.children.map((a) => i(wt, {
|
|
3117
3118
|
mdHeadingId: o,
|
|
3118
3119
|
key: `${t.text}-link-${a.level}-${a.text}`,
|
|
3119
3120
|
tocItem: a,
|
|
@@ -3124,7 +3125,7 @@ const go = {
|
|
|
3124
3125
|
};
|
|
3125
3126
|
}
|
|
3126
3127
|
});
|
|
3127
|
-
const
|
|
3128
|
+
const yo = {
|
|
3128
3129
|
/**
|
|
3129
3130
|
* 编辑器的Id,务必与需要绑定的编辑器Id相同
|
|
3130
3131
|
*/
|
|
@@ -3173,9 +3174,9 @@ const Co = {
|
|
|
3173
3174
|
onClick: {
|
|
3174
3175
|
type: Function
|
|
3175
3176
|
}
|
|
3176
|
-
},
|
|
3177
|
+
}, ce = /* @__PURE__ */ M({
|
|
3177
3178
|
name: "MdCatalog",
|
|
3178
|
-
props:
|
|
3179
|
+
props: yo,
|
|
3179
3180
|
emits: ["onClick"],
|
|
3180
3181
|
setup(e, t) {
|
|
3181
3182
|
const o = e.editorId, l = N({
|
|
@@ -3234,7 +3235,7 @@ const Co = {
|
|
|
3234
3235
|
const n = () => {
|
|
3235
3236
|
var c;
|
|
3236
3237
|
const a = l.scrollElement instanceof HTMLElement ? l.scrollElement : document.querySelector(l.scrollElement);
|
|
3237
|
-
(c = a === document.documentElement ? window : a) == null || c.addEventListener("scroll",
|
|
3238
|
+
(c = a === document.documentElement ? window : a) == null || c.addEventListener("scroll", nl(() => {
|
|
3238
3239
|
if (l.list.length === 0)
|
|
3239
3240
|
return !1;
|
|
3240
3241
|
const {
|
|
@@ -3242,7 +3243,7 @@ const Co = {
|
|
|
3242
3243
|
} = l.list.reduce((u, d, f) => {
|
|
3243
3244
|
const h = document.getElementById(e.mdHeadingId(d.text, d.level, f + 1));
|
|
3244
3245
|
if (h instanceof HTMLElement) {
|
|
3245
|
-
const v =
|
|
3246
|
+
const v = rl(h, a);
|
|
3246
3247
|
if (v < e.offsetTop && v > u.minTop)
|
|
3247
3248
|
return {
|
|
3248
3249
|
activeHead: d,
|
|
@@ -3265,14 +3266,14 @@ const Co = {
|
|
|
3265
3266
|
};
|
|
3266
3267
|
return A(() => {
|
|
3267
3268
|
n(), C.on(o, {
|
|
3268
|
-
name:
|
|
3269
|
+
name: he,
|
|
3269
3270
|
callback(a) {
|
|
3270
|
-
a &&
|
|
3271
|
+
a && z(n);
|
|
3271
3272
|
}
|
|
3272
3273
|
});
|
|
3273
3274
|
}), () => i("div", {
|
|
3274
3275
|
class: `${s}-catalog${e.theme === "dark" ? "-dark" : ""} ${e.class}`
|
|
3275
|
-
}, [r.value.map((a) => i(
|
|
3276
|
+
}, [r.value.map((a) => i(wt, {
|
|
3276
3277
|
mdHeadingId: e.mdHeadingId,
|
|
3277
3278
|
tocItem: a,
|
|
3278
3279
|
key: `link-${a.level}-${a.text}`,
|
|
@@ -3283,7 +3284,7 @@ const Co = {
|
|
|
3283
3284
|
scrollElementOffsetTop: e.scrollElementOffsetTop
|
|
3284
3285
|
}, null))]);
|
|
3285
3286
|
}
|
|
3286
|
-
}),
|
|
3287
|
+
}), Co = (e, t) => {
|
|
3287
3288
|
const { editorId: o, previewOnly: l } = e, r = N({
|
|
3288
3289
|
// 是否已编译成html
|
|
3289
3290
|
buildFinished: !1,
|
|
@@ -3302,7 +3303,7 @@ const Co = {
|
|
|
3302
3303
|
r.buildFinished = !0, r.html = n;
|
|
3303
3304
|
}
|
|
3304
3305
|
}), C.on(o, {
|
|
3305
|
-
name:
|
|
3306
|
+
name: ue,
|
|
3306
3307
|
callback() {
|
|
3307
3308
|
const n = new Promise((a) => {
|
|
3308
3309
|
if (r.buildFinished)
|
|
@@ -3321,52 +3322,52 @@ const Co = {
|
|
|
3321
3322
|
}
|
|
3322
3323
|
}));
|
|
3323
3324
|
});
|
|
3324
|
-
},
|
|
3325
|
+
}, $o = (e) => {
|
|
3325
3326
|
var n;
|
|
3326
3327
|
const { editorId: t, previewOnly: o } = e, l = (n = I == null ? void 0 : I.editorExtensions) == null ? void 0 : n.highlight;
|
|
3327
|
-
|
|
3328
|
+
W("editorId", t), W("tabWidth", e.tabWidth), W(
|
|
3328
3329
|
"theme",
|
|
3329
3330
|
D(() => e.theme)
|
|
3330
|
-
),
|
|
3331
|
+
), W(
|
|
3331
3332
|
"highlight",
|
|
3332
3333
|
D(() => {
|
|
3333
3334
|
const a = {
|
|
3334
|
-
...
|
|
3335
|
+
...Je,
|
|
3335
3336
|
...l == null ? void 0 : l.css
|
|
3336
3337
|
}, c = e.codeStyleReverse && e.codeStyleReverseList.includes(e.previewTheme) ? "dark" : e.theme;
|
|
3337
3338
|
return {
|
|
3338
|
-
js: (l == null ? void 0 : l.js) ||
|
|
3339
|
-
css: a[e.codeTheme] ? a[e.codeTheme][c] :
|
|
3339
|
+
js: (l == null ? void 0 : l.js) || Kt,
|
|
3340
|
+
css: a[e.codeTheme] ? a[e.codeTheme][c] : Je.atom[c]
|
|
3340
3341
|
};
|
|
3341
3342
|
})
|
|
3342
|
-
),
|
|
3343
|
+
), W("previewOnly", o), W("showCodeRowNumber", e.showCodeRowNumber);
|
|
3343
3344
|
const r = D(() => {
|
|
3344
3345
|
var c;
|
|
3345
3346
|
const a = {
|
|
3346
|
-
...
|
|
3347
|
+
...Xe,
|
|
3347
3348
|
...(c = I == null ? void 0 : I.editorConfig) == null ? void 0 : c.languageUserDefined
|
|
3348
3349
|
};
|
|
3349
|
-
return a[e.language] ? a[e.language] :
|
|
3350
|
+
return a[e.language] ? a[e.language] : Xe["zh-CN"];
|
|
3350
3351
|
});
|
|
3351
|
-
|
|
3352
|
+
W("usedLanguageText", r), W(
|
|
3352
3353
|
"previewTheme",
|
|
3353
3354
|
D(() => e.previewTheme)
|
|
3354
3355
|
);
|
|
3355
|
-
},
|
|
3356
|
+
}, wo = (e) => {
|
|
3356
3357
|
var u, d, f, h, v, b;
|
|
3357
3358
|
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
3359
|
A(() => {
|
|
3359
|
-
var L, S,
|
|
3360
|
+
var L, S, j, B;
|
|
3360
3361
|
const k = document.createElement("script");
|
|
3361
|
-
k.src = (n == null ? void 0 : n.iconfont) ||
|
|
3362
|
+
k.src = (n == null ? void 0 : n.iconfont) || zt, k.id = `${s}-icon`;
|
|
3362
3363
|
const p = document.createElement("script"), y = document.createElement("script");
|
|
3363
|
-
p.src = ((L = n == null ? void 0 : n.prettier) == null ? void 0 : L.standaloneJs) ||
|
|
3364
|
+
p.src = ((L = n == null ? void 0 : n.prettier) == null ? void 0 : L.standaloneJs) || ze.main, p.id = `${s}-prettier`, y.src = ((S = n == null ? void 0 : n.prettier) == null ? void 0 : S.parserMarkdownJs) || ze.markdown, y.id = `${s}-prettierMD`;
|
|
3364
3365
|
const $ = document.createElement("link");
|
|
3365
|
-
$.rel = "stylesheet", $.href = ((
|
|
3366
|
+
$.rel = "stylesheet", $.href = ((j = n == null ? void 0 : n.cropper) == null ? void 0 : j.css) || Ke.css, $.id = `${s}-cropperCss`;
|
|
3366
3367
|
const w = document.createElement("script");
|
|
3367
|
-
w.src = ((
|
|
3368
|
+
w.src = ((B = n == null ? void 0 : n.cropper) == null ? void 0 : B.js) || Ke.js, w.id = `${s}-cropper`, l || O(k), o || (m || (O($), O(w)), a || O(p), c || O(y));
|
|
3368
3369
|
});
|
|
3369
|
-
},
|
|
3370
|
+
}, To = (e, t) => {
|
|
3370
3371
|
const { editorId: o, previewOnly: l } = e, r = N({
|
|
3371
3372
|
pageFullscreen: e.pageFullscreen,
|
|
3372
3373
|
fullscreen: !1,
|
|
@@ -3393,11 +3394,11 @@ const Co = {
|
|
|
3393
3394
|
}
|
|
3394
3395
|
}), a = document.body.style.overflow, c();
|
|
3395
3396
|
}), [r, n];
|
|
3396
|
-
},
|
|
3397
|
+
}, So = (e) => {
|
|
3397
3398
|
const { editorId: t } = e, o = F(!1);
|
|
3398
3399
|
A(() => {
|
|
3399
3400
|
C.on(t, {
|
|
3400
|
-
name:
|
|
3401
|
+
name: $e,
|
|
3401
3402
|
callback: (r) => {
|
|
3402
3403
|
r === void 0 ? o.value = !o.value : o.value = r;
|
|
3403
3404
|
}
|
|
@@ -3405,37 +3406,37 @@ const Co = {
|
|
|
3405
3406
|
});
|
|
3406
3407
|
const l = D(() => !e.toolbarsExclude.includes("catalog") && e.toolbars.includes("catalog"));
|
|
3407
3408
|
return [o, l];
|
|
3408
|
-
},
|
|
3409
|
+
}, xo = (e, t, o, l, r) => {
|
|
3409
3410
|
const { editorId: n } = e;
|
|
3410
3411
|
T(
|
|
3411
3412
|
() => l.pageFullscreen,
|
|
3412
3413
|
(c) => {
|
|
3413
|
-
C.emit(n,
|
|
3414
|
+
C.emit(n, Ye, c);
|
|
3414
3415
|
}
|
|
3415
3416
|
), T(
|
|
3416
3417
|
() => l.fullscreen,
|
|
3417
3418
|
(c) => {
|
|
3418
|
-
C.emit(n,
|
|
3419
|
+
C.emit(n, Qe, c);
|
|
3419
3420
|
}
|
|
3420
3421
|
), T(
|
|
3421
3422
|
() => l.preview,
|
|
3422
3423
|
(c) => {
|
|
3423
|
-
C.emit(n,
|
|
3424
|
+
C.emit(n, he, c);
|
|
3424
3425
|
}
|
|
3425
3426
|
), T(
|
|
3426
3427
|
() => l.htmlPreview,
|
|
3427
3428
|
(c) => {
|
|
3428
|
-
C.emit(n,
|
|
3429
|
+
C.emit(n, et, c);
|
|
3429
3430
|
}
|
|
3430
3431
|
), T(o, (c) => {
|
|
3431
|
-
C.emit(n,
|
|
3432
|
+
C.emit(n, tt, c);
|
|
3432
3433
|
});
|
|
3433
3434
|
const a = {
|
|
3434
3435
|
on(c, m) {
|
|
3435
3436
|
switch (c) {
|
|
3436
3437
|
case "pageFullscreen": {
|
|
3437
3438
|
C.on(n, {
|
|
3438
|
-
name:
|
|
3439
|
+
name: Ye,
|
|
3439
3440
|
callback(u) {
|
|
3440
3441
|
m(u);
|
|
3441
3442
|
}
|
|
@@ -3444,7 +3445,7 @@ const Co = {
|
|
|
3444
3445
|
}
|
|
3445
3446
|
case "fullscreen": {
|
|
3446
3447
|
C.on(n, {
|
|
3447
|
-
name:
|
|
3448
|
+
name: Qe,
|
|
3448
3449
|
callback(u) {
|
|
3449
3450
|
m(u);
|
|
3450
3451
|
}
|
|
@@ -3453,7 +3454,7 @@ const Co = {
|
|
|
3453
3454
|
}
|
|
3454
3455
|
case "preview": {
|
|
3455
3456
|
C.on(n, {
|
|
3456
|
-
name:
|
|
3457
|
+
name: he,
|
|
3457
3458
|
callback(u) {
|
|
3458
3459
|
m(u);
|
|
3459
3460
|
}
|
|
@@ -3462,7 +3463,7 @@ const Co = {
|
|
|
3462
3463
|
}
|
|
3463
3464
|
case "htmlPreview": {
|
|
3464
3465
|
C.on(n, {
|
|
3465
|
-
name:
|
|
3466
|
+
name: et,
|
|
3466
3467
|
callback(u) {
|
|
3467
3468
|
m(u);
|
|
3468
3469
|
}
|
|
@@ -3471,7 +3472,7 @@ const Co = {
|
|
|
3471
3472
|
}
|
|
3472
3473
|
case "catalog": {
|
|
3473
3474
|
C.on(n, {
|
|
3474
|
-
name:
|
|
3475
|
+
name: tt,
|
|
3475
3476
|
callback(u) {
|
|
3476
3477
|
m(u);
|
|
3477
3478
|
}
|
|
@@ -3484,7 +3485,7 @@ const Co = {
|
|
|
3484
3485
|
r("pageFullscreen", c);
|
|
3485
3486
|
},
|
|
3486
3487
|
toggleFullscreen(c) {
|
|
3487
|
-
C.emit(n,
|
|
3488
|
+
C.emit(n, Ct, c);
|
|
3488
3489
|
},
|
|
3489
3490
|
togglePreview(c) {
|
|
3490
3491
|
r("preview", c);
|
|
@@ -3493,20 +3494,20 @@ const Co = {
|
|
|
3493
3494
|
r("htmlPreview", c);
|
|
3494
3495
|
},
|
|
3495
3496
|
toggleCatalog(c) {
|
|
3496
|
-
C.emit(n,
|
|
3497
|
+
C.emit(n, $e, c);
|
|
3497
3498
|
},
|
|
3498
3499
|
triggerSave() {
|
|
3499
|
-
C.emit(n,
|
|
3500
|
+
C.emit(n, ue);
|
|
3500
3501
|
},
|
|
3501
3502
|
insert(c) {
|
|
3502
3503
|
C.emit(n, "replace", "universal", { generate: c });
|
|
3503
3504
|
},
|
|
3504
3505
|
focus() {
|
|
3505
|
-
C.emit(n,
|
|
3506
|
+
C.emit(n, $t);
|
|
3506
3507
|
}
|
|
3507
3508
|
};
|
|
3508
3509
|
t.expose(a);
|
|
3509
|
-
},
|
|
3510
|
+
}, Eo = (e) => e, Lo = {
|
|
3510
3511
|
/**
|
|
3511
3512
|
* 主题
|
|
3512
3513
|
*
|
|
@@ -3604,7 +3605,7 @@ const Co = {
|
|
|
3604
3605
|
*/
|
|
3605
3606
|
toolbars: {
|
|
3606
3607
|
type: Array,
|
|
3607
|
-
default:
|
|
3608
|
+
default: kt
|
|
3608
3609
|
},
|
|
3609
3610
|
/**
|
|
3610
3611
|
* 工具栏选择不显示
|
|
@@ -3643,7 +3644,7 @@ const Co = {
|
|
|
3643
3644
|
*/
|
|
3644
3645
|
editorId: {
|
|
3645
3646
|
type: String,
|
|
3646
|
-
default:
|
|
3647
|
+
default: Gt
|
|
3647
3648
|
},
|
|
3648
3649
|
/**
|
|
3649
3650
|
* 一个tab等于空格数
|
|
@@ -3686,7 +3687,7 @@ const Co = {
|
|
|
3686
3687
|
*/
|
|
3687
3688
|
mdHeadingId: {
|
|
3688
3689
|
type: Function,
|
|
3689
|
-
default:
|
|
3690
|
+
default: Eo
|
|
3690
3691
|
},
|
|
3691
3692
|
/**
|
|
3692
3693
|
* 表格预设格子数
|
|
@@ -3761,7 +3762,7 @@ const Co = {
|
|
|
3761
3762
|
*/
|
|
3762
3763
|
footers: {
|
|
3763
3764
|
type: Array,
|
|
3764
|
-
default:
|
|
3765
|
+
default: yt
|
|
3765
3766
|
},
|
|
3766
3767
|
/**
|
|
3767
3768
|
* 是否默认激活输入框和预览框同步滚动
|
|
@@ -3877,7 +3878,7 @@ const Co = {
|
|
|
3877
3878
|
type: Boolean,
|
|
3878
3879
|
default: !1
|
|
3879
3880
|
}
|
|
3880
|
-
},
|
|
3881
|
+
}, Ho = [
|
|
3881
3882
|
"onChange",
|
|
3882
3883
|
"onSave",
|
|
3883
3884
|
"onUploadImg",
|
|
@@ -3888,10 +3889,10 @@ const Co = {
|
|
|
3888
3889
|
"onBlur",
|
|
3889
3890
|
"onFocus"
|
|
3890
3891
|
];
|
|
3891
|
-
const
|
|
3892
|
+
const G = /* @__PURE__ */ M({
|
|
3892
3893
|
name: "MdEditorV3",
|
|
3893
|
-
props:
|
|
3894
|
-
emits:
|
|
3894
|
+
props: Lo,
|
|
3895
|
+
emits: Ho,
|
|
3895
3896
|
setup(e, t) {
|
|
3896
3897
|
const {
|
|
3897
3898
|
editorId: o,
|
|
@@ -3904,11 +3905,11 @@ const z = /* @__PURE__ */ M({
|
|
|
3904
3905
|
} = e, u = N({
|
|
3905
3906
|
scrollAuto: e.scrollAuto
|
|
3906
3907
|
});
|
|
3907
|
-
|
|
3908
|
-
const [d, f] =
|
|
3909
|
-
return
|
|
3908
|
+
Co(e, t), $o(e), wo(e);
|
|
3909
|
+
const [d, f] = To(e, t), [h, v] = So(e);
|
|
3910
|
+
return ke(() => {
|
|
3910
3911
|
C.clear(o);
|
|
3911
|
-
}),
|
|
3912
|
+
}), xo(e, t, h, d, f), () => {
|
|
3912
3913
|
var p;
|
|
3913
3914
|
const b = _({
|
|
3914
3915
|
props: e,
|
|
@@ -3921,7 +3922,7 @@ const z = /* @__PURE__ */ M({
|
|
|
3921
3922
|
id: o,
|
|
3922
3923
|
class: [s, e.class, e.theme === "dark" && `${s}-dark`, d.fullscreen || d.pageFullscreen ? `${s}-fullscreen` : "", l && `${s}-previewOnly`],
|
|
3923
3924
|
style: e.style
|
|
3924
|
-
}, [!l && i(
|
|
3925
|
+
}, [!l && i(kl, {
|
|
3925
3926
|
noPrettier: a,
|
|
3926
3927
|
toolbars: e.toolbars,
|
|
3927
3928
|
toolbarsExclude: e.toolbarsExclude,
|
|
@@ -3930,7 +3931,7 @@ const z = /* @__PURE__ */ M({
|
|
|
3930
3931
|
tableShape: e.tableShape,
|
|
3931
3932
|
defToolbars: b,
|
|
3932
3933
|
noUploadImg: c
|
|
3933
|
-
}, null), i(
|
|
3934
|
+
}, null), i(uo, {
|
|
3934
3935
|
value: e.modelValue,
|
|
3935
3936
|
setting: d,
|
|
3936
3937
|
mdHeadingId: e.mdHeadingId,
|
|
@@ -3962,13 +3963,13 @@ const z = /* @__PURE__ */ M({
|
|
|
3962
3963
|
onFocus: (y) => {
|
|
3963
3964
|
e.onFocus ? e.onFocus(y) : t.emit("onFocus", y);
|
|
3964
3965
|
}
|
|
3965
|
-
}, null), !l && ((p = e.footers) == null ? void 0 : p.length) > 0 && i(
|
|
3966
|
+
}, null), !l && ((p = e.footers) == null ? void 0 : p.length) > 0 && i(bo, {
|
|
3966
3967
|
modelValue: e.modelValue,
|
|
3967
3968
|
footers: e.footers,
|
|
3968
3969
|
defFooters: k,
|
|
3969
3970
|
scrollAuto: u.scrollAuto,
|
|
3970
3971
|
onScrollAutoChange: (y) => u.scrollAuto = y
|
|
3971
|
-
}, null), v.value && !l && i(
|
|
3972
|
+
}, null), v.value && !l && i(ce, {
|
|
3972
3973
|
theme: e.theme,
|
|
3973
3974
|
style: {
|
|
3974
3975
|
display: h.value ? "block" : "none"
|
|
@@ -3979,7 +3980,7 @@ const z = /* @__PURE__ */ M({
|
|
|
3979
3980
|
}, null)]);
|
|
3980
3981
|
};
|
|
3981
3982
|
}
|
|
3982
|
-
}),
|
|
3983
|
+
}), Io = {
|
|
3983
3984
|
title: {
|
|
3984
3985
|
type: String,
|
|
3985
3986
|
default: ""
|
|
@@ -3991,9 +3992,9 @@ const z = /* @__PURE__ */ M({
|
|
|
3991
3992
|
onClick: {
|
|
3992
3993
|
type: Function
|
|
3993
3994
|
}
|
|
3994
|
-
},
|
|
3995
|
+
}, ve = /* @__PURE__ */ M({
|
|
3995
3996
|
name: "NormalToolbar",
|
|
3996
|
-
props:
|
|
3997
|
+
props: Io,
|
|
3997
3998
|
emits: ["onClick"],
|
|
3998
3999
|
setup(e, t) {
|
|
3999
4000
|
return () => {
|
|
@@ -4010,7 +4011,7 @@ const z = /* @__PURE__ */ M({
|
|
|
4010
4011
|
}, [o]);
|
|
4011
4012
|
};
|
|
4012
4013
|
}
|
|
4013
|
-
}),
|
|
4014
|
+
}), Ao = {
|
|
4014
4015
|
title: {
|
|
4015
4016
|
type: String,
|
|
4016
4017
|
default: ""
|
|
@@ -4029,9 +4030,9 @@ const z = /* @__PURE__ */ M({
|
|
|
4029
4030
|
overlay: {
|
|
4030
4031
|
type: [String, Object]
|
|
4031
4032
|
}
|
|
4032
|
-
},
|
|
4033
|
+
}, pe = /* @__PURE__ */ M({
|
|
4033
4034
|
name: "DropdownToolbar",
|
|
4034
|
-
props:
|
|
4035
|
+
props: Ao,
|
|
4035
4036
|
emits: ["onChange"],
|
|
4036
4037
|
setup(e, t) {
|
|
4037
4038
|
const o = x("editorId");
|
|
@@ -4059,10 +4060,10 @@ const z = /* @__PURE__ */ M({
|
|
|
4059
4060
|
};
|
|
4060
4061
|
}
|
|
4061
4062
|
});
|
|
4062
|
-
function
|
|
4063
|
-
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !
|
|
4063
|
+
function Fo(e) {
|
|
4064
|
+
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !Et(e);
|
|
4064
4065
|
}
|
|
4065
|
-
const
|
|
4066
|
+
const Mo = {
|
|
4066
4067
|
title: {
|
|
4067
4068
|
type: String,
|
|
4068
4069
|
default: ""
|
|
@@ -4106,9 +4107,9 @@ const jo = {
|
|
|
4106
4107
|
onAdjust: {
|
|
4107
4108
|
type: Function
|
|
4108
4109
|
}
|
|
4109
|
-
},
|
|
4110
|
+
}, be = /* @__PURE__ */ M({
|
|
4110
4111
|
name: "ModalToolbar",
|
|
4111
|
-
props:
|
|
4112
|
+
props: Mo,
|
|
4112
4113
|
emits: ["onClick", "onClose", "onAdjust"],
|
|
4113
4114
|
setup(e, t) {
|
|
4114
4115
|
return () => {
|
|
@@ -4119,13 +4120,13 @@ const jo = {
|
|
|
4119
4120
|
props: e,
|
|
4120
4121
|
ctx: t
|
|
4121
4122
|
}, "default");
|
|
4122
|
-
return i(
|
|
4123
|
+
return i(ye, null, [i("div", {
|
|
4123
4124
|
class: `${s}-toolbar-item`,
|
|
4124
4125
|
title: e.title,
|
|
4125
4126
|
onClick: () => {
|
|
4126
4127
|
e.onClick instanceof Function ? e.onClick() : t.emit("onClick");
|
|
4127
4128
|
}
|
|
4128
|
-
}, [o]), i(
|
|
4129
|
+
}, [o]), i(we, {
|
|
4129
4130
|
width: e.width,
|
|
4130
4131
|
height: e.height,
|
|
4131
4132
|
title: e.modalTitle,
|
|
@@ -4138,18 +4139,18 @@ const jo = {
|
|
|
4138
4139
|
onAdjust: (r) => {
|
|
4139
4140
|
e.onAdjust instanceof Function ? e.onAdjust(r) : t.emit("onAdjust", r);
|
|
4140
4141
|
}
|
|
4141
|
-
},
|
|
4142
|
+
}, Fo(l) ? l : {
|
|
4142
4143
|
default: () => [l]
|
|
4143
4144
|
})]);
|
|
4144
4145
|
};
|
|
4145
4146
|
}
|
|
4146
4147
|
});
|
|
4147
|
-
|
|
4148
|
-
|
|
4149
|
-
|
|
4150
|
-
|
|
4151
|
-
|
|
4152
|
-
|
|
4148
|
+
G.install = (e) => (e.component(G.name, G), e.component(ve.name, ve), e.component(pe.name, pe), e.component(ce.name, ce), e.component(be.name, be), e);
|
|
4149
|
+
G.NormalToolbar = ve;
|
|
4150
|
+
G.DropdownToolbar = pe;
|
|
4151
|
+
G.MdCatalog = ce;
|
|
4152
|
+
G.ModalToolbar = be;
|
|
4153
|
+
G.config = Jt;
|
|
4153
4154
|
export {
|
|
4154
|
-
|
|
4155
|
+
G as default
|
|
4155
4156
|
};
|