md-editor-v3 4.11.2 → 4.11.3

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,16 +1,17 @@
1
- import { inject as _, onMounted as P, watch as C, toRef as te, nextTick as U, shallowRef as B, ref as R, computed as F, defineComponent as ne, createVNode as M, Fragment as pe, reactive as oe, provide as H, onBeforeUnmount as he } from "vue";
1
+ import { inject as _, onMounted as P, watch as I, nextTick as j, shallowRef as B, ref as R, computed as H, toRef as fe, defineComponent as te, createVNode as M, Fragment as pe, reactive as ne, provide as x, onBeforeUnmount as he } from "vue";
2
2
  import { e as S, p as h, m as ge, k as D, f as V, h as ye, s as z, a as ve, i as be, g as W, j as K, l as we, b as ke, d as $e } from "./config.mjs";
3
- import { a as Ce, b as y, P as Ie, C as q, R as G, B as A, O as re, E as Se, U as Ee, c as ae, d as Z, F as J, e as Q, H as X, f as Y, h as le, i as Pe } from "./index4.mjs";
3
+ import { a as Ce, b as y, P as Ie, C as q, R as G, B as A, O as oe, E as Se, U as Ee, c as re, d as Z, F as J, e as X, H as Q, f as Y, h as ae, i as Pe } from "./index4.mjs";
4
4
  import { a as T, u as _e } from "./dom.mjs";
5
5
  import Te from "medium-zoom";
6
- import { debounce as ie, uuid as j } from "@vavt/util";
7
- import He from "copy-to-clipboard";
8
- import Fe from "markdown-it";
9
- import xe from "markdown-it-image-figures";
6
+ import { debounce as le, uuid as U } from "@vavt/util";
7
+ import xe from "copy-to-clipboard";
8
+ import He from "markdown-it";
9
+ import Fe from "markdown-it-image-figures";
10
10
  import Me from "markdown-it-task-lists";
