md-editor-v3 4.3.0-beta.6 → 4.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,41 +1,40 @@
1
1
  var wt = Object.defineProperty;
2
2
  var xt = (e, a, l) => a in e ? wt(e, a, { enumerable: !0, configurable: !0, writable: !0, value: l }) : e[a] = l;
3
- var K = (e, a, l) => (xt(e, typeof a != "symbol" ? a + "" : a, l), l);
4
- import { defineComponent as V, createVNode as t, inject as A, ref as q, onMounted as Y, reactive as J, computed as he, watch as H, nextTick as ce, Fragment as kt, cloneVNode as at, toRef as le, shallowRef as St, onBeforeUnmount as At } from "vue";
5
- import { p as o, a as z, s as Mt, b as Lt, d as Dt } from "./chunks/config.mjs";
6
- import { draggingScroll as It, linkTo as Nt, debounce as Et, throttle as Ht, smoothScroll as nt } from "@vavt/util";
7
- import { a as te, D as Bt } from "./chunks/index2.mjs";
8
- import { b as h, a as Ft } from "./chunks/index3.mjs";
9
- import { C as Vt, a as Ot, O as pt, T as Rt, b as Pt, e as qt, c as Ut, u as Gt, d as Kt, f as jt, g as _t, h as Wt, i as zt, j as Yt, M as Zt } from "./chunks/index.mjs";
10
- import { a as Jt } from "./chunks/dom.mjs";
3
+ var P = (e, a, l) => (xt(e, typeof a != "symbol" ? a + "" : a, l), l);
4
+ import { defineComponent as V, createVNode as t, inject as A, ref as U, onMounted as X, reactive as Z, computed as fe, watch as H, nextTick as ce, Fragment as kt, cloneVNode as at, toRef as le, shallowRef as St, onBeforeUnmount as At } from "vue";
5
+ import { p as o, a as z, s as Mt, b as Lt, d as It } from "./chunks/config.mjs";
6
+ import { draggingScroll as Dt, linkTo as Et, debounce as Nt, throttle as Ht, smoothScroll as nt } from "@vavt/util";
7
+ import { a as te, D as Ft } from "./chunks/index2.mjs";
8
+ import { b as f, a as Bt } from "./chunks/index3.mjs";
9
+ import { C as Vt, a as Ot, O as pt, T as Rt, b as Pt, e as qt, c as Ut, u as Gt, d as Kt, f as jt, g as _t, h as Wt, i as zt, j as Xt, M as Yt } from "./chunks/index.mjs";
10
+ import { a as Zt } from "./chunks/dom.mjs";
11
11
  import Ct from "./MdModal.mjs";
12
- import { minimalSetup as Xt, EditorView as ie } from "codemirror";
12
+ import { minimalSetup as Jt, EditorView as ie } from "codemirror";
13
13
  import { EditorView as be, placeholder as Qt, keymap as el } from "@codemirror/view";
14
14
  import { languages as tl } from "@codemirror/language-data";
15
15
  import { markdown as ll } from "@codemirror/lang-markdown";
16
- import { htmlCompletionSource as ol, html as al } from "@codemirror/lang-html";
17
- import { deleteLine as nl, indentWithTab as rl, undo as il, redo as sl } from "@codemirror/commands";
18
- import { HighlightStyle as $t, syntaxHighlighting as yt, indentUnit as cl } from "@codemirror/language";
16
+ import { deleteLine as ol, indentWithTab as al, undo as nl, redo as rl } from "@codemirror/commands";
17
+ import { HighlightStyle as $t, syntaxHighlighting as yt, indentUnit as il } from "@codemirror/language";
19
18
  import { tags as s } from "@lezer/highlight";
20
- import { EditorSelection as P, EditorState as ue, Compartment as dl, StateEffect as ul } from "@codemirror/state";
21
- import { autocompletion as ml } from "@codemirror/autocomplete";
19
+ import { EditorSelection as q, EditorState as ue, Compartment as sl, StateEffect as cl } from "@codemirror/state";
20
+ import { autocompletion as dl } from "@codemirror/autocomplete";
22
21
  import Tt from "./MdCatalog.mjs";
23
22
  import { g as rt } from "./chunks/vue-tsx.mjs";
24
- import fl from "./NormalToolbar.mjs";
25
- import gl from "./ModalToolbar.mjs";
23
+ import ul from "./NormalToolbar.mjs";
24
+ import ml from "./ModalToolbar.mjs";
26
25
  import "medium-zoom";
27
26
  import "copy-to-clipboard";
28
27
  import "markdown-it";
29
28
  import "markdown-it-image-figures";
30
29
  import "markdown-it-task-lists";
31
30
  import "lru-cache";
