md-editor-v3 4.8.1 → 4.8.3-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,61 +1,61 @@
1
- import { inject as P, onMounted as S, watch as $, toRef as X, nextTick as B, shallowRef as M, ref as L, computed as H, defineComponent as Q, createVNode as x, Fragment as ue, reactive as Y, provide as F, onBeforeUnmount as de } from "vue";
2
- import { e as C, p, m as me, k as O, f as U, h as fe, s as j, a as pe, i as he, g as G, j as D, l as ge, b as ye, d as ve } from "./config.mjs";
3
- import { u as be, a as we, b as g, P as ke, C as V, B as A, O as ee, E as $e, U as Ce, c as te, d as z, F as W, e as K, H as q, f as Z, R as ne, h as Ie, T as Se } from "./index4.mjs";
4
- import { a as _, u as Ee } from "./dom.mjs";
5
- import Pe from "medium-zoom";
6
- import { debounce as oe } from "@vavt/util";
7
- import Te from "copy-to-clipboard";
8
- import _e from "markdown-it";
9
- import Fe from "markdown-it-image-figures";
10
- import He from "markdown-it-task-lists";
11
- import xe from "lru-cache";
12
- const Ae = (e, a) => {
13
- const l = P("editorId"), { noImgZoomIn: t } = e, n = oe(() => {
1
+ import { inject as P, onMounted as S, watch as C, toRef as Y, nextTick as O, shallowRef as R, ref as U, computed as H, defineComponent as ee, createVNode as A, Fragment as de, reactive as te, provide as F, onBeforeUnmount as me } from "vue";
2
+ import { e as I, p, m as fe, k as j, f as G, h as pe, s as D, a as he, i as ge, g as V, j as z, l as ye, b as ve, d as be } from "./config.mjs";
3
+ import { u as we, a as ke, b as g, P as $e, C as W, B as M, O as ne, E as Ce, U as Ie, c as oe, d as K, F as q, e as Z, H as J, f as X, R as re, h as Se, T as Ee } from "./index4.mjs";
4
+ import { a as _, u as Pe } from "./dom.mjs";
5
+ import Te from "medium-zoom";
6
+ import { debounce as ae } from "@vavt/util";
7
+ import _e from "copy-to-clipboard";
8
+ import Fe from "markdown-it";
9
+ import He from "markdown-it-image-figures";
10
+ import xe from "markdown-it-task-lists";
11
+ import Ae from "lru-cache";
12
+ const Me = (e, a) => {
13
+ const l = P("editorId"), { noImgZoomIn: t } = e, n = ae(() => {
14
14
  const r = document.querySelectorAll(`#${l}-preview img`);
15
- r.length !== 0 && Pe(r, {
15
+ r.length !== 0 && Te(r, {
16
16
  background: "#00000073"
17
17
  });
18
18
  });
19
19
  S(() => {
20
20
  !t && n();
21
- }), $([a, X(e.setting, "preview")], () => {
21
+ }), C([a, Y(e.setting, "preview")], () => {
22
22
  !t && n();
23
23
  });
24
- }, Me = Ae, Re = (e, a) => {
24
+ }, Re = Me, Be = (e, a) => {
25
25
  if (typeof a[e] == "string")
26
26
  return a[e];
27
27
  const l = `<i class="${p}-iconfont ${p}-icon-${e}"></i>`;
28
- switch (C.iconfontType) {
28
+ switch (I.iconfontType) {
29
29
  case "svg":
30
30
  return `<svg class="${p}-icon" aria-hidden="true"><use xlink:href="#${p}-icon-${e}"></use></svg>`;
31
31
  default:
32
32
  return l;
33
33
  }
34
- }, Be = (e, a) => {
34
+ }, Le = (e, a) => {
35
35
  const l = P("editorId"), t = P("usedLanguageText"), n = P("customIcon"), r = () => {
36
36
  document.querySelectorAll(`#${l}-preview pre`).forEach((u) => {
37
- var b, v;
37
+ var b, y;
38
38
  let s = -1;
39
39
  (b = u.querySelector(".copy-button")) == null || b.remove();
40
- const o = ((v = t.value.copyCode) == null ? void 0 : v.text) || "复制代码", d = document.createElement("span");
41
- d.setAttribute("class", "copy-button"), d.dataset.tips = o, d.innerHTML = Re("copy", n.value), d.addEventListener("click", () => {
42
- var y, w;
40
+ const o = ((y = t.value.copyCode) == null ? void 0 : y.text) || "复制代码", d = document.createElement("span");
41
+ d.setAttribute("class", "copy-button"), d.dataset.tips = o, d.innerHTML = Be("copy", n.value), d.addEventListener("click", () => {
42
+ var v, k;
43
43
  clearTimeout(s);
44
- const m = u.querySelector("code").innerText, h = Te(e.formatCopiedText(m)), f = ((y = t.value.copyCode) == null ? void 0 : y.successTips) || "已复制!", k = ((w = t.value.copyCode) == null ? void 0 : w.failTips) || "已复制!";
45
- d.dataset.tips = h ? f : k, s = window.setTimeout(() => {
44
+ const m = u.querySelector("code").innerText, h = _e(e.formatCopiedText(m)), f = ((v = t.value.copyCode) == null ? void 0 : v.successTips) || "已复制!", w = ((k = t.value.copyCode) == null ? void 0 : k.failTips) || "已复制!";
45
+ d.dataset.tips = h ? f : w, s = window.setTimeout(() => {
46
46
  d.dataset.tips = o;
47
47
  }, 1500);
48
48
  }), u.appendChild(d);
49
49
  });
50
50
  }, i = () => {
51
- B(r);
51
+ O(r);
52
52
  }, c = (u) => {
53
- u && B(r);
53
+ u && O(r);
54
54
  };
55
- $(() => a.value, i), $(() => e.setting.preview, c), $(() => e.setting.htmlPreview, c), $(() => t.value, r), S(r);
56
- }, Le = Be, Ne = (e) => {
55
+ C(() => a.value, i), C(() => e.setting.preview, c), C(() => e.setting.htmlPreview, c), C(() => t.value, r), S(r);
56
+ }, Ne = Le, Oe = (e) => {
57
57
  var r;
58
- const a = (r = C.editorExtensions) == null ? void 0 : r.highlight, l = a == null ? void 0 : a.instance, t = P("highlight"), n = M(l);
58
+ const a = (r = I.editorExtensions) == null ? void 0 : r.highlight, l = a == null ? void 0 : a.instance, t = P("highlight"), n = R(l);
59
59
  return S(() => {
60
60
  if (!e.noHighlight && !n.value) {
61
61
  const i = document.createElement("script");
@@ -65,14 +65,14 @@ const Ae = (e, a) => {
65
65
  const c = document.createElement("link");
66
66
  c.rel = "stylesheet", c.href = t.value.css, c.id = `${p}-hlCss`, _(c);
67
67
  }
68
- }), $(
68
+ }), C(
69
69
  () => t.value.css,
70
70
  (i) => {
71
- Ee(`${p}-hlCss`, "href", i);
71
+ Pe(`${p}-hlCss`, "href", i);
72
72
  }
73
73
  ), n;
74
- }, Oe = Ne, Ue = (e) => {
75
- const a = P("theme"), { editorExtensions: l } = C, t = l == null ? void 0 : l.mermaid, n = M(t == null ? void 0 : t.instance), r = M(-1), i = new xe({
74
+ }, Ue = Oe, je = (e) => {
75
+ const a = P("theme"), { editorExtensions: l } = I, t = l == null ? void 0 : l.mermaid, n = R(t == null ? void 0 : t.instance), r = R(-1), i = new Ae({
76
76
  max: 1e3,
77
77
  // 缓存10分钟
78
78
  ttl: 6e5
@@ -83,14 +83,14 @@ const Ae = (e, a) => {
83
83
  theme: a.value === "dark" ? "dark" : "default"
84
84
  }), r.value = r.value + 1);
85
85
  };
86
- return $(
86
+ return C(
87
87
  () => a.value,
88
88
  () => {
89
89
  i.clear(), c();
90
90
  }
91
91
  ), S(() => {
92
92
  if (!e.noMermaid && !(t != null && t.instance)) {
93
- const s = (t == null ? void 0 : t.js) || me;
93
+ const s = (t == null ? void 0 : t.js) || fe;
94
94
  if (/\.mjs/.test(s))
95
95
  import(
96
96
  /* @vite-ignore */
@@ -107,7 +107,7 @@ const Ae = (e, a) => {
107
107
  }
108
108
  }
109
109
  }), { mermaidRef: n, reRenderRef: r, replaceMermaid: () => {
110
- B(() => {
110
+ O(() => {
111
111
  if (!e.noMermaid && n.value) {
112
112
  const s = document.querySelectorAll(
113
113
  `div.${p}-mermaid`
@@ -115,36 +115,36 @@ const Ae = (e, a) => {
115
115
  o.style.width = document.body.offsetWidth + "px", o.style.height = document.body.offsetHeight + "px", o.style.position = "fixed", o.style.zIndex = "-10000", o.style.top = "-10000";
116
116
  let d = s.length;
117
117
  d > 0 && document.body.appendChild(o), s.forEach(async (b) => {
118
- let v = i.get(b.innerText);
119
- if (!v) {
120
- const h = be(), f = n.value.renderAsync || n.value.render;
121
- let k = "";
118
+ let y = i.get(b.innerText);
119
+ if (!y) {
120
+ const h = we(), f = n.value.renderAsync || n.value.render;
121
+ let w = "";
122
122
  try {
123
- k = await f(h, b.innerText, o);
123
+ w = await f(h, b.innerText, o);
124
124
  } catch {
125
125
  }
126
- v = typeof k == "string" ? k : k.svg, i.set(b.innerText, v);
126
+ y = typeof w == "string" ? w : w.svg, i.set(b.innerText, y);
127
127
  }
128
128
  const m = document.createElement("p");
129
- m.className = `${p}-mermaid`, m.setAttribute("data-processed", ""), m.innerHTML = v, b.dataset.line !== void 0 && (m.dataset.line = b.dataset.line), b.replaceWith(m), --d === 0 && o.remove();
129
+ m.className = `${p}-mermaid`, m.setAttribute("data-processed", ""), m.innerHTML = y, b.dataset.line !== void 0 && (m.dataset.line = b.dataset.line), b.replaceWith(m), --d === 0 && o.remove();
130
130
  });
131
131
  }
132
132
  });
133
133
  } };
134
- }, je = Ue, Ge = (e) => {
134
+ }, Ge = je, De = (e) => {
135
135
  var n;
136
- const a = (n = C.editorExtensions) == null ? void 0 : n.katex, l = a == null ? void 0 : a.instance, t = M(l);
136
+ const a = (n = I.editorExtensions) == null ? void 0 : n.katex, l = a == null ? void 0 : a.instance, t = R(l);
137
137
  return S(() => {
138
138
  if (!e.noKatex && !t.value) {
139
139
  const r = document.createElement("script");
140
- r.src = (a == null ? void 0 : a.js) || O.js, r.onload = () => {
140
+ r.src = (a == null ? void 0 : a.js) || j.js, r.onload = () => {
141
141
  t.value = window.katex;
142
142
  }, r.id = `${p}-katex`;
143
143
  const i = document.createElement("link");
144
- i.rel = "stylesheet", i.href = (a == null ? void 0 : a.css) || O.css, i.id = `${p}-katexCss`, _(r, "katex"), _(i);
144
+ i.rel = "stylesheet", i.href = (a == null ? void 0 : a.css) || j.css, i.id = `${p}-katexCss`, _(r, "katex"), _(i);
145
145
  }
146
146
  }), t;
147
- }, De = Ge, Ve = (e, a) => {
147
+ }, Ve = De, ze = (e, a) => {
148
148
  const l = e.renderer.rules.fence.bind(e.renderer.rules);
149
149
  e.renderer.rules.fence = (t, n, r, i, c) => {
150
150
  const u = t[n], s = u.content.trim();
@@ -154,18 +154,18 @@ const Ae = (e, a) => {
154
154
  }
155
155
  return l(t, n, r, i, c);
156
156
  };
157
- }, ze = Ve, J = (e, a) => {
157
+ }, We = ze, Q = (e, a) => {
158
158
  let l = !0, t = !0;
159
159
  const n = e.posMax, r = a > 0 ? e.src.charCodeAt(a - 1) : -1, i = a + 1 <= n ? e.src.charCodeAt(a + 1) : -1;
160
160
  return (r === 32 || r === 9 || i >= 48 && i <= 57) && (t = !1), (i === 32 || i === 9) && (l = !1), {
161
161
  can_open: l,
162
162
  can_close: t
163
163
  };
164
- }, We = (e, a) => {
164
+ }, Ke = (e, a) => {
165
165
  let l, t, n, r;
166
166
  if (e.src[e.pos] !== "$")
167
167
  return !1;
168
- if (n = J(e, e.pos), !n.can_open)
168
+ if (n = Q(e, e.pos), !n.can_open)
169
169
  return a || (e.pending += "$"), e.pos += 1, !0;
170
170
  const i = e.pos + 1;
171
171
  for (l = i; (l = e.src.indexOf("$", l)) !== -1; ) {
@@ -175,8 +175,8 @@ const Ae = (e, a) => {
175
175
  break;
176
176
  l += 1;
177
177
  }
178
- return l === -1 ? (a || (e.pending += "$"), e.pos = i, !0) : l - i === 0 ? (a || (e.pending += "$$"), e.pos = i + 1, !0) : (n = J(e, l), n.can_close ? (a || (t = e.push("math_inline", "math", 0), t.markup = "$", t.content = e.src.slice(i, l)), e.pos = l + 1, !0) : (a || (e.pending += "$"), e.pos = i, !0));
179
- }, Ke = (e, a, l, t) => {
178
+ return l === -1 ? (a || (e.pending += "$"), e.pos = i, !0) : l - i === 0 ? (a || (e.pending += "$$"), e.pos = i + 1, !0) : (n = Q(e, l), n.can_close ? (a || (t = e.push("math_inline", "math", 0), t.markup = "$", t.content = e.src.slice(i, l)), e.pos = l + 1, !0) : (a || (e.pending += "$"), e.pos = i, !0));
179
+ }, qe = (e, a, l, t) => {
180
180
  let n, r, i, c, u = !1, s = e.bMarks[a] + e.tShift[a], o = e.eMarks[a];
181
181
  if (s + 2 > o || e.src.slice(s, s + 2) !== "$$")
182
182
  return !1;
@@ -188,7 +188,7 @@ const Ae = (e, a) => {
188
188
  const d = e.push("math_block", "math", 0);
189
189
  return d.block = !0, d.content = (n && n.trim() ? n + `
190
190
  ` : "") + e.getLines(a + 1, i, e.tShift[a], !0) + (r && r.trim() ? r : ""), d.map = [a, e.line], d.markup = "$$", !0;
191
- }, qe = (e, a) => {
191
+ }, Ze = (e, a) => {
192
192
  const l = (n) => {
193
193
  if (a.katexRef.value) {
194
194
  const r = a.katexRef.value.renderToString(n, {
@@ -207,15 +207,15 @@ const Ae = (e, a) => {
207
207
  } else
208
208
  return `<p class="${p}-katex-block" data-line=${r}>${n}</p>`;
209
209
  };
210
- e.inline.ruler.after("escape", "math_inline", We), e.block.ruler.after("blockquote", "math_block", Ke, {
210
+ e.inline.ruler.after("escape", "math_inline", Ke), e.block.ruler.after("blockquote", "math_block", qe, {
211
211
  alt: ["paragraph", "reference", "blockquote", "list"]
212
212
  }), e.renderer.rules.math_inline = (n, r) => l(n[r].content), e.renderer.rules.math_block = (n, r) => t(n[r].content, n[r].map[0]) + `
213
213
  `;
214
- }, Ze = qe, Je = (e, a) => {
214
+ }, Je = Ze, Xe = (e, a) => {
215
215
  a = a || {};
216
216
  const l = 3, t = a.marker || "!", n = t.charCodeAt(0), r = t.length;
217
217
  let i = "", c = "";
218
- const u = (o, d, b, v, m) => {
218
+ const u = (o, d, b, y, m) => {
219
219
  const h = o[d];
220
220
  return h.type === "admonition_open" ? (o[d].attrPush([
221
221
  "class",
@@ -228,36 +228,36 @@ const Ae = (e, a) => {
228
228
  e.block.ruler.before(
229
229
  "code",
230
230
  "admonition",
231
- (o, d, b, v) => {
232
- let m, h, f, k = !1, y = o.bMarks[d] + o.tShift[d], w = o.eMarks[d];
233
- if (n !== o.src.charCodeAt(y))
231
+ (o, d, b, y) => {
232
+ let m, h, f, w = !1, v = o.bMarks[d] + o.tShift[d], k = o.eMarks[d];
233
+ if (n !== o.src.charCodeAt(v))
234
234
  return !1;
235
- for (m = y + 1; m <= w && t[(m - y) % r] === o.src[m]; m++)
235
+ for (m = v + 1; m <= k && t[(m - v) % r] === o.src[m]; m++)
236
236
  ;
237
- const I = Math.floor((m - y) / r);
238
- if (I !== l)
237
+ const $ = Math.floor((m - v) / r);
238
+ if ($ !== l)
239
239
  return !1;
240
- m -= (m - y) % r;
241
- const E = o.src.slice(y, m), T = o.src.slice(m, w);
242
- if (s(T), v)
240
+ m -= (m - v) % r;
241
+ const E = o.src.slice(v, m), T = o.src.slice(m, k);
242
+ if (s(T), y)
243
243
  return !0;
244
- for (h = d; h++, !(h >= b || (y = o.bMarks[h] + o.tShift[h], w = o.eMarks[h], y < w && o.sCount[h] < o.blkIndent)); )
245
- if (n === o.src.charCodeAt(y) && !(o.sCount[h] - o.blkIndent >= 4)) {
246
- for (m = y + 1; m <= w && t[(m - y) % r] === o.src[m]; m++)
244
+ for (h = d; h++, !(h >= b || (v = o.bMarks[h] + o.tShift[h], k = o.eMarks[h], v < k && o.sCount[h] < o.blkIndent)); )
245
+ if (n === o.src.charCodeAt(v) && !(o.sCount[h] - o.blkIndent >= 4)) {
246
+ for (m = v + 1; m <= k && t[(m - v) % r] === o.src[m]; m++)
247
247
  ;
248
- if (!(Math.floor((m - y) / r) < I) && (m -= (m - y) % r, m = o.skipSpaces(m), !(m < w))) {
249
- k = !0;
248
+ if (!(Math.floor((m - v) / r) < $) && (m -= (m - v) % r, m = o.skipSpaces(m), !(m < k))) {
249
+ w = !0;
250
250
  break;
251
251
  }
252
252
  }
253
- const N = o.parentType, se = o.lineMax;
254
- return o.parentType = "root", o.lineMax = h, f = o.push("admonition_open", "div", 1), f.markup = E, f.block = !0, f.info = i, f.map = [d, h], f = o.push("admonition_title_open", "p", 1), f.markup = E + " " + i, f.map = [d, h], f = o.push("inline", "", 0), f.content = c, f.map = [d, o.line - 1], f.children = [], f = o.push("admonition_title_close", "p", -1), f.markup = E + " " + i, o.md.block.tokenize(o, d + 1, h), f = o.push("admonition_close", "div", -1), f.markup = o.src.slice(y, m), f.block = !0, o.parentType = N, o.lineMax = se, o.line = h + (k ? 1 : 0), !0;
253
+ const x = o.parentType, B = o.lineMax;
254
+ return o.parentType = "root", o.lineMax = h, f = o.push("admonition_open", "div", 1), f.markup = E, f.block = !0, f.info = i, f.map = [d, h], f = o.push("admonition_title_open", "p", 1), f.markup = E + " " + i, f.map = [d, h], f = o.push("inline", "", 0), f.content = c, f.map = [d, o.line - 1], f.children = [], f = o.push("admonition_title_close", "p", -1), f.markup = E + " " + i, o.md.block.tokenize(o, d + 1, h), f = o.push("admonition_close", "div", -1), f.markup = o.src.slice(v, m), f.block = !0, o.parentType = x, o.lineMax = B, o.line = h + (w ? 1 : 0), !0;
255
255
  },
256
256
  {
257
257
  alt: ["paragraph", "reference", "blockquote", "list"]
258
258
  }
259
259
  ), e.renderer.rules.admonition_open = u, e.renderer.rules.admonition_title_open = u, e.renderer.rules.admonition_title_close = u, e.renderer.rules.admonition_close = u;
260
- }, Xe = Je, Qe = (e, a) => {
260
+ }, Qe = Xe, Ye = (e, a) => {
261
261
  e.renderer.rules.heading_open = (l, t) => {
262
262
  var c;
263
263
  const n = l[t], r = ((c = l[t + 1].children) == null ? void 0 : c.reduce((u, s) => u + (s.content || ""), "")) || "", i = n.markup.length;
@@ -269,7 +269,7 @@ const Ae = (e, a) => {
269
269
  a.mdHeadingId(r, i, a.headsRef.value.length)
270
270
  )), e.renderer.renderToken(l, t, a);
271
271
  }, e.renderer.rules.heading_close = (l, t, n, r, i) => i.renderToken(l, t, n);
272
- }, Ye = Qe, et = (e, a) => {
272
+ }, et = Ye, tt = (e, a) => {
273
273
  const l = e.renderer.rules.fence, t = e.utils.unescapeAll, n = /\[(\w*)(?::([\w ]*))?\]/;
274
274
  function r(s) {
275
275
  return s.info ? t(s.info).trim() : "";
@@ -282,24 +282,24 @@ const Ae = (e, a) => {
282
282
  const o = r(s);
283
283
  return o ? o.split(/(\s+)/g)[0] : "";
284
284
  }
285
- const u = (s, o, d, b, v) => {
285
+ const u = (s, o, d, b, y) => {
286
286
  if (s[o].hidden)
287
287
  return "";
288
288
  const [m, h] = i(s[o]);
289
289
  if (m === null)
290
- return l(s, o, d, b, v);
291
- let f, k, y, w, I = "", E = "";
292
- for (let T = o; T < s.length && (f = s[T], [k, y] = i(f), k === m); T++)
293
- f.info = f.info.replace(n, ""), f.hidden = !0, w = T - o > 0 ? "" : " checked", I += `<li><input type="radio" name="label-group-${a.editorId}-${o}"${w}><label for="group-${a.editorId}-${o}-tab-${T - o}" onclick="this.previousElementSibling.click()">${y || c(f)}</label></li>
294
- `, E += `<input type="radio" id="group-${a.editorId}-${o}-tab-${T - o}" name="group-${a.editorId}-${o}"${w}>
295
- ` + l(s, T, d, b, v);
290
+ return l(s, o, d, b, y);
291
+ let f, w, v, k, $ = "", E = "";
292
+ for (let T = o; T < s.length && (f = s[T], [w, v] = i(f), w === m); T++)
293
+ f.info = f.info.replace(n, ""), f.hidden = !0, k = T - o > 0 ? "" : " checked", $ += `<li><input type="radio" name="label-group-${a.editorId}-${o}"${k}><label for="group-${a.editorId}-${o}-tab-${T - o}" onclick="this.previousElementSibling.click()">${v || c(f)}</label></li>
294
+ `, E += `<input type="radio" id="group-${a.editorId}-${o}-tab-${T - o}" name="group-${a.editorId}-${o}"${k}>
295
+ ` + l(s, T, d, b, y);
296
296
  return `<div class="code-tabs">
297
297
  <ul>
298
- ` + I + `</ul>
298
+ ` + $ + `</ul>
299
299
  ` + E + "</div>";
300
300
  };
301
301
  e.renderer.rules.fence = u;
302
- }, tt = et, nt = (e) => {
302
+ }, nt = tt, ot = (e) => {
303
303
  [
304
304
  "paragraph_open",
305
305
  "table_open",
@@ -320,80 +320,87 @@ const Ae = (e, a) => {
320
320
  return t[n].map && t[n].level === 0 && (u = t[n].map[0], t[n].attrSet("data-line", String(u))), c.renderToken(t, n, r);
321
321
  };
322
322
  });
323
- }, ot = (e, a) => {
324
- const { editorConfig: l, markdownItConfig: t, markdownItPlugins: n } = C, r = P("editorId"), i = P("showCodeRowNumber"), c = P("theme"), u = L([]), s = Oe(e), o = De(e), { reRenderRef: d, replaceMermaid: b } = je(e), v = _e({
323
+ }, rt = (e, a) => {
324
+ const { editorConfig: l, markdownItConfig: t, markdownItPlugins: n } = I, r = P("editorId"), i = P("showCodeRowNumber"), c = P("theme"), u = U([]), s = Ue(e), o = Ve(e), { reRenderRef: d, replaceMermaid: b } = Ge(e), y = Fe({
325
325
  html: !0,
326
326
  breaks: !0
327
327
  });
328
- t(v);
328
+ t(y);
329
329
  const m = [
330
330
  {
331
331
  type: "katex",
332
- plugin: Ze,
332
+ plugin: Je,
333
333
  options: { katexRef: o }
334
334
  },
335
335
  {
336
336
  type: "image",
337
- plugin: Fe,
337
+ plugin: He,
338
338
  options: { figcaption: !0, classes: "md-zoom" }
339
339
  },
340
340
  {
341
341
  type: "admonition",
342
- plugin: Xe,
342
+ plugin: Qe,
343
343
  options: {}
344
344
  },
345
345
  {
346
346
  type: "taskList",
347
- plugin: He,
347
+ plugin: xe,
348
348
  options: {}
349
349
  },
350
350
  {
351
351
  type: "heading",
352
- plugin: Ye,
352
+ plugin: et,
353
353
  options: { mdHeadingId: e.mdHeadingId, headsRef: u }
354
354
  },
355
355
  {
356
356
  type: "codeTabs",
357
- plugin: tt,
357
+ plugin: nt,
358
358
  options: { editorId: r }
359
359
  }
360
360
  ];
361
361
  e.noMermaid || m.push({
362
362
  type: "mermaid",
363
- plugin: ze,
363
+ plugin: We,
364
364
  options: { themeRef: c }
365
- }), n(m).forEach((w) => {
366
- v.use(w.plugin, w.options);
367
- }), v.set({
368
- highlight: (w, I) => {
369
- let E;
370
- !e.noHighlight && s.value ? s.value.getLanguage(I) ? E = s.value.highlight(w, {
371
- language: I,
365
+ }), n(m).forEach(($) => {
366
+ y.use($.plugin, $.options);
367
+ });
368
+ const h = y.options.highlight;
369
+ y.set({
370
+ highlight: ($, E, T) => {
371
+ if (h) {
372
+ const L = h($, E, T);
373
+ if (L)
374
+ return L;
375
+ }
376
+ let x;
377
+ !e.noHighlight && s.value ? s.value.getLanguage(E) ? x = s.value.highlight($, {
378
+ language: E,
372
379
  ignoreIllegals: !0
373
- }).value : E = s.value.highlightAuto(w).value : E = v.utils.escapeHtml(w);
374
- const T = i ? we(E.replace(/^\n+|\n+$/g, "")) : `<span class="code-block">${E.replace(/^\n+|\n+$/g, "")}</span>`;
375
- return `<pre><code class="language-${I}" language=${I}>${T}</code></pre>`;
380
+ }).value : x = s.value.highlightAuto($).value : x = y.utils.escapeHtml($);
381
+ const B = i ? ke(x.replace(/^\n+|\n+$/g, "")) : `<span class="code-block">${x.replace(/^\n+|\n+$/g, "")}</span>`;
382
+ return `<pre><code class="language-${E}" language=${E}>${B}</code></pre>`;
376
383
  }
377
- }), nt(v);
378
- const h = L(e.sanitize(v.render(e.modelValue))), f = () => {
379
- g.emit(r, A, h.value), e.onHtmlChanged(h.value), e.onGetCatalog(u.value), g.emit(r, V, u.value), b();
384
+ }), ot(y);
385
+ const f = U(e.sanitize(y.render(e.modelValue))), w = () => {
386
+ g.emit(r, M, f.value), e.onHtmlChanged(f.value), e.onGetCatalog(u.value), g.emit(r, W, u.value), b();
380
387
  };
381
- S(f);
382
- const k = oe(
388
+ S(w);
389
+ const v = ae(
383
390
  async () => {
384
- u.value = [], h.value = e.sanitize(v.render(e.modelValue)), f();
391
+ u.value = [], f.value = e.sanitize(y.render(e.modelValue)), w();
385
392
  },
386
393
  (l == null ? void 0 : l.renderDelay) !== void 0 ? l == null ? void 0 : l.renderDelay : a ? 0 : 500
387
- ), y = H(() => (e.noKatex || o.value) && (e.noHighlight || s.value));
388
- return $([X(e, "modelValue"), y, d], k), S(() => {
394
+ ), k = H(() => (e.noKatex || o.value) && (e.noHighlight || s.value));
395
+ return C([Y(e, "modelValue"), k, d], v), S(() => {
389
396
  g.on(r, {
390
- name: ke,
397
+ name: $e,
391
398
  callback() {
392
- g.emit(r, V, u.value);
399
+ g.emit(r, W, u.value);
393
400
  }
394
401
  });
395
- }), { html: h };
396
- }, rt = ot, re = {
402
+ }), { html: f };
403
+ }, at = rt, le = {
397
404
  modelValue: {
398
405
  type: String,
399
406
  default: ""
@@ -444,8 +451,8 @@ const Ae = (e, a) => {
444
451
  noImgZoomIn: {
445
452
  type: Boolean
446
453
  }
447
- }, bt = {
448
- ...re,
454
+ }, wt = {
455
+ ...le,
449
456
  onChange: {
450
457
  type: Function,
451
458
  default: () => {
@@ -516,61 +523,61 @@ const Ae = (e, a) => {
516
523
  onInputBoxWitdhChange: {
517
524
  type: Function
518
525
  }
519
- }, at = /* @__PURE__ */ Q({
526
+ }, lt = /* @__PURE__ */ ee({
520
527
  name: "ContentPreview",
521
- props: re,
528
+ props: le,
522
529
  setup(e) {
523
530
  const a = P("editorId"), l = P("previewTheme"), t = P("showCodeRowNumber"), {
524
531
  html: n
525
- } = rt(e, e.previewOnly);
526
- return Le(e, n), Me(e, n), () => x(ue, null, [x("div", {
532
+ } = at(e, e.previewOnly);
533
+ return Ne(e, n), Re(e, n), () => A(de, null, [A("div", {
527
534
  id: `${a}-preview-wrapper`,
528
535
  class: `${p}-preview-wrapper`,
529
536
  "data-show": e.setting.preview,
530
537
  key: "content-preview-wrapper"
531
- }, [x("article", {
538
+ }, [A("article", {
532
539
  id: `${a}-preview`,
533
540
  class: [`${p}-preview`, `${l == null ? void 0 : l.value}-theme`, t && `${p}-scrn`],
534
541
  innerHTML: n.value
535
- }, null)]), !e.previewOnly && x("div", {
542
+ }, null)]), !e.previewOnly && A("div", {
536
543
  id: `${a}-html-wrapper`,
537
544
  class: `${p}-preview-wrapper`,
538
545
  "data-show": e.setting.htmlPreview,
539
546
  key: "html-preview-wrapper"
540
- }, [x("div", {
547
+ }, [A("div", {
541
548
  class: `${p}-html`
542
549
  }, [n.value])])]);
543
550
  }
544
- }), wt = (e, a) => {
545
- const { editorId: l } = e, t = Y({
551
+ }), kt = (e, a) => {
552
+ const { editorId: l } = e, t = te({
546
553
  // 是否已编译成html
547
554
  buildFinished: !1,
548
555
  // 存储当前最新的html
549
556
  html: ""
550
557
  });
551
- $(
558
+ C(
552
559
  () => e.modelValue,
553
560
  () => {
554
561
  t.buildFinished = !1;
555
562
  }
556
563
  ), S(() => {
557
564
  g.on(l, {
558
- name: A,
565
+ name: M,
559
566
  callback(n) {
560
567
  t.buildFinished = !0, t.html = n;
561
568
  }
562
569
  }), g.on(l, {
563
- name: ee,
570
+ name: ne,
564
571
  callback() {
565
572
  const n = new Promise((r) => {
566
573
  if (t.buildFinished)
567
574
  r(t.html);
568
575
  else {
569
576
  const i = (c) => {
570
- r(c), g.remove(l, A, i);
577
+ r(c), g.remove(l, M, i);
571
578
  };
572
579
  g.on(l, {
573
- name: A,
580
+ name: M,
574
581
  callback: i
575
582
  });
576
583
  }
@@ -579,9 +586,9 @@ const Ae = (e, a) => {
579
586
  }
580
587
  });
581
588
  });
582
- }, ae = (e) => {
589
+ }, ie = (e) => {
583
590
  var n, r;
584
- const { editorId: a } = e, l = (r = (n = C) == null ? void 0 : n.editorExtensions) == null ? void 0 : r.highlight;
591
+ const { editorId: a } = e, l = (r = (n = I) == null ? void 0 : n.editorExtensions) == null ? void 0 : r.highlight;
585
592
  F("editorId", a), F(
586
593
  "theme",
587
594
  H(() => e.theme)
@@ -592,22 +599,22 @@ const Ae = (e, a) => {
592
599
  "highlight",
593
600
  H(() => {
594
601
  const i = {
595
- ...U,
602
+ ...G,
596
603
  ...l == null ? void 0 : l.css
597
604
  }, c = e.codeStyleReverse && e.codeStyleReverseList.includes(e.previewTheme) ? "dark" : e.theme;
598
605
  return {
599
- js: (l == null ? void 0 : l.js) || fe,
600
- css: i[e.codeTheme] ? i[e.codeTheme][c] : U.atom[c]
606
+ js: (l == null ? void 0 : l.js) || pe,
607
+ css: i[e.codeTheme] ? i[e.codeTheme][c] : G.atom[c]
601
608
  };
602
609
  })
603
610
  ), F("showCodeRowNumber", e.showCodeRowNumber);
604
611
  const t = H(() => {
605
612
  var c, u;
606
613
  const i = {
607
- ...j,
608
- ...(u = (c = C) == null ? void 0 : c.editorConfig) == null ? void 0 : u.languageUserDefined
614
+ ...D,
615
+ ...(u = (c = I) == null ? void 0 : c.editorConfig) == null ? void 0 : u.languageUserDefined
609
616
  };
610
- return i[e.language] ? i[e.language] : j["zh-CN"];
617
+ return i[e.language] ? i[e.language] : D["zh-CN"];
611
618
  });
612
619
  F("usedLanguageText", t), F(
613
620
  "previewTheme",
@@ -616,44 +623,44 @@ const Ae = (e, a) => {
616
623
  "customIcon",
617
624
  H(() => e.customIcon)
618
625
  );
619
- }, kt = (e) => {
620
- ae(e), F("tabWidth", e.tabWidth);
621
- }, le = (e) => {
626
+ }, $t = (e) => {
627
+ ie(e), F("tabWidth", e.tabWidth);
628
+ }, ce = (e) => {
622
629
  S(() => {
623
630
  var a, l;
624
631
  if (!e.noIconfont)
625
- if (C.iconfontType === "svg") {
632
+ if (I.iconfontType === "svg") {
626
633
  const t = document.createElement("script");
627
- t.src = ((a = C.editorExtensions) == null ? void 0 : a.iconfont) || pe, t.id = `${p}-icon`, _(t);
634
+ t.src = ((a = I.editorExtensions) == null ? void 0 : a.iconfont) || he, t.id = `${p}-icon`, _(t);
628
635
  } else {
629
636
  const t = document.createElement("link");
630
- t.rel = "stylesheet", t.href = ((l = C.editorExtensions) == null ? void 0 : l.iconfontClass) || he, t.id = `${p}-icon-class`, _(t);
637
+ t.rel = "stylesheet", t.href = ((l = I.editorExtensions) == null ? void 0 : l.iconfontClass) || ge, t.id = `${p}-icon-class`, _(t);
631
638
  }
632
639
  });
633
- }, $t = (e) => {
640
+ }, Ct = (e) => {
634
641
  var c, u, s, o, d, b;
635
- const { noPrettier: a, noUploadImg: l } = e, { editorExtensions: t } = C, n = a || !!((u = (c = C.editorExtensions) == null ? void 0 : c.prettier) != null && u.prettierInstance), r = a || !!((o = (s = C.editorExtensions) == null ? void 0 : s.prettier) != null && o.parserMarkdownInstance), i = l || !!((b = (d = C.editorExtensions) == null ? void 0 : d.cropper) != null && b.instance);
642
+ const { noPrettier: a, noUploadImg: l } = e, { editorExtensions: t } = I, n = a || !!((u = (c = I.editorExtensions) == null ? void 0 : c.prettier) != null && u.prettierInstance), r = a || !!((o = (s = I.editorExtensions) == null ? void 0 : s.prettier) != null && o.parserMarkdownInstance), i = l || !!((b = (d = I.editorExtensions) == null ? void 0 : d.cropper) != null && b.instance);
636
643
  S(() => {
637
- var k, y, w, I;
638
- const v = document.createElement("script"), m = document.createElement("script");
639
- v.src = ((k = t == null ? void 0 : t.prettier) == null ? void 0 : k.standaloneJs) || G.main, v.id = `${p}-prettier`, m.src = ((y = t == null ? void 0 : t.prettier) == null ? void 0 : y.parserMarkdownJs) || G.markdown, m.id = `${p}-prettierMD`;
644
+ var w, v, k, $;
645
+ const y = document.createElement("script"), m = document.createElement("script");
646
+ y.src = ((w = t == null ? void 0 : t.prettier) == null ? void 0 : w.standaloneJs) || V.main, y.id = `${p}-prettier`, m.src = ((v = t == null ? void 0 : t.prettier) == null ? void 0 : v.parserMarkdownJs) || V.markdown, m.id = `${p}-prettierMD`;
640
647
  const h = document.createElement("link");
641
- h.rel = "stylesheet", h.href = ((w = t == null ? void 0 : t.cropper) == null ? void 0 : w.css) || D.css, h.id = `${p}-cropperCss`;
648
+ h.rel = "stylesheet", h.href = ((k = t == null ? void 0 : t.cropper) == null ? void 0 : k.css) || z.css, h.id = `${p}-cropperCss`;
642
649
  const f = document.createElement("script");
643
- f.src = ((I = t == null ? void 0 : t.cropper) == null ? void 0 : I.js) || D.js, f.id = `${p}-cropper`, i || (_(h), _(f)), n || _(v), r || _(m);
644
- }), le(e);
645
- }, Ct = (e, a) => {
650
+ f.src = (($ = t == null ? void 0 : t.cropper) == null ? void 0 : $.js) || z.js, f.id = `${p}-cropper`, i || (_(h), _(f)), n || _(y), r || _(m);
651
+ }), ce(e);
652
+ }, It = (e, a) => {
646
653
  const { editorId: l } = e;
647
654
  S(() => {
648
655
  g.on(l, {
649
- name: $e,
656
+ name: Ce,
650
657
  callback: (t) => {
651
658
  e.onError instanceof Function ? e.onError(t) : a.emit("onError", t);
652
659
  }
653
660
  });
654
661
  });
655
- }, It = (e, a) => {
656
- const { editorId: l } = e, t = Y({
662
+ }, St = (e, a) => {
663
+ const { editorId: l } = e, t = te({
657
664
  pageFullscreen: e.pageFullscreen,
658
665
  fullscreen: !1,
659
666
  preview: e.preview,
@@ -665,12 +672,12 @@ const Ae = (e, a) => {
665
672
  const i = () => {
666
673
  t.pageFullscreen || t.fullscreen ? document.body.style.overflow = "hidden" : document.body.style.overflow = r;
667
674
  };
668
- return $(() => [t.pageFullscreen, t.fullscreen], i), S(() => {
675
+ return C(() => [t.pageFullscreen, t.fullscreen], i), S(() => {
669
676
  g.on(l, {
670
- name: Ce,
677
+ name: Ie,
671
678
  callback(c, u) {
672
679
  const s = (o) => {
673
- g.emit(l, ne, "image", {
680
+ g.emit(l, re, "image", {
674
681
  desc: "",
675
682
  urls: o
676
683
  }), u && u();
@@ -679,47 +686,47 @@ const Ae = (e, a) => {
679
686
  }
680
687
  }), r = document.body.style.overflow, i();
681
688
  }), [t, n];
682
- }, St = (e) => {
683
- const { editorId: a } = e, l = L(!1);
689
+ }, Et = (e) => {
690
+ const { editorId: a } = e, l = U(!1);
684
691
  return S(() => {
685
692
  g.on(a, {
686
- name: te,
693
+ name: oe,
687
694
  callback: (n) => {
688
695
  n === void 0 ? l.value = !l.value : l.value = n;
689
696
  }
690
697
  });
691
698
  }), H(() => !e.toolbarsExclude.includes("catalog") && e.toolbars.includes("catalog") && l.value);
692
- }, Et = (e, a, l, t, n) => {
699
+ }, Pt = (e, a, l, t, n) => {
693
700
  const { editorId: r } = e;
694
- $(
701
+ C(
695
702
  () => t.pageFullscreen,
696
703
  (c) => {
697
- g.emit(r, z, c);
704
+ g.emit(r, K, c);
698
705
  }
699
- ), $(
706
+ ), C(
700
707
  () => t.fullscreen,
701
708
  (c) => {
702
- g.emit(r, W, c);
709
+ g.emit(r, q, c);
703
710
  }
704
- ), $(
711
+ ), C(
705
712
  () => t.preview,
706
713
  (c) => {
707
- g.emit(r, K, c);
714
+ g.emit(r, Z, c);
708
715
  }
709
- ), $(
716
+ ), C(
710
717
  () => t.htmlPreview,
711
718
  (c) => {
712
- g.emit(r, q, c);
719
+ g.emit(r, J, c);
713
720
  }
714
- ), $(l, (c) => {
715
- g.emit(r, Z, c);
721
+ ), C(l, (c) => {
722
+ g.emit(r, X, c);
716
723
  });
717
724
  const i = {
718
725
  on(c, u) {
719
726
  switch (c) {
720
727
  case "pageFullscreen": {
721
728
  g.on(r, {
722
- name: z,
729
+ name: K,
723
730
  callback(s) {
724
731
  u(s);
725
732
  }
@@ -728,7 +735,7 @@ const Ae = (e, a) => {
728
735
  }
729
736
  case "fullscreen": {
730
737
  g.on(r, {
731
- name: W,
738
+ name: q,
732
739
  callback(s) {
733
740
  u(s);
734
741
  }
@@ -737,7 +744,7 @@ const Ae = (e, a) => {
737
744
  }
738
745
  case "preview": {
739
746
  g.on(r, {
740
- name: K,
747
+ name: Z,
741
748
  callback(s) {
742
749
  u(s);
743
750
  }
@@ -746,7 +753,7 @@ const Ae = (e, a) => {
746
753
  }
747
754
  case "htmlPreview": {
748
755
  g.on(r, {
749
- name: q,
756
+ name: J,
750
757
  callback(s) {
751
758
  u(s);
752
759
  }
@@ -755,7 +762,7 @@ const Ae = (e, a) => {
755
762
  }
756
763
  case "catalog": {
757
764
  g.on(r, {
758
- name: Z,
765
+ name: X,
759
766
  callback(s) {
760
767
  u(s);
761
768
  }
@@ -768,7 +775,7 @@ const Ae = (e, a) => {
768
775
  n("pageFullscreen", c);
769
776
  },
770
777
  toggleFullscreen(c) {
771
- g.emit(r, Ie, c);
778
+ g.emit(r, Se, c);
772
779
  },
773
780
  togglePreview(c) {
774
781
  n("preview", c);
@@ -777,20 +784,20 @@ const Ae = (e, a) => {
777
784
  n("htmlPreview", c);
778
785
  },
779
786
  toggleCatalog(c) {
780
- g.emit(r, te, c);
787
+ g.emit(r, oe, c);
781
788
  },
782
789
  triggerSave() {
783
- g.emit(r, ee);
790
+ g.emit(r, ne);
784
791
  },
785
792
  insert(c) {
786
- g.emit(r, ne, "universal", { generate: c });
793
+ g.emit(r, re, "universal", { generate: c });
787
794
  },
788
795
  focus(c) {
789
- g.emit(r, Se, c);
796
+ g.emit(r, Ee, c);
790
797
  }
791
798
  };
792
799
  a.expose(i);
793
- }, lt = (e) => e, ie = {
800
+ }, it = (e) => e, se = {
794
801
  /**
795
802
  * markdown content.
796
803
  *
@@ -846,7 +853,7 @@ const Ae = (e, a) => {
846
853
  */
847
854
  editorId: {
848
855
  type: String,
849
- default: ge
856
+ default: ye
850
857
  },
851
858
  /**
852
859
  * 预览中代码是否显示行号
@@ -880,7 +887,7 @@ const Ae = (e, a) => {
880
887
  */
881
888
  mdHeadingId: {
882
889
  type: Function,
883
- default: lt
890
+ default: it
884
891
  },
885
892
  /**
886
893
  *
@@ -974,8 +981,8 @@ const Ae = (e, a) => {
974
981
  type: Object,
975
982
  default: {}
976
983
  }
977
- }, Pt = {
978
- ...ie,
984
+ }, Tt = {
985
+ ...se,
979
986
  /**
980
987
  * input回调事件
981
988
  */
@@ -1039,7 +1046,7 @@ const Ae = (e, a) => {
1039
1046
  */
1040
1047
  toolbars: {
1041
1048
  type: Array,
1042
- default: ye
1049
+ default: ve
1043
1050
  },
1044
1051
  /**
1045
1052
  * 工具栏选择不显示
@@ -1103,7 +1110,7 @@ const Ae = (e, a) => {
1103
1110
  */
1104
1111
  footers: {
1105
1112
  type: Array,
1106
- default: ve
1113
+ default: be
1107
1114
  },
1108
1115
  /**
1109
1116
  * 是否默认激活输入框和预览框同步滚动
@@ -1226,8 +1233,8 @@ const Ae = (e, a) => {
1226
1233
  onInputBoxWitdhChange: {
1227
1234
  type: Function
1228
1235
  }
1229
- }, ce = ["onHtmlChanged", "onGetCatalog"], Tt = [
1230
- ...ce,
1236
+ }, ue = ["onHtmlChanged", "onGetCatalog"], _t = [
1237
+ ...ue,
1231
1238
  "onChange",
1232
1239
  "onSave",
1233
1240
  "onUploadImg",
@@ -1238,10 +1245,10 @@ const Ae = (e, a) => {
1238
1245
  "onInput",
1239
1246
  "onDrop",
1240
1247
  "onInputBoxWitdhChange"
1241
- ], it = /* @__PURE__ */ Q({
1248
+ ], ct = /* @__PURE__ */ ee({
1242
1249
  name: "MdPreview",
1243
- props: ie,
1244
- emits: ce,
1250
+ props: se,
1251
+ emits: ue,
1245
1252
  setup(e, a) {
1246
1253
  const {
1247
1254
  editorId: l,
@@ -1249,13 +1256,13 @@ const Ae = (e, a) => {
1249
1256
  noMermaid: n,
1250
1257
  noHighlight: r
1251
1258
  } = e;
1252
- return ae(e), le(e), de(() => {
1259
+ return ie(e), ce(e), me(() => {
1253
1260
  g.clear(l);
1254
- }), () => x("div", {
1261
+ }), () => A("div", {
1255
1262
  id: l,
1256
1263
  class: [p, e.class, e.theme === "dark" && `${p}-dark`, `${p}-previewOnly`],
1257
1264
  style: e.style
1258
- }, [x(at, {
1265
+ }, [A(lt, {
1259
1266
  modelValue: e.modelValue,
1260
1267
  onHtmlChanged: (i) => {
1261
1268
  e.onHtmlChanged ? e.onHtmlChanged(i) : a.emit("onHtmlChanged", i);
@@ -1273,19 +1280,19 @@ const Ae = (e, a) => {
1273
1280
  previewOnly: !0
1274
1281
  }, null)]);
1275
1282
  }
1276
- }), R = it;
1277
- R.install = (e) => (e.component(R.name, R), e);
1283
+ }), N = ct;
1284
+ N.install = (e) => (e.component(N.name, N), e);
1278
1285
  export {
1279
- at as C,
1280
- R as M,
1281
- Tt as a,
1282
- kt as b,
1283
- bt as c,
1284
- $t as d,
1285
- Pt as e,
1286
- Ct as f,
1287
- It as g,
1288
- St as h,
1289
- Et as i,
1290
- wt as u
1286
+ lt as C,
1287
+ N as M,
1288
+ _t as a,
1289
+ $t as b,
1290
+ wt as c,
1291
+ Ct as d,
1292
+ Tt as e,
1293
+ It as f,
1294
+ St as g,
1295
+ Et as h,
1296
+ Pt as i,
1297
+ kt as u
1291
1298
  };