11
- import Re from "lru-cache";
12
- const Ae = (e, a) => {
13
- const l = _("editorId"), { noImgZoomIn: t } = e, n = ie(() => {
11
+ import Re from "markdown-it-xss";
12
+ import Ae from "lru-cache";
13
+ const Be = (e, a) => {
14
+ const l = _("editorId"), { noImgZoomIn: t } = e, n = le(() => {
14
15
  const i = document.querySelectorAll(`#${l}-preview img`);
15
16
  i.length !== 0 && Te(i, {
16
17
  background: "#00000073"
@@ -18,10 +19,10 @@ const Ae = (e, a) => {
18
19
  });
19
20
  P(() => {
20
21
  !t && e.setting.preview && n();
21
- }), C([a, te(e.setting, "preview")], () => {
22
+ }), I([a], () => {
22
23
  !t && n();
23
24
  });
24
- }, Be = Ae, Le = (e, a) => {
25
+ }, Le = Be, Ne = (e, a) => {
25
26
  if (typeof a[e] == "string")
26
27
  return a[e];
27
28
  const l = `<i class="${h}-iconfont ${h}-icon-${e}"></i>`;
@@ -31,29 +32,29 @@ const Ae = (e, a) => {
31
32
  default:
32
33
  return l;
33
34
  }
34
- }, Ne = (e, a, l) => {
35
+ }, Oe = (e, a, l) => {
35
36
  const t = _("editorId"), n = _("usedLanguageText"), i = _("customIcon"), r = () => {
36
37
  document.querySelectorAll(`#${t}-preview pre`).forEach((s) => {
37
38
  var v, m;
38
39
  let o = -1;
39
40
  (v = s.querySelector(".copy-button")) == null || v.remove();
40
41
  const d = ((m = n.value.copyCode) == null ? void 0 : m.text) || "复制代码", b = document.createElement("span");
41
- b.setAttribute("class", "copy-button"), b.dataset.tips = d, b.innerHTML = Le("copy", i.value), b.addEventListener("click", () => {
42
+ b.setAttribute("class", "copy-button"), b.dataset.tips = d, b.innerHTML = Ne("copy", i.value), b.addEventListener("click", () => {
42
43
  var w, E;
43
44
  clearTimeout(o);
44
- const p = s.querySelector("code").innerText, f = He(e.formatCopiedText(p)), k = ((w = n.value.copyCode) == null ? void 0 : w.successTips) || "已复制!", g = ((E = n.value.copyCode) == null ? void 0 : E.failTips) || "已复制!";
45
+ const p = s.querySelector("code").innerText, f = xe(e.formatCopiedText(p)), k = ((w = n.value.copyCode) == null ? void 0 : w.successTips) || "已复制!", g = ((E = n.value.copyCode) == null ? void 0 : E.failTips) || "已复制!";
45
46
  b.dataset.tips = f ? k : g, o = window.setTimeout(() => {
46
47
  b.dataset.tips = d;
47
48
  }, 1500);
48
49
  }), s.appendChild(b);
49
50
  });
50
51
  }, u = () => {
51
- U(r);
52
+ j(r);
52
53
  }, c = (s) => {
53
- s && U(r);
54
+ s && j(r);
54
55
  };
55
- C([a, l], u), C(() => e.setting.preview, c), C(() => e.setting.htmlPreview, c), C(() => n.value, r), P(r);
56
- }, Oe = Ne, Ue = (e) => {
56
+ I([a, l], u), I(() => e.setting.preview, c), I(() => e.setting.htmlPreview, c), I(() => n.value, r), P(r);
57
+ }, je = Oe, Ue = (e) => {
57
58
  var i;
58
59
  const a = (i = S.editorExtensions) == null ? void 0 : i.highlight, l = a == null ? void 0 : a.instance, t = _("highlight"), n = B(l);
59
60
  return P(() => {
@@ -65,14 +66,14 @@ const Ae = (e, a) => {
65
66
  const u = document.createElement("link");
66
67
  u.rel = "stylesheet", u.href = t.value.css, u.id = `${h}-hlCss`, T(u);
67
68
  }
68
- }), C(
69
+ }), I(
69
70
  () => t.value.css,
70
71
  (r) => {
71
72
  _e(`${h}-hlCss`, "href", r);
72
73
  }
73
74
  ), n;
74
- }, je = Ue, Ge = (e) => {
75
- const a = _("theme"), { editorExtensions: l, mermaidConfig: t } = S, n = l == null ? void 0 : l.mermaid, i = B(n == null ? void 0 : n.instance), r = B(-1), u = new Re({
75
+ }, Ge = Ue, De = (e) => {
76
+ const a = _("theme"), { editorExtensions: l, mermaidConfig: t } = S, n = l == null ? void 0 : l.mermaid, i = B(n == null ? void 0 : n.instance), r = B(-1), u = new Ae({
76
77
  max: 1e3,
77
78
  // 缓存10分钟
78
79
  ttl: 6e5
@@ -85,7 +86,7 @@ const Ae = (e, a) => {
85
86
  })
86
87
  ), r.value = r.value + 1);
87
88
  };
88
- return C(
89
+ return I(
89
90
  () => a.value,
90
91
  () => {
91
92
  u.clear(), c();
@@ -109,7 +110,7 @@ const Ae = (e, a) => {
109
110
  }
110
111
  }
111
112
  }), { mermaidRef: i, reRenderRef: r, replaceMermaid: () => {
112
- U(() => {
113
+ j(() => {
113
114
  if (!e.noMermaid && i.value) {
114
115
  const o = document.querySelectorAll(
115
116
  `div.${h}-mermaid`
@@ -119,7 +120,7 @@ const Ae = (e, a) => {
119
120
  b > 0 && document.body.appendChild(d), o.forEach(async (v) => {
120
121
  let m = u.get(v.innerText);
121
122
  if (!m) {
122
- const f = j(), k = i.value.renderAsync || i.value.render;
123
+ const f = U(), k = i.value.renderAsync || i.value.render;
123
124
  let g = "";
124
125
  try {
125
126
  g = await k(f, v.innerText, d);
@@ -135,7 +136,7 @@ const Ae = (e, a) => {
135
136
  }
136
137
  });
137
138
  } };
138
- }, De = Ge, Ve = (e) => {
139
+ }, Ve = De, ze = (e) => {
139
140
  var n;
140
141
  const a = (n = S.editorExtensions) == null ? void 0 : n.katex, l = a == null ? void 0 : a.instance, t = B(l);
141
142
  return P(() => {
@@ -148,7 +149,7 @@ const Ae = (e, a) => {
148
149
  r.rel = "stylesheet", r.href = (a == null ? void 0 : a.css) || D.css, r.id = `${h}-katexCss`, T(i, "katex"), T(r);
149
150
  }
150
151
  }), t;
151
- }, ze = Ve, We = (e, a) => {
152
+ }, We = ze, Ke = (e, a) => {
152
153
  const l = e.renderer.rules.fence.bind(e.renderer.rules);
153
154
  e.renderer.rules.fence = (t, n, i, r, u) => {
154
155
  const c = t[n], s = c.content.trim();
@@ -158,14 +159,14 @@ const Ae = (e, a) => {
158
159
  }
159
160
  return l(t, n, i, r, u);
160
161
  };
161
- }, Ke = We, ee = (e, a) => {
162
+ }, qe = Ke, ee = (e, a) => {
162
163
  let l = !0, t = !0;
163
164
  const n = e.posMax, i = a > 0 ? e.src.charCodeAt(a - 1) : -1, r = a + 1 <= n ? e.src.charCodeAt(a + 1) : -1;
164
165
  return (i === 32 || i === 9 || r >= 48 && r <= 57) && (t = !1), (r === 32 || r === 9) && (l = !1), {
165
166
  can_open: l,
166
167
  can_close: t
167
168
  };
168
- }, qe = (e, a) => {
169
+ }, Ze = (e, a) => {
169
170
  let l, t, n, i;
170
171
  if (e.src[e.pos] !== "$")
171
172
  return !1;
@@ -180,7 +181,7 @@ const Ae = (e, a) => {
180
181
  l += 1;
181
182
  }
182
183
  return l === -1 ? (a || (e.pending += "$"), e.pos = r, !0) : l - r === 0 ? (a || (e.pending += "$$"), e.pos = r + 1, !0) : (n = ee(e, l), n.can_close ? (a || (t = e.push("math_inline", "math", 0), t.markup = "$", t.content = e.src.slice(r, l)), e.pos = l + 1, !0) : (a || (e.pending += "$"), e.pos = r, !0));
183
- }, Ze = (e, a, l, t) => {
184
+ }, Je = (e, a, l, t) => {
184
185
  let n, i, r, u, c = !1, s = e.bMarks[a] + e.tShift[a], o = e.eMarks[a];
185
186
  if (s + 2 > o || e.src.slice(s, s + 2) !== "$$")
186
187
  return !1;
@@ -192,7 +193,7 @@ const Ae = (e, a) => {
192
193
  const d = e.push("math_block", "math", 0);
193
194
  return d.block = !0, d.content = (n && n.trim() ? n + `
194
195
  ` : "") + e.getLines(a + 1, r, e.tShift[a], !0) + (i && i.trim() ? i : ""), d.map = [a, e.line], d.markup = "$$", !0;
195
- }, Je = (e, a) => {
196
+ }, Xe = (e, a) => {
196
197
  const l = (n) => {
197
198
  if (a.katexRef.value) {
198
199
  const i = a.katexRef.value.renderToString(n, {
@@ -211,11 +212,11 @@ const Ae = (e, a) => {
211
212
  } else
212
213
  return `<p class="${h}-katex-block" data-line=${i}>${n}</p>`;
213
214
  };
214
- e.inline.ruler.after("escape", "math_inline", qe), e.block.ruler.after("blockquote", "math_block", Ze, {
215
+ e.inline.ruler.after("escape", "math_inline", Ze), e.block.ruler.after("blockquote", "math_block", Je, {
215
216
  alt: ["paragraph", "reference", "blockquote", "list"]
216
217
  }), e.renderer.rules.math_inline = (n, i) => l(n[i].content), e.renderer.rules.math_block = (n, i) => t(n[i].content, n[i].map[0]) + `
217
218
  `;
218
- }, Qe = Je, Xe = (e, a) => {
219
+ }, Qe = Xe, Ye = (e, a) => {
219
220
  a = a || {};
220
221
  const l = 3, t = a.marker || "!", n = t.charCodeAt(0), i = t.length;
221
222
  let r = "", u = "";
@@ -242,8 +243,8 @@ const Ae = (e, a) => {
242
243
  if (E !== l)
243
244
  return !1;
244
245
  m -= (m - g) % i;
245
- const I = o.src.slice(g, m), $ = o.src.slice(m, w);
246
- if (s($), v)
246
+ const $ = o.src.slice(g, m), C = o.src.slice(m, w);
247
+ if (s(C), v)
247
248
  return !0;
248
249
  for (p = d; p++, !(p >= b || (g = o.bMarks[p] + o.tShift[p], w = o.eMarks[p], g < w && o.sCount[p] < o.blkIndent)); )
249
250
  if (n === o.src.charCodeAt(g) && !(o.sCount[p] - o.blkIndent >= 4)) {
@@ -254,14 +255,14 @@ const Ae = (e, a) => {
254
255
  break;
255
256
  }
256
257
  }
257
- const L = o.parentType, x = o.lineMax;
258
- return o.parentType = "root", o.lineMax = p, f = o.push("admonition_open", "div", 1), f.markup = I, f.block = !0, f.info = r, f.map = [d, p], f = o.push("admonition_title_open", "p", 1), f.markup = I + " " + r, f.map = [d, p], f = o.push("inline", "", 0), f.content = u, f.map = [d, o.line - 1], f.children = [], f = o.push("admonition_title_close", "p", -1), f.markup = I + " " + r, o.md.block.tokenize(o, d + 1, p), f = o.push("admonition_close", "div", -1), f.markup = o.src.slice(g, m), f.block = !0, o.parentType = L, o.lineMax = x, o.line = p + (k ? 1 : 0), !0;
258
+ const L = o.parentType, F = o.lineMax;
259
+ return o.parentType = "root", o.lineMax = p, f = o.push("admonition_open", "div", 1), f.markup = $, f.block = !0, f.info = r, f.map = [d, p], f = o.push("admonition_title_open", "p", 1), f.markup = $ + " " + r, f.map = [d, p], f = o.push("inline", "", 0), f.content = u, f.map = [d, o.line - 1], f.children = [], f = o.push("admonition_title_close", "p", -1), f.markup = $ + " " + r, o.md.block.tokenize(o, d + 1, p), f = o.push("admonition_close", "div", -1), f.markup = o.src.slice(g, m), f.block = !0, o.parentType = L, o.lineMax = F, o.line = p + (k ? 1 : 0), !0;
259
260
  },
260
261
  {
261
262
  alt: ["paragraph", "reference", "blockquote", "list"]
262
263
  }
263
264
  ), e.renderer.rules.admonition_open = c, e.renderer.rules.admonition_title_open = c, e.renderer.rules.admonition_title_close = c, e.renderer.rules.admonition_close = c;
264
- }, Ye = Xe, et = (e, a) => {
265
+ }, et = Ye, tt = (e, a) => {
265
266
  e.renderer.rules.heading_open = (l, t) => {
266
267
  var u;
267
268
  const n = l[t], i = ((u = l[t + 1].children) == null ? void 0 : u.reduce((c, s) => c + (s.content || ""), "")) || "", r = n.markup.length;
@@ -273,7 +274,7 @@ const Ae = (e, a) => {
273
274
  a.mdHeadingId(i, r, a.headsRef.value.length)
274
275
  )), e.renderer.renderToken(l, t, a);
275
276
  }, e.renderer.rules.heading_close = (l, t, n, i, r) => r.renderToken(l, t, n);
276
- }, tt = et, nt = (e, a) => {
277
+ }, nt = tt, ot = (e, a) => {
277
278
  const l = e.renderer.rules.fence, t = e.utils.unescapeAll, n = /\[(\w*)(?::([\w ]*))?\]/;
278
279
  function i(s) {
279
280
  return s.info ? t(s.info).trim() : "";
@@ -292,18 +293,18 @@ const Ae = (e, a) => {
292
293
  const [m, p] = r(s[o]);
293
294
  if (m === null)
294
295
  return l(s, o, d, b, v);
295
- let f, k, g, w, E = "", I = "";
296
- for (let $ = o; $ < s.length && (f = s[$], [k, g] = r(f), k === m); $++)
297
- f.info = f.info.replace(n, ""), f.hidden = !0, w = $ - o > 0 ? "" : " checked", E += `<li><input type="radio" name="label-group-${a.editorId}-${o}"${w}><label for="group-${a.editorId}-${o}-tab-${$ - o}" onclick="this.previousElementSibling.click()">${g || u(f)}</label></li>
298
- `, I += `<input type="radio" id="group-${a.editorId}-${o}-tab-${$ - o}" name="group-${a.editorId}-${o}"${w}>
299
- ` + l(s, $, d, b, v);
296
+ let f, k, g, w, E = "", $ = "";
297
+ for (let C = o; C < s.length && (f = s[C], [k, g] = r(f), k === m); C++)
298
+ f.info = f.info.replace(n, ""), f.hidden = !0, w = C - o > 0 ? "" : " checked", E += `<li><input type="radio" name="label-group-${a.editorId}-${o}"${w}><label for="group-${a.editorId}-${o}-tab-${C - o}" onclick="this.previousElementSibling.click()">${g || u(f)}</label></li>
299
+ `, $ += `<input type="radio" id="group-${a.editorId}-${o}-tab-${C - o}" name="group-${a.editorId}-${o}"${w}>
300
+ ` + l(s, C, d, b, v);
300
301
  return `<div class="code-tabs">
301
302
  <ul>
302
303
  ` + E + `</ul>
303
- ` + I + "</div>";
304
+ ` + $ + "</div>";
304
305
  };
305
306
  e.renderer.rules.fence = c;
306
- }, ot = nt, rt = (e) => {
307
+ }, rt = ot, at = (e) => {
307
308
  [
308
309
  "paragraph_open",
309
310
  "table_open",
@@ -324,8 +325,8 @@ const Ae = (e, a) => {
324
325
  return t[n].map && t[n].level === 0 && (c = t[n].map[0], t[n].attrSet("data-line", String(c))), u.renderToken(t, n, i);
325
326
  };
326
327
  });
327
- }, at = (e, a) => {
328
- const { editorConfig: l, markdownItConfig: t, markdownItPlugins: n } = S, i = _("editorId"), r = _("showCodeRowNumber"), u = _("theme"), c = R([]), s = je(e), o = ze(e), { reRenderRef: d, replaceMermaid: b } = De(e), v = Fe({
328
+ }, lt = (e, a) => {
329
+ const { editorConfig: l, markdownItConfig: t, markdownItPlugins: n } = S, i = _("editorId"), r = _("showCodeRowNumber"), u = _("theme"), c = R([]), s = Ge(e), o = We(e), { reRenderRef: d, replaceMermaid: b } = Ve(e), v = He({
329
330
  html: !0,
330
331
  breaks: !0
331
332
  });
@@ -340,12 +341,12 @@ const Ae = (e, a) => {
340
341
  },
341
342
  {
342
343
  type: "image",
343
- plugin: xe,
344
+ plugin: Fe,
344
345
  options: { figcaption: !0, classes: "md-zoom" }
345
346
  },
346
347
  {
347
348
  type: "admonition",
348
- plugin: Ye,
349
+ plugin: et,
349
350
  options: {}
350
351
  },
351
352
  {
@@ -355,51 +356,65 @@ const Ae = (e, a) => {
355
356
  },
356
357
  {
357
358
  type: "heading",
358
- plugin: tt,
359
+ plugin: nt,
359
360
  options: { mdHeadingId: e.mdHeadingId, headsRef: c }
360
361
  },
361
362
  {
362
363
  type: "codeTabs",
363
- plugin: ot,
364
+ plugin: rt,
364
365
  options: { editorId: i }
366
+ },
367
+ {
368
+ type: "xss",
369
+ plugin: Re,
370
+ options: {
371
+ // https://github.com/leizongmin/js-xss/blob/master/README.zh.md
372
+ xss($) {
373
+ return {
374
+ whiteList: Object.assign({}, $.getDefaultWhiteList(), {
375
+ input: ["class", "disabled", "type", "checked"]
376
+ })
377
+ };
378
+ }
379
+ }
365
380
  }
366
381
  ];
367
382
  e.noMermaid || m.push({
368
383
  type: "mermaid",
369
- plugin: Ke,
384
+ plugin: qe,
370
385
  options: { themeRef: u }
371
386
  }), n(m, {
372
387
  editorId: i
373
- }).forEach((I) => {
374
- v.use(I.plugin, I.options);
388
+ }).forEach(($) => {
389
+ v.use($.plugin, $.options);
375
390
  });
376
391
  const p = v.options.highlight;
377
392
  v.set({
378
- highlight: (I, $, L) => {
393
+ highlight: ($, C, L) => {
379
394
  if (p) {
380
- const N = p(I, $, L);
395
+ const N = p($, C, L);
381
396
  if (N)
382
397
  return N;
383
398
  }
384
- let x;
385
- !e.noHighlight && s.value ? s.value.getLanguage($) ? x = s.value.highlight(I, {
386
- language: $,
399
+ let F;
400
+ !e.noHighlight && s.value ? s.value.getLanguage(C) ? F = s.value.highlight($, {
401
+ language: C,
387
402
  ignoreIllegals: !0
388
- }).value : x = s.value.highlightAuto(I).value : x = v.utils.escapeHtml(I);
389
- const fe = r ? Ce(x.replace(/^\n+|\n+$/g, "")) : `<span class="code-block">${x.replace(/^\n+|\n+$/g, "")}</span>`;
390
- return `<pre><code class="language-${$}" language=${$}>${fe}</code></pre>`;
403
+ }).value : F = s.value.highlightAuto($).value : F = v.utils.escapeHtml($);
404
+ const me = r ? Ce(F.replace(/^\n+|\n+$/g, "")) : `<span class="code-block">${F.replace(/^\n+|\n+$/g, "")}</span>`;
405
+ return `<pre><code class="language-${C}" language=${C}>${me}</code></pre>`;
391
406
  }
392
- }), rt(v);
393
- const f = R(`_article-key_${j()}`), k = R(e.sanitize(v.render(e.modelValue))), g = () => {
407
+ }), at(v);
408
+ const f = R(`_article-key_${U()}`), k = R(e.sanitize(v.render(e.modelValue))), g = () => {
394
409
  y.emit(i, A, k.value), e.onHtmlChanged(k.value), e.onGetCatalog(c.value), y.emit(i, q, c.value), b();
395
410
  };
396
411
  P(g);
397
412
  const w = () => {
398
413
  c.value = [], k.value = e.sanitize(v.render(e.modelValue)), g();
399
- }, E = F(() => (e.noKatex || o.value) && (e.noHighlight || s.value));
400
- return C(
401
- [te(e, "modelValue"), E, d],
402
- ie(
414
+ }, E = H(() => (e.noKatex || o.value) && (e.noHighlight || s.value));
415
+ return I(
416
+ [fe(e, "modelValue"), E, d],
417
+ le(
403
418
  w,
404
419
  (l == null ? void 0 : l.renderDelay) !== void 0 ? l == null ? void 0 : l.renderDelay : a ? 0 : 500
405
420
  )
@@ -412,11 +427,11 @@ const Ae = (e, a) => {
412
427
  }), y.on(i, {
413
428
  name: G,
414
429
  callback: () => {
415
- w(), f.value = `_article-key_${j()}`;
430
+ w(), f.value = `_article-key_${U()}`;
416
431
  }
417
432
  });
418
433
  }), { html: k, key: f };
419
- }, lt = at, ce = {
434
+ }, it = lt, ie = {
420
435
  modelValue: {
421
436
  type: String,
422
437
  default: ""
@@ -470,8 +485,8 @@ const Ae = (e, a) => {
470
485
  sanitizeMermaid: {
471
486
  type: Function
472
487
  }
473
- }, $t = {
474
- ...ce,
488
+ }, It = {
489
+ ...ie,
475
490
  onChange: {
476
491
  type: Function,
477
492
  default: () => {
@@ -542,15 +557,15 @@ const Ae = (e, a) => {
542
557
  onInputBoxWitdhChange: {
543
558
  type: Function
544
559
  }
545
- }, it = /* @__PURE__ */ ne({
560
+ }, ct = /* @__PURE__ */ te({
546
561
  name: "ContentPreview",
547
- props: ce,
562
+ props: ie,
548
563
  setup(e) {
549
564
  const a = _("editorId"), l = _("previewTheme"), t = _("showCodeRowNumber"), {
550
565
  html: n,
551
566
  key: i
552
- } = lt(e, e.previewOnly);
553
- return Oe(e, n, i), Be(e, n), () => M(pe, null, [M("div", {
567
+ } = it(e, e.previewOnly);
568
+ return je(e, n, i), Le(e, n), () => M(pe, null, [M("div", {
554
569
  id: `${a}-preview-wrapper`,
555
570
  class: `${h}-preview-wrapper`,
556
571
  "data-show": e.setting.preview,
@@ -569,14 +584,14 @@ const Ae = (e, a) => {
569
584
  class: `${h}-html`
570
585
  }, [n.value])])]);
571
586
  }
572
- }), Ct = (e, a) => {
573
- const { editorId: l } = e, t = oe({
587
+ }), St = (e, a) => {
588
+ const { editorId: l } = e, t = ne({
574
589
  // 是否已编译成html
575
590
  buildFinished: !1,
576
591
  // 存储当前最新的html
577
592
  html: ""
578
593
  });
579
- C(
594
+ I(
580
595
  () => e.modelValue,
581
596
  () => {
582
597
  t.buildFinished = !1;
@@ -588,7 +603,7 @@ const Ae = (e, a) => {
588
603
  t.buildFinished = !0, t.html = n;
589
604
  }
590
605
  }), y.on(l, {
591
- name: re,
606
+ name: oe,
592
607
  callback() {
593
608
  const n = new Promise((i) => {
594
609
  if (t.buildFinished)
@@ -607,18 +622,18 @@ const Ae = (e, a) => {
607
622
  }
608
623
  });
609
624
  });
610
- }, se = (e) => {
625
+ }, ce = (e) => {
611
626
  var n, i;
612
627
  const { editorId: a } = e, l = (i = (n = S) == null ? void 0 : n.editorExtensions) == null ? void 0 : i.highlight;
613
- H("editorId", a), H(
628
+ x("editorId", a), x(
614
629
  "theme",
615
- F(() => e.theme)
616
- ), H(
630
+ H(() => e.theme)
631
+ ), x(
617
632
  "language",
618
- F(() => e.language)
619
- ), H(
633
+ H(() => e.language)
634
+ ), x(
620
635
  "highlight",
621
- F(() => {
636
+ H(() => {
622
637
  const r = {
623
638
  ...V,
624
639
  ...l == null ? void 0 : l.css
@@ -628,8 +643,8 @@ const Ae = (e, a) => {
628
643
  css: r[e.codeTheme] ? r[e.codeTheme][u] : V.atom[u]
629
644
  };
630
645
  })
631
- ), H("showCodeRowNumber", e.showCodeRowNumber);
632
- const t = F(() => {
646
+ ), x("showCodeRowNumber", e.showCodeRowNumber);
647
+ const t = H(() => {
633
648
  var u, c;
634
649
  const r = {
635
650
  ...z,
@@ -637,16 +652,16 @@ const Ae = (e, a) => {
637
652
  };
638
653
  return r[e.language] ? r[e.language] : z["zh-CN"];
639
654
  });
640
- H("usedLanguageText", t), H(
655
+ x("usedLanguageText", t), x(
641
656
  "previewTheme",
642
- F(() => e.previewTheme)
643
- ), H(
657
+ H(() => e.previewTheme)
658
+ ), x(
644
659
  "customIcon",
645
- F(() => e.customIcon)
660
+ H(() => e.customIcon)
646
661
  );
647
- }, It = (e) => {
648
- se(e), H("tabWidth", e.tabWidth);
649
- }, ue = (e) => {
662
+ }, Et = (e) => {
663
+ ce(e), x("tabWidth", e.tabWidth);
664
+ }, se = (e) => {
650
665
  P(() => {
651
666
  var a, l;
652
667
  if (!e.noIconfont)
@@ -658,7 +673,7 @@ const Ae = (e, a) => {
658
673
  t.rel = "stylesheet", t.href = ((l = S.editorExtensions) == null ? void 0 : l.iconfontClass) || be, t.id = `${h}-icon-class`, T(t);
659
674
  }
660
675
  });
661
- }, St = (e) => {
676
+ }, Pt = (e) => {
662
677
  var u, c, s, o, d, b;
663
678
  const { noPrettier: a, noUploadImg: l } = e, { editorExtensions: t } = S, n = a || !!((c = (u = S.editorExtensions) == null ? void 0 : u.prettier) != null && c.prettierInstance), i = a || !!((o = (s = S.editorExtensions) == null ? void 0 : s.prettier) != null && o.parserMarkdownInstance), r = l || !!((b = (d = S.editorExtensions) == null ? void 0 : d.cropper) != null && b.instance);
664
679
  P(() => {
@@ -669,8 +684,8 @@ const Ae = (e, a) => {
669
684
  p.rel = "stylesheet", p.href = ((w = t == null ? void 0 : t.cropper) == null ? void 0 : w.css) || K.css, p.id = `${h}-cropperCss`;
670
685
  const f = document.createElement("script");
671
686
  f.src = ((E = t == null ? void 0 : t.cropper) == null ? void 0 : E.js) || K.js, f.id = `${h}-cropper`, r || (T(p), T(f)), n || T(v), i || T(m);
672
- }), ue(e);
673
- }, Et = (e, a) => {
687
+ }), se(e);
688
+ }, _t = (e, a) => {
674
689
  const { editorId: l } = e;
675
690
  P(() => {
676
691
  y.on(l, {
@@ -680,8 +695,8 @@ const Ae = (e, a) => {
680
695
  }
681
696
  });
682
697
  });
683
- }, Pt = (e, a) => {
684
- const { editorId: l } = e, t = oe({
698
+ }, Tt = (e, a) => {
699
+ const { editorId: l } = e, t = ne({
685
700
  pageFullscreen: e.pageFullscreen,
686
701
  fullscreen: !1,
687
702
  preview: e.preview,
@@ -693,12 +708,12 @@ const Ae = (e, a) => {
693
708
  const r = () => {
694
709
  t.pageFullscreen || t.fullscreen ? document.body.style.overflow = "hidden" : document.body.style.overflow = i;
695
710
  };
696
- return C(() => [t.pageFullscreen, t.fullscreen], r), P(() => {
711
+ return I(() => [t.pageFullscreen, t.fullscreen], r), P(() => {
697
712
  y.on(l, {
698
713
  name: Ee,
699
714
  callback(u, c) {
700
715
  const s = (o) => {
701
- y.emit(l, le, "image", {
716
+ y.emit(l, ae, "image", {
702
717
  desc: "",
703
718
  urls: o
704
719
  }), c && c();
@@ -707,39 +722,39 @@ const Ae = (e, a) => {
707
722
  }
708
723
  }), i = document.body.style.overflow, r();
709
724
  }), [t, n];
710
- }, _t = (e) => {
725
+ }, xt = (e) => {
711
726
  const { editorId: a } = e, l = R(!1);
712
727
  return P(() => {
713
728
  y.on(a, {
714
- name: ae,
729
+ name: re,
715
730
  callback: (n) => {
716
731
  n === void 0 ? l.value = !l.value : l.value = n;
717
732
  }
718
733
  });
719
- }), F(() => !e.toolbarsExclude.includes("catalog") && e.toolbars.includes("catalog") && l.value);
720
- }, Tt = (e, a, l, t, n, i) => {
734
+ }), H(() => !e.toolbarsExclude.includes("catalog") && e.toolbars.includes("catalog") && l.value);
735
+ }, Ht = (e, a, l, t, n, i) => {
721
736
  const { editorId: r } = e;
722
- C(
737
+ I(
723
738
  () => t.pageFullscreen,
724
739
  (c) => {
725
740
  y.emit(r, Z, c);
726
741
  }
727
- ), C(
742
+ ), I(
728
743
  () => t.fullscreen,
729
744
  (c) => {
730
745
  y.emit(r, J, c);
731
746
  }
732
- ), C(
747
+ ), I(
733
748
  () => t.preview,
734
749
  (c) => {
735
- y.emit(r, Q, c);
750
+ y.emit(r, X, c);
736
751
  }
737
- ), C(
752
+ ), I(
738
753
  () => t.htmlPreview,
739
754
  (c) => {
740
- y.emit(r, X, c);
755
+ y.emit(r, Q, c);
741
756
  }
742
- ), C(l, (c) => {
757
+ ), I(l, (c) => {
743
758
  y.emit(r, Y, c);
744
759
  });
745
760
  const u = {
@@ -765,7 +780,7 @@ const Ae = (e, a) => {
765
780
  }
766
781
  case "preview": {
767
782
  y.on(r, {
768
- name: Q,
783
+ name: X,
769
784
  callback(o) {
770
785
  s(o);
771
786
  }
@@ -774,7 +789,7 @@ const Ae = (e, a) => {
774
789
  }
775
790
  case "htmlPreview": {
776
791
  y.on(r, {
777
- name: X,
792
+ name: Q,
778
793
  callback(o) {
779
794
  s(o);
780
795
  }
@@ -805,13 +820,13 @@ const Ae = (e, a) => {
805
820
  n("htmlPreview", c);
806
821
  },
807
822
  toggleCatalog(c) {
808
- y.emit(r, ae, c);
823
+ y.emit(r, re, c);
809
824
  },
810
825
  triggerSave() {
811
- y.emit(r, re);
826
+ y.emit(r, oe);
812
827
  },
813
828
  insert(c) {
814
- y.emit(r, le, "universal", { generate: c });
829
+ y.emit(r, ae, "universal", { generate: c });
815
830
  },
816
831
  focus(c) {
817
832
  var s;
@@ -830,7 +845,7 @@ const Ae = (e, a) => {
830
845
  }
831
846
  };
832
847
  a.expose(u);
833
- }, ct = (e) => e, de = {
848
+ }, st = (e) => e, ue = {
834
849
  /**
835
850
  * markdown content.
836
851
  *
@@ -920,7 +935,7 @@ const Ae = (e, a) => {
920
935
  */
921
936
  mdHeadingId: {
922
937
  type: Function,
923
- default: ct
938
+ default: st
924
939
  },
925
940
  /**
926
941
  *
@@ -1018,8 +1033,8 @@ const Ae = (e, a) => {
1018
1033
  type: Function,
1019
1034
  default: (e) => Promise.resolve(e)
1020
1035
  }
1021
- }, Ht = {
1022
- ...de,
1036
+ }, Ft = {
1037
+ ...ue,
1023
1038
  /**
1024
1039
  * input回调事件
1025
1040
  */
@@ -1270,8 +1285,8 @@ const Ae = (e, a) => {
1270
1285
  onInputBoxWitdhChange: {
1271
1286
  type: Function
1272
1287
  }
1273
- }, me = ["onHtmlChanged", "onGetCatalog"], Ft = [
1274
- ...me,
1288
+ }, de = ["onHtmlChanged", "onGetCatalog"], Mt = [
1289
+ ...de,
1275
1290
  "onChange",
1276
1291
  "onSave",
1277
1292
  "onUploadImg",
@@ -1282,17 +1297,17 @@ const Ae = (e, a) => {
1282
1297
  "onInput",
1283
1298
  "onDrop",
1284
1299
  "onInputBoxWitdhChange"
1285
- ], st = (e, a) => {
1300
+ ], ut = (e, a) => {
1286
1301
  const { editorId: l } = e, t = {
1287
1302
  rerender() {
1288
1303
  y.emit(l, G);
1289
1304
  }
1290
1305
  };
1291
1306
  a.expose(t);
1292
- }, ut = /* @__PURE__ */ ne({
1307
+ }, dt = /* @__PURE__ */ te({
1293
1308
  name: "MdPreview",
1294
- props: de,
1295
- emits: me,
1309
+ props: ue,
1310
+ emits: de,
1296
1311
  setup(e, a) {
1297
1312
  const {
1298
1313
  editorId: l,
@@ -1300,13 +1315,13 @@ const Ae = (e, a) => {
1300
1315
  noMermaid: n,
1301
1316
  noHighlight: i
1302
1317
  } = e;
1303
- return se(e), ue(e), st(e, a), he(() => {
1318
+ return ce(e), se(e), ut(e, a), he(() => {
1304
1319
  y.clear(l);
1305
1320
  }), () => M("div", {
1306
1321
  id: l,
1307
1322
  class: [h, e.class, e.theme === "dark" && `${h}-dark`, `${h}-previewOnly`],
1308
1323
  style: e.style
1309
- }, [M(it, {
1324
+ }, [M(ct, {
1310
1325
  modelValue: e.modelValue,
1311
1326
  onHtmlChanged: (r) => {
1312
1327
  e.onHtmlChanged ? e.onHtmlChanged(r) : a.emit("onHtmlChanged", r);
@@ -1325,19 +1340,19 @@ const Ae = (e, a) => {
1325
1340
  sanitizeMermaid: e.sanitizeMermaid
1326
1341
  }, null)]);
1327
1342
  }
1328
- }), O = ut;
1343
+ }), O = dt;
1329
1344
  O.install = (e) => (e.component(O.name, O), e);
1330
1345
  export {
1331
- it as C,
1346
+ ct as C,
1332
1347
  O as M,
1333
- Ft as a,
1334
- It as b,
1335
- $t as c,
1336
- St as d,
1337
- Ht as e,
1338
- Et as f,
1339
- Pt as g,
1340
- _t as h,
1341
- Tt as i,
1342
- Ct as u
1348
+ Mt as a,
1349
+ Et as b,
1350
+ It as c,
1351
+ Pt as d,
1352
+ Ft as e,
1353
+ _t as f,
1354
+ Tt as g,
1355
+ xt as h,
1356
+ Ht as i,
1357
+ St as u
1343
1358
  };