md-editor-v3 4.0.3 → 4.0.4-beta.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,38 +1,38 @@
1
1
  var Ze = Object.defineProperty;
2
2
  var Je = (e, o, n) => o in e ? Ze(e, o, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[o] = n;
3
3
  var U = (e, o, n) => (Je(e, typeof o != "symbol" ? o + "" : o, n), n);
4
- import { defineComponent as I, createVNode as t, inject as S, ref as q, onMounted as W, reactive as Y, computed as me, watch as F, nextTick as ue, Fragment as Ke, toRef as ae, shallowRef as Xe, onBeforeUnmount as Qe } from "vue";
4
+ import { defineComponent as B, createVNode as t, inject as S, ref as q, onMounted as W, reactive as Y, computed as me, watch as I, nextTick as ue, Fragment as Ke, toRef as ae, shallowRef as Xe, onBeforeUnmount as Qe } from "vue";
5
5
  import { p as a, a as G, s as et, b as tt, d as lt } from "./chunks/config.mjs";
6
6
  import { a as Q, D as ot } from "./chunks/index2.mjs";
7
- import { b as h } from "./chunks/event-bus.mjs";
8
- import { b as at, g as nt, d as rt } from "./chunks/index4.mjs";
9
- import { C as it, a as st, O as je, T as ct, b as dt, e as ut, c as mt, u as ft, d as gt, f as ht, g as bt, h as vt, i as kt, M as pt } from "./chunks/index.mjs";
10
- import { a as Ct } from "./chunks/dom.mjs";
11
- import { a as _e, M as $t } from "./chunks/index3.mjs";
12
- import { minimalSetup as yt, EditorView as ne } from "codemirror";
13
- import { EditorView as fe, placeholder as xt, keymap as wt } from "@codemirror/view";
14
- import { languages as Tt } from "@codemirror/language-data";
15
- import { markdown as St } from "@codemirror/lang-markdown";
16
- import { deleteLine as At, indentWithTab as Mt, undo as Lt, redo as Dt } from "@codemirror/commands";
17
- import { HighlightStyle as We, syntaxHighlighting as ze, indentUnit as Et } from "@codemirror/language";
7
+ import { b as h, a as at } from "./chunks/index4.mjs";
8
+ import { linkTo as nt, debounce as rt, throttle as it, smoothScroll as De } from "@vavt/util";
9
+ import { C as st, a as ct, O as je, T as dt, b as ut, e as mt, c as ft, u as gt, d as ht, f as bt, g as vt, h as kt, i as pt, M as Ct } from "./chunks/index.mjs";
10
+ import { a as $t } from "./chunks/dom.mjs";
11
+ import { a as _e, M as yt } from "./chunks/index3.mjs";
12
+ import { minimalSetup as xt, EditorView as ne } from "codemirror";
13
+ import { EditorView as fe, placeholder as wt, keymap as Tt } from "@codemirror/view";
14
+ import { languages as St } from "@codemirror/language-data";
15
+ import { markdown as At } from "@codemirror/lang-markdown";
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";
18
18
  import { tags as i } from "@lezer/highlight";
19
- import { EditorSelection as re, EditorState as ie, Compartment as Ht, StateEffect as Ft } from "@codemirror/state";
20
- import { g as De } from "./chunks/vue-tsx.mjs";
19
+ import { EditorSelection as re, EditorState as ie, Compartment as Ft, StateEffect as It } from "@codemirror/state";
20
+ import { g as Ee } from "./chunks/vue-tsx.mjs";
21
21
  import Ye from "./MdCatalog.mjs";
22
- import It from "./NormalToolbar.mjs";
22
+ import Bt from "./NormalToolbar.mjs";
23
23
  import "medium-zoom";
24
24
  import "copy-to-clipboard";
25
25
  import "markdown-it";
26
26
  import "markdown-it-image-figures";
27
27
  import "markdown-it-task-lists";
28
28
  import "lru-cache";
29
- const Bt = /* @__PURE__ */ I({
29
+ const Ot = /* @__PURE__ */ B({
30
30
  setup() {
31
31
  return () => t("div", {
32
32
  class: `${a}-divider`
33
33
  }, null);
34
34
  }
35
- }), Ot = {
35
+ }), Vt = {
36
36
  noPrettier: {
37
37
  type: Boolean
38
38
  },
@@ -73,7 +73,7 @@ const Bt = /* @__PURE__ */ I({
73
73
  noUploadImg: {
74
74
  type: Boolean
75
75
  }
76
- }, Vt = (e) => {
76
+ }, Rt = (e) => {
77
77
  var f, d, u, k;
78
78
  const o = S("editorId");
79
79
  let n = (d = (f = G.editorExtensions) == null ? void 0 : f.screenfull) == null ? void 0 : d.instance;
@@ -96,15 +96,15 @@ const Bt = /* @__PURE__ */ I({
96
96
  return W(() => {
97
97
  if (c(), !n) {
98
98
  const $ = document.createElement("script");
99
- $.src = l || et, $.onload = g, $.id = `${a}-screenfull`, Ct($, "screenfull");
99
+ $.src = l || et, $.onload = g, $.id = `${a}-screenfull`, $t($, "screenfull");
100
100
  }
101
101
  }), W(() => {
102
102
  h.on(o, {
103
- name: it,
103
+ name: st,
104
104
  callback: r
105
105
  });
106
106
  }), { fullscreenHandler: r };
107
- }, Rt = {
107
+ }, Nt = {
108
108
  tableShape: {
109
109
  type: Array,
110
110
  default: () => [6, 4]
@@ -114,9 +114,9 @@ const Bt = /* @__PURE__ */ I({
114
114
  default: () => {
115
115
  }
116
116
  }
117
- }, Nt = /* @__PURE__ */ I({
117
+ }, Pt = /* @__PURE__ */ B({
118
118
  name: "TableShape",
119
- props: Rt,
119
+ props: Nt,
120
120
  setup(e) {
121
121
  const o = Y({
122
122
  x: -1,
@@ -143,7 +143,7 @@ const Bt = /* @__PURE__ */ I({
143
143
  class: [`${a}-table-shape-col-default`, l <= o.x && r <= o.y && `${a}-table-shape-col-include`]
144
144
  }, null)]))]))]);
145
145
  }
146
- }), Pt = Nt, Ut = {
146
+ }), Ut = Pt, qt = {
147
147
  type: {
148
148
  type: String,
149
149
  default: "link"
@@ -162,8 +162,8 @@ const Bt = /* @__PURE__ */ I({
162
162
  default: () => {
163
163
  }
164
164
  }
165
- }, qt = /* @__PURE__ */ I({
166
- props: Ut,
165
+ }, Gt = /* @__PURE__ */ B({
166
+ props: qt,
167
167
  setup(e) {
168
168
  const o = S("usedLanguageText"), n = S("editorId"), l = me(() => {
169
169
  var r, c;
@@ -179,7 +179,7 @@ const Bt = /* @__PURE__ */ I({
179
179
  desc: "",
180
180
  url: ""
181
181
  });
182
- return F(() => e.visible, (r) => {
182
+ return I(() => e.visible, (r) => {
183
183
  r || setTimeout(() => {
184
184
  s.desc = "", s.url = "";
185
185
  }, 200);
@@ -232,7 +232,7 @@ const Bt = /* @__PURE__ */ I({
232
232
  }
233
233
  });
234
234
  }
235
- }), Gt = {
235
+ }), Kt = {
236
236
  visible: {
237
237
  type: Boolean,
238
238
  default: !1
@@ -247,8 +247,8 @@ const Bt = /* @__PURE__ */ I({
247
247
  default: () => {
248
248
  }
249
249
  }
250
- }, Kt = /* @__PURE__ */ I({
251
- props: Gt,
250
+ }, jt = /* @__PURE__ */ B({
251
+ props: Kt,
252
252
  setup(e) {
253
253
  var u, k, $;
254
254
  const o = S("usedLanguageText"), n = S("editorId");
@@ -261,7 +261,7 @@ const Bt = /* @__PURE__ */ I({
261
261
  isFullscreen: !1
262
262
  });
263
263
  let f = null;
264
- F(() => e.visible, () => {
264
+ I(() => e.visible, () => {
265
265
  e.visible && !g.cropperInited && (l = l || window.Cropper, s.value.onchange = () => {
266
266
  if (!l) {
267
267
  h.emit(n, "errorCatcher", {
@@ -284,9 +284,9 @@ const Bt = /* @__PURE__ */ I({
284
284
  }, v.readAsDataURL(b[0]);
285
285
  }
286
286
  });
287
- }), F(() => [g.imgSelected], () => {
287
+ }), I(() => [g.imgSelected], () => {
288
288
  c.value.style = "";
289
- }), F(() => g.isFullscreen, () => {
289
+ }), I(() => g.isFullscreen, () => {
290
290
  ue(() => {
291
291
  f == null || f.destroy(), c.value.style = "", r.value && (f = new l(r.value, {
292
292
  viewMode: 2,
@@ -375,7 +375,7 @@ const Bt = /* @__PURE__ */ I({
375
375
  });
376
376
  };
377
377
  }
378
- }), jt = {
378
+ }), _t = {
379
379
  type: {
380
380
  type: String,
381
381
  default: "link"
@@ -398,27 +398,27 @@ const Bt = /* @__PURE__ */ I({
398
398
  default: () => {
399
399
  }
400
400
  }
401
- }, _t = /* @__PURE__ */ I({
402
- props: jt,
401
+ }, Wt = /* @__PURE__ */ B({
402
+ props: _t,
403
403
  setup(e) {
404
- return () => t(Ke, null, [t(qt, {
404
+ return () => t(Ke, null, [t(Gt, {
405
405
  type: e.type,
406
406
  visible: e.linkVisible,
407
407
  onOk: e.onOk,
408
408
  onCancel: e.onCancel
409
- }, null), t(Kt, {
409
+ }, null), t(jt, {
410
410
  visible: e.clipVisible,
411
411
  onOk: e.onOk,
412
412
  onCancel: e.onCancel
413
413
  }, null)]);
414
414
  }
415
- }), Wt = /* @__PURE__ */ I({
415
+ }), zt = /* @__PURE__ */ B({
416
416
  name: "MDEditorToolbar",
417
- props: Ot,
417
+ props: Vt,
418
418
  setup(e) {
419
419
  const o = S("editorId"), n = S("usedLanguageText"), {
420
420
  fullscreenHandler: l
421
- } = Vt(e), s = `${o}-toolbar-wrapper`, r = Y({
421
+ } = Rt(e), s = `${o}-toolbar-wrapper`, r = Y({
422
422
  title: !1,
423
423
  catalog: !1,
424
424
  // 图片上传下拉
@@ -453,11 +453,11 @@ const Bt = /* @__PURE__ */ I({
453
453
  u.value.addEventListener("change", k);
454
454
  });
455
455
  const $ = (b) => {
456
- var v, m, y, x, T, w, A, p, M, R, L, D, B, O, E, K, N, le, Z, j, P, J, _, H, V, X, oe, ge, he, be, ve, ke, pe, Ce, $e, ye, xe, we, Te, Se, Ae, Me, Le;
456
+ var v, m, y, x, T, w, A, p, M, R, L, D, O, F, E, K, N, le, Z, j, P, J, _, H, V, X, oe, ge, he, be, ve, ke, pe, Ce, $e, ye, xe, we, Te, Se, Ae, Me, Le;
457
457
  if (tt.includes(b))
458
458
  switch (b) {
459
459
  case "-":
460
- return t(Bt, null, null);
460
+ return t(Ot, null, null);
461
461
  case "bold":
462
462
  return t("div", {
463
463
  class: `${a}-toolbar-item`,
@@ -596,7 +596,7 @@ const Bt = /* @__PURE__ */ I({
596
596
  case "quote":
597
597
  return t("div", {
598
598
  class: `${a}-toolbar-item`,
599
- title: (B = n.value.toolbarTips) == null ? void 0 : B.quote,
599
+ title: (O = n.value.toolbarTips) == null ? void 0 : O.quote,
600
600
  onClick: () => {
601
601
  c("quote");
602
602
  }
@@ -609,7 +609,7 @@ const Bt = /* @__PURE__ */ I({
609
609
  case "unorderedList":
610
610
  return t("div", {
611
611
  class: `${a}-toolbar-item`,
612
- title: (O = n.value.toolbarTips) == null ? void 0 : O.unorderedList,
612
+ title: (F = n.value.toolbarTips) == null ? void 0 : F.unorderedList,
613
613
  onClick: () => {
614
614
  c("unorderedList");
615
615
  }
@@ -745,7 +745,7 @@ const Bt = /* @__PURE__ */ I({
745
745
  r.table = C;
746
746
  },
747
747
  key: "bar-table",
748
- overlay: t(Pt, {
748
+ overlay: t(Ut, {
749
749
  tableShape: e.tableShape,
750
750
  onSelected: (C) => {
751
751
  c("table", {
@@ -876,7 +876,7 @@ const Bt = /* @__PURE__ */ I({
876
876
  class: `${a}-toolbar-item`,
877
877
  title: (ke = n.value.toolbarTips) == null ? void 0 : ke.catalog,
878
878
  onClick: () => {
879
- h.emit(o, st);
879
+ h.emit(o, ct);
880
880
  },
881
881
  key: "bar-catalog"
882
882
  }, [t("svg", {
@@ -1026,7 +1026,7 @@ const Bt = /* @__PURE__ */ I({
1026
1026
  style: {
1027
1027
  display: "none"
1028
1028
  }
1029
- }, null), t(_t, {
1029
+ }, null), t(Wt, {
1030
1030
  linkVisible: g.linkVisible,
1031
1031
  clipVisible: g.clipVisible,
1032
1032
  type: g.type,
@@ -1042,14 +1042,7 @@ const Bt = /* @__PURE__ */ I({
1042
1042
  }, null)]);
1043
1043
  };
1044
1044
  }
1045
- }), zt = (e, o, n) => {
1046
- let l = e.scrollTop;
1047
- const s = () => {
1048
- const r = o - l;
1049
- l = l + r / 5, Math.abs(r) < 1 ? (e.scrollTo(0, o), n && setTimeout(n, 100)) : (e.scrollTo(0, l), requestAnimationFrame(s));
1050
- };
1051
- s();
1052
- }, Ee = zt, Yt = (e, o) => {
1045
+ }), Yt = (e, o) => {
1053
1046
  const n = rt(() => {
1054
1047
  e.removeEventListener("scroll", l), e.addEventListener("scroll", l), o.removeEventListener("scroll", l), o.addEventListener("scroll", l);
1055
1048
  }, 50), l = (s) => {
@@ -1088,7 +1081,7 @@ const Bt = /* @__PURE__ */ I({
1088
1081
  });
1089
1082
  };
1090
1083
  let f = 0, d = 0;
1091
- const u = (k) => {
1084
+ const u = it((k) => {
1092
1085
  var v, m, y, x, T, w, A;
1093
1086
  if (!((v = o.firstElementChild) != null && v.firstElementChild))
1094
1087
  return;
@@ -1100,11 +1093,11 @@ const Bt = /* @__PURE__ */ I({
1100
1093
  f++;
1101
1094
  const p = c[b - 1], M = s(p.end) + r(p.end);
1102
1095
  let R = 0;
1103
- const L = s(p.start), D = o.querySelector(`[data-line="${p.start - 1}"]`) || ((m = o.firstElementChild) == null ? void 0 : m.firstElementChild), B = o.querySelector(`[data-line="${p.end}"]`) || ((y = o.lastElementChild) == null ? void 0 : y.lastElementChild);
1104
- let O = 0, E = 0;
1105
- L === 0 ? (R = (l.scrollDOM.scrollTop - L) / (M - L), O = B.offsetTop) : M > l.scrollDOM.scrollHeight - l.scrollDOM.clientHeight ? (R = (l.scrollDOM.scrollTop - L) / (l.scrollDOM.scrollHeight - l.scrollDOM.clientHeight - L), E = D.offsetTop, O = o.scrollHeight - o.clientHeight - E + 10) : (R = (l.scrollDOM.scrollTop - L) / (M - L), E = D.offsetTop, O = B.offsetTop - E);
1106
- const K = E - 10 + O * R;
1107
- Ee(o, K, () => {
1096
+ const L = s(p.start), D = o.querySelector(`[data-line="${p.start - 1}"]`) || ((m = o.firstElementChild) == null ? void 0 : m.firstElementChild), O = o.querySelector(`[data-line="${p.end}"]`) || ((y = o.lastElementChild) == null ? void 0 : y.lastElementChild);
1097
+ let F = 0, E = 0;
1098
+ L === 0 ? (R = (l.scrollDOM.scrollTop - L) / (M - L), F = O.offsetTop) : M > l.scrollDOM.scrollHeight - l.scrollDOM.clientHeight ? (R = (l.scrollDOM.scrollTop - L) / (l.scrollDOM.scrollHeight - l.scrollDOM.clientHeight - L), E = D.offsetTop, F = o.scrollHeight - o.clientHeight - E + 10) : (R = (l.scrollDOM.scrollTop - L) / (M - L), E = D.offsetTop, F = O.offsetTop - E);
1099
+ const K = E - 10 + F * R;
1100
+ De(o, K, () => {
1108
1101
  f--;
1109
1102
  });
1110
1103
  } else {
@@ -1124,15 +1117,20 @@ const Bt = /* @__PURE__ */ I({
1124
1117
  break;
1125
1118
  }
1126
1119
  }
1127
- let B = (T = o.firstElementChild) == null ? void 0 : T.firstElementChild, O = (w = o.firstElementChild) == null ? void 0 : w.lastElementChild;
1120
+ let O = (T = o.firstElementChild) == null ? void 0 : T.firstElementChild, F = (w = o.firstElementChild) == null ? void 0 : w.lastElementChild;
1128
1121
  for (; p.length > 0; ) {
1129
1122
  const H = p.indexOf(D);
1130
1123
  if (H + 1 >= p.length)
1131
1124
  break;
1132
- const V = p[H + 1], X = D.offsetTop;
1125
+ const V = p[H + 1];
1126
+ if (H === -1) {
1127
+ F = V;
1128
+ break;
1129
+ }
1130
+ const X = D.offsetTop;
1133
1131
  if (X > M) {
1134
1132
  if (H === 0) {
1135
- B = D, O = V;
1133
+ O = D, F = V;
1136
1134
  break;
1137
1135
  }
1138
1136
  D = p[H - 1];
@@ -1140,28 +1138,28 @@ const Bt = /* @__PURE__ */ I({
1140
1138
  }
1141
1139
  const oe = V.offsetTop;
1142
1140
  if (X <= M && oe > M) {
1143
- B = D, O = V;
1141
+ O = D, F = V;
1144
1142
  break;
1145
1143
  }
1146
1144
  D = V;
1147
1145
  }
1148
- const E = B.offsetTop, K = O.offsetTop;
1146
+ const E = O.offsetTop, K = F.offsetTop;
1149
1147
  let N = 0;
1150
- const { start: le, end: Z } = c[Number(B.dataset.line || 0)], j = s(le);
1148
+ const { start: le, end: Z } = c[Number(O.dataset.line || 0)], j = s(le);
1151
1149
  let P = s(Z);
1152
1150
  const J = r(Z);
1153
1151
  let _ = 0;
1154
- B === ((A = o.firstElementChild) == null ? void 0 : A.firstElementChild) ? (N = Math.max(M / K, 0), _ = P + J - j) : P > l.scrollDOM.scrollHeight - l.scrollDOM.clientHeight ? (N = Math.max(
1152
+ O === ((A = o.firstElementChild) == null ? void 0 : A.firstElementChild) ? (N = Math.max(M / K, 0), _ = P + J - j) : P > l.scrollDOM.scrollHeight - l.scrollDOM.clientHeight ? (N = Math.max(
1155
1153
  (M - E) / (o.scrollHeight - E - o.clientHeight),
1156
1154
  0
1157
1155
  ), P = s(l.state.doc.lines) + r(l.state.doc.lines), _ = 8 + P - j - e.clientHeight) : (N = Math.max(
1158
1156
  (M - E) / (K - E),
1159
1157
  0
1160
- ), _ = P + J - j), Ee(e, j + _ * N, () => {
1158
+ ), _ = P + J - j), De(e, j + _ * N, () => {
1161
1159
  d--;
1162
1160
  });
1163
1161
  }
1164
- };
1162
+ }, 10);
1165
1163
  return [
1166
1164
  () => {
1167
1165
  g(), e.addEventListener("scroll", u), o.addEventListener("scroll", u), e.dispatchEvent(new Event("scroll"));
@@ -1188,7 +1186,7 @@ const Bt = /* @__PURE__ */ I({
1188
1186
  n.value
1189
1187
  )), e.scrollAuto && r();
1190
1188
  };
1191
- F(
1189
+ I(
1192
1190
  [
1193
1191
  o,
1194
1192
  ae(e.setting, "preview"),
@@ -1199,7 +1197,7 @@ const Bt = /* @__PURE__ */ I({
1199
1197
  () => {
1200
1198
  ue(c);
1201
1199
  }
1202
- ), F(
1200
+ ), I(
1203
1201
  () => e.scrollAuto,
1204
1202
  (g) => {
1205
1203
  g ? r() : s();
@@ -1624,9 +1622,9 @@ $$
1624
1622
  pl,
1625
1623
  ze(Cl)
1626
1624
  ], z = (e) => {
1627
- const o = new Ht();
1625
+ const o = new Ft();
1628
1626
  return (l) => (o.get(e.state) ? e.dispatch({ effects: o.reconfigure(l) }) : e.dispatch({
1629
- effects: Ft.appendConfig.of(o.of(l))
1627
+ effects: It.appendConfig.of(o.of(l))
1630
1628
  }), !0);
1631
1629
  };
1632
1630
  class yl {
@@ -1712,7 +1710,7 @@ class yl {
1712
1710
  setTabSize(o) {
1713
1711
  this.toggleTabSize([
1714
1712
  ie.tabSize.of(o),
1715
- Et.of(" ".repeat(o))
1713
+ Ht.of(" ".repeat(o))
1716
1714
  ]);
1717
1715
  }
1718
1716
  /**
@@ -1721,7 +1719,7 @@ class yl {
1721
1719
  * @param t 目标内容
1722
1720
  */
1723
1721
  setPlaceholder(o) {
1724
- this.togglePlaceholder(xt(o));
1722
+ this.togglePlaceholder(wt(o));
1725
1723
  }
1726
1724
  focus() {
1727
1725
  this.view.focus();
@@ -1763,7 +1761,7 @@ const xl = (e) => {
1763
1761
  const o = S("editorId");
1764
1762
  W(() => {
1765
1763
  h.on(o, {
1766
- name: ct,
1764
+ name: dt,
1767
1765
  callback() {
1768
1766
  var n;
1769
1767
  (n = e.value) == null || n.focus();
@@ -1779,7 +1777,7 @@ const xl = (e) => {
1779
1777
  {
1780
1778
  key: "Ctrl-d",
1781
1779
  mac: "Cmd-d",
1782
- run: At,
1780
+ run: Mt,
1783
1781
  preventDefault: !0
1784
1782
  },
1785
1783
  {
@@ -1868,9 +1866,9 @@ const xl = (e) => {
1868
1866
  }
1869
1867
  ], Ml = Al, Ll = (e) => {
1870
1868
  const o = S("tabWidth"), n = S("editorId"), l = S("theme"), s = q(), r = Xe(), c = Ml(n, e), g = wl(e), f = [
1871
- wt.of([...c, Mt]),
1872
- yt,
1873
- St({ codeLanguages: Tt }),
1869
+ Tt.of([...c, Lt]),
1870
+ xt,
1871
+ At({ codeLanguages: St }),
1874
1872
  // 横向换行
1875
1873
  ne.lineWrapping,
1876
1874
  ne.updateListener.of((u) => {
@@ -1898,12 +1896,12 @@ const xl = (e) => {
1898
1896
  r.value = new yl(u), r.value.setTabSize(o), r.value.setExtensions(d()), r.value.setDisabled(e.disabled), r.value.setReadOnly(e.readonly), e.placeholder && r.value.setPlaceholder(e.placeholder), e.autofocus && u.focus(), e.maxlength && r.value.setMaxLength(e.maxlength), h.on(n, {
1899
1897
  name: "ctrlZ",
1900
1898
  callback() {
1901
- Lt(u);
1899
+ Dt(u);
1902
1900
  }
1903
1901
  }), h.on(n, {
1904
1902
  name: "ctrlShiftZ",
1905
1903
  callback() {
1906
- Dt(u);
1904
+ Et(u);
1907
1905
  }
1908
1906
  }), h.on(n, {
1909
1907
  name: "replace",
@@ -1913,37 +1911,37 @@ const xl = (e) => {
1913
1911
  (m = r.value) == null || m.replaceSelectedText(b, v);
1914
1912
  }
1915
1913
  });
1916
- }), F(
1914
+ }), I(
1917
1915
  () => l.value,
1918
1916
  () => {
1919
1917
  var u, k;
1920
1918
  l.value === "dark" ? (u = r.value) == null || u.setExtensions(d()) : (k = r.value) == null || k.setExtensions(d());
1921
1919
  }
1922
- ), F(
1920
+ ), I(
1923
1921
  () => e.value,
1924
1922
  () => {
1925
1923
  var u, k;
1926
1924
  ((u = r.value) == null ? void 0 : u.getValue()) !== e.value && ((k = r.value) == null || k.setValue(e.value));
1927
1925
  }
1928
- ), F(
1926
+ ), I(
1929
1927
  () => e.placeholder,
1930
1928
  () => {
1931
1929
  var u;
1932
1930
  (u = r.value) == null || u.setPlaceholder(e.placeholder);
1933
1931
  }
1934
- ), F(
1932
+ ), I(
1935
1933
  () => e.disabled,
1936
1934
  () => {
1937
1935
  var u;
1938
1936
  (u = r.value) == null || u.setDisabled(e.disabled);
1939
1937
  }
1940
- ), F(
1938
+ ), I(
1941
1939
  () => e.readonly,
1942
1940
  () => {
1943
1941
  var u;
1944
1942
  (u = r.value) == null || u.setDisabled(e.readonly);
1945
1943
  }
1946
- ), F(
1944
+ ), I(
1947
1945
  () => e.maxlength,
1948
1946
  () => {
1949
1947
  var u;
@@ -2043,7 +2041,7 @@ const xl = (e) => {
2043
2041
  type: Boolean,
2044
2042
  default: !1
2045
2043
  }
2046
- }, Hl = /* @__PURE__ */ I({
2044
+ }, Hl = /* @__PURE__ */ B({
2047
2045
  name: "MDEditorContent",
2048
2046
  props: El,
2049
2047
  setup(e) {
@@ -2056,7 +2054,7 @@ const xl = (e) => {
2056
2054
  }, [t("div", {
2057
2055
  class: `${a}-input-wrapper`,
2058
2056
  ref: n
2059
- }, null), t(dt, {
2057
+ }, null), t(ut, {
2060
2058
  modelValue: e.value,
2061
2059
  setting: e.setting,
2062
2060
  onHtmlChanged: (s) => {
@@ -2071,7 +2069,7 @@ const xl = (e) => {
2071
2069
  noHighlight: e.noHighlight
2072
2070
  }, null)]);
2073
2071
  }
2074
- }), Fl = /* @__PURE__ */ I({
2072
+ }), Fl = /* @__PURE__ */ B({
2075
2073
  props: {
2076
2074
  modelValue: {
2077
2075
  type: String,
@@ -2099,7 +2097,7 @@ const xl = (e) => {
2099
2097
  default: () => {
2100
2098
  }
2101
2099
  }
2102
- }, Bl = /* @__PURE__ */ I({
2100
+ }, Bl = /* @__PURE__ */ B({
2103
2101
  props: Il,
2104
2102
  setup(e) {
2105
2103
  return () => t("div", {
@@ -2118,7 +2116,7 @@ const xl = (e) => {
2118
2116
  default: () => {
2119
2117
  }
2120
2118
  }
2121
- }, Vl = /* @__PURE__ */ I({
2119
+ }, Vl = /* @__PURE__ */ B({
2122
2120
  props: Ol,
2123
2121
  setup(e) {
2124
2122
  const o = S("usedLanguageText");
@@ -2157,7 +2155,7 @@ const xl = (e) => {
2157
2155
  defFooters: {
2158
2156
  type: Object
2159
2157
  }
2160
- }, Nl = /* @__PURE__ */ I({
2158
+ }, Nl = /* @__PURE__ */ B({
2161
2159
  name: "MDEditorFooter",
2162
2160
  props: Rl,
2163
2161
  setup(e) {
@@ -2191,10 +2189,10 @@ const xl = (e) => {
2191
2189
  }, [s])]);
2192
2190
  };
2193
2191
  }
2194
- }), Pl = /* @__PURE__ */ I({
2192
+ }), Pl = /* @__PURE__ */ B({
2195
2193
  name: "MdEditorV3",
2196
- props: ut,
2197
- emits: mt,
2194
+ props: mt,
2195
+ emits: ft,
2198
2196
  setup(e, o) {
2199
2197
  const {
2200
2198
  editorId: n,
@@ -2206,16 +2204,16 @@ const xl = (e) => {
2206
2204
  } = e, f = Y({
2207
2205
  scrollAuto: e.scrollAuto
2208
2206
  });
2209
- ft(e, o), gt(e), ht(e);
2210
- const [d, u] = bt(e, o), k = vt(e);
2207
+ gt(e, o), ht(e), bt(e);
2208
+ const [d, u] = vt(e, o), k = kt(e);
2211
2209
  return Qe(() => {
2212
2210
  h.clear(n);
2213
- }), kt(e, o, k, d, u), () => {
2211
+ }), pt(e, o, k, d, u), () => {
2214
2212
  var v;
2215
- const $ = De({
2213
+ const $ = Ee({
2216
2214
  props: e,
2217
2215
  ctx: o
2218
- }, "defToolbars"), b = De({
2216
+ }, "defToolbars"), b = Ee({
2219
2217
  props: e,
2220
2218
  ctx: o
2221
2219
  }, "defFooters");
@@ -2223,7 +2221,7 @@ const xl = (e) => {
2223
2221
  id: n,
2224
2222
  class: [a, e.class, e.theme === "dark" && `${a}-dark`, d.fullscreen || d.pageFullscreen ? `${a}-fullscreen` : ""],
2225
2223
  style: e.style
2226
- }, [t(Wt, {
2224
+ }, [t(zt, {
2227
2225
  noPrettier: r,
2228
2226
  toolbars: e.toolbars,
2229
2227
  toolbarsExclude: e.toolbarsExclude,
@@ -2280,7 +2278,7 @@ const xl = (e) => {
2280
2278
  };
2281
2279
  }
2282
2280
  }), de = Pl;
2283
- de.install = (e) => (e.component(de.name, de), e.use(It).use(ot).use($t).use(Ye).use(pt), e);
2281
+ de.install = (e) => (e.component(de.name, de), e.use(Bt).use(ot).use(yt).use(Ye).use(Ct), e);
2284
2282
  export {
2285
2283
  de as default
2286
2284
  };
@@ -1,9 +1,9 @@
1
1
  import { M as x } from "./chunks/index.mjs";
2
2
  import "vue";
3
3
  import "./chunks/config.mjs";
4
- import "./chunks/event-bus.mjs";
5
- import "./chunks/dom.mjs";
6
4
  import "./chunks/index4.mjs";
5
+ import "./chunks/dom.mjs";
6
+ import "@vavt/util";
7
7
  import "medium-zoom";
8
8
  import "copy-to-clipboard";
9
9
  import "markdown-it";
@@ -3,7 +3,7 @@ import "vue";
3
3
  import "./chunks/config.mjs";
4
4
  import "./chunks/vue-tsx.mjs";
5
5
  import "./chunks/dom.mjs";
6
- import "./chunks/index4.mjs";
6
+ import "@vavt/util";
7
7
  export {
8
8
  e as default
9
9
  };
@@ -1,4 +1,4 @@
1
- import { d as E } from "./index4.mjs";
1
+ import { debounce as E } from "@vavt/util";
2
2
  const L = (e, d) => {
3
3
  const t = (n) => {
4
4
  const o = e.parentElement || document.body, i = o.offsetWidth, m = o.offsetHeight, { clientWidth: u } = document.documentElement, { clientHeight: l } = document.documentElement, p = n.offsetX, v = n.offsetY, a = (f) => {
@@ -1,9 +1,9 @@
1
1
  import { inject as I, onMounted as C, watch as $, toRef as W, nextTick as A, shallowRef as R, ref as L, computed as M, defineComponent as Z, createVNode as H, Fragment as le, reactive as J, provide as F, onBeforeUnmount as ie } from "vue";
2
2
  import { p as g, a as S, m as ce, k as N, e as B, h as se, f as j, i as ue, g as O, j as U, l as de, b as me, d as fe } from "./config.mjs";
3
- import { b } from "./event-bus.mjs";
4
- import { a as P, u as he } from "./dom.mjs";
5
- import pe from "medium-zoom";
6
- import { d as X, u as ge, a as ve } from "./index4.mjs";
3
+ import { u as he, g as pe, b } from "./index4.mjs";
4
+ import { a as P, u as ge } from "./dom.mjs";
5
+ import ve from "medium-zoom";
6
+ import { debounce as X } from "@vavt/util";
7
7
  import be from "copy-to-clipboard";
8
8
  import ye from "markdown-it";
9
9
  import we from "markdown-it-image-figures";
@@ -12,7 +12,7 @@ import $e from "lru-cache";
12
12
  const Q = "onSave", Y = "changeCatalogVisible", Ce = "changeFullscreen", V = "pageFullscreenChanged", G = "fullscreenChanged", D = "previewChanged", z = "htmlPreviewChanged", K = "catalogVisibleChanged", Se = "textareaFocus", Ie = (e, a) => {
13
13
  const l = I("editorId"), t = X(() => {
14
14
  const n = document.querySelectorAll(`#${l}-preview img`);
15
- n.length !== 0 && pe(n, {
15
+ n.length !== 0 && ve(n, {
16
16
  background: "#00000073"
17
17
  });
18
18
  });
@@ -54,7 +54,7 @@ const Q = "onSave", Y = "changeCatalogVisible", Ce = "changeFullscreen", V = "pa
54
54
  }), $(
55
55
  () => t.value.css,
56
56
  (c) => {
57
- he(`${g}-hlCss`, "href", c);
57
+ ge(`${g}-hlCss`, "href", c);
58
58
  }
59
59
  ), n;
60
60
  }, Fe = _e, He = (e) => {
@@ -99,7 +99,7 @@ const Q = "onSave", Y = "changeCatalogVisible", Ce = "changeFullscreen", V = "pa
99
99
  ).forEach(async (r) => {
100
100
  let d = c.get(r.innerText);
101
101
  if (!d) {
102
- const w = ge(), p = await (n.value.renderAsync || n.value.render)(w, r.innerText);
102
+ const w = he(), p = await (n.value.renderAsync || n.value.render)(w, r.innerText);
103
103
  d = typeof p == "string" ? p : p.svg, c.set(r.innerText, d);
104
104
  }
105
105
  const f = document.createElement("p");
@@ -310,7 +310,7 @@ const Q = "onSave", Y = "changeCatalogVisible", Ce = "changeFullscreen", V = "pa
310
310
  language: v,
311
311
  ignoreIllegals: !0
312
312
  }).value : y = u.value.highlightAuto(k).value : y = f.utils.escapeHtml(k);
313
- const T = o ? ve(y.trim()) : `<span class="code-block">${y.trim()}</span>`;
313
+ const T = o ? pe(y.trim()) : `<span class="code-block">${y.trim()}</span>`;
314
314
  return `<pre><code class="language-${v}" language=${v}>${T}</code></pre>`;
315
315
  }
316
316
  }), qe(f);