32
- const hl = /* @__PURE__ */ V({
31
+ const gl = /* @__PURE__ */ V({
33
32
  setup() {
34
33
  return () => t("div", {
35
34
  class: `${o}-divider`
36
35
  }, null);
37
36
  }
38
- }), bl = {
37
+ }), hl = {
39
38
  noPrettier: {
40
39
  type: Boolean
41
40
  },
@@ -84,13 +83,13 @@ const hl = /* @__PURE__ */ V({
84
83
  showToolbarName: {
85
84
  type: Boolean
86
85
  }
87
- }, vl = (e) => {
88
- var c, f, m, b;
86
+ }, fl = (e) => {
87
+ var c, g, m, b;
89
88
  const a = A("editorId");
90
- let l = (f = (c = z.editorExtensions) == null ? void 0 : c.screenfull) == null ? void 0 : f.instance;
91
- const n = (b = (m = z.editorExtensions) == null ? void 0 : m.screenfull) == null ? void 0 : b.js, r = q(!1), i = ($) => {
89
+ let l = (g = (c = z.editorExtensions) == null ? void 0 : c.screenfull) == null ? void 0 : g.instance;
90
+ const n = (b = (m = z.editorExtensions) == null ? void 0 : m.screenfull) == null ? void 0 : b.js, r = U(!1), i = ($) => {
92
91
  if (!l) {
93
- h.emit(a, "errorCatcher", {
92
+ f.emit(a, "errorCatcher", {
94
93
  name: "fullscreen",
95
94
  message: "fullscreen is undefined"
96
95
  });
@@ -104,18 +103,18 @@ const hl = /* @__PURE__ */ V({
104
103
  }, d = () => {
105
104
  l = window.screenfull, u();
106
105
  };
107
- return Y(() => {
106
+ return X(() => {
108
107
  if (u(), !l) {
109
108
  const $ = document.createElement("script");
110
- $.src = n || Mt, $.onload = d, $.id = `${o}-screenfull`, Jt($, "screenfull");
109
+ $.src = n || Mt, $.onload = d, $.id = `${o}-screenfull`, Zt($, "screenfull");
111
110
  }
112
- }), Y(() => {
113
- h.on(a, {
111
+ }), X(() => {
112
+ f.on(a, {
114
113
  name: Vt,
115
114
  callback: i
116
115
  });
117
116
  }), { fullscreenHandler: i };
118
- }, kl = {
117
+ }, bl = {
119
118
  tableShape: {
120
119
  type: Array,
121
120
  default: () => [6, 4]
@@ -125,11 +124,11 @@ const hl = /* @__PURE__ */ V({
125
124
  default: () => {
126
125
  }
127
126
  }
128
- }, pl = /* @__PURE__ */ V({
127
+ }, vl = /* @__PURE__ */ V({
129
128
  name: "TableShape",
130
- props: kl,
129
+ props: bl,
131
130
  setup(e) {
132
- const a = J({
131
+ const a = Z({
133
132
  x: -1,
134
133
  y: -1
135
134
  });
@@ -154,7 +153,7 @@ const hl = /* @__PURE__ */ V({
154
153
  class: [`${o}-table-shape-col-default`, n <= a.x && i <= a.y && `${o}-table-shape-col-include`]
155
154
  }, null)]))]))]);
156
155
  }
157
- }), Cl = pl, $l = {
156
+ }), kl = vl, pl = {
158
157
  type: {
159
158
  type: String,
160
159
  default: "link"
@@ -173,10 +172,10 @@ const hl = /* @__PURE__ */ V({
173
172
  default: () => {
174
173
  }
175
174
  }
176
- }, yl = /* @__PURE__ */ V({
177
- props: $l,
175
+ }, Cl = /* @__PURE__ */ V({
176
+ props: pl,
178
177
  setup(e) {
179
- const a = A("usedLanguageText"), l = A("editorId"), n = he(() => {
178
+ const a = A("usedLanguageText"), l = A("editorId"), n = fe(() => {
180
179
  var i, u;
181
180
  switch (e.type) {
182
181
  case "link":
@@ -186,7 +185,7 @@ const hl = /* @__PURE__ */ V({
186
185
  default:
187
186
  return "";
188
187
  }
189
- }), r = J({
188
+ }), r = Z({
190
189
  desc: "",
191
190
  url: ""
192
191
  });
@@ -200,7 +199,7 @@ const hl = /* @__PURE__ */ V({
200
199
  onClose: e.onCancel
201
200
  }, {
202
201
  default: () => {
203
- var i, u, d, c, f;
202
+ var i, u, d, c, g;
204
203
  return [t("div", {
205
204
  class: `${o}-form-item`
206
205
  }, [t("label", {
@@ -239,11 +238,11 @@ const hl = /* @__PURE__ */ V({
239
238
  onClick: () => {
240
239
  e.onOk(r), r.desc = "", r.url = "";
241
240
  }
242
- }, [(f = a.value.linkModalTips) == null ? void 0 : f.buttonOK])])];
241
+ }, [(g = a.value.linkModalTips) == null ? void 0 : g.buttonOK])])];
243
242
  }
244
243
  });
245
244
  }
246
- }), Tl = {
245
+ }), $l = {
247
246
  visible: {
248
247
  type: Boolean,
249
248
  default: !1
@@ -258,13 +257,13 @@ const hl = /* @__PURE__ */ V({
258
257
  default: () => {
259
258
  }
260
259
  }
261
- }, wl = /* @__PURE__ */ V({
262
- props: Tl,
260
+ }, yl = /* @__PURE__ */ V({
261
+ props: $l,
263
262
  setup(e) {
264
263
  var m, b, $;
265
264
  const a = A("usedLanguageText"), l = A("editorId");
266
265
  let n = ($ = (b = (m = z) == null ? void 0 : m.editorExtensions) == null ? void 0 : b.cropper) == null ? void 0 : $.instance;
267
- const r = q(), i = q(), u = q(), d = J({
266
+ const r = U(), i = U(), u = U(), d = Z({
268
267
  cropperInited: !1,
269
268
  imgSelected: !1,
270
269
  imgSrc: "",
@@ -275,7 +274,7 @@ const hl = /* @__PURE__ */ V({
275
274
  H(() => e.visible, () => {
276
275
  e.visible && !d.cropperInited && (n = n || window.Cropper, r.value.onchange = () => {
277
276
  if (!n) {
278
- h.emit(l, "errorCatcher", {
277
+ f.emit(l, "errorCatcher", {
279
278
  name: "Cropper",
280
279
  message: "Cropper is undefined"
281
280
  });
@@ -284,8 +283,8 @@ const hl = /* @__PURE__ */ V({
284
283
  const T = r.value.files || [];
285
284
  if (d.imgSelected = !0, (T == null ? void 0 : T.length) > 0) {
286
285
  const v = new FileReader();
287
- v.onload = (g) => {
288
- d.imgSrc = g.target.result, ce(() => {
286
+ v.onload = (h) => {
287
+ d.imgSrc = h.target.result, ce(() => {
289
288
  c = new n(i.value, {
290
289
  viewMode: 2,
291
290
  preview: `.${o}-clip-preview-target`
@@ -306,7 +305,7 @@ const hl = /* @__PURE__ */ V({
306
305
  }));
307
306
  });
308
307
  });
309
- const f = () => {
308
+ const g = () => {
310
309
  c.clear(), c.destroy(), c = null, r.value.value = "", d.imgSelected = !1;
311
310
  };
312
311
  return () => {
@@ -325,7 +324,7 @@ const hl = /* @__PURE__ */ V({
325
324
  height: "421px"
326
325
  }, {
327
326
  default: () => {
328
- var v, g;
327
+ var v, h;
329
328
  return [t("div", {
330
329
  class: `${o}-form-item ${o}-clip`
331
330
  }, [t("div", {
@@ -341,7 +340,7 @@ const hl = /* @__PURE__ */ V({
341
340
  alt: ""
342
341
  }, null), t("div", {
343
342
  class: `${o}-clip-delete`,
344
- onClick: f
343
+ onClick: g
345
344
  }, [t("svg", {
346
345
  class: `${o}-icon`,
347
346
  "aria-hidden": "true"
@@ -370,10 +369,10 @@ const hl = /* @__PURE__ */ V({
370
369
  onClick: () => {
371
370
  if (c) {
372
371
  const k = c.getCroppedCanvas();
373
- h.emit(l, "uploadImage", [Ft(k.toDataURL("image/png"))], e.onOk), f();
372
+ f.emit(l, "uploadImage", [Bt(k.toDataURL("image/png"))], e.onOk), g();
374
373
  }
375
374
  }
376
- }, [((v = a.value.clipModalTips) == null ? void 0 : v.buttonUpload) || ((g = a.value.linkModalTips) == null ? void 0 : g.buttonOK)])]), t("input", {
375
+ }, [((v = a.value.clipModalTips) == null ? void 0 : v.buttonUpload) || ((h = a.value.linkModalTips) == null ? void 0 : h.buttonOK)])]), t("input", {
377
376
  ref: r,
378
377
  accept: "image/*",
379
378
  type: "file",
@@ -386,7 +385,7 @@ const hl = /* @__PURE__ */ V({
386
385
  });
387
386
  };
388
387
  }
389
- }), xl = {
388
+ }), Tl = {
390
389
  type: {
391
390
  type: String,
392
391
  default: "link"
@@ -409,27 +408,27 @@ const hl = /* @__PURE__ */ V({
409
408
  default: () => {
410
409
  }
411
410
  }
412
- }, Sl = /* @__PURE__ */ V({
413
- props: xl,
411
+ }, wl = /* @__PURE__ */ V({
412
+ props: Tl,
414
413
  setup(e) {
415
- return () => t(kt, null, [t(yl, {
414
+ return () => t(kt, null, [t(Cl, {
416
415
  type: e.type,
417
416
  visible: e.linkVisible,
418
417
  onOk: e.onOk,
419
418
  onCancel: e.onCancel
420
- }, null), t(wl, {
419
+ }, null), t(yl, {
421
420
  visible: e.clipVisible,
422
421
  onOk: e.onOk,
423
422
  onCancel: e.onCancel
424
423
  }, null)]);
425
424
  }
426
- }), Al = /* @__PURE__ */ V({
425
+ }), xl = /* @__PURE__ */ V({
427
426
  name: "MDEditorToolbar",
428
- props: bl,
427
+ props: hl,
429
428
  setup(e) {
430
429
  const a = A("editorId"), l = A("usedLanguageText"), {
431
430
  fullscreenHandler: n
432
- } = vl(e), r = `${a}-toolbar-wrapper`, i = q(), u = J({
431
+ } = fl(e), r = `${a}-toolbar-wrapper`, i = U(), u = Z({
433
432
  title: !1,
434
433
  catalog: !1,
435
434
  // 图片上传下拉
@@ -439,40 +438,40 @@ const hl = /* @__PURE__ */ V({
439
438
  // mermaid
440
439
  mermaid: !1,
441
440
  katex: !1
442
- }), d = (v, g) => {
443
- h.emit(a, "replace", v, g);
444
- }, c = J({
441
+ }), d = (v, h) => {
442
+ f.emit(a, "replace", v, h);
443
+ }, c = Z({
445
444
  type: "link",
446
445
  linkVisible: !1,
447
446
  clipVisible: !1
448
- }), f = q();
449
- Y(() => {
450
- h.on(a, {
447
+ }), g = U();
448
+ X(() => {
449
+ f.on(a, {
451
450
  name: "openModals",
452
451
  callback(v) {
453
452
  c.type = v, c.linkVisible = !0;
454
453
  }
455
454
  });
456
455
  });
457
- const m = he(() => {
458
- const v = e.toolbars.filter((w) => !e.toolbarsExclude.includes(w)), g = v.indexOf("="), k = g === -1 ? v : v.slice(0, g + 1), y = g === -1 ? [] : v.slice(g, Number.MAX_SAFE_INTEGER);
456
+ const m = fe(() => {
457
+ const v = e.toolbars.filter((w) => !e.toolbarsExclude.includes(w)), h = v.indexOf("="), k = h === -1 ? v : v.slice(0, h + 1), y = h === -1 ? [] : v.slice(h, Number.MAX_SAFE_INTEGER);
459
458
  return [k, y];
460
- }), b = q(), $ = () => {
461
- h.emit(a, "uploadImage", Array.from(b.value.files || [])), b.value.value = "";
459
+ }), b = U(), $ = () => {
460
+ f.emit(a, "uploadImage", Array.from(b.value.files || [])), b.value.value = "";
462
461
  };
463
- Y(() => {
462
+ X(() => {
464
463
  b.value.addEventListener("change", $);
465
464
  });
466
465
  const T = (v) => {
467
- var g, k, y, w, x, L, C, M, R, D, I, O, B, N, j, U, ne, X, _, G, Q, W, E, F, ee, re, ve, ke, pe, Ce, $e, ye, Te, we, xe, Se, Ae, Me, Le, De, Ie, Ne, Ee, He, Be, Fe, Ve, Oe, Re, Pe, qe, Ue, Ge, Ke, je, _e, We, ze, Ye, Ze, Je, Xe, Qe, et, tt, lt, ot;
466
+ var h, k, y, w, x, L, C, M, R, I, D, O, F, E, j, G, ne, J, _, K, Q, W, N, B, ee, re, ve, ke, pe, Ce, $e, ye, Te, we, xe, Se, Ae, Me, Le, Ie, De, Ee, Ne, He, Fe, Be, Ve, Oe, Re, Pe, qe, Ue, Ge, Ke, je, _e, We, ze, Xe, Ye, Ze, Je, Qe, et, tt, lt, ot;
468
467
  if (Lt.includes(v))
469
468
  switch (v) {
470
469
  case "-":
471
- return t(hl, null, null);
470
+ return t(gl, null, null);
472
471
  case "bold":
473
472
  return t("div", {
474
473
  class: `${o}-toolbar-item`,
475
- title: (g = l.value.toolbarTips) == null ? void 0 : g.bold,
474
+ title: (h = l.value.toolbarTips) == null ? void 0 : h.bold,
476
475
  onClick: () => {
477
476
  d("bold");
478
477
  }
@@ -551,12 +550,12 @@ const hl = /* @__PURE__ */ V({
551
550
  onClick: () => {
552
551
  d("h2");
553
552
  }
554
- }, [(D = l.value.titleItem) == null ? void 0 : D.h2]), t("li", {
553
+ }, [(I = l.value.titleItem) == null ? void 0 : I.h2]), t("li", {
555
554
  class: `${o}-menu-item`,
556
555
  onClick: () => {
557
556
  d("h3");
558
557
  }
559
- }, [(I = l.value.titleItem) == null ? void 0 : I.h3]), t("li", {
558
+ }, [(D = l.value.titleItem) == null ? void 0 : D.h3]), t("li", {
560
559
  class: `${o}-menu-item`,
561
560
  onClick: () => {
562
561
  d("h4");
@@ -566,12 +565,12 @@ const hl = /* @__PURE__ */ V({
566
565
  onClick: () => {
567
566
  d("h5");
568
567
  }
569
- }, [(B = l.value.titleItem) == null ? void 0 : B.h5]), t("li", {
568
+ }, [(F = l.value.titleItem) == null ? void 0 : F.h5]), t("li", {
570
569
  class: `${o}-menu-item`,
571
570
  onClick: () => {
572
571
  d("h6");
573
572
  }
574
- }, [(N = l.value.titleItem) == null ? void 0 : N.h6])])
573
+ }, [(E = l.value.titleItem) == null ? void 0 : E.h6])])
575
574
  }, {
576
575
  default: () => {
577
576
  var p, S;
@@ -602,7 +601,7 @@ const hl = /* @__PURE__ */ V({
602
601
  "xlink:href": "#md-editor-icon-sub"
603
602
  }, null)]), e.showToolbarName && t("div", {
604
603
  class: `${o}-toolbar-item-name`
605
- }, [(U = l.value.toolbarTips) == null ? void 0 : U.sub])]);
604
+ }, [(G = l.value.toolbarTips) == null ? void 0 : G.sub])]);
606
605
  case "sup":
607
606
  return t("div", {
608
607
  class: `${o}-toolbar-item`,
@@ -617,7 +616,7 @@ const hl = /* @__PURE__ */ V({
617
616
  "xlink:href": "#md-editor-icon-sup"
618
617
  }, null)]), e.showToolbarName && t("div", {
619
618
  class: `${o}-toolbar-item-name`
620
- }, [(X = l.value.toolbarTips) == null ? void 0 : X.sup])]);
619
+ }, [(J = l.value.toolbarTips) == null ? void 0 : J.sup])]);
621
620
  case "quote":
622
621
  return t("div", {
623
622
  class: `${o}-toolbar-item`,
@@ -632,7 +631,7 @@ const hl = /* @__PURE__ */ V({
632
631
  "xlink:href": "#md-editor-icon-quote"
633
632
  }, null)]), e.showToolbarName && t("div", {
634
633
  class: `${o}-toolbar-item-name`
635
- }, [(G = l.value.toolbarTips) == null ? void 0 : G.quote])]);
634
+ }, [(K = l.value.toolbarTips) == null ? void 0 : K.quote])]);
636
635
  case "unorderedList":
637
636
  return t("div", {
638
637
  class: `${o}-toolbar-item`,
@@ -651,7 +650,7 @@ const hl = /* @__PURE__ */ V({
651
650
  case "orderedList":
652
651
  return t("div", {
653
652
  class: `${o}-toolbar-item`,
654
- title: (E = l.value.toolbarTips) == null ? void 0 : E.orderedList,
653
+ title: (N = l.value.toolbarTips) == null ? void 0 : N.orderedList,
655
654
  onClick: () => {
656
655
  d("orderedList");
657
656
  }
@@ -662,7 +661,7 @@ const hl = /* @__PURE__ */ V({
662
661
  "xlink:href": "#md-editor-icon-ordered-list"
663
662
  }, null)]), e.showToolbarName && t("div", {
664
663
  class: `${o}-toolbar-item-name`
665
- }, [(F = l.value.toolbarTips) == null ? void 0 : F.orderedList])]);
664
+ }, [(B = l.value.toolbarTips) == null ? void 0 : B.orderedList])]);
666
665
  case "task":
667
666
  return t("div", {
668
667
  class: `${o}-toolbar-item`,
@@ -788,7 +787,7 @@ const hl = /* @__PURE__ */ V({
788
787
  u.table = p;
789
788
  },
790
789
  key: "bar-table",
791
- overlay: t(Cl, {
790
+ overlay: t(kl, {
792
791
  tableShape: e.tableShape,
793
792
  onSelected: (p) => {
794
793
  d("table", {
@@ -817,7 +816,7 @@ const hl = /* @__PURE__ */ V({
817
816
  class: `${o}-toolbar-item`,
818
817
  title: (Me = l.value.toolbarTips) == null ? void 0 : Me.revoke,
819
818
  onClick: () => {
820
- h.emit(a, "ctrlZ");
819
+ f.emit(a, "ctrlZ");
821
820
  }
822
821
  }, [t("svg", {
823
822
  class: `${o}-icon`,
@@ -830,9 +829,9 @@ const hl = /* @__PURE__ */ V({
830
829
  case "next":
831
830
  return t("div", {
832
831
  class: `${o}-toolbar-item`,
833
- title: (De = l.value.toolbarTips) == null ? void 0 : De.next,
832
+ title: (Ie = l.value.toolbarTips) == null ? void 0 : Ie.next,
834
833
  onClick: () => {
835
- h.emit(a, "ctrlShiftZ");
834
+ f.emit(a, "ctrlShiftZ");
836
835
  }
837
836
  }, [t("svg", {
838
837
  class: `${o}-icon`,
@@ -841,13 +840,13 @@ const hl = /* @__PURE__ */ V({
841
840
  "xlink:href": "#md-editor-icon-next"
842
841
  }, null)]), e.showToolbarName && t("div", {
843
842
  class: `${o}-toolbar-item-name`
844
- }, [(Ie = l.value.toolbarTips) == null ? void 0 : Ie.next])]);
843
+ }, [(De = l.value.toolbarTips) == null ? void 0 : De.next])]);
845
844
  case "save":
846
845
  return t("div", {
847
846
  class: `${o}-toolbar-item`,
848
- title: (Ne = l.value.toolbarTips) == null ? void 0 : Ne.save,
847
+ title: (Ee = l.value.toolbarTips) == null ? void 0 : Ee.save,
849
848
  onClick: () => {
850
- h.emit(a, pt);
849
+ f.emit(a, pt);
851
850
  }
852
851
  }, [t("svg", {
853
852
  class: `${o}-icon`,
@@ -856,7 +855,7 @@ const hl = /* @__PURE__ */ V({
856
855
  "xlink:href": "#md-editor-icon-baocun"
857
856
  }, null)]), e.showToolbarName && t("div", {
858
857
  class: `${o}-toolbar-item-name`
859
- }, [(Ee = l.value.toolbarTips) == null ? void 0 : Ee.save])]);
858
+ }, [(Ne = l.value.toolbarTips) == null ? void 0 : Ne.save])]);
860
859
  case "prettier":
861
860
  return e.noPrettier ? "" : t("div", {
862
861
  class: `${o}-toolbar-item`,
@@ -871,11 +870,11 @@ const hl = /* @__PURE__ */ V({
871
870
  "xlink:href": "#md-editor-icon-prettier"
872
871
  }, null)]), e.showToolbarName && t("div", {
873
872
  class: `${o}-toolbar-item-name`
874
- }, [(Be = l.value.toolbarTips) == null ? void 0 : Be.prettier])]);
873
+ }, [(Fe = l.value.toolbarTips) == null ? void 0 : Fe.prettier])]);
875
874
  case "pageFullscreen":
876
875
  return !e.setting.fullscreen && t("div", {
877
876
  class: `${o}-toolbar-item`,
878
- title: (Fe = l.value.toolbarTips) == null ? void 0 : Fe.pageFullscreen,
877
+ title: (Be = l.value.toolbarTips) == null ? void 0 : Be.pageFullscreen,
879
878
  onClick: () => {
880
879
  e.updateSetting("pageFullscreen");
881
880
  }
@@ -937,7 +936,7 @@ const hl = /* @__PURE__ */ V({
937
936
  class: `${o}-toolbar-item`,
938
937
  title: (Ke = l.value.toolbarTips) == null ? void 0 : Ke.catalog,
939
938
  onClick: () => {
940
- h.emit(a, Ot);
939
+ f.emit(a, Ot);
941
940
  },
942
941
  key: "bar-catalog"
943
942
  }, [t("svg", {
@@ -952,7 +951,7 @@ const hl = /* @__PURE__ */ V({
952
951
  return t("div", {
953
952
  class: `${o}-toolbar-item`,
954
953
  title: (_e = l.value.toolbarTips) == null ? void 0 : _e.github,
955
- onClick: () => Nt("https://github.com/imzbf/md-editor-v3")
954
+ onClick: () => Et("https://github.com/imzbf/md-editor-v3")
956
955
  }, [t("svg", {
957
956
  class: `${o}-icon`,
958
957
  "aria-hidden": "true"
@@ -983,22 +982,22 @@ const hl = /* @__PURE__ */ V({
983
982
  onClick: () => {
984
983
  d("sequence");
985
984
  }
986
- }, [(Ye = l.value.mermaid) == null ? void 0 : Ye.sequence]), t("li", {
985
+ }, [(Xe = l.value.mermaid) == null ? void 0 : Xe.sequence]), t("li", {
987
986
  class: `${o}-menu-item`,
988
987
  onClick: () => {
989
988
  d("gantt");
990
989
  }
991
- }, [(Ze = l.value.mermaid) == null ? void 0 : Ze.gantt]), t("li", {
990
+ }, [(Ye = l.value.mermaid) == null ? void 0 : Ye.gantt]), t("li", {
992
991
  class: `${o}-menu-item`,
993
992
  onClick: () => {
994
993
  d("class");
995
994
  }
996
- }, [(Je = l.value.mermaid) == null ? void 0 : Je.class]), t("li", {
995
+ }, [(Ze = l.value.mermaid) == null ? void 0 : Ze.class]), t("li", {
997
996
  class: `${o}-menu-item`,
998
997
  onClick: () => {
999
998
  d("state");
1000
999
  }
1001
- }, [(Xe = l.value.mermaid) == null ? void 0 : Xe.state]), t("li", {
1000
+ }, [(Je = l.value.mermaid) == null ? void 0 : Je.state]), t("li", {
1002
1001
  class: `${o}-menu-item`,
1003
1002
  onClick: () => {
1004
1003
  d("pie");
@@ -1076,7 +1075,7 @@ const hl = /* @__PURE__ */ V({
1076
1075
  const p = e.defToolbars[v];
1077
1076
  return p ? at(p, {
1078
1077
  insert(de) {
1079
- h.emit(a, "replace", "universal", {
1078
+ f.emit(a, "replace", "universal", {
1080
1079
  generate: de
1081
1080
  });
1082
1081
  }
@@ -1085,7 +1084,7 @@ const hl = /* @__PURE__ */ V({
1085
1084
  const p = e.defToolbars.children[v];
1086
1085
  return p ? at(p, {
1087
1086
  insert(de) {
1088
- h.emit(a, "replace", "universal", {
1087
+ f.emit(a, "replace", "universal", {
1089
1088
  generate: de
1090
1089
  });
1091
1090
  }
@@ -1095,12 +1094,12 @@ const hl = /* @__PURE__ */ V({
1095
1094
  };
1096
1095
  return H(() => e.toolbars, () => {
1097
1096
  ce(() => {
1098
- i.value && It(i.value);
1097
+ i.value && Dt(i.value);
1099
1098
  });
1100
1099
  }, {
1101
1100
  immediate: !0
1102
1101
  }), () => {
1103
- const v = m.value[0].map((k) => T(k)), g = m.value[1].map((k) => T(k));
1102
+ const v = m.value[0].map((k) => T(k)), h = m.value[1].map((k) => T(k));
1104
1103
  return t(kt, null, [e.toolbars.length > 0 && t("div", {
1105
1104
  class: `${o}-toolbar-wrapper`,
1106
1105
  ref: i,
@@ -1109,10 +1108,10 @@ const hl = /* @__PURE__ */ V({
1109
1108
  class: [`${o}-toolbar`, e.showToolbarName && `${o}-stn`]
1110
1109
  }, [t("div", {
1111
1110
  class: `${o}-toolbar-left`,
1112
- ref: f
1111
+ ref: g
1113
1112
  }, [v]), t("div", {
1114
1113
  class: `${o}-toolbar-right`
1115
- }, [g])])]), t("input", {
1114
+ }, [h])])]), t("input", {
1116
1115
  ref: b,
1117
1116
  accept: "image/*",
1118
1117
  type: "file",
@@ -1120,7 +1119,7 @@ const hl = /* @__PURE__ */ V({
1120
1119
  style: {
1121
1120
  display: "none"
1122
1121
  }
1123
- }, null), t(Sl, {
1122
+ }, null), t(wl, {
1124
1123
  linkVisible: c.linkVisible,
1125
1124
  clipVisible: c.clipVisible,
1126
1125
  type: c.type,
@@ -1136,16 +1135,16 @@ const hl = /* @__PURE__ */ V({
1136
1135
  }, null)]);
1137
1136
  };
1138
1137
  }
1139
- }), Ml = (e, a) => {
1140
- const l = Et(() => {
1138
+ }), Sl = (e, a) => {
1139
+ const l = Nt(() => {
1141
1140
  e.removeEventListener("scroll", n), e.addEventListener("scroll", n), a.removeEventListener("scroll", n), a.addEventListener("scroll", n);
1142
1141
  }, 50), n = (r) => {
1143
- const i = e.clientHeight, u = a.clientHeight, d = e.scrollHeight, c = a.scrollHeight, f = (d - i) / (c - u);
1142
+ const i = e.clientHeight, u = a.clientHeight, d = e.scrollHeight, c = a.scrollHeight, g = (d - i) / (c - u);
1144
1143
  r.target === e ? (a.removeEventListener("scroll", n), a.scrollTo({
1145
- top: e.scrollTop / f
1144
+ top: e.scrollTop / g
1146
1145
  // behavior: 'smooth'
1147
1146
  }), l()) : (e.removeEventListener("scroll", n), e.scrollTo({
1148
- top: a.scrollTop * f
1147
+ top: a.scrollTop * g
1149
1148
  // behavior: 'smooth'
1150
1149
  }), l());
1151
1150
  };
@@ -1159,98 +1158,98 @@ const hl = /* @__PURE__ */ V({
1159
1158
  e.removeEventListener("scroll", n), a.removeEventListener("scroll", n);
1160
1159
  }
1161
1160
  ];
1162
- }, Ll = (e, a, l) => {
1161
+ }, Al = (e, a, l) => {
1163
1162
  const { view: n } = l, r = (b) => n.lineBlockAt(n.state.doc.line(b).from).top, i = (b) => n.lineBlockAt(n.state.doc.line(b).from).height;
1164
1163
  let u = [];
1165
1164
  const d = () => {
1166
1165
  u = [];
1167
1166
  const b = Array.from(a.querySelectorAll("[data-line]")).map(
1168
- (g) => Number(g.dataset.line) + 1
1167
+ (h) => Number(h.dataset.line) + 1
1169
1168
  ), { lines: $ } = n.state.doc;
1170
1169
  let T = 1, v = b.shift() ?? $;
1171
- for (let g = 1; g <= $; g++)
1172
- g === v && (T = g, v = b.shift() || $ + 1), u.push({
1170
+ for (let h = 1; h <= $; h++)
1171
+ h === v && (T = h, v = b.shift() || $ + 1), u.push({
1173
1172
  start: T,
1174
1173
  end: v - 1
1175
1174
  });
1176
1175
  };
1177
- let c = 0, f = 0;
1176
+ let c = 0, g = 0;
1178
1177
  const m = Ht((b) => {
1179
- var v, g, k, y, w, x, L;
1178
+ var v, h, k, y, w, x, L;
1180
1179
  if (!((v = a.firstElementChild) != null && v.firstElementChild))
1181
1180
  return;
1182
1181
  const $ = n.lineBlockAtHeight(n.scrollDOM.scrollTop), { number: T } = n.state.doc.lineAt($.from);
1183
1182
  if (!(T > u.length) && !(n.state.doc.lines < u[u.length - 1].end))
1184
1183
  if (b.target === e) {
1185
- if (f !== 0)
1184
+ if (g !== 0)
1186
1185
  return;
1187
1186
  c++;
1188
1187
  const C = u[T - 1], M = r(C.end) + i(C.end);
1189
1188
  let R = 0;
1190
- const D = r(C.start), I = a.querySelector(`[data-line="${C.start - 1}"]`) || ((g = a.firstElementChild) == null ? void 0 : g.firstElementChild), O = a.querySelector(`[data-line="${C.end}"]`) || ((k = a.lastElementChild) == null ? void 0 : k.lastElementChild);
1191
- let B = 0, N = 0;
1192
- D === 0 ? (R = (n.scrollDOM.scrollTop - D) / (M - D), B = O.offsetTop) : M > n.scrollDOM.scrollHeight - n.scrollDOM.clientHeight ? (R = (n.scrollDOM.scrollTop - D) / (n.scrollDOM.scrollHeight - n.scrollDOM.clientHeight - D), N = I.offsetTop, B = a.scrollHeight - a.clientHeight - N + 10) : (R = (n.scrollDOM.scrollTop - D) / (M - D), N = I.offsetTop, B = O.offsetTop - N);
1193
- const j = N - 10 + B * R;
1189
+ const I = r(C.start), D = a.querySelector(`[data-line="${C.start - 1}"]`) || ((h = a.firstElementChild) == null ? void 0 : h.firstElementChild), O = a.querySelector(`[data-line="${C.end}"]`) || ((k = a.lastElementChild) == null ? void 0 : k.lastElementChild);
1190
+ let F = 0, E = 0;
1191
+ I === 0 ? (R = (n.scrollDOM.scrollTop - I) / (M - I), F = O.offsetTop) : M > n.scrollDOM.scrollHeight - n.scrollDOM.clientHeight ? (R = (n.scrollDOM.scrollTop - I) / (n.scrollDOM.scrollHeight - n.scrollDOM.clientHeight - I), E = D.offsetTop, F = a.scrollHeight - a.clientHeight - E + 10) : (R = (n.scrollDOM.scrollTop - I) / (M - I), E = D.offsetTop, F = O.offsetTop - E);
1192
+ const j = E - 10 + F * R;
1194
1193
  nt(a, j, () => {
1195
1194
  c--;
1196
1195
  });
1197
1196
  } else {
1198
1197
  if (c !== 0)
1199
1198
  return;
1200
- f++;
1199
+ g++;
1201
1200
  const C = Array.from(
1202
1201
  a.querySelectorAll("[data-line]")
1203
1202
  ), M = a.scrollTop, R = a.scrollHeight;
1204
- let D = C.length === 0 ? 1 : Math.ceil(
1203
+ let I = C.length === 0 ? 1 : Math.ceil(
1205
1204
  Number(C[C.length - 1].dataset.line) * (M / R)
1206
- ), I = (y = a.firstElementChild) == null ? void 0 : y.firstElementChild;
1207
- for (let E = D; E >= 0; E--) {
1208
- const F = a.querySelector(`[data-line="${E}"]`);
1209
- if (F && F.offsetTop <= M) {
1210
- I = F, D = E;
1205
+ ), D = (y = a.firstElementChild) == null ? void 0 : y.firstElementChild;
1206
+ for (let N = I; N >= 0; N--) {
1207
+ const B = a.querySelector(`[data-line="${N}"]`);
1208
+ if (B && B.offsetTop <= M) {
1209
+ D = B, I = N;
1211
1210
  break;
1212
1211
  }
1213
1212
  }
1214
- let O = (w = a.firstElementChild) == null ? void 0 : w.firstElementChild, B = (x = a.firstElementChild) == null ? void 0 : x.lastElementChild;
1213
+ let O = (w = a.firstElementChild) == null ? void 0 : w.firstElementChild, F = (x = a.firstElementChild) == null ? void 0 : x.lastElementChild;
1215
1214
  for (; C.length > 0; ) {
1216
- const E = C.indexOf(I);
1217
- if (E + 1 >= C.length)
1215
+ const N = C.indexOf(D);
1216
+ if (N + 1 >= C.length)
1218
1217
  break;
1219
- const F = C[E + 1];
1220
- if (E === -1) {
1221
- B = F;
1218
+ const B = C[N + 1];
1219
+ if (N === -1) {
1220
+ F = B;
1222
1221
  break;
1223
1222
  }
1224
- const ee = I.offsetTop;
1223
+ const ee = D.offsetTop;
1225
1224
  if (ee > M) {
1226
- if (E === 0) {
1227
- O = I, B = F;
1225
+ if (N === 0) {
1226
+ O = D, F = B;
1228
1227
  break;
1229
1228
  }
1230
- I = C[E - 1];
1229
+ D = C[N - 1];
1231
1230
  continue;
1232
1231
  }
1233
- const re = F.offsetTop;
1232
+ const re = B.offsetTop;
1234
1233
  if (ee <= M && re > M) {
1235
- O = I, B = F;
1234
+ O = D, F = B;
1236
1235
  break;
1237
1236
  }
1238
- I = F;
1237
+ D = B;
1239
1238
  }
1240
- const N = O.offsetTop, j = B.offsetTop;
1241
- let U = 0;
1242
- const { start: ne, end: X } = u[Number(O.dataset.line || 0)], _ = r(ne);
1243
- let G = r(X);
1244
- const Q = i(X);
1239
+ const E = O.offsetTop, j = F.offsetTop;
1240
+ let G = 0;
1241
+ const { start: ne, end: J } = u[Number(O.dataset.line || 0)], _ = r(ne);
1242
+ let K = r(J);
1243
+ const Q = i(J);
1245
1244
  let W = 0;
1246
- O === ((L = a.firstElementChild) == null ? void 0 : L.firstElementChild) ? (U = Math.max(M / j, 0), W = G + Q - _) : G > n.scrollDOM.scrollHeight - n.scrollDOM.clientHeight ? (U = Math.max(
1247
- (M - N) / (a.scrollHeight - N - a.clientHeight),
1245
+ O === ((L = a.firstElementChild) == null ? void 0 : L.firstElementChild) ? (G = Math.max(M / j, 0), W = K + Q - _) : K > n.scrollDOM.scrollHeight - n.scrollDOM.clientHeight ? (G = Math.max(
1246
+ (M - E) / (a.scrollHeight - E - a.clientHeight),
1248
1247
  0
1249
- ), G = r(n.state.doc.lines) + i(n.state.doc.lines), W = 8 + G - _ - e.clientHeight) : (U = Math.max(
1250
- (M - N) / (j - N),
1248
+ ), K = r(n.state.doc.lines) + i(n.state.doc.lines), W = 8 + K - _ - e.clientHeight) : (G = Math.max(
1249
+ (M - E) / (j - E),
1251
1250
  0
1252
- ), W = G + Q - _), nt(e, _ + W * U, () => {
1253
- f--;
1251
+ ), W = K + Q - _), nt(e, _ + W * G, () => {
1252
+ g--;
1254
1253
  });
1255
1254
  }
1256
1255
  }, 10);
@@ -1262,7 +1261,7 @@ const hl = /* @__PURE__ */ V({
1262
1261
  u = [], e.removeEventListener("scroll", m), a.removeEventListener("scroll", m);
1263
1262
  }
1264
1263
  ];
1265
- }, Dl = (e, a, l) => {
1264
+ }, Ml = (e, a, l) => {
1266
1265
  const n = A("editorId");
1267
1266
  let r = () => {
1268
1267
  }, i = () => {
@@ -1271,12 +1270,12 @@ const hl = /* @__PURE__ */ V({
1271
1270
  r();
1272
1271
  const d = document.querySelector(".cm-scroller"), c = document.querySelector(
1273
1272
  `[id="${n}-preview-wrapper"][data-show="true"]`
1274
- ), f = document.querySelector(
1273
+ ), g = document.querySelector(
1275
1274
  `[id="${n}-html-wrapper"][data-show="true"]`
1276
1275
  );
1277
- (c || f) && ([i, r] = (c ? Ll : Ml)(
1276
+ (c || g) && ([i, r] = (c ? Al : Sl)(
1278
1277
  d,
1279
- c || f,
1278
+ c || g,
1280
1279
  l.value
1281
1280
  )), e.scrollAuto && i();
1282
1281
  };
@@ -1296,19 +1295,19 @@ const hl = /* @__PURE__ */ V({
1296
1295
  (d) => {
1297
1296
  d ? i() : r();
1298
1297
  }
1299
- ), Y(u);
1300
- }, Il = Dl, Nl = (e, a, l) => {
1301
- var m, b, $, T, v, g;
1298
+ ), X(u);
1299
+ }, Ll = Ml, Il = (e, a, l) => {
1300
+ var m, b, $, T, v, h;
1302
1301
  let n = "", r = 0, i = 0, u = !0, d = !1;
1303
- const c = a.getSelectedText(), f = (m = z.editorConfig) == null ? void 0 : m.mermaidTemplate;
1302
+ const c = a.getSelectedText(), g = (m = z.editorConfig) == null ? void 0 : m.mermaidTemplate;
1304
1303
  if (/^h[1-6]{1}$/.test(e)) {
1305
1304
  const k = e.replace(/^h(\d)/, (y, w) => new Array(Number(w)).fill("#", 0, w).join(""));
1306
1305
  n = `${k} ${c}`, r = k.length + 1;
1307
1306
  } else if (e === "prettier") {
1308
1307
  const k = window.prettier || (($ = (b = z.editorExtensions) == null ? void 0 : b.prettier) == null ? void 0 : $.prettierInstance), y = [
1309
- ((T = window.prettierPlugins) == null ? void 0 : T.markdown) || ((g = (v = z.editorExtensions) == null ? void 0 : v.prettier) == null ? void 0 : g.parserMarkdownInstance)
1308
+ ((T = window.prettierPlugins) == null ? void 0 : T.markdown) || ((h = (v = z.editorExtensions) == null ? void 0 : v.prettier) == null ? void 0 : h.parserMarkdownInstance)
1310
1309
  ];
1311
- !k || y[0] === void 0 ? (h.emit(l.editorId, "errorCatcher", {
1310
+ !k || y[0] === void 0 ? (f.emit(l.editorId, "errorCatcher", {
1312
1311
  name: "prettier",
1313
1312
  message: "prettier is undefined"
1314
1313
  }), n = a.getValue()) : n = k.format(a.getValue(), {
@@ -1401,7 +1400,7 @@ ${k}
1401
1400
  }
1402
1401
  case "flow": {
1403
1402
  n = `\`\`\`mermaid
1404
- ${(f == null ? void 0 : f.flow) || `flowchart TD
1403
+ ${(g == null ? void 0 : g.flow) || `flowchart TD
1405
1404
  Start --> Stop`}
1406
1405
  \`\`\`
1407
1406
  `, r = 3, i = 10 - n.length;
@@ -1409,7 +1408,7 @@ ${(f == null ? void 0 : f.flow) || `flowchart TD
1409
1408
  }
1410
1409
  case "sequence": {
1411
1410
  n = `\`\`\`mermaid
1412
- ${(f == null ? void 0 : f.sequence) || `sequenceDiagram
1411
+ ${(g == null ? void 0 : g.sequence) || `sequenceDiagram
1413
1412
  A->>B: hello!
1414
1413
  B-->>A: hi!
1415
1414
  A-)B: bye!`}
@@ -1419,7 +1418,7 @@ ${(f == null ? void 0 : f.sequence) || `sequenceDiagram
1419
1418
  }
1420
1419
  case "gantt": {
1421
1420
  n = `\`\`\`mermaid
1422
- ${(f == null ? void 0 : f.gantt) || `gantt
1421
+ ${(g == null ? void 0 : g.gantt) || `gantt
1423
1422
  title A Gantt Diagram
1424
1423
  dateFormat YYYY-MM-DD
1425
1424
  section Section
@@ -1431,7 +1430,7 @@ Another task :after a1, 20d`}
1431
1430
  }
1432
1431
  case "class": {
1433
1432
  n = `\`\`\`mermaid
1434
- ${(f == null ? void 0 : f.class) || `classDiagram
1433
+ ${(g == null ? void 0 : g.class) || `classDiagram
1435
1434
  class Animal
1436
1435
  Vehicle <|-- Car`}
1437
1436
  \`\`\`
@@ -1440,7 +1439,7 @@ ${(f == null ? void 0 : f.class) || `classDiagram
1440
1439
  }
1441
1440
  case "state": {
1442
1441
  n = `\`\`\`mermaid
1443
- ${(f == null ? void 0 : f.state) || `stateDiagram-v2
1442
+ ${(g == null ? void 0 : g.state) || `stateDiagram-v2
1444
1443
  s1 --> s2`}
1445
1444
  \`\`\`
1446
1445
  `, r = 3, i = 10 - n.length;
@@ -1448,7 +1447,7 @@ ${(f == null ? void 0 : f.state) || `stateDiagram-v2
1448
1447
  }
1449
1448
  case "pie": {
1450
1449
  n = `\`\`\`mermaid
1451
- ${(f == null ? void 0 : f.pie) || `pie title Pets adopted by volunteers
1450
+ ${(g == null ? void 0 : g.pie) || `pie title Pets adopted by volunteers
1452
1451
  "Dogs" : 386
1453
1452
  "Cats" : 85
1454
1453
  "Rats" : 15`}
@@ -1458,7 +1457,7 @@ ${(f == null ? void 0 : f.pie) || `pie title Pets adopted by volunteers
1458
1457
  }
1459
1458
  case "relationship": {
1460
1459
  n = `\`\`\`mermaid
1461
- ${(f == null ? void 0 : f.relationship) || `erDiagram
1460
+ ${(g == null ? void 0 : g.relationship) || `erDiagram
1462
1461
  CAR ||--o{ NAMED-DRIVER : allows
1463
1462
  PERSON ||--o{ NAMED-DRIVER : is`}
1464
1463
  \`\`\`
@@ -1467,7 +1466,7 @@ ${(f == null ? void 0 : f.relationship) || `erDiagram
1467
1466
  }
1468
1467
  case "journey": {
1469
1468
  n = `\`\`\`mermaid
1470
- ${(f == null ? void 0 : f.journey) || `journey
1469
+ ${(g == null ? void 0 : g.journey) || `journey
1471
1470
  title My working day
1472
1471
  section Go to work
1473
1472
  Make tea: 5: Me
@@ -1509,7 +1508,7 @@ $$
1509
1508
  replaceAll: d
1510
1509
  }
1511
1510
  };
1512
- }, El = "#e5c07b", it = "var(--md-color)", Hl = "#56b6c2", Bl = "#ffffff", oe = "var(--md-color)", st = "#e5c07b", Fl = "#e5c07b", Vl = "var(--md-color)", ct = "#d19a66", Ol = "#c678dd", Rl = "#21252b", Pl = "#2c313a", dt = "var(--md-bk-color)", me = "var(--md-bk-color)", ql = "#ceedfa33", ut = "#528bff", Ul = be.theme(
1511
+ }, Dl = "#e5c07b", it = "var(--md-color)", El = "#56b6c2", Nl = "#ffffff", oe = "var(--md-color)", st = "#e5c07b", Hl = "#e5c07b", Fl = "var(--md-color)", ct = "#d19a66", Bl = "#c678dd", Vl = "#21252b", Ol = "#2c313a", dt = "var(--md-bk-color)", me = "var(--md-bk-color)", Rl = "#ceedfa33", ut = "#528bff", Pl = be.theme(
1513
1512
  {
1514
1513
  "&": {
1515
1514
  color: oe,
@@ -1519,8 +1518,8 @@ $$
1519
1518
  caretColor: ut
1520
1519
  },
1521
1520
  ".cm-cursor, .cm-dropCursor": { borderLeftColor: ut },
1522
- "&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection": { backgroundColor: ql },
1523
- ".cm-panels": { backgroundColor: Rl, color: oe },
1521
+ "&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection": { backgroundColor: Rl },
1522
+ ".cm-panels": { backgroundColor: Vl, color: oe },
1524
1523
  ".cm-panels.cm-panels-top": { borderBottom: "2px solid black" },
1525
1524
  ".cm-panels.cm-panels-bottom": { borderTop: "2px solid black" },
1526
1525
  ".cm-searchMatch": {
@@ -1542,7 +1541,7 @@ $$
1542
1541
  borderColor: "var(--md-border-color)"
1543
1542
  },
1544
1543
  ".cm-activeLineGutter": {
1545
- backgroundColor: Pl
1544
+ backgroundColor: Ol
1546
1545
  },
1547
1546
  ".cm-foldPlaceholder": {
1548
1547
  backgroundColor: "transparent",
@@ -1568,10 +1567,10 @@ $$
1568
1567
  }
1569
1568
  },
1570
1569
  { dark: !0 }
1571
- ), Gl = $t.define([
1572
- { tag: s.keyword, color: Ol },
1570
+ ), ql = $t.define([
1571
+ { tag: s.keyword, color: Bl },
1573
1572
  { tag: [s.name, s.deleted, s.character, s.propertyName, s.macroName], color: it },
1574
- { tag: [s.function(s.variableName), s.labelName], color: Fl },
1573
+ { tag: [s.function(s.variableName), s.labelName], color: Hl },
1575
1574
  { tag: [s.color, s.constant(s.name), s.standard(s.name)], color: ct },
1576
1575
  { tag: [s.definition(s.name), s.separator], color: oe },
1577
1576
  {
@@ -1585,7 +1584,7 @@ $$
1585
1584
  s.self,
1586
1585
  s.namespace
1587
1586
  ],
1588
- color: El
1587
+ color: Dl
1589
1588
  },
1590
1589
  {
1591
1590
  tag: [
@@ -1597,7 +1596,7 @@ $$
1597
1596
  s.link,
1598
1597
  s.special(s.string)
1599
1598
  ],
1600
- color: Hl
1599
+ color: El
1601
1600
  },
1602
1601
  { tag: [s.meta, s.comment], color: st },
1603
1602
  { tag: s.strong, fontWeight: "bold" },
@@ -1606,23 +1605,23 @@ $$
1606
1605
  { tag: s.link, color: st, textDecoration: "underline" },
1607
1606
  { tag: s.heading, fontWeight: "bold", color: it },
1608
1607
  { tag: [s.atom, s.bool, s.special(s.variableName)], color: ct },
1609
- { tag: [s.processingInstruction, s.string, s.inserted], color: Vl },
1610
- { tag: s.invalid, color: Bl }
1611
- ]), Kl = [
1612
- Ul,
1613
- yt(Gl)
1614
- ], jl = "#e5c07b", mt = "#3f4a54", _l = "#56b6c2", Wl = "#fff", ae = "#3f4a54", ft = "#2d8cf0", zl = "#2d8cf0", Yl = "#3f4a54", gt = "#d19a66", Zl = "#c678dd", Jl = "#21252b", Xl = "#ceedfa33", ht = "var(--md-bk-color)", fe = "var(--md-bk-color)", Ql = "#bad5fa", bt = "#3f4a54", eo = be.theme(
1608
+ { tag: [s.processingInstruction, s.string, s.inserted], color: Fl },
1609
+ { tag: s.invalid, color: Nl }
1610
+ ]), Ul = [
1611
+ Pl,
1612
+ yt(ql)
1613
+ ], Gl = "#e5c07b", mt = "#3f4a54", Kl = "#56b6c2", jl = "#fff", ae = "#3f4a54", gt = "#2d8cf0", _l = "#2d8cf0", Wl = "#3f4a54", ht = "#d19a66", zl = "#c678dd", Xl = "#21252b", Yl = "#ceedfa33", ft = "var(--md-bk-color)", ge = "var(--md-bk-color)", Zl = "#bad5fa", bt = "#3f4a54", Jl = be.theme(
1615
1614
  {
1616
1615
  "&": {
1617
1616
  color: ae,
1618
- backgroundColor: ht
1617
+ backgroundColor: ft
1619
1618
  },
1620
1619
  ".cm-content": {
1621
1620
  caretColor: bt
1622
1621
  },
1623
1622
  ".cm-cursor, .cm-dropCursor": { borderLeftColor: bt },
1624
- "&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection": { backgroundColor: Ql },
1625
- ".cm-panels": { backgroundColor: Jl, color: ae },
1623
+ "&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection": { backgroundColor: Zl },
1624
+ ".cm-panels": { backgroundColor: Xl, color: ae },
1626
1625
  ".cm-panels.cm-panels-top": { borderBottom: "2px solid black" },
1627
1626
  ".cm-panels.cm-panels-bottom": { borderTop: "2px solid black" },
1628
1627
  ".cm-searchMatch": {
@@ -1638,13 +1637,13 @@ $$
1638
1637
  backgroundColor: "#bad0f847"
1639
1638
  },
1640
1639
  ".cm-gutters": {
1641
- backgroundColor: ht,
1640
+ backgroundColor: ft,
1642
1641
  color: ae,
1643
1642
  borderRight: "1px solid",
1644
1643
  borderColor: "var(--md-border-color)"
1645
1644
  },
1646
1645
  ".cm-activeLineGutter": {
1647
- backgroundColor: Xl
1646
+ backgroundColor: Yl
1648
1647
  },
1649
1648
  ".cm-foldPlaceholder": {
1650
1649
  backgroundColor: "transparent",
@@ -1653,15 +1652,15 @@ $$
1653
1652
  },
1654
1653
  ".cm-tooltip": {
1655
1654
  border: "1px solid var(--md-border-color)",
1656
- backgroundColor: fe
1655
+ backgroundColor: ge
1657
1656
  },
1658
1657
  ".cm-tooltip .cm-tooltip-arrow:before": {
1659
1658
  borderTopColor: "transparent",
1660
1659
  borderBottomColor: "transparent"
1661
1660
  },
1662
1661
  ".cm-tooltip .cm-tooltip-arrow:after": {
1663
- borderTopColor: fe,
1664
- borderBottomColor: fe
1662
+ borderTopColor: ge,
1663
+ borderBottomColor: ge
1665
1664
  },
1666
1665
  ".cm-tooltip-autocomplete": {
1667
1666
  "& > ul > li[aria-selected]": {
@@ -1670,11 +1669,11 @@ $$
1670
1669
  }
1671
1670
  }
1672
1671
  // { dark: true }
1673
- ), to = $t.define([
1674
- { tag: s.keyword, color: Zl },
1672
+ ), Ql = $t.define([
1673
+ { tag: s.keyword, color: zl },
1675
1674
  { tag: [s.name, s.deleted, s.character, s.propertyName, s.macroName], color: mt },
1676
- { tag: [s.function(s.variableName), s.labelName], color: zl },
1677
- { tag: [s.color, s.constant(s.name), s.standard(s.name)], color: gt },
1675
+ { tag: [s.function(s.variableName), s.labelName], color: _l },
1676
+ { tag: [s.color, s.constant(s.name), s.standard(s.name)], color: ht },
1678
1677
  { tag: [s.definition(s.name), s.separator], color: ae },
1679
1678
  {
1680
1679
  tag: [
@@ -1687,7 +1686,7 @@ $$
1687
1686
  s.self,
1688
1687
  s.namespace
1689
1688
  ],
1690
- color: jl
1689
+ color: Gl
1691
1690
  },
1692
1691
  {
1693
1692
  tag: [
@@ -1699,32 +1698,32 @@ $$
1699
1698
  s.link,
1700
1699
  s.special(s.string)
1701
1700
  ],
1702
- color: _l
1701
+ color: Kl
1703
1702
  },
1704
- { tag: [s.meta, s.comment], color: ft },
1703
+ { tag: [s.meta, s.comment], color: gt },
1705
1704
  { tag: s.strong, fontWeight: "bold" },
1706
1705
  { tag: s.emphasis, fontStyle: "italic" },
1707
1706
  { tag: s.strikethrough, textDecoration: "line-through" },
1708
- { tag: s.link, color: ft, textDecoration: "underline" },
1707
+ { tag: s.link, color: gt, textDecoration: "underline" },
1709
1708
  { tag: s.heading, fontWeight: "bold", color: mt },
1710
- { tag: [s.atom, s.bool, s.special(s.variableName)], color: gt },
1711
- { tag: [s.processingInstruction, s.string, s.inserted], color: Yl },
1712
- { tag: s.invalid, color: Wl }
1713
- ]), lo = [
1714
- eo,
1715
- yt(to)
1709
+ { tag: [s.atom, s.bool, s.special(s.variableName)], color: ht },
1710
+ { tag: [s.processingInstruction, s.string, s.inserted], color: Wl },
1711
+ { tag: s.invalid, color: jl }
1712
+ ]), eo = [
1713
+ Jl,
1714
+ yt(Ql)
1716
1715
  ], se = (e, a, l, n, r) => (i, u, d, c) => {
1717
- const f = `${e}${a}`.slice(c - d);
1718
- i.dispatch(i.state.replaceSelection(`${f}${l}${n}`));
1716
+ const g = `${e}${a}`.slice(c - d);
1717
+ i.dispatch(i.state.replaceSelection(`${g}${l}${n}`));
1719
1718
  const m = d + u.label.length + (r === "title" ? l.length : 0);
1720
1719
  i.dispatch({
1721
- selection: P.create(
1720
+ selection: q.create(
1722
1721
  [
1723
- P.range(
1722
+ q.range(
1724
1723
  d + u.label.length + (r === "title" ? 1 : -a.length),
1725
1724
  m
1726
1725
  ),
1727
- P.cursor(m)
1726
+ q.cursor(m)
1728
1727
  ],
1729
1728
  1
1730
1729
  )
@@ -1732,7 +1731,7 @@ $$
1732
1731
  }, vt = (e) => (a, l, n, r) => {
1733
1732
  const i = e.slice(r - n);
1734
1733
  a.dispatch(a.state.replaceSelection(`${i} `));
1735
- }, oo = (e) => {
1734
+ }, to = (e) => {
1736
1735
  const a = (l) => {
1737
1736
  const n = l.matchBefore(
1738
1737
  /^#+|^-\s*\[*\s*\]*|`+|\[|!\[*|^\|\s?\|?|^\$\$?|!+\s*\w*/
@@ -1828,29 +1827,30 @@ $$`, "title")
1828
1827
  ]
1829
1828
  };
1830
1829
  };
1831
- return ml({
1832
- override: e ? [a, ol, ...e] : [a]
1830
+ return dl({
1831
+ override: e ? [a, ...e] : [a]
1833
1832
  });
1834
- }, ao = oo, Z = (e) => {
1835
- const a = new dl();
1833
+ }, lo = to, Y = (e) => {
1834
+ const a = new sl();
1836
1835
  return (n) => (a.get(e.state) ? e.dispatch({ effects: a.reconfigure(n) }) : e.dispatch({
1837
- effects: ul.appendConfig.of(a.of(n))
1836
+ effects: cl.appendConfig.of(a.of(n))
1838
1837
  }), !0);
1839
1838
  };
1840
- class no {
1839
+ class oo {
1841
1840
  constructor(a) {
1842
- K(this, "view");
1841
+ P(this, "view");
1842
+ P(this, "maxLength", Number.MAX_SAFE_INTEGER);
1843
1843
  // 切换tabSize的执行方法。切换时,Compartment实例需要相同
1844
- K(this, "toggleTabSize");
1845
- K(this, "togglePlaceholder");
1844
+ P(this, "toggleTabSize");
1845
+ P(this, "togglePlaceholder");
1846
1846
  /**
1847
1847
  * 设置全部的扩展
1848
1848
  */
1849
- K(this, "setExtensions");
1850
- K(this, "toggleDisabled");
1851
- K(this, "toggleReadOnly");
1852
- K(this, "toggleMaxlength");
1853
- this.view = a, this.toggleTabSize = Z(this.view), this.togglePlaceholder = Z(this.view), this.setExtensions = Z(this.view), this.toggleDisabled = Z(this.view), this.toggleReadOnly = Z(this.view), this.toggleMaxlength = Z(this.view);
1849
+ P(this, "setExtensions");
1850
+ P(this, "toggleDisabled");
1851
+ P(this, "toggleReadOnly");
1852
+ P(this, "toggleMaxlength");
1853
+ this.view = a, this.toggleTabSize = Y(this.view), this.togglePlaceholder = Y(this.view), this.setExtensions = Y(this.view), this.toggleDisabled = Y(this.view), this.toggleReadOnly = Y(this.view), this.toggleMaxlength = Y(this.view);
1854
1854
  }
1855
1855
  getValue() {
1856
1856
  return this.view.state.doc.toString();
@@ -1894,35 +1894,37 @@ class no {
1894
1894
  // 直接替换所有文本
1895
1895
  replaceAll: !1
1896
1896
  }, n) {
1897
- var r;
1898
1897
  try {
1899
1898
  if (l.replaceAll) {
1900
- this.setValue(a);
1899
+ if (this.setValue(a), a.length > this.maxLength)
1900
+ throw new Error("The input text is too long");
1901
1901
  return;
1902
1902
  }
1903
- const { from: i } = this.view.state.selection.main;
1903
+ if (this.view.state.doc.length - this.getSelectedText().length + a.length > this.maxLength)
1904
+ throw new Error("The input text is too long");
1905
+ const { from: r } = this.view.state.selection.main;
1904
1906
  if (this.view.dispatch(this.view.state.replaceSelection(a)), l.select) {
1905
- const u = i + a.length + l.deviationEnd;
1907
+ const i = r + a.length + l.deviationEnd;
1906
1908
  this.view.dispatch({
1907
- selection: P.create(
1909
+ selection: q.create(
1908
1910
  [
1909
- P.range(i + l.deviationStart, u),
1910
- P.cursor(u)
1911
+ q.range(r + l.deviationStart, i),
1912
+ q.cursor(i)
1911
1913
  ],
1912
1914
  1
1913
1915
  )
1914
1916
  });
1915
1917
  }
1916
1918
  this.view.focus();
1917
- } catch (i) {
1918
- if ((r = i.message) != null && r.includes("Selection points outside of document"))
1919
- h.emit(n, "errorCatcher", {
1919
+ } catch (r) {
1920
+ if (r.message === "The input text is too long")
1921
+ f.emit(n, "errorCatcher", {
1920
1922
  name: "overlength",
1921
- message: "The input text is too long",
1923
+ message: r.message,
1922
1924
  data: a
1923
1925
  });
1924
1926
  else
1925
- throw i;
1927
+ throw r;
1926
1928
  }
1927
1929
  }
1928
1930
  /**
@@ -1933,7 +1935,7 @@ class no {
1933
1935
  setTabSize(a) {
1934
1936
  this.toggleTabSize([
1935
1937
  ue.tabSize.of(a),
1936
- cl.of(" ".repeat(a))
1938
+ il.of(" ".repeat(a))
1937
1939
  ]);
1938
1940
  }
1939
1941
  /**
@@ -1960,8 +1962,8 @@ class no {
1960
1962
  }
1961
1963
  this.view.dispatch({
1962
1964
  scrollIntoView: !0,
1963
- selection: P.create(
1964
- [P.range(l, n), P.cursor(r)],
1965
+ selection: q.create(
1966
+ [q.range(l, n), q.cursor(r)],
1965
1967
  1
1966
1968
  )
1967
1969
  });
@@ -1973,19 +1975,19 @@ class no {
1973
1975
  this.toggleReadOnly([ue.readOnly.of(a)]);
1974
1976
  }
1975
1977
  setMaxLength(a) {
1976
- this.toggleMaxlength([
1978
+ this.maxLength = a, this.toggleMaxlength([
1977
1979
  ue.changeFilter.of((l) => l.newDoc.length <= a)
1978
1980
  ]);
1979
1981
  }
1980
1982
  }
1981
- const ro = (e) => {
1983
+ const ao = (e) => {
1982
1984
  const a = A("editorId");
1983
1985
  return (n) => {
1984
1986
  if (!n.clipboardData)
1985
1987
  return;
1986
1988
  if (n.clipboardData.files.length > 0) {
1987
1989
  const { files: i } = n.clipboardData;
1988
- h.emit(
1990
+ f.emit(
1989
1991
  a,
1990
1992
  "uploadImage",
1991
1993
  Array.from(i).filter((u) => /image\/.*/.test(u.type))
@@ -1994,23 +1996,23 @@ const ro = (e) => {
1994
1996
  }
1995
1997
  if (e.autoDetectCode && n.clipboardData.types.includes("vscode-editor-data")) {
1996
1998
  const i = JSON.parse(n.clipboardData.getData("vscode-editor-data"));
1997
- h.emit(a, "replace", "code", {
1999
+ f.emit(a, "replace", "code", {
1998
2000
  mode: i.mode,
1999
2001
  text: n.clipboardData.getData("text/plain")
2000
2002
  }), n.preventDefault();
2001
2003
  return;
2002
2004
  }
2003
2005
  const r = n.clipboardData.getData("text/plain");
2004
- e.maxlength && r.length + e.value.length > e.maxlength && h.emit(a, "errorCatcher", {
2006
+ e.maxlength && r.length + e.value.length > e.maxlength && f.emit(a, "errorCatcher", {
2005
2007
  name: "overlength",
2006
2008
  message: "The input text is too long",
2007
2009
  data: r
2008
2010
  });
2009
2011
  };
2010
- }, io = ro, so = (e) => {
2012
+ }, no = ao, ro = (e) => {
2011
2013
  const a = A("editorId");
2012
- Y(() => {
2013
- h.on(a, {
2014
+ X(() => {
2015
+ f.on(a, {
2014
2016
  name: Rt,
2015
2017
  callback(l) {
2016
2018
  var n;
@@ -2018,107 +2020,106 @@ const ro = (e) => {
2018
2020
  }
2019
2021
  });
2020
2022
  });
2021
- }, co = so, uo = (e, a) => [
2023
+ }, io = ro, so = (e, a) => [
2022
2024
  {
2023
2025
  key: "Ctrl-b",
2024
2026
  mac: "Cmd-b",
2025
- run: () => (h.emit(e, "replace", "bold"), !0)
2027
+ run: () => (f.emit(e, "replace", "bold"), !0)
2026
2028
  },
2027
2029
  {
2028
2030
  key: "Ctrl-d",
2029
2031
  mac: "Cmd-d",
2030
- run: nl,
2032
+ run: ol,
2031
2033
  preventDefault: !0
2032
2034
  },
2033
2035
  {
2034
2036
  key: "Ctrl-s",
2035
2037
  mac: "Cmd-s",
2036
- run: (L) => (h.emit(e, pt, L.state.doc.toString()), !0),
2037
- shift: () => (h.emit(e, "replace", "strikeThrough"), !0)
2038
+ run: (L) => (f.emit(e, pt, L.state.doc.toString()), !0),
2039
+ shift: () => (f.emit(e, "replace", "strikeThrough"), !0)
2038
2040
  },
2039
2041
  {
2040
2042
  key: "Ctrl-u",
2041
2043
  mac: "Cmd-u",
2042
- run: () => (h.emit(e, "replace", "underline"), !0),
2043
- shift: () => (h.emit(e, "replace", "unorderedList"), !0)
2044
+ run: () => (f.emit(e, "replace", "underline"), !0),
2045
+ shift: () => (f.emit(e, "replace", "unorderedList"), !0)
2044
2046
  },
2045
2047
  {
2046
2048
  key: "Ctrl-i",
2047
2049
  mac: "Cmd-i",
2048
- run: () => (h.emit(e, "replace", "italic"), !0),
2049
- shift: () => (h.emit(e, "openModals", "image"), !0)
2050
+ run: () => (f.emit(e, "replace", "italic"), !0),
2051
+ shift: () => (f.emit(e, "openModals", "image"), !0)
2050
2052
  },
2051
2053
  {
2052
2054
  key: "Ctrl-1",
2053
2055
  mac: "Cmd-1",
2054
- run: () => (h.emit(e, "replace", "h1"), !0)
2056
+ run: () => (f.emit(e, "replace", "h1"), !0)
2055
2057
  },
2056
2058
  {
2057
2059
  key: "Ctrl-2",
2058
2060
  mac: "Cmd-2",
2059
- run: () => (h.emit(e, "replace", "h2"), !0)
2061
+ run: () => (f.emit(e, "replace", "h2"), !0)
2060
2062
  },
2061
2063
  {
2062
2064
  key: "Ctrl-3",
2063
2065
  mac: "Cmd-3",
2064
- run: () => (h.emit(e, "replace", "h3"), !0)
2066
+ run: () => (f.emit(e, "replace", "h3"), !0)
2065
2067
  },
2066
2068
  {
2067
2069
  key: "Ctrl-4",
2068
2070
  mac: "Cmd-4",
2069
- run: () => (h.emit(e, "replace", "h4"), !0)
2071
+ run: () => (f.emit(e, "replace", "h4"), !0)
2070
2072
  },
2071
2073
  {
2072
2074
  key: "Ctrl-5",
2073
2075
  mac: "Cmd-5",
2074
- run: () => (h.emit(e, "replace", "h5"), !0)
2076
+ run: () => (f.emit(e, "replace", "h5"), !0)
2075
2077
  },
2076
2078
  {
2077
2079
  key: "Ctrl-6",
2078
2080
  mac: "Cmd-6",
2079
- run: () => (h.emit(e, "replace", "h6"), !0)
2081
+ run: () => (f.emit(e, "replace", "h6"), !0)
2080
2082
  },
2081
2083
  {
2082
2084
  key: "Ctrl-ArrowUp",
2083
2085
  mac: "Cmd-ArrowUp",
2084
- run: () => (h.emit(e, "replace", "sup"), !0)
2086
+ run: () => (f.emit(e, "replace", "sup"), !0)
2085
2087
  },
2086
2088
  {
2087
2089
  key: "Ctrl-ArrowDown",
2088
2090
  mac: "Cmd-ArrowDown",
2089
- run: () => (h.emit(e, "replace", "sub"), !0)
2091
+ run: () => (f.emit(e, "replace", "sub"), !0)
2090
2092
  },
2091
2093
  {
2092
2094
  key: "Ctrl-o",
2093
2095
  mac: "Cmd-o",
2094
- run: () => (h.emit(e, "replace", "orderedList"), !0)
2096
+ run: () => (f.emit(e, "replace", "orderedList"), !0)
2095
2097
  },
2096
2098
  {
2097
2099
  key: "Ctrl-c",
2098
2100
  mac: "Cmd-c",
2099
- shift: () => (h.emit(e, "replace", "code"), !0),
2101
+ shift: () => (f.emit(e, "replace", "code"), !0),
2100
2102
  any(L, C) {
2101
- return (C.ctrlKey || C.metaKey) && C.altKey && C.code === "KeyC" ? (h.emit(e, "replace", "codeRow"), !0) : !1;
2103
+ return (C.ctrlKey || C.metaKey) && C.altKey && C.code === "KeyC" ? (f.emit(e, "replace", "codeRow"), !0) : !1;
2102
2104
  }
2103
2105
  },
2104
2106
  {
2105
2107
  key: "Ctrl-l",
2106
2108
  mac: "Cmd-l",
2107
- run: () => (h.emit(e, "openModals", "link"), !0)
2109
+ run: () => (f.emit(e, "openModals", "link"), !0)
2108
2110
  },
2109
2111
  {
2110
2112
  key: "Ctrl-f",
2111
2113
  mac: "Cmd-f",
2112
- shift: () => a.noPrettier ? !1 : (h.emit(e, "replace", "prettier"), !0)
2114
+ shift: () => a.noPrettier ? !1 : (f.emit(e, "replace", "prettier"), !0)
2113
2115
  },
2114
2116
  {
2115
- any: (L, C) => (C.ctrlKey || C.metaKey) && C.altKey && C.shiftKey && C.code === "KeyT" ? (h.emit(e, "replace", "table"), !0) : !1
2117
+ any: (L, C) => (C.ctrlKey || C.metaKey) && C.altKey && C.shiftKey && C.code === "KeyT" ? (f.emit(e, "replace", "table"), !0) : !1
2116
2118
  }
2117
- ], mo = uo, fo = (e) => {
2118
- const a = A("tabWidth"), l = A("editorId"), n = A("theme"), r = q(), i = St(), u = mo(l, e), d = io(e), c = [
2119
- el.of([...u, rl]),
2120
- Xt,
2121
- al(),
2119
+ ], co = so, uo = (e) => {
2120
+ const a = A("tabWidth"), l = A("editorId"), n = A("theme"), r = U(), i = St(), u = co(l, e), d = no(e), c = [
2121
+ el.of([...u, al]),
2122
+ Jt,
2122
2123
  ll({ codeLanguages: tl }),
2123
2124
  // 横向换行
2124
2125
  ie.lineWrapping,
@@ -2132,53 +2133,53 @@ const ro = (e) => {
2132
2133
  input: (m) => {
2133
2134
  e.onInput && e.onInput(m);
2134
2135
  const { data: b } = m;
2135
- e.maxlength && e.value.length + b.length > e.maxlength && h.emit(l, "errorCatcher", {
2136
+ e.maxlength && e.value.length + b.length > e.maxlength && f.emit(l, "errorCatcher", {
2136
2137
  name: "overlength",
2137
2138
  message: "The input text is too long",
2138
2139
  data: b
2139
2140
  });
2140
2141
  }
2141
2142
  })
2142
- ], f = () => {
2143
+ ], g = () => {
2143
2144
  const m = [
2144
2145
  ...c,
2145
- n.value === "light" ? lo : Kl,
2146
- ao(e.completions)
2146
+ n.value === "light" ? eo : Ul,
2147
+ lo(e.completions)
2147
2148
  ];
2148
2149
  return z.codeMirrorExtensions(n.value, m, [
2149
2150
  ...u
2150
2151
  ]);
2151
2152
  };
2152
- return Y(() => {
2153
+ return X(() => {
2153
2154
  const m = new ie({
2154
2155
  doc: e.value,
2155
2156
  parent: r.value
2156
- }), b = new no(m);
2157
+ }), b = new oo(m);
2157
2158
  i.value = b, setTimeout(() => {
2158
- b.setTabSize(a), b.setDisabled(e.disabled), b.setReadOnly(e.readonly), b.setExtensions(f()), e.placeholder && b.setPlaceholder(e.placeholder), typeof e.maxlength == "number" && b.setMaxLength(e.maxlength), e.autofocus && m.focus();
2159
- }, 0), h.on(l, {
2159
+ b.setTabSize(a), b.setDisabled(e.disabled), b.setReadOnly(e.readonly), b.setExtensions(g()), e.placeholder && b.setPlaceholder(e.placeholder), typeof e.maxlength == "number" && b.setMaxLength(e.maxlength), e.autofocus && m.focus();
2160
+ }, 0), f.on(l, {
2160
2161
  name: "ctrlZ",
2161
2162
  callback() {
2162
- il(m);
2163
+ nl(m);
2163
2164
  }
2164
- }), h.on(l, {
2165
+ }), f.on(l, {
2165
2166
  name: "ctrlShiftZ",
2166
2167
  callback() {
2167
- sl(m);
2168
+ rl(m);
2168
2169
  }
2169
- }), h.on(l, {
2170
+ }), f.on(l, {
2170
2171
  name: "replace",
2171
2172
  callback($, T = {}) {
2172
2173
  var k;
2173
- const { text: v, options: g } = Nl($, i.value, T);
2174
- (k = i.value) == null || k.replaceSelectedText(v, g, l);
2174
+ const { text: v, options: h } = Il($, i.value, T);
2175
+ (k = i.value) == null || k.replaceSelectedText(v, h, l);
2175
2176
  }
2176
2177
  });
2177
2178
  }), H(
2178
2179
  [n, le(e, "completions")],
2179
2180
  () => {
2180
2181
  var m;
2181
- (m = i.value) == null || m.setExtensions(f());
2182
+ (m = i.value) == null || m.setExtensions(g());
2182
2183
  },
2183
2184
  {
2184
2185
  deep: !0
@@ -2213,11 +2214,11 @@ const ro = (e) => {
2213
2214
  var m;
2214
2215
  e.maxlength && ((m = i.value) == null || m.setMaxLength(e.maxlength));
2215
2216
  }
2216
- ), co(i), {
2217
+ ), io(i), {
2217
2218
  inputWrapperRef: r,
2218
2219
  codeMirrorUt: i
2219
2220
  };
2220
- }, go = fo, ho = {
2221
+ }, mo = uo, go = {
2221
2222
  value: {
2222
2223
  type: String,
2223
2224
  default: ""
@@ -2320,15 +2321,15 @@ const ro = (e) => {
2320
2321
  onInput: {
2321
2322
  type: Function
2322
2323
  }
2323
- }, bo = /* @__PURE__ */ V({
2324
+ }, ho = /* @__PURE__ */ V({
2324
2325
  name: "MDEditorContent",
2325
- props: ho,
2326
+ props: go,
2326
2327
  setup(e) {
2327
- const a = A("editorId"), l = q(""), {
2328
+ const a = A("editorId"), l = U(""), {
2328
2329
  inputWrapperRef: n,
2329
2330
  codeMirrorUt: r
2330
- } = go(e);
2331
- return Il(e, l, r), () => t("div", {
2331
+ } = mo(e);
2332
+ return Ll(e, l, r), () => t("div", {
2332
2333
  class: `${o}-content`
2333
2334
  }, [t("div", {
2334
2335
  class: `${o}-input-wrapper`,
@@ -2354,7 +2355,7 @@ const ro = (e) => {
2354
2355
  key: "internal-catalog"
2355
2356
  }, null)]);
2356
2357
  }
2357
- }), vo = /* @__PURE__ */ V({
2358
+ }), fo = /* @__PURE__ */ V({
2358
2359
  props: {
2359
2360
  modelValue: {
2360
2361
  type: String,
@@ -2372,7 +2373,7 @@ const ro = (e) => {
2372
2373
  }, [`${(l = a.value.footer) == null ? void 0 : l.markdownTotal}:`]), t("span", null, [((n = e.modelValue) == null ? void 0 : n.length) || 0])]);
2373
2374
  };
2374
2375
  }
2375
- }), ko = {
2376
+ }), bo = {
2376
2377
  checked: {
2377
2378
  type: Boolean,
2378
2379
  default: !1
@@ -2382,8 +2383,8 @@ const ro = (e) => {
2382
2383
  default: () => {
2383
2384
  }
2384
2385
  }
2385
- }, po = /* @__PURE__ */ V({
2386
- props: ko,
2386
+ }, vo = /* @__PURE__ */ V({
2387
+ props: bo,
2387
2388
  setup(e) {
2388
2389
  return () => t("div", {
2389
2390
  class: [`${o}-checkbox`, e.checked && `${o}-checkbox-checked`],
@@ -2392,7 +2393,7 @@ const ro = (e) => {
2392
2393
  }
2393
2394
  }, null);
2394
2395
  }
2395
- }), Co = {
2396
+ }), ko = {
2396
2397
  scrollAuto: {
2397
2398
  type: Boolean
2398
2399
  },
@@ -2401,8 +2402,8 @@ const ro = (e) => {
2401
2402
  default: () => {
2402
2403
  }
2403
2404
  }
2404
- }, $o = /* @__PURE__ */ V({
2405
- props: Co,
2405
+ }, po = /* @__PURE__ */ V({
2406
+ props: ko,
2406
2407
  setup(e) {
2407
2408
  const a = A("usedLanguageText");
2408
2409
  return () => {
@@ -2414,13 +2415,13 @@ const ro = (e) => {
2414
2415
  onClick: () => {
2415
2416
  e.onScrollAutoChange(!e.scrollAuto);
2416
2417
  }
2417
- }, [(l = a.value.footer) == null ? void 0 : l.scrollAuto]), t(po, {
2418
+ }, [(l = a.value.footer) == null ? void 0 : l.scrollAuto]), t(vo, {
2418
2419
  checked: e.scrollAuto,
2419
2420
  onChange: e.onScrollAutoChange
2420
2421
  }, null)]);
2421
2422
  };
2422
2423
  }
2423
- }), yo = {
2424
+ }), Co = {
2424
2425
  modelValue: {
2425
2426
  type: String,
2426
2427
  default: ""
@@ -2440,22 +2441,22 @@ const ro = (e) => {
2440
2441
  defFooters: {
2441
2442
  type: Object
2442
2443
  }
2443
- }, To = /* @__PURE__ */ V({
2444
+ }, $o = /* @__PURE__ */ V({
2444
2445
  name: "MDEditorFooter",
2445
- props: yo,
2446
+ props: Co,
2446
2447
  setup(e) {
2447
- const a = he(() => {
2448
+ const a = fe(() => {
2448
2449
  const n = e.footers.indexOf("="), r = n === -1 ? e.footers : e.footers.slice(0, n), i = n === -1 ? [] : e.footers.slice(n, Number.MAX_SAFE_INTEGER);
2449
2450
  return [r, i];
2450
2451
  }), l = (n) => {
2451
- if (Dt.includes(n))
2452
+ if (It.includes(n))
2452
2453
  switch (n) {
2453
2454
  case "markdownTotal":
2454
- return t(vo, {
2455
+ return t(fo, {
2455
2456
  modelValue: e.modelValue
2456
2457
  }, null);
2457
2458
  case "scrollSwitch":
2458
- return t($o, {
2459
+ return t(po, {
2459
2460
  scrollAuto: e.scrollAuto,
2460
2461
  onScrollAutoChange: e.onScrollAutoChange
2461
2462
  }, null);
@@ -2474,7 +2475,7 @@ const ro = (e) => {
2474
2475
  }, [r])]);
2475
2476
  };
2476
2477
  }
2477
- }), wo = /* @__PURE__ */ V({
2478
+ }), yo = /* @__PURE__ */ V({
2478
2479
  name: "MdEditorV3",
2479
2480
  props: qt,
2480
2481
  emits: Ut,
@@ -2486,14 +2487,14 @@ const ro = (e) => {
2486
2487
  noPrettier: i,
2487
2488
  noUploadImg: u,
2488
2489
  noHighlight: d
2489
- } = e, c = J({
2490
+ } = e, c = Z({
2490
2491
  scrollAuto: e.scrollAuto
2491
2492
  });
2492
2493
  Gt(e, a), Kt(e), jt(e), _t(e, a);
2493
- const [f, m] = Wt(e, a), b = zt(e);
2494
+ const [g, m] = Wt(e, a), b = zt(e);
2494
2495
  return At(() => {
2495
- h.clear(l);
2496
- }), Yt(e, a, b, f, m), () => {
2496
+ f.clear(l);
2497
+ }), Xt(e, a, b, g, m), () => {
2497
2498
  var v;
2498
2499
  const $ = rt({
2499
2500
  props: e,
@@ -2504,21 +2505,21 @@ const ro = (e) => {
2504
2505
  }, "defFooters");
2505
2506
  return t("div", {
2506
2507
  id: l,
2507
- class: [o, e.class, e.theme === "dark" && `${o}-dark`, f.fullscreen || f.pageFullscreen ? `${o}-fullscreen` : ""],
2508
+ class: [o, e.class, e.theme === "dark" && `${o}-dark`, g.fullscreen || g.pageFullscreen ? `${o}-fullscreen` : ""],
2508
2509
  style: e.style
2509
- }, [t(Al, {
2510
+ }, [t(xl, {
2510
2511
  noPrettier: i,
2511
2512
  toolbars: e.toolbars,
2512
2513
  toolbarsExclude: e.toolbarsExclude,
2513
- setting: f,
2514
+ setting: g,
2514
2515
  updateSetting: m,
2515
2516
  tableShape: e.tableShape,
2516
2517
  defToolbars: $,
2517
2518
  noUploadImg: u,
2518
2519
  showToolbarName: e.showToolbarName
2519
- }, null), t(bo, {
2520
+ }, null), t(ho, {
2520
2521
  value: e.modelValue,
2521
- setting: f,
2522
+ setting: g,
2522
2523
  mdHeadingId: e.mdHeadingId,
2523
2524
  noMermaid: r,
2524
2525
  noPrettier: i,
@@ -2533,38 +2534,38 @@ const ro = (e) => {
2533
2534
  maxlength: e.maxLength,
2534
2535
  autoDetectCode: e.autoDetectCode,
2535
2536
  noHighlight: d,
2536
- onChange: (g) => {
2537
- e.onChange ? e.onChange(g) : (a.emit("update:modelValue", g), a.emit("onChange", g));
2537
+ onChange: (h) => {
2538
+ e.onChange ? e.onChange(h) : (a.emit("update:modelValue", h), a.emit("onChange", h));
2538
2539
  },
2539
- onHtmlChanged: (g) => {
2540
- e.onHtmlChanged ? e.onHtmlChanged(g) : a.emit("onHtmlChanged", g);
2540
+ onHtmlChanged: (h) => {
2541
+ e.onHtmlChanged ? e.onHtmlChanged(h) : a.emit("onHtmlChanged", h);
2541
2542
  },
2542
- onGetCatalog: (g) => {
2543
- e.onGetCatalog ? e.onGetCatalog(g) : a.emit("onGetCatalog", g);
2543
+ onGetCatalog: (h) => {
2544
+ e.onGetCatalog ? e.onGetCatalog(h) : a.emit("onGetCatalog", h);
2544
2545
  },
2545
- onBlur: (g) => {
2546
- e.onBlur ? e.onBlur(g) : a.emit("onBlur", g);
2546
+ onBlur: (h) => {
2547
+ e.onBlur ? e.onBlur(h) : a.emit("onBlur", h);
2547
2548
  },
2548
- onFocus: (g) => {
2549
- e.onFocus ? e.onFocus(g) : a.emit("onFocus", g);
2549
+ onFocus: (h) => {
2550
+ e.onFocus ? e.onFocus(h) : a.emit("onFocus", h);
2550
2551
  },
2551
- onInput: (g) => {
2552
- e.onInput ? e.onInput(g) : a.emit("onInput", g);
2552
+ onInput: (h) => {
2553
+ e.onInput ? e.onInput(h) : a.emit("onInput", h);
2553
2554
  },
2554
2555
  completions: e.completions,
2555
2556
  catalogVisible: b.value,
2556
2557
  theme: e.theme
2557
- }, null), ((v = e.footers) == null ? void 0 : v.length) > 0 && t(To, {
2558
+ }, null), ((v = e.footers) == null ? void 0 : v.length) > 0 && t($o, {
2558
2559
  modelValue: e.modelValue,
2559
2560
  footers: e.footers,
2560
2561
  defFooters: T,
2561
2562
  scrollAuto: c.scrollAuto,
2562
- onScrollAutoChange: (g) => c.scrollAuto = g
2563
+ onScrollAutoChange: (h) => c.scrollAuto = h
2563
2564
  }, null)]);
2564
2565
  };
2565
2566
  }
2566
- }), ge = wo;
2567
- ge.install = (e) => (e.component(ge.name, ge), e.use(fl).use(Bt).use(gl).use(Tt).use(Zt), e);
2567
+ }), he = yo;
2568
+ he.install = (e) => (e.component(he.name, he), e.use(ul).use(Ft).use(ml).use(Tt).use(Yt), e);
2568
2569
  export {
2569
- ge as default
2570
+ he as default
2570
2571
  };