md-editor-v3 4.1.0-beta.1 → 4.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  var Ze = Object.defineProperty;
2
2
  var Je = (e, o, a) => o in e ? Ze(e, o, { enumerable: !0, configurable: !0, writable: !0, value: a }) : e[o] = a;
3
3
  var q = (e, o, a) => (Je(e, typeof o != "symbol" ? o + "" : o, a), a);
4
- import { defineComponent as O, createVNode as t, inject as A, ref as U, onMounted as W, reactive as Z, computed as fe, watch as I, nextTick as me, Fragment as Ke, toRef as ne, shallowRef as Xe, onBeforeUnmount as Qe } from "vue";
4
+ import { defineComponent as O, createVNode as t, inject as A, ref as U, onMounted as W, reactive as Z, computed as fe, watch as I, nextTick as me, Fragment as Ke, toRef as te, shallowRef as Xe, onBeforeUnmount as Qe } from "vue";
5
5
  import { p as n, a as _, s as et, b as tt, d as lt } from "./chunks/config.mjs";
6
6
  import { a as ee, D as ot } from "./chunks/index2.mjs";
7
7
  import { b as h, a as at } from "./chunks/index4.mjs";
@@ -13,28 +13,27 @@ import { minimalSetup as xt, EditorView as re } from "codemirror";
13
13
  import { EditorView as ge, placeholder as wt, keymap as Tt } from "@codemirror/view";
14
14
  import { languages as St } from "@codemirror/language-data";
15
15
  import { markdown as At } from "@codemirror/lang-markdown";
16
- import { htmlCompletionSource as Mt, html as Lt } from "@codemirror/lang-html";
17
- import { deleteLine as Dt, indentWithTab as Et, undo as Ht, redo as Bt } from "@codemirror/commands";
18
- import { HighlightStyle as We, syntaxHighlighting as ze, indentUnit as Ft } from "@codemirror/language";
16
+ import { deleteLine as Mt, indentWithTab as Lt, undo as Dt, redo as Et } from "@codemirror/commands";
17
+ import { HighlightStyle as We, syntaxHighlighting as ze, indentUnit as Ht } from "@codemirror/language";
19
18
  import { tags as s } from "@lezer/highlight";
20
- import { EditorSelection as Y, EditorState as se, Compartment as It, StateEffect as Ot } from "@codemirror/state";
21
- import { autocompletion as Vt } from "@codemirror/autocomplete";
19
+ import { EditorSelection as Y, EditorState as se, Compartment as Bt, StateEffect as Ft } from "@codemirror/state";
20
+ import { autocompletion as It } from "@codemirror/autocomplete";
22
21
  import { g as He } from "./chunks/vue-tsx.mjs";
23
22
  import Ye from "./MdCatalog.mjs";
24
- import Rt from "./NormalToolbar.mjs";
23
+ import Ot from "./NormalToolbar.mjs";
25
24
  import "medium-zoom";
26
25
  import "copy-to-clipboard";
27
26
  import "markdown-it";
28
27
  import "markdown-it-image-figures";
29
28
  import "markdown-it-task-lists";
30
29
  import "lru-cache";
31
- const Nt = /* @__PURE__ */ O({
30
+ const Vt = /* @__PURE__ */ O({
32
31
  setup() {
33
32
  return () => t("div", {
34
33
  class: `${n}-divider`
35
34
  }, null);
36
35
  }
37
- }), Pt = {
36
+ }), Rt = {
38
37
  noPrettier: {
39
38
  type: Boolean
40
39
  },
@@ -75,11 +74,11 @@ const Nt = /* @__PURE__ */ O({
75
74
  noUploadImg: {
76
75
  type: Boolean
77
76
  }
78
- }, qt = (e) => {
79
- var f, u, d, p;
77
+ }, Nt = (e) => {
78
+ var f, u, d, v;
80
79
  const o = A("editorId");
81
80
  let a = (u = (f = _.editorExtensions) == null ? void 0 : f.screenfull) == null ? void 0 : u.instance;
82
- const l = (p = (d = _.editorExtensions) == null ? void 0 : d.screenfull) == null ? void 0 : p.js, i = U(!1), r = ($) => {
81
+ const l = (v = (d = _.editorExtensions) == null ? void 0 : d.screenfull) == null ? void 0 : v.js, i = U(!1), r = (y) => {
83
82
  if (!a) {
84
83
  h.emit(o, "errorCatcher", {
85
84
  name: "fullscreen",
@@ -87,7 +86,7 @@ const Nt = /* @__PURE__ */ O({
87
86
  });
88
87
  return;
89
88
  }
90
- a.isEnabled ? (i.value = !0, ($ === void 0 ? !a.isFullscreen : $) ? a.request() : a.exit()) : console.error("browser does not support screenfull!");
89
+ a.isEnabled ? (i.value = !0, (y === void 0 ? !a.isFullscreen : y) ? a.request() : a.exit()) : console.error("browser does not support screenfull!");
91
90
  }, c = () => {
92
91
  a && a.isEnabled && a.on("change", () => {
93
92
  (i.value || e.setting.fullscreen) && (i.value = !1, e.updateSetting("fullscreen"));
@@ -97,8 +96,8 @@ const Nt = /* @__PURE__ */ O({
97
96
  };
98
97
  return W(() => {
99
98
  if (c(), !a) {
100
- const $ = document.createElement("script");
101
- $.src = l || et, $.onload = m, $.id = `${n}-screenfull`, $t($, "screenfull");
99
+ const y = document.createElement("script");
100
+ y.src = l || et, y.onload = m, y.id = `${n}-screenfull`, $t(y, "screenfull");
102
101
  }
103
102
  }), W(() => {
104
103
  h.on(o, {
@@ -106,7 +105,7 @@ const Nt = /* @__PURE__ */ O({
106
105
  callback: r
107
106
  });
108
107
  }), { fullscreenHandler: r };
109
- }, Ut = {
108
+ }, Pt = {
110
109
  tableShape: {
111
110
  type: Array,
112
111
  default: () => [6, 4]
@@ -116,9 +115,9 @@ const Nt = /* @__PURE__ */ O({
116
115
  default: () => {
117
116
  }
118
117
  }
119
- }, Gt = /* @__PURE__ */ O({
118
+ }, qt = /* @__PURE__ */ O({
120
119
  name: "TableShape",
121
- props: Ut,
120
+ props: Pt,
122
121
  setup(e) {
123
122
  const o = Z({
124
123
  x: -1,
@@ -145,7 +144,7 @@ const Nt = /* @__PURE__ */ O({
145
144
  class: [`${n}-table-shape-col-default`, l <= o.x && r <= o.y && `${n}-table-shape-col-include`]
146
145
  }, null)]))]))]);
147
146
  }
148
- }), Kt = Gt, jt = {
147
+ }), Ut = qt, Gt = {
149
148
  type: {
150
149
  type: String,
151
150
  default: "link"
@@ -164,8 +163,8 @@ const Nt = /* @__PURE__ */ O({
164
163
  default: () => {
165
164
  }
166
165
  }
167
- }, _t = /* @__PURE__ */ O({
168
- props: jt,
166
+ }, Kt = /* @__PURE__ */ O({
167
+ props: Gt,
169
168
  setup(e) {
170
169
  const o = A("usedLanguageText"), a = A("editorId"), l = fe(() => {
171
170
  var r, c;
@@ -234,7 +233,7 @@ const Nt = /* @__PURE__ */ O({
234
233
  }
235
234
  });
236
235
  }
237
- }), Wt = {
236
+ }), jt = {
238
237
  visible: {
239
238
  type: Boolean,
240
239
  default: !1
@@ -249,12 +248,12 @@ const Nt = /* @__PURE__ */ O({
249
248
  default: () => {
250
249
  }
251
250
  }
252
- }, zt = /* @__PURE__ */ O({
253
- props: Wt,
251
+ }, _t = /* @__PURE__ */ O({
252
+ props: jt,
254
253
  setup(e) {
255
- var d, p, $;
254
+ var d, v, y;
256
255
  const o = A("usedLanguageText"), a = A("editorId");
257
- let l = ($ = (p = (d = _) == null ? void 0 : d.editorExtensions) == null ? void 0 : p.cropper) == null ? void 0 : $.instance;
256
+ let l = (y = (v = (d = _) == null ? void 0 : d.editorExtensions) == null ? void 0 : v.cropper) == null ? void 0 : y.instance;
258
257
  const i = U(), r = U(), c = U(), m = Z({
259
258
  cropperInited: !1,
260
259
  imgSelected: !1,
@@ -274,8 +273,8 @@ const Nt = /* @__PURE__ */ O({
274
273
  }
275
274
  const b = i.value.files || [];
276
275
  if (m.imgSelected = !0, (b == null ? void 0 : b.length) > 0) {
277
- const v = new FileReader();
278
- v.onload = (g) => {
276
+ const p = new FileReader();
277
+ p.onload = (g) => {
279
278
  m.imgSrc = g.target.result, me(() => {
280
279
  f = new l(r.value, {
281
280
  viewMode: 2,
@@ -283,7 +282,7 @@ const Nt = /* @__PURE__ */ O({
283
282
  // aspectRatio: 16 / 9,
284
283
  });
285
284
  });
286
- }, v.readAsDataURL(b[0]);
285
+ }, p.readAsDataURL(b[0]);
287
286
  }
288
287
  });
289
288
  }), I(() => [m.imgSelected], () => {
@@ -309,14 +308,14 @@ const Nt = /* @__PURE__ */ O({
309
308
  onClose: e.onCancel,
310
309
  showAdjust: !0,
311
310
  isFullscreen: m.isFullscreen,
312
- onAdjust: (v) => {
313
- m.isFullscreen = v;
311
+ onAdjust: (p) => {
312
+ m.isFullscreen = p;
314
313
  },
315
314
  width: "668px",
316
315
  height: "421px"
317
316
  }, {
318
317
  default: () => {
319
- var v, g;
318
+ var p, g;
320
319
  return [t("div", {
321
320
  class: `${n}-form-item ${n}-clip`
322
321
  }, [t("div", {
@@ -360,11 +359,11 @@ const Nt = /* @__PURE__ */ O({
360
359
  type: "button",
361
360
  onClick: () => {
362
361
  if (f) {
363
- const y = f.getCroppedCanvas();
364
- h.emit(a, "uploadImage", [at(y.toDataURL("image/png"))], e.onOk), u();
362
+ const k = f.getCroppedCanvas();
363
+ h.emit(a, "uploadImage", [at(k.toDataURL("image/png"))], e.onOk), u();
365
364
  }
366
365
  }
367
- }, [((v = o.value.clipModalTips) == null ? void 0 : v.buttonUpload) || ((g = o.value.linkModalTips) == null ? void 0 : g.buttonOK)])]), t("input", {
366
+ }, [((p = o.value.clipModalTips) == null ? void 0 : p.buttonUpload) || ((g = o.value.linkModalTips) == null ? void 0 : g.buttonOK)])]), t("input", {
368
367
  ref: i,
369
368
  accept: "image/*",
370
369
  type: "file",
@@ -377,7 +376,7 @@ const Nt = /* @__PURE__ */ O({
377
376
  });
378
377
  };
379
378
  }
380
- }), Yt = {
379
+ }), Wt = {
381
380
  type: {
382
381
  type: String,
383
382
  default: "link"
@@ -400,27 +399,27 @@ const Nt = /* @__PURE__ */ O({
400
399
  default: () => {
401
400
  }
402
401
  }
403
- }, Zt = /* @__PURE__ */ O({
404
- props: Yt,
402
+ }, zt = /* @__PURE__ */ O({
403
+ props: Wt,
405
404
  setup(e) {
406
- return () => t(Ke, null, [t(_t, {
405
+ return () => t(Ke, null, [t(Kt, {
407
406
  type: e.type,
408
407
  visible: e.linkVisible,
409
408
  onOk: e.onOk,
410
409
  onCancel: e.onCancel
411
- }, null), t(zt, {
410
+ }, null), t(_t, {
412
411
  visible: e.clipVisible,
413
412
  onOk: e.onOk,
414
413
  onCancel: e.onCancel
415
414
  }, null)]);
416
415
  }
417
- }), Jt = /* @__PURE__ */ O({
416
+ }), Yt = /* @__PURE__ */ O({
418
417
  name: "MDEditorToolbar",
419
- props: Pt,
418
+ props: Rt,
420
419
  setup(e) {
421
420
  const o = A("editorId"), a = A("usedLanguageText"), {
422
421
  fullscreenHandler: l
423
- } = qt(e), i = `${o}-toolbar-wrapper`, r = Z({
422
+ } = Nt(e), i = `${o}-toolbar-wrapper`, r = Z({
424
423
  title: !1,
425
424
  catalog: !1,
426
425
  // 图片上传下拉
@@ -430,8 +429,8 @@ const Nt = /* @__PURE__ */ O({
430
429
  // mermaid
431
430
  mermaid: !1,
432
431
  katex: !1
433
- }), c = (b, v) => {
434
- h.emit(o, "replace", b, v);
432
+ }), c = (b, p) => {
433
+ h.emit(o, "replace", b, p);
435
434
  }, m = Z({
436
435
  type: "link",
437
436
  linkVisible: !1,
@@ -446,24 +445,24 @@ const Nt = /* @__PURE__ */ O({
446
445
  });
447
446
  });
448
447
  const u = fe(() => {
449
- const b = e.toolbars.filter((x) => !e.toolbarsExclude.includes(x)), v = b.indexOf("="), g = v === -1 ? b : b.slice(0, v + 1), y = v === -1 ? [] : b.slice(v, Number.MAX_SAFE_INTEGER);
450
- return [g, y];
451
- }), d = U(), p = () => {
448
+ const b = e.toolbars.filter((x) => !e.toolbarsExclude.includes(x)), p = b.indexOf("="), g = p === -1 ? b : b.slice(0, p + 1), k = p === -1 ? [] : b.slice(p, Number.MAX_SAFE_INTEGER);
449
+ return [g, k];
450
+ }), d = U(), v = () => {
452
451
  h.emit(o, "uploadImage", Array.from(d.value.files || [])), d.value.value = "";
453
452
  };
454
453
  W(() => {
455
- d.value.addEventListener("change", p);
454
+ d.value.addEventListener("change", v);
456
455
  });
457
- const $ = (b) => {
458
- var v, g, y, x, T, w, M, k, S, R, L, D, V, B, E, G, N, oe, J, K, P, X, j, H, F, Q, ae, he, be, ve, pe, ke, Ce, $e, ye, xe, we, Te, Se, Ae, Me, Le, De;
456
+ const y = (b) => {
457
+ var p, g, k, x, T, w, M, C, S, R, L, D, V, B, E, G, N, ae, J, K, P, X, j, H, F, Q, ne, he, be, ve, pe, ke, Ce, $e, ye, xe, we, Te, Se, Ae, Me, Le, De;
459
458
  if (tt.includes(b))
460
459
  switch (b) {
461
460
  case "-":
462
- return t(Nt, null, null);
461
+ return t(Vt, null, null);
463
462
  case "bold":
464
463
  return t("div", {
465
464
  class: `${n}-toolbar-item`,
466
- title: (v = a.value.toolbarTips) == null ? void 0 : v.bold,
465
+ title: (p = a.value.toolbarTips) == null ? void 0 : p.bold,
467
466
  onClick: () => {
468
467
  c("bold");
469
468
  }
@@ -489,7 +488,7 @@ const Nt = /* @__PURE__ */ O({
489
488
  case "italic":
490
489
  return t("div", {
491
490
  class: `${n}-toolbar-item`,
492
- title: (y = a.value.toolbarTips) == null ? void 0 : y.italic,
491
+ title: (k = a.value.toolbarTips) == null ? void 0 : k.italic,
493
492
  onClick: () => {
494
493
  c("italic");
495
494
  }
@@ -516,8 +515,8 @@ const Nt = /* @__PURE__ */ O({
516
515
  return t(ee, {
517
516
  relative: `#${i}`,
518
517
  visible: r.title,
519
- onChange: (C) => {
520
- r.title = C;
518
+ onChange: ($) => {
519
+ r.title = $;
521
520
  },
522
521
  overlay: t("ul", {
523
522
  class: `${n}-menu`,
@@ -544,7 +543,7 @@ const Nt = /* @__PURE__ */ O({
544
543
  onClick: () => {
545
544
  c("h4");
546
545
  }
547
- }, [(k = a.value.titleItem) == null ? void 0 : k.h4]), t("li", {
546
+ }, [(C = a.value.titleItem) == null ? void 0 : C.h4]), t("li", {
548
547
  class: `${n}-menu-item`,
549
548
  onClick: () => {
550
549
  c("h5");
@@ -557,10 +556,10 @@ const Nt = /* @__PURE__ */ O({
557
556
  }, [(R = a.value.titleItem) == null ? void 0 : R.h6])])
558
557
  }, {
559
558
  default: () => {
560
- var C;
559
+ var $;
561
560
  return [t("div", {
562
561
  class: `${n}-toolbar-item`,
563
- title: (C = a.value.toolbarTips) == null ? void 0 : C.title
562
+ title: ($ = a.value.toolbarTips) == null ? void 0 : $.title
564
563
  }, [t("svg", {
565
564
  class: `${n}-icon`,
566
565
  "aria-hidden": "true"
@@ -663,7 +662,7 @@ const Nt = /* @__PURE__ */ O({
663
662
  case "code":
664
663
  return t("div", {
665
664
  class: `${n}-toolbar-item`,
666
- title: (oe = a.value.toolbarTips) == null ? void 0 : oe.code,
665
+ title: (ae = a.value.toolbarTips) == null ? void 0 : ae.code,
667
666
  onClick: () => {
668
667
  c("code");
669
668
  }
@@ -701,8 +700,8 @@ const Nt = /* @__PURE__ */ O({
701
700
  }, null)])]) : t(ee, {
702
701
  relative: `#${i}`,
703
702
  visible: r.image,
704
- onChange: (C) => {
705
- r.image = C;
703
+ onChange: ($) => {
704
+ r.image = $;
706
705
  },
707
706
  overlay: t("ul", {
708
707
  class: `${n}-menu`,
@@ -727,10 +726,10 @@ const Nt = /* @__PURE__ */ O({
727
726
  }, [(j = a.value.imgTitleItem) == null ? void 0 : j.clip2upload])])
728
727
  }, {
729
728
  default: () => {
730
- var C;
729
+ var $;
731
730
  return [t("div", {
732
731
  class: `${n}-toolbar-item`,
733
- title: (C = a.value.toolbarTips) == null ? void 0 : C.image
732
+ title: ($ = a.value.toolbarTips) == null ? void 0 : $.image
734
733
  }, [t("svg", {
735
734
  class: `${n}-icon`,
736
735
  "aria-hidden": "true"
@@ -743,24 +742,24 @@ const Nt = /* @__PURE__ */ O({
743
742
  return t(ee, {
744
743
  relative: `#${i}`,
745
744
  visible: r.table,
746
- onChange: (C) => {
747
- r.table = C;
745
+ onChange: ($) => {
746
+ r.table = $;
748
747
  },
749
748
  key: "bar-table",
750
- overlay: t(Kt, {
749
+ overlay: t(Ut, {
751
750
  tableShape: e.tableShape,
752
- onSelected: (C) => {
751
+ onSelected: ($) => {
753
752
  c("table", {
754
- selectedShape: C
753
+ selectedShape: $
755
754
  });
756
755
  }
757
756
  }, null)
758
757
  }, {
759
758
  default: () => {
760
- var C;
759
+ var $;
761
760
  return [t("div", {
762
761
  class: `${n}-toolbar-item`,
763
- title: (C = a.value.toolbarTips) == null ? void 0 : C.table
762
+ title: ($ = a.value.toolbarTips) == null ? void 0 : $.table
764
763
  }, [t("svg", {
765
764
  class: `${n}-icon`,
766
765
  "aria-hidden": "true"
@@ -811,7 +810,7 @@ const Nt = /* @__PURE__ */ O({
811
810
  case "prettier":
812
811
  return e.noPrettier ? "" : t("div", {
813
812
  class: `${n}-toolbar-item`,
814
- title: (ae = a.value.toolbarTips) == null ? void 0 : ae.prettier,
813
+ title: (ne = a.value.toolbarTips) == null ? void 0 : ne.prettier,
815
814
  onClick: () => {
816
815
  c("prettier");
817
816
  }
@@ -902,8 +901,8 @@ const Nt = /* @__PURE__ */ O({
902
901
  return t(ee, {
903
902
  relative: `#${i}`,
904
903
  visible: r.mermaid,
905
- onChange: (C) => {
906
- r.mermaid = C;
904
+ onChange: ($) => {
905
+ r.mermaid = $;
907
906
  },
908
907
  overlay: t("ul", {
909
908
  class: `${n}-menu`,
@@ -954,10 +953,10 @@ const Nt = /* @__PURE__ */ O({
954
953
  key: "bar-mermaid"
955
954
  }, {
956
955
  default: () => {
957
- var C;
956
+ var $;
958
957
  return [t("div", {
959
958
  class: `${n}-toolbar-item`,
960
- title: (C = a.value.toolbarTips) == null ? void 0 : C.mermaid
959
+ title: ($ = a.value.toolbarTips) == null ? void 0 : $.mermaid
961
960
  }, [t("svg", {
962
961
  class: `${n}-icon`,
963
962
  "aria-hidden": "true"
@@ -970,8 +969,8 @@ const Nt = /* @__PURE__ */ O({
970
969
  return t(ee, {
971
970
  relative: `#${i}`,
972
971
  visible: r.katex,
973
- onChange: (C) => {
974
- r.katex = C;
972
+ onChange: ($) => {
973
+ r.katex = $;
975
974
  },
976
975
  overlay: t("ul", {
977
976
  class: `${n}-menu`,
@@ -992,10 +991,10 @@ const Nt = /* @__PURE__ */ O({
992
991
  key: "bar-katex"
993
992
  }, {
994
993
  default: () => {
995
- var C;
994
+ var $;
996
995
  return [t("div", {
997
996
  class: `${n}-toolbar-item`,
998
- title: (C = a.value.toolbarTips) == null ? void 0 : C.katex
997
+ title: ($ = a.value.toolbarTips) == null ? void 0 : $.katex
999
998
  }, [t("svg", {
1000
999
  class: `${n}-icon`,
1001
1000
  "aria-hidden": "true"
@@ -1009,7 +1008,7 @@ const Nt = /* @__PURE__ */ O({
1009
1008
  return e.defToolbars instanceof Array ? e.defToolbars[b] || "" : e.defToolbars && e.defToolbars.children instanceof Array && e.defToolbars.children[b] || "";
1010
1009
  };
1011
1010
  return () => {
1012
- const b = u.value[0].map((g) => $(g)), v = u.value[1].map((g) => $(g));
1011
+ const b = u.value[0].map((g) => y(g)), p = u.value[1].map((g) => y(g));
1013
1012
  return t(Ke, null, [e.toolbars.length > 0 && t("div", {
1014
1013
  class: `${n}-toolbar-wrapper`,
1015
1014
  id: i
@@ -1020,7 +1019,7 @@ const Nt = /* @__PURE__ */ O({
1020
1019
  ref: f
1021
1020
  }, [b]), t("div", {
1022
1021
  class: `${n}-toolbar-right`
1023
- }, [v])])]), t("input", {
1022
+ }, [p])])]), t("input", {
1024
1023
  ref: d,
1025
1024
  accept: "image/*",
1026
1025
  type: "file",
@@ -1028,7 +1027,7 @@ const Nt = /* @__PURE__ */ O({
1028
1027
  style: {
1029
1028
  display: "none"
1030
1029
  }
1031
- }, null), t(Zt, {
1030
+ }, null), t(zt, {
1032
1031
  linkVisible: m.linkVisible,
1033
1032
  clipVisible: m.clipVisible,
1034
1033
  type: m.type,
@@ -1044,7 +1043,7 @@ const Nt = /* @__PURE__ */ O({
1044
1043
  }, null)]);
1045
1044
  };
1046
1045
  }
1047
- }), Xt = (e, o) => {
1046
+ }), Zt = (e, o) => {
1048
1047
  const a = rt(() => {
1049
1048
  e.removeEventListener("scroll", l), e.addEventListener("scroll", l), o.removeEventListener("scroll", l), o.addEventListener("scroll", l);
1050
1049
  }, 50), l = (i) => {
@@ -1067,35 +1066,35 @@ const Nt = /* @__PURE__ */ O({
1067
1066
  e.removeEventListener("scroll", l), o.removeEventListener("scroll", l);
1068
1067
  }
1069
1068
  ];
1070
- }, Qt = (e, o, a) => {
1071
- const { view: l } = a, i = (p) => l.lineBlockAt(l.state.doc.line(p).from).top, r = (p) => l.lineBlockAt(l.state.doc.line(p).from).height;
1069
+ }, Jt = (e, o, a) => {
1070
+ const { view: l } = a, i = (v) => l.lineBlockAt(l.state.doc.line(v).from).top, r = (v) => l.lineBlockAt(l.state.doc.line(v).from).height;
1072
1071
  let c = [];
1073
1072
  const m = () => {
1074
1073
  c = [];
1075
- const p = Array.from(o.querySelectorAll("[data-line]")).map(
1074
+ const v = Array.from(o.querySelectorAll("[data-line]")).map(
1076
1075
  (g) => Number(g.dataset.line) + 1
1077
- ), { lines: $ } = l.state.doc;
1078
- let b = 1, v = p.shift() ?? $;
1079
- for (let g = 1; g <= $; g++)
1080
- g === v && (b = g, v = p.shift() || $ + 1), c.push({
1076
+ ), { lines: y } = l.state.doc;
1077
+ let b = 1, p = v.shift() ?? y;
1078
+ for (let g = 1; g <= y; g++)
1079
+ g === p && (b = g, p = v.shift() || y + 1), c.push({
1081
1080
  start: b,
1082
- end: v - 1
1081
+ end: p - 1
1083
1082
  });
1084
1083
  };
1085
1084
  let f = 0, u = 0;
1086
- const d = it((p) => {
1087
- var v, g, y, x, T, w, M;
1088
- if (!((v = o.firstElementChild) != null && v.firstElementChild))
1085
+ const d = it((v) => {
1086
+ var p, g, k, x, T, w, M;
1087
+ if (!((p = o.firstElementChild) != null && p.firstElementChild))
1089
1088
  return;
1090
- const $ = l.lineBlockAtHeight(l.scrollDOM.scrollTop), { number: b } = l.state.doc.lineAt($.from);
1089
+ const y = l.lineBlockAtHeight(l.scrollDOM.scrollTop), { number: b } = l.state.doc.lineAt(y.from);
1091
1090
  if (!(b > c.length) && !(l.state.doc.lines < c[c.length - 1].end))
1092
- if (p.target === e) {
1091
+ if (v.target === e) {
1093
1092
  if (u !== 0)
1094
1093
  return;
1095
1094
  f++;
1096
- const k = c[b - 1], S = i(k.end) + r(k.end);
1095
+ const C = c[b - 1], S = i(C.end) + r(C.end);
1097
1096
  let R = 0;
1098
- const L = i(k.start), D = o.querySelector(`[data-line="${k.start - 1}"]`) || ((g = o.firstElementChild) == null ? void 0 : g.firstElementChild), V = o.querySelector(`[data-line="${k.end}"]`) || ((y = o.lastElementChild) == null ? void 0 : y.lastElementChild);
1097
+ const L = i(C.start), D = o.querySelector(`[data-line="${C.start - 1}"]`) || ((g = o.firstElementChild) == null ? void 0 : g.firstElementChild), V = o.querySelector(`[data-line="${C.end}"]`) || ((k = o.lastElementChild) == null ? void 0 : k.lastElementChild);
1099
1098
  let B = 0, E = 0;
1100
1099
  L === 0 ? (R = (l.scrollDOM.scrollTop - L) / (S - L), B = V.offsetTop) : S > l.scrollDOM.scrollHeight - l.scrollDOM.clientHeight ? (R = (l.scrollDOM.scrollTop - L) / (l.scrollDOM.scrollHeight - l.scrollDOM.clientHeight - L), E = D.offsetTop, B = o.scrollHeight - o.clientHeight - E + 10) : (R = (l.scrollDOM.scrollTop - L) / (S - L), E = D.offsetTop, B = V.offsetTop - E);
1101
1100
  const G = E - 10 + B * R;
@@ -1106,11 +1105,11 @@ const Nt = /* @__PURE__ */ O({
1106
1105
  if (f !== 0)
1107
1106
  return;
1108
1107
  u++;
1109
- const k = Array.from(
1108
+ const C = Array.from(
1110
1109
  o.querySelectorAll("[data-line]")
1111
1110
  ), S = o.scrollTop, R = o.scrollHeight;
1112
- let L = k.length === 0 ? 1 : Math.ceil(
1113
- Number(k[k.length - 1].dataset.line) * (S / R)
1111
+ let L = C.length === 0 ? 1 : Math.ceil(
1112
+ Number(C[C.length - 1].dataset.line) * (S / R)
1114
1113
  ), D = (x = o.firstElementChild) == null ? void 0 : x.firstElementChild;
1115
1114
  for (let H = L; H >= 0; H--) {
1116
1115
  const F = o.querySelector(`[data-line="${H}"]`);
@@ -1120,11 +1119,11 @@ const Nt = /* @__PURE__ */ O({
1120
1119
  }
1121
1120
  }
1122
1121
  let V = (T = o.firstElementChild) == null ? void 0 : T.firstElementChild, B = (w = o.firstElementChild) == null ? void 0 : w.lastElementChild;
1123
- for (; k.length > 0; ) {
1124
- const H = k.indexOf(D);
1125
- if (H + 1 >= k.length)
1122
+ for (; C.length > 0; ) {
1123
+ const H = C.indexOf(D);
1124
+ if (H + 1 >= C.length)
1126
1125
  break;
1127
- const F = k[H + 1];
1126
+ const F = C[H + 1];
1128
1127
  if (H === -1) {
1129
1128
  B = F;
1130
1129
  break;
@@ -1135,11 +1134,11 @@ const Nt = /* @__PURE__ */ O({
1135
1134
  V = D, B = F;
1136
1135
  break;
1137
1136
  }
1138
- D = k[H - 1];
1137
+ D = C[H - 1];
1139
1138
  continue;
1140
1139
  }
1141
- const ae = F.offsetTop;
1142
- if (Q <= S && ae > S) {
1140
+ const ne = F.offsetTop;
1141
+ if (Q <= S && ne > S) {
1143
1142
  V = D, B = F;
1144
1143
  break;
1145
1144
  }
@@ -1147,7 +1146,7 @@ const Nt = /* @__PURE__ */ O({
1147
1146
  }
1148
1147
  const E = V.offsetTop, G = B.offsetTop;
1149
1148
  let N = 0;
1150
- const { start: oe, end: J } = c[Number(V.dataset.line || 0)], K = i(oe);
1149
+ const { start: ae, end: J } = c[Number(V.dataset.line || 0)], K = i(ae);
1151
1150
  let P = i(J);
1152
1151
  const X = r(J);
1153
1152
  let j = 0;
@@ -1170,7 +1169,7 @@ const Nt = /* @__PURE__ */ O({
1170
1169
  c = [], e.removeEventListener("scroll", d), o.removeEventListener("scroll", d);
1171
1170
  }
1172
1171
  ];
1173
- }, el = (e, o, a) => {
1172
+ }, Xt = (e, o, a) => {
1174
1173
  const l = A("editorId");
1175
1174
  let i = () => {
1176
1175
  }, r = () => {
@@ -1182,7 +1181,7 @@ const Nt = /* @__PURE__ */ O({
1182
1181
  ), u = document.querySelector(
1183
1182
  `[id="${l}-html-wrapper"][data-show="true"]`
1184
1183
  );
1185
- (f || u) && ([r, i] = (f ? Qt : Xt)(
1184
+ (f || u) && ([r, i] = (f ? Jt : Zt)(
1186
1185
  m,
1187
1186
  f || u,
1188
1187
  a.value
@@ -1191,10 +1190,10 @@ const Nt = /* @__PURE__ */ O({
1191
1190
  I(
1192
1191
  [
1193
1192
  o,
1194
- ne(e.setting, "preview"),
1195
- ne(e.setting, "htmlPreview"),
1196
- ne(e.setting, "fullscreen"),
1197
- ne(e.setting, "pageFullscreen")
1193
+ te(e.setting, "preview"),
1194
+ te(e.setting, "htmlPreview"),
1195
+ te(e.setting, "fullscreen"),
1196
+ te(e.setting, "pageFullscreen")
1198
1197
  ],
1199
1198
  () => {
1200
1199
  me(c);
@@ -1205,21 +1204,21 @@ const Nt = /* @__PURE__ */ O({
1205
1204
  m ? r() : i();
1206
1205
  }
1207
1206
  ), W(c);
1208
- }, tl = el, ll = (e, o, a) => {
1209
- var d, p, $, b, v, g;
1207
+ }, Qt = Xt, el = (e, o, a) => {
1208
+ var d, v, y, b, p, g;
1210
1209
  let l = "", i = 0, r = 0, c = !0, m = !1;
1211
1210
  const f = o.getSelectedText(), u = (d = _.editorConfig) == null ? void 0 : d.mermaidTemplate;
1212
1211
  if (/^h[1-6]{1}$/.test(e)) {
1213
- const y = e.replace(/^h(\d)/, (x, T) => new Array(Number(T)).fill("#", 0, T).join(""));
1214
- l = `${y} ${f}`, i = y.length + 1;
1212
+ const k = e.replace(/^h(\d)/, (x, T) => new Array(Number(T)).fill("#", 0, T).join(""));
1213
+ l = `${k} ${f}`, i = k.length + 1;
1215
1214
  } else if (e === "prettier") {
1216
- const y = window.prettier || (($ = (p = _.editorExtensions) == null ? void 0 : p.prettier) == null ? void 0 : $.prettierInstance), x = [
1217
- ((b = window.prettierPlugins) == null ? void 0 : b.markdown) || ((g = (v = _.editorExtensions) == null ? void 0 : v.prettier) == null ? void 0 : g.parserMarkdownInstance)
1215
+ const k = window.prettier || ((y = (v = _.editorExtensions) == null ? void 0 : v.prettier) == null ? void 0 : y.prettierInstance), x = [
1216
+ ((b = window.prettierPlugins) == null ? void 0 : b.markdown) || ((g = (p = _.editorExtensions) == null ? void 0 : p.prettier) == null ? void 0 : g.parserMarkdownInstance)
1218
1217
  ];
1219
- !y || x[0] === void 0 ? (h.emit(a.editorId, "errorCatcher", {
1218
+ !k || x[0] === void 0 ? (h.emit(a.editorId, "errorCatcher", {
1220
1219
  name: "prettier",
1221
1220
  message: "prettier is undefined"
1222
- }), l = o.getValue()) : l = y.format(o.getValue(), {
1221
+ }), l = o.getValue()) : l = k.format(o.getValue(), {
1223
1222
  parser: "markdown",
1224
1223
  plugins: x
1225
1224
  }), c = !1, m = !0;
@@ -1270,16 +1269,16 @@ const Nt = /* @__PURE__ */ O({
1270
1269
  break;
1271
1270
  }
1272
1271
  case "code": {
1273
- const y = a.text || f || "", x = a.mode || "language";
1272
+ const k = a.text || f || "", x = a.mode || "language";
1274
1273
  l = `\`\`\`${x}
1275
- ${y}
1274
+ ${k}
1276
1275
  \`\`\`
1277
1276
  `, i = 3, r = 3 + x.length - l.length;
1278
1277
  break;
1279
1278
  }
1280
1279
  case "table": {
1281
1280
  l = "|";
1282
- const { selectedShape: y = { x: 1, y: 1 } } = a, { x, y: T } = y;
1281
+ const { selectedShape: k = { x: 1, y: 1 } } = a, { x, y: T } = k;
1283
1282
  for (let w = 0; w <= T; w++)
1284
1283
  l += " col |";
1285
1284
  l += `
@@ -1296,14 +1295,14 @@ ${y}
1296
1295
  break;
1297
1296
  }
1298
1297
  case "link": {
1299
- const { desc: y, url: x } = a;
1300
- l = `[${y}](${x})`, c = !1;
1298
+ const { desc: k, url: x } = a;
1299
+ l = `[${k}](${x})`, c = !1;
1301
1300
  break;
1302
1301
  }
1303
1302
  case "image": {
1304
- const { desc: y, url: x, urls: T } = a;
1305
- T instanceof Array ? l = T.reduce((w, M) => w + `![${y}](${M})
1306
- `, "") : l = `![${y}](${x})
1303
+ const { desc: k, url: x, urls: T } = a;
1304
+ T instanceof Array ? l = T.reduce((w, M) => w + `![${k}](${M})
1305
+ `, "") : l = `![${k}](${x})
1307
1306
  `, c = !1;
1308
1307
  break;
1309
1308
  }
@@ -1400,7 +1399,7 @@ $$
1400
1399
  break;
1401
1400
  }
1402
1401
  case "universal": {
1403
- const { generate: y } = a, x = y(f);
1402
+ const { generate: k } = a, x = k(f);
1404
1403
  l = x.targetValue, c = x.select, i = x.deviationStart, r = x.deviationEnd;
1405
1404
  }
1406
1405
  }
@@ -1417,18 +1416,18 @@ $$
1417
1416
  replaceAll: m
1418
1417
  }
1419
1418
  };
1420
- }, ol = "#e5c07b", Be = "var(--md-color)", al = "#56b6c2", nl = "#ffffff", te = "var(--md-color)", Fe = "#e5c07b", rl = "#e5c07b", il = "var(--md-color)", Ie = "#d19a66", sl = "#c678dd", cl = "#21252b", dl = "#2c313a", Oe = "var(--md-bk-color)", ce = "var(--md-bk-color)", ul = "#ceedfa33", Ve = "#528bff", ml = ge.theme(
1419
+ }, tl = "#e5c07b", Be = "var(--md-color)", ll = "#56b6c2", ol = "#ffffff", le = "var(--md-color)", Fe = "#e5c07b", al = "#e5c07b", nl = "var(--md-color)", Ie = "#d19a66", rl = "#c678dd", il = "#21252b", sl = "#2c313a", Oe = "var(--md-bk-color)", ce = "var(--md-bk-color)", cl = "#ceedfa33", Ve = "#528bff", dl = ge.theme(
1421
1420
  {
1422
1421
  "&": {
1423
- color: te,
1422
+ color: le,
1424
1423
  backgroundColor: Oe
1425
1424
  },
1426
1425
  ".cm-content": {
1427
1426
  caretColor: Ve
1428
1427
  },
1429
1428
  ".cm-cursor, .cm-dropCursor": { borderLeftColor: Ve },
1430
- "&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection": { backgroundColor: ul },
1431
- ".cm-panels": { backgroundColor: cl, color: te },
1429
+ "&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection": { backgroundColor: cl },
1430
+ ".cm-panels": { backgroundColor: il, color: le },
1432
1431
  ".cm-panels.cm-panels-top": { borderBottom: "2px solid black" },
1433
1432
  ".cm-panels.cm-panels-bottom": { borderTop: "2px solid black" },
1434
1433
  ".cm-searchMatch": {
@@ -1445,12 +1444,12 @@ $$
1445
1444
  },
1446
1445
  ".cm-gutters": {
1447
1446
  backgroundColor: Oe,
1448
- color: te,
1447
+ color: le,
1449
1448
  borderRight: "1px solid",
1450
1449
  borderColor: "var(--md-border-color)"
1451
1450
  },
1452
1451
  ".cm-activeLineGutter": {
1453
- backgroundColor: dl
1452
+ backgroundColor: sl
1454
1453
  },
1455
1454
  ".cm-foldPlaceholder": {
1456
1455
  backgroundColor: "transparent",
@@ -1471,17 +1470,17 @@ $$
1471
1470
  },
1472
1471
  ".cm-tooltip-autocomplete": {
1473
1472
  "& > ul > li[aria-selected]": {
1474
- color: te
1473
+ color: le
1475
1474
  }
1476
1475
  }
1477
1476
  },
1478
1477
  { dark: !0 }
1479
- ), fl = We.define([
1480
- { tag: s.keyword, color: sl },
1478
+ ), ul = We.define([
1479
+ { tag: s.keyword, color: rl },
1481
1480
  { tag: [s.name, s.deleted, s.character, s.propertyName, s.macroName], color: Be },
1482
- { tag: [s.function(s.variableName), s.labelName], color: rl },
1481
+ { tag: [s.function(s.variableName), s.labelName], color: al },
1483
1482
  { tag: [s.color, s.constant(s.name), s.standard(s.name)], color: Ie },
1484
- { tag: [s.definition(s.name), s.separator], color: te },
1483
+ { tag: [s.definition(s.name), s.separator], color: le },
1485
1484
  {
1486
1485
  tag: [
1487
1486
  s.typeName,
@@ -1493,7 +1492,7 @@ $$
1493
1492
  s.self,
1494
1493
  s.namespace
1495
1494
  ],
1496
- color: ol
1495
+ color: tl
1497
1496
  },
1498
1497
  {
1499
1498
  tag: [
@@ -1505,7 +1504,7 @@ $$
1505
1504
  s.link,
1506
1505
  s.special(s.string)
1507
1506
  ],
1508
- color: al
1507
+ color: ll
1509
1508
  },
1510
1509
  { tag: [s.meta, s.comment], color: Fe },
1511
1510
  { tag: s.strong, fontWeight: "bold" },
@@ -1514,23 +1513,23 @@ $$
1514
1513
  { tag: s.link, color: Fe, textDecoration: "underline" },
1515
1514
  { tag: s.heading, fontWeight: "bold", color: Be },
1516
1515
  { tag: [s.atom, s.bool, s.special(s.variableName)], color: Ie },
1517
- { tag: [s.processingInstruction, s.string, s.inserted], color: il },
1518
- { tag: s.invalid, color: nl }
1519
- ]), gl = [
1520
- ml,
1521
- ze(fl)
1522
- ], hl = "#e5c07b", Re = "#3f4a54", bl = "#56b6c2", vl = "#fff", le = "#3f4a54", Ne = "#2d8cf0", pl = "#2d8cf0", kl = "#3f4a54", Pe = "#d19a66", Cl = "#c678dd", $l = "#21252b", yl = "#ceedfa33", qe = "var(--md-bk-color)", de = "var(--md-bk-color)", xl = "#bad5fa", Ue = "#3f4a54", wl = ge.theme(
1516
+ { tag: [s.processingInstruction, s.string, s.inserted], color: nl },
1517
+ { tag: s.invalid, color: ol }
1518
+ ]), ml = [
1519
+ dl,
1520
+ ze(ul)
1521
+ ], fl = "#e5c07b", Re = "#3f4a54", gl = "#56b6c2", hl = "#fff", oe = "#3f4a54", Ne = "#2d8cf0", bl = "#2d8cf0", vl = "#3f4a54", Pe = "#d19a66", pl = "#c678dd", kl = "#21252b", Cl = "#ceedfa33", qe = "var(--md-bk-color)", de = "var(--md-bk-color)", $l = "#bad5fa", Ue = "#3f4a54", yl = ge.theme(
1523
1522
  {
1524
1523
  "&": {
1525
- color: le,
1524
+ color: oe,
1526
1525
  backgroundColor: qe
1527
1526
  },
1528
1527
  ".cm-content": {
1529
1528
  caretColor: Ue
1530
1529
  },
1531
1530
  ".cm-cursor, .cm-dropCursor": { borderLeftColor: Ue },
1532
- "&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection": { backgroundColor: xl },
1533
- ".cm-panels": { backgroundColor: $l, color: le },
1531
+ "&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection": { backgroundColor: $l },
1532
+ ".cm-panels": { backgroundColor: kl, color: oe },
1534
1533
  ".cm-panels.cm-panels-top": { borderBottom: "2px solid black" },
1535
1534
  ".cm-panels.cm-panels-bottom": { borderTop: "2px solid black" },
1536
1535
  ".cm-searchMatch": {
@@ -1547,12 +1546,12 @@ $$
1547
1546
  },
1548
1547
  ".cm-gutters": {
1549
1548
  backgroundColor: qe,
1550
- color: le,
1549
+ color: oe,
1551
1550
  borderRight: "1px solid",
1552
1551
  borderColor: "var(--md-border-color)"
1553
1552
  },
1554
1553
  ".cm-activeLineGutter": {
1555
- backgroundColor: yl
1554
+ backgroundColor: Cl
1556
1555
  },
1557
1556
  ".cm-foldPlaceholder": {
1558
1557
  backgroundColor: "transparent",
@@ -1573,17 +1572,17 @@ $$
1573
1572
  },
1574
1573
  ".cm-tooltip-autocomplete": {
1575
1574
  "& > ul > li[aria-selected]": {
1576
- color: le
1575
+ color: oe
1577
1576
  }
1578
1577
  }
1579
1578
  }
1580
1579
  // { dark: true }
1581
- ), Tl = We.define([
1582
- { tag: s.keyword, color: Cl },
1580
+ ), xl = We.define([
1581
+ { tag: s.keyword, color: pl },
1583
1582
  { tag: [s.name, s.deleted, s.character, s.propertyName, s.macroName], color: Re },
1584
- { tag: [s.function(s.variableName), s.labelName], color: pl },
1583
+ { tag: [s.function(s.variableName), s.labelName], color: bl },
1585
1584
  { tag: [s.color, s.constant(s.name), s.standard(s.name)], color: Pe },
1586
- { tag: [s.definition(s.name), s.separator], color: le },
1585
+ { tag: [s.definition(s.name), s.separator], color: oe },
1587
1586
  {
1588
1587
  tag: [
1589
1588
  s.typeName,
@@ -1595,7 +1594,7 @@ $$
1595
1594
  s.self,
1596
1595
  s.namespace
1597
1596
  ],
1598
- color: hl
1597
+ color: fl
1599
1598
  },
1600
1599
  {
1601
1600
  tag: [
@@ -1607,7 +1606,7 @@ $$
1607
1606
  s.link,
1608
1607
  s.special(s.string)
1609
1608
  ],
1610
- color: bl
1609
+ color: gl
1611
1610
  },
1612
1611
  { tag: [s.meta, s.comment], color: Ne },
1613
1612
  { tag: s.strong, fontWeight: "bold" },
@@ -1616,11 +1615,11 @@ $$
1616
1615
  { tag: s.link, color: Ne, textDecoration: "underline" },
1617
1616
  { tag: s.heading, fontWeight: "bold", color: Re },
1618
1617
  { tag: [s.atom, s.bool, s.special(s.variableName)], color: Pe },
1619
- { tag: [s.processingInstruction, s.string, s.inserted], color: kl },
1620
- { tag: s.invalid, color: vl }
1621
- ]), Sl = [
1622
- wl,
1623
- ze(Tl)
1618
+ { tag: [s.processingInstruction, s.string, s.inserted], color: vl },
1619
+ { tag: s.invalid, color: hl }
1620
+ ]), wl = [
1621
+ yl,
1622
+ ze(xl)
1624
1623
  ], ie = (e, o, a, l, i) => (r, c, m, f) => {
1625
1624
  const u = `${e}${o}`.slice(f - m);
1626
1625
  r.dispatch(r.state.replaceSelection(`${u}${a}${l}`));
@@ -1640,7 +1639,7 @@ $$
1640
1639
  }, Ge = (e) => (o, a, l, i) => {
1641
1640
  const r = e.slice(i - l);
1642
1641
  o.dispatch(o.state.replaceSelection(`${r} `));
1643
- }, Al = (e) => {
1642
+ }, Tl = (e) => {
1644
1643
  const o = (a) => {
1645
1644
  const l = a.matchBefore(
1646
1645
  /^#+|^-\s*\[*\s*\]*|`+|\[|!\[*|^\|\s?\|?|^\$\$?|!+\s*\w*/
@@ -1736,16 +1735,16 @@ $$`, "title")
1736
1735
  ]
1737
1736
  };
1738
1737
  };
1739
- return Vt({
1740
- override: e ? [o, Mt, ...e] : [o]
1738
+ return It({
1739
+ override: e ? [o, ...e] : [o]
1741
1740
  });
1742
- }, Ml = Al, z = (e) => {
1743
- const o = new It();
1741
+ }, Sl = Tl, z = (e) => {
1742
+ const o = new Bt();
1744
1743
  return (l) => (o.get(e.state) ? e.dispatch({ effects: o.reconfigure(l) }) : e.dispatch({
1745
- effects: Ot.appendConfig.of(o.of(l))
1744
+ effects: Ft.appendConfig.of(o.of(l))
1746
1745
  }), !0);
1747
1746
  };
1748
- class Ll {
1747
+ class Al {
1749
1748
  constructor(o) {
1750
1749
  q(this, "view");
1751
1750
  // 切换tabSize的执行方法。切换时,Compartment实例需要相同
@@ -1828,7 +1827,7 @@ class Ll {
1828
1827
  setTabSize(o) {
1829
1828
  this.toggleTabSize([
1830
1829
  se.tabSize.of(o),
1831
- Ft.of(" ".repeat(o))
1830
+ Ht.of(" ".repeat(o))
1832
1831
  ]);
1833
1832
  }
1834
1833
  /**
@@ -1854,7 +1853,7 @@ class Ll {
1854
1853
  ]);
1855
1854
  }
1856
1855
  }
1857
- const Dl = (e) => {
1856
+ const Ml = (e) => {
1858
1857
  const o = A("editorId");
1859
1858
  return (l) => {
1860
1859
  if (l.clipboardData) {
@@ -1875,7 +1874,7 @@ const Dl = (e) => {
1875
1874
  }
1876
1875
  }
1877
1876
  };
1878
- }, El = Dl, Hl = (e) => {
1877
+ }, Ll = Ml, Dl = (e) => {
1879
1878
  const o = A("editorId");
1880
1879
  W(() => {
1881
1880
  h.on(o, {
@@ -1886,7 +1885,7 @@ const Dl = (e) => {
1886
1885
  }
1887
1886
  });
1888
1887
  });
1889
- }, Bl = Hl, Fl = (e, o) => [
1888
+ }, El = Dl, Hl = (e, o) => [
1890
1889
  {
1891
1890
  key: "Ctrl-b",
1892
1891
  mac: "Cmd-b",
@@ -1895,7 +1894,7 @@ const Dl = (e) => {
1895
1894
  {
1896
1895
  key: "Ctrl-d",
1897
1896
  mac: "Cmd-d",
1898
- run: Dt,
1897
+ run: Mt,
1899
1898
  preventDefault: !0
1900
1899
  },
1901
1900
  {
@@ -1965,8 +1964,8 @@ const Dl = (e) => {
1965
1964
  key: "Ctrl-c",
1966
1965
  mac: "Cmd-c",
1967
1966
  shift: () => (h.emit(e, "replace", "code"), !0),
1968
- any(M, k) {
1969
- return (k.ctrlKey || k.metaKey) && k.altKey && k.code === "KeyC" ? (h.emit(e, "replace", "codeRow"), !0) : !1;
1967
+ any(M, C) {
1968
+ return (C.ctrlKey || C.metaKey) && C.altKey && C.code === "KeyC" ? (h.emit(e, "replace", "codeRow"), !0) : !1;
1970
1969
  }
1971
1970
  },
1972
1971
  {
@@ -1980,13 +1979,12 @@ const Dl = (e) => {
1980
1979
  shift: () => o.noPrettier ? !1 : (h.emit(e, "replace", "prettier"), !0)
1981
1980
  },
1982
1981
  {
1983
- any: (M, k) => (k.ctrlKey || k.metaKey) && k.altKey && k.shiftKey && k.code === "KeyT" ? (h.emit(e, "replace", "table"), !0) : !1
1982
+ any: (M, C) => (C.ctrlKey || C.metaKey) && C.altKey && C.shiftKey && C.code === "KeyT" ? (h.emit(e, "replace", "table"), !0) : !1
1984
1983
  }
1985
- ], Il = Fl, Ol = (e) => {
1986
- const o = A("tabWidth"), a = A("editorId"), l = A("theme"), i = U(), r = Xe(), c = Il(a, e), m = El(e), f = [
1987
- Tt.of([...c, Et]),
1984
+ ], Bl = Hl, Fl = (e) => {
1985
+ const o = A("tabWidth"), a = A("editorId"), l = A("theme"), i = U(), r = Xe(), c = Bl(a, e), m = Ll(e), f = [
1986
+ Tt.of([...c, Lt]),
1988
1987
  xt,
1989
- Lt(),
1990
1988
  At({ codeLanguages: St }),
1991
1989
  // 横向换行
1992
1990
  re.lineWrapping,
@@ -2001,8 +1999,8 @@ const Dl = (e) => {
2001
1999
  ], u = () => {
2002
2000
  const d = [
2003
2001
  ...f,
2004
- l.value === "light" ? Sl : gl,
2005
- Ml(e.completions)
2002
+ l.value === "light" ? wl : ml,
2003
+ Sl(e.completions)
2006
2004
  ];
2007
2005
  return _.codeMirrorExtensions(l.value, d, [
2008
2006
  ...c
@@ -2012,27 +2010,29 @@ const Dl = (e) => {
2012
2010
  const d = new re({
2013
2011
  doc: e.value,
2014
2012
  parent: i.value
2015
- });
2016
- r.value = new Ll(d), r.value.setTabSize(o), r.value.setExtensions(u()), r.value.setDisabled(e.disabled), r.value.setReadOnly(e.readonly), e.placeholder && r.value.setPlaceholder(e.placeholder), e.autofocus && d.focus(), e.maxlength && r.value.setMaxLength(e.maxlength), h.on(a, {
2013
+ }), v = new Al(d);
2014
+ r.value = v, setTimeout(() => {
2015
+ v.setTabSize(o), v.setDisabled(e.disabled), v.setReadOnly(e.readonly), v.setExtensions(u()), e.placeholder && v.setPlaceholder(e.placeholder), typeof e.maxlength == "number" && v.setMaxLength(e.maxlength), e.autofocus && d.focus();
2016
+ }, 0), h.on(a, {
2017
2017
  name: "ctrlZ",
2018
2018
  callback() {
2019
- Ht(d);
2019
+ Dt(d);
2020
2020
  }
2021
2021
  }), h.on(a, {
2022
2022
  name: "ctrlShiftZ",
2023
2023
  callback() {
2024
- Bt(d);
2024
+ Et(d);
2025
2025
  }
2026
2026
  }), h.on(a, {
2027
2027
  name: "replace",
2028
- callback(p, $ = {}) {
2029
- var g;
2030
- const { text: b, options: v } = ll(p, r.value, $);
2031
- (g = r.value) == null || g.replaceSelectedText(b, v);
2028
+ callback(y, b = {}) {
2029
+ var k;
2030
+ const { text: p, options: g } = el(y, r.value, b);
2031
+ (k = r.value) == null || k.replaceSelectedText(p, g);
2032
2032
  }
2033
2033
  });
2034
2034
  }), I(
2035
- [() => l.value, e.completions],
2035
+ [l, te(e, "completions")],
2036
2036
  () => {
2037
2037
  var d;
2038
2038
  (d = r.value) == null || d.setExtensions(u());
@@ -2043,8 +2043,8 @@ const Dl = (e) => {
2043
2043
  ), I(
2044
2044
  () => e.value,
2045
2045
  () => {
2046
- var d, p;
2047
- ((d = r.value) == null ? void 0 : d.getValue()) !== e.value && ((p = r.value) == null || p.setValue(e.value));
2046
+ var d, v;
2047
+ ((d = r.value) == null ? void 0 : d.getValue()) !== e.value && ((v = r.value) == null || v.setValue(e.value));
2048
2048
  }
2049
2049
  ), I(
2050
2050
  () => e.placeholder,
@@ -2070,11 +2070,11 @@ const Dl = (e) => {
2070
2070
  var d;
2071
2071
  e.maxlength && ((d = r.value) == null || d.setMaxLength(e.maxlength));
2072
2072
  }
2073
- ), Bl(r), {
2073
+ ), El(r), {
2074
2074
  inputWrapperRef: i,
2075
2075
  codeMirrorUt: r
2076
2076
  };
2077
- }, Vl = Ol, Rl = {
2077
+ }, Il = Fl, Ol = {
2078
2078
  value: {
2079
2079
  type: String,
2080
2080
  default: ""
@@ -2167,15 +2167,15 @@ const Dl = (e) => {
2167
2167
  completions: {
2168
2168
  type: Array
2169
2169
  }
2170
- }, Nl = /* @__PURE__ */ O({
2170
+ }, Vl = /* @__PURE__ */ O({
2171
2171
  name: "MDEditorContent",
2172
- props: Rl,
2172
+ props: Ol,
2173
2173
  setup(e) {
2174
2174
  const o = U(""), {
2175
2175
  inputWrapperRef: a,
2176
2176
  codeMirrorUt: l
2177
- } = Vl(e);
2178
- return tl(e, o, l), () => t("div", {
2177
+ } = Il(e);
2178
+ return Qt(e, o, l), () => t("div", {
2179
2179
  class: `${n}-content`
2180
2180
  }, [t("div", {
2181
2181
  class: `${n}-input-wrapper`,
@@ -2195,7 +2195,7 @@ const Dl = (e) => {
2195
2195
  noHighlight: e.noHighlight
2196
2196
  }, null)]);
2197
2197
  }
2198
- }), Pl = /* @__PURE__ */ O({
2198
+ }), Rl = /* @__PURE__ */ O({
2199
2199
  props: {
2200
2200
  modelValue: {
2201
2201
  type: String,
@@ -2213,7 +2213,7 @@ const Dl = (e) => {
2213
2213
  }, [`${(a = o.value.footer) == null ? void 0 : a.markdownTotal}:`]), t("span", null, [((l = e.modelValue) == null ? void 0 : l.length) || 0])]);
2214
2214
  };
2215
2215
  }
2216
- }), ql = {
2216
+ }), Nl = {
2217
2217
  checked: {
2218
2218
  type: Boolean,
2219
2219
  default: !1
@@ -2223,8 +2223,8 @@ const Dl = (e) => {
2223
2223
  default: () => {
2224
2224
  }
2225
2225
  }
2226
- }, Ul = /* @__PURE__ */ O({
2227
- props: ql,
2226
+ }, Pl = /* @__PURE__ */ O({
2227
+ props: Nl,
2228
2228
  setup(e) {
2229
2229
  return () => t("div", {
2230
2230
  class: [`${n}-checkbox`, e.checked && `${n}-checkbox-checked`],
@@ -2233,7 +2233,7 @@ const Dl = (e) => {
2233
2233
  }
2234
2234
  }, null);
2235
2235
  }
2236
- }), Gl = {
2236
+ }), ql = {
2237
2237
  scrollAuto: {
2238
2238
  type: Boolean
2239
2239
  },
@@ -2242,8 +2242,8 @@ const Dl = (e) => {
2242
2242
  default: () => {
2243
2243
  }
2244
2244
  }
2245
- }, Kl = /* @__PURE__ */ O({
2246
- props: Gl,
2245
+ }, Ul = /* @__PURE__ */ O({
2246
+ props: ql,
2247
2247
  setup(e) {
2248
2248
  const o = A("usedLanguageText");
2249
2249
  return () => {
@@ -2255,13 +2255,13 @@ const Dl = (e) => {
2255
2255
  onClick: () => {
2256
2256
  e.onScrollAutoChange(!e.scrollAuto);
2257
2257
  }
2258
- }, [(a = o.value.footer) == null ? void 0 : a.scrollAuto]), t(Ul, {
2258
+ }, [(a = o.value.footer) == null ? void 0 : a.scrollAuto]), t(Pl, {
2259
2259
  checked: e.scrollAuto,
2260
2260
  onChange: e.onScrollAutoChange
2261
2261
  }, null)]);
2262
2262
  };
2263
2263
  }
2264
- }), jl = {
2264
+ }), Gl = {
2265
2265
  modelValue: {
2266
2266
  type: String,
2267
2267
  default: ""
@@ -2281,9 +2281,9 @@ const Dl = (e) => {
2281
2281
  defFooters: {
2282
2282
  type: Object
2283
2283
  }
2284
- }, _l = /* @__PURE__ */ O({
2284
+ }, Kl = /* @__PURE__ */ O({
2285
2285
  name: "MDEditorFooter",
2286
- props: jl,
2286
+ props: Gl,
2287
2287
  setup(e) {
2288
2288
  const o = fe(() => {
2289
2289
  const l = e.footers.indexOf("="), i = l === -1 ? e.footers : e.footers.slice(0, l), r = l === -1 ? [] : e.footers.slice(l, Number.MAX_SAFE_INTEGER);
@@ -2292,11 +2292,11 @@ const Dl = (e) => {
2292
2292
  if (lt.includes(l))
2293
2293
  switch (l) {
2294
2294
  case "markdownTotal":
2295
- return t(Pl, {
2295
+ return t(Rl, {
2296
2296
  modelValue: e.modelValue
2297
2297
  }, null);
2298
2298
  case "scrollSwitch":
2299
- return t(Kl, {
2299
+ return t(Ul, {
2300
2300
  scrollAuto: e.scrollAuto,
2301
2301
  onScrollAutoChange: e.onScrollAutoChange
2302
2302
  }, null);
@@ -2315,7 +2315,7 @@ const Dl = (e) => {
2315
2315
  }, [i])]);
2316
2316
  };
2317
2317
  }
2318
- }), Wl = /* @__PURE__ */ O({
2318
+ }), jl = /* @__PURE__ */ O({
2319
2319
  name: "MdEditorV3",
2320
2320
  props: mt,
2321
2321
  emits: ft,
@@ -2331,12 +2331,12 @@ const Dl = (e) => {
2331
2331
  scrollAuto: e.scrollAuto
2332
2332
  });
2333
2333
  gt(e, o), ht(e), bt(e);
2334
- const [u, d] = vt(e, o), p = pt(e);
2334
+ const [u, d] = vt(e, o), v = pt(e);
2335
2335
  return Qe(() => {
2336
2336
  h.clear(a);
2337
- }), kt(e, o, p, u, d), () => {
2338
- var v;
2339
- const $ = He({
2337
+ }), kt(e, o, v, u, d), () => {
2338
+ var p;
2339
+ const y = He({
2340
2340
  props: e,
2341
2341
  ctx: o
2342
2342
  }, "defToolbars"), b = He({
@@ -2347,16 +2347,16 @@ const Dl = (e) => {
2347
2347
  id: a,
2348
2348
  class: [n, e.class, e.theme === "dark" && `${n}-dark`, u.fullscreen || u.pageFullscreen ? `${n}-fullscreen` : ""],
2349
2349
  style: e.style
2350
- }, [t(Jt, {
2350
+ }, [t(Yt, {
2351
2351
  noPrettier: r,
2352
2352
  toolbars: e.toolbars,
2353
2353
  toolbarsExclude: e.toolbarsExclude,
2354
2354
  setting: u,
2355
2355
  updateSetting: d,
2356
2356
  tableShape: e.tableShape,
2357
- defToolbars: $,
2357
+ defToolbars: y,
2358
2358
  noUploadImg: c
2359
- }, null), t(Nl, {
2359
+ }, null), t(Vl, {
2360
2360
  value: e.modelValue,
2361
2361
  setting: u,
2362
2362
  mdHeadingId: e.mdHeadingId,
@@ -2389,13 +2389,13 @@ const Dl = (e) => {
2389
2389
  e.onFocus ? e.onFocus(g) : o.emit("onFocus", g);
2390
2390
  },
2391
2391
  completions: e.completions
2392
- }, null), ((v = e.footers) == null ? void 0 : v.length) > 0 && t(_l, {
2392
+ }, null), ((p = e.footers) == null ? void 0 : p.length) > 0 && t(Kl, {
2393
2393
  modelValue: e.modelValue,
2394
2394
  footers: e.footers,
2395
2395
  defFooters: b,
2396
2396
  scrollAuto: f.scrollAuto,
2397
2397
  onScrollAutoChange: (g) => f.scrollAuto = g
2398
- }, null), p.value && t(Ye, {
2398
+ }, null), v.value && t(Ye, {
2399
2399
  theme: e.theme,
2400
2400
  class: `${n}-catalog-editor`,
2401
2401
  editorId: a,
@@ -2404,8 +2404,8 @@ const Dl = (e) => {
2404
2404
  }, null)]);
2405
2405
  };
2406
2406
  }
2407
- }), ue = Wl;
2408
- ue.install = (e) => (e.component(ue.name, ue), e.use(Rt).use(ot).use(yt).use(Ye).use(Ct), e);
2407
+ }), ue = jl;
2408
+ ue.install = (e) => (e.component(ue.name, ue), e.use(Ot).use(ot).use(yt).use(Ye).use(Ct), e);
2409
2409
  export {
2410
2410
  ue as default
2411
2411
  };