md-editor-v3 4.3.0 → 4.4.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,64 +1,68 @@
1
- import { inject as T, onMounted as S, watch as $, toRef as Z, nextTick as A, shallowRef as x, ref as L, computed as M, defineComponent as J, createVNode as H, Fragment as le, reactive as X, provide as F, onBeforeUnmount as ie } from "vue";
2
- import { p as h, a as P, m as ce, k as B, e as j, h as se, f as O, i as de, g as U, j as V, l as ue, b as me, d as fe } from "./config.mjs";
3
- import { u as pe, g as he, b as g } from "./index3.mjs";
4
- import { a as _, u as ge } from "./dom.mjs";
5
- import ve from "medium-zoom";
1
+ import { inject as T, onMounted as I, watch as $, toRef as W, nextTick as A, shallowRef as x, ref as B, computed as M, defineComponent as J, createVNode as H, Fragment as ie, reactive as X, provide as _, onBeforeUnmount as ce } from "vue";
2
+ import { p as h, a as P, m as se, k as N, e as j, h as ue, f as O, i as de, g as V, j as U, l as me, b as fe, d as pe } from "./config.mjs";
3
+ import { u as he, g as ge, b as g } from "./index3.mjs";
4
+ import { a as F, u as ve } from "./dom.mjs";
5
+ import ye from "medium-zoom";
6
6
  import { debounce as Q } from "@vavt/util";
7
- import ye from "copy-to-clipboard";
8
- import be from "markdown-it";
9
- import we from "markdown-it-image-figures";
10
- import ke from "markdown-it-task-lists";
11
- import $e from "lru-cache";
12
- const Y = "onSave", ee = "changeCatalogVisible", Ce = "changeFullscreen", G = "pageFullscreenChanged", z = "fullscreenChanged", D = "previewChanged", K = "htmlPreviewChanged", q = "catalogVisibleChanged", Se = "textareaFocus", Ie = (e, o) => {
13
- const l = T("editorId"), t = Q(() => {
14
- const n = document.querySelectorAll(`#${l}-preview img.md-zoom`);
15
- n.length !== 0 && ve(n, {
7
+ import be from "copy-to-clipboard";
8
+ import we from "markdown-it";
9
+ import ke from "markdown-it-image-figures";
10
+ import $e from "markdown-it-task-lists";
11
+ import Ce from "lru-cache";
12
+ const Y = "onSave", ee = "changeCatalogVisible", Ie = "changeFullscreen", G = "pageFullscreenChanged", D = "fullscreenChanged", z = "previewChanged", K = "htmlPreviewChanged", q = "catalogVisibleChanged", Se = "textareaFocus", Ee = (e, a) => {
13
+ const l = T("editorId"), { noImgZoomIn: t } = e, n = Q(() => {
14
+ const r = document.querySelectorAll(`#${l}-preview img`);
15
+ r.length !== 0 && ye(r, {
16
16
  background: "#00000073"
17
17
  });
18
18
  });
19
- S(t), $([o, Z(e.setting, "preview")], t);
20
- }, Ee = Ie, Pe = (e, o) => {
19
+ I(() => {
20
+ !t && n();
21
+ }), $([a, W(e.setting, "preview")], () => {
22
+ !t && n();
23
+ });
24
+ }, Pe = Ee, Te = (e, a) => {
21
25
  const l = T("editorId"), t = T("usedLanguageText"), n = () => {
22
26
  document.querySelectorAll(`#${l}-preview pre`).forEach((c) => {
23
27
  var m, b;
24
- let d = -1;
28
+ let u = -1;
25
29
  (m = c.querySelector(".copy-button")) == null || m.remove();
26
- const s = ((b = t.value.copyCode) == null ? void 0 : b.text) || "复制代码", r = document.createElement("span");
27
- r.setAttribute("class", "copy-button"), r.dataset.tips = s, r.innerHTML = `<svg class="${h}-icon" aria-hidden="true"><use xlink:href="#${h}-icon-copy"></use></svg>`, r.addEventListener("click", () => {
30
+ const s = ((b = t.value.copyCode) == null ? void 0 : b.text) || "复制代码", o = document.createElement("span");
31
+ o.setAttribute("class", "copy-button"), o.dataset.tips = s, o.innerHTML = `<svg class="${h}-icon" aria-hidden="true"><use xlink:href="#${h}-icon-copy"></use></svg>`, o.addEventListener("click", () => {
28
32
  var k, v;
29
- clearTimeout(d);
30
- const y = c.querySelector("code").innerText, u = ye(e.formatCopiedText(y)), p = ((k = t.value.copyCode) == null ? void 0 : k.successTips) || "已复制!", f = ((v = t.value.copyCode) == null ? void 0 : v.failTips) || "已复制!";
31
- r.dataset.tips = u ? p : f, d = window.setTimeout(() => {
32
- r.dataset.tips = s;
33
+ clearTimeout(u);
34
+ const y = c.querySelector("code").innerText, d = be(e.formatCopiedText(y)), p = ((k = t.value.copyCode) == null ? void 0 : k.successTips) || "已复制!", f = ((v = t.value.copyCode) == null ? void 0 : v.failTips) || "已复制!";
35
+ o.dataset.tips = d ? p : f, u = window.setTimeout(() => {
36
+ o.dataset.tips = s;
33
37
  }, 1500);
34
- }), c.appendChild(r);
38
+ }), c.appendChild(o);
35
39
  });
36
- }, a = () => {
40
+ }, r = () => {
37
41
  A(n);
38
42
  }, i = (c) => {
39
43
  c && A(n);
40
44
  };
41
- $(() => o.value, a), $(() => e.setting.preview, i), $(() => e.setting.htmlPreview, i), $(() => t.value, n), S(n);
42
- }, Te = Pe, _e = (e) => {
43
- var a;
44
- const o = (a = P.editorExtensions) == null ? void 0 : a.highlight, l = o == null ? void 0 : o.instance, t = T("highlight"), n = x(l);
45
- return S(() => {
45
+ $(() => a.value, r), $(() => e.setting.preview, i), $(() => e.setting.htmlPreview, i), $(() => t.value, n), I(n);
46
+ }, Fe = Te, _e = (e) => {
47
+ var r;
48
+ const a = (r = P.editorExtensions) == null ? void 0 : r.highlight, l = a == null ? void 0 : a.instance, t = T("highlight"), n = x(l);
49
+ return I(() => {
46
50
  if (!e.noHighlight && !n.value) {
47
51
  const i = document.createElement("script");
48
52
  i.src = t.value.js, i.onload = () => {
49
53
  n.value = window.hljs;
50
- }, i.id = `${h}-hljs`, _(i, "hljs");
54
+ }, i.id = `${h}-hljs`, F(i, "hljs");
51
55
  const c = document.createElement("link");
52
- c.rel = "stylesheet", c.href = t.value.css, c.id = `${h}-hlCss`, _(c);
56
+ c.rel = "stylesheet", c.href = t.value.css, c.id = `${h}-hlCss`, F(c);
53
57
  }
54
58
  }), $(
55
59
  () => t.value.css,
56
60
  (i) => {
57
- ge(`${h}-hlCss`, "href", i);
61
+ ve(`${h}-hlCss`, "href", i);
58
62
  }
59
63
  ), n;
60
- }, Fe = _e, He = (e) => {
61
- const o = T("theme"), { editorExtensions: l } = P, t = l == null ? void 0 : l.mermaid, n = x(t == null ? void 0 : t.instance), a = x(-1), i = new $e({
64
+ }, He = _e, Me = (e) => {
65
+ const a = T("theme"), { editorExtensions: l } = P, t = l == null ? void 0 : l.mermaid, n = x(t == null ? void 0 : t.instance), r = x(-1), i = new Ce({
62
66
  max: 1e3,
63
67
  // 缓存10分钟
64
68
  ttl: 6e5
@@ -66,225 +70,225 @@ const Y = "onSave", ee = "changeCatalogVisible", Ce = "changeFullscreen", G = "p
66
70
  const s = n.value;
67
71
  !e.noMermaid && s && (s.initialize({
68
72
  startOnLoad: !1,
69
- theme: o.value === "dark" ? "dark" : "default"
70
- }), a.value = a.value + 1);
73
+ theme: a.value === "dark" ? "dark" : "default"
74
+ }), r.value = r.value + 1);
71
75
  };
72
76
  return $(
73
- () => o.value,
77
+ () => a.value,
74
78
  () => {
75
79
  i.clear(), c();
76
80
  }
77
- ), S(() => {
81
+ ), I(() => {
78
82
  if (!e.noMermaid && !(t != null && t.instance)) {
79
- const s = (t == null ? void 0 : t.js) || ce;
83
+ const s = (t == null ? void 0 : t.js) || se;
80
84
  if (/\.mjs/.test(s))
81
85
  import(
82
86
  /* @vite-ignore */
83
87
  /* webpackIgnore: true */
84
88
  s
85
- ).then((r) => {
86
- n.value = r.default, c();
89
+ ).then((o) => {
90
+ n.value = o.default, c();
87
91
  });
88
92
  else {
89
- const r = document.createElement("script");
90
- r.id = `${h}-mermaid`, r.src = s, r.onload = () => {
93
+ const o = document.createElement("script");
94
+ o.id = `${h}-mermaid`, o.src = s, o.onload = () => {
91
95
  n.value = window.mermaid, c();
92
- }, _(r, "mermaid");
96
+ }, F(o, "mermaid");
93
97
  }
94
98
  }
95
- }), { mermaidRef: n, reRenderRef: a, replaceMermaid: () => {
99
+ }), { mermaidRef: n, reRenderRef: r, replaceMermaid: () => {
96
100
  A(() => {
97
101
  if (!e.noMermaid && n.value) {
98
102
  const s = document.querySelectorAll(
99
103
  `div.${h}-mermaid`
100
- ), r = document.createElement("div");
101
- r.style.width = document.body.offsetWidth + "px", r.style.height = document.body.offsetHeight + "px", r.style.position = "fixed", r.style.zIndex = "-10000", r.style.top = "-10000";
104
+ ), o = document.createElement("div");
105
+ 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";
102
106
  let m = s.length;
103
- m > 0 && document.body.appendChild(r), s.forEach(async (b) => {
107
+ m > 0 && document.body.appendChild(o), s.forEach(async (b) => {
104
108
  let y = i.get(b.innerText);
105
109
  if (!y) {
106
- const p = pe(), f = n.value.renderAsync || n.value.render;
110
+ const p = he(), f = n.value.renderAsync || n.value.render;
107
111
  let k = "";
108
112
  try {
109
- k = await f(p, b.innerText, r);
113
+ k = await f(p, b.innerText, o);
110
114
  } catch {
111
115
  }
112
116
  y = typeof k == "string" ? k : k.svg, i.set(b.innerText, y);
113
117
  }
114
- const u = document.createElement("p");
115
- u.className = `${h}-mermaid`, u.setAttribute("data-processed", ""), u.innerHTML = y, b.dataset.line !== void 0 && (u.dataset.line = b.dataset.line), b.replaceWith(u), --m === 0 && r.remove();
118
+ const d = document.createElement("p");
119
+ d.className = `${h}-mermaid`, d.setAttribute("data-processed", ""), d.innerHTML = y, b.dataset.line !== void 0 && (d.dataset.line = b.dataset.line), b.replaceWith(d), --m === 0 && o.remove();
116
120
  });
117
121
  }
118
122
  });
119
123
  } };
120
- }, Me = He, xe = (e) => {
124
+ }, xe = Me, Re = (e) => {
121
125
  var n;
122
- const o = (n = P.editorExtensions) == null ? void 0 : n.katex, l = o == null ? void 0 : o.instance, t = x(l);
123
- return S(() => {
126
+ const a = (n = P.editorExtensions) == null ? void 0 : n.katex, l = a == null ? void 0 : a.instance, t = x(l);
127
+ return I(() => {
124
128
  if (!e.noKatex && !t.value) {
125
- const a = document.createElement("script");
126
- a.src = (o == null ? void 0 : o.js) || B.js, a.onload = () => {
129
+ const r = document.createElement("script");
130
+ r.src = (a == null ? void 0 : a.js) || N.js, r.onload = () => {
127
131
  t.value = window.katex;
128
- }, a.id = `${h}-katex`;
132
+ }, r.id = `${h}-katex`;
129
133
  const i = document.createElement("link");
130
- i.rel = "stylesheet", i.href = (o == null ? void 0 : o.css) || B.css, i.id = `${h}-katexCss`, _(a, "katex"), _(i);
134
+ i.rel = "stylesheet", i.href = (a == null ? void 0 : a.css) || N.css, i.id = `${h}-katexCss`, F(r, "katex"), F(i);
131
135
  }
132
136
  }), t;
133
- }, Re = xe, Ae = (e, o) => {
137
+ }, Ae = Re, Be = (e, a) => {
134
138
  const l = e.renderer.rules.fence.bind(e.renderer.rules);
135
- e.renderer.rules.fence = (t, n, a, i, c) => {
136
- const d = t[n], s = d.content.trim();
137
- if (d.info === "mermaid") {
138
- let r;
139
- return t[n].map && t[n].level === 0 && (r = t[n].map[0], t[n].attrSet("data-line", String(r))), `<div class="${h}-mermaid" ${r !== void 0 ? "data-line=" + r : ""} data-mermaid-theme=${o.themeRef.value}>${s}</div>`;
139
+ e.renderer.rules.fence = (t, n, r, i, c) => {
140
+ const u = t[n], s = u.content.trim();
141
+ if (u.info === "mermaid") {
142
+ let o;
143
+ return t[n].map && t[n].level === 0 && (o = t[n].map[0], t[n].attrSet("data-line", String(o))), `<div class="${h}-mermaid" ${o !== void 0 ? "data-line=" + o : ""} data-mermaid-theme=${a.themeRef.value}>${s}</div>`;
140
144
  }
141
- return l(t, n, a, i, c);
145
+ return l(t, n, r, i, c);
142
146
  };
143
- }, Le = Ae, W = (e, o) => {
147
+ }, Le = Be, Z = (e, a) => {
144
148
  let l = !0, t = !0;
145
- const n = e.posMax, a = o > 0 ? e.src.charCodeAt(o - 1) : -1, i = o + 1 <= n ? e.src.charCodeAt(o + 1) : -1;
146
- return (a === 32 || a === 9 || i >= 48 && i <= 57) && (t = !1), (i === 32 || i === 9) && (l = !1), {
149
+ const n = e.posMax, r = a > 0 ? e.src.charCodeAt(a - 1) : -1, i = a + 1 <= n ? e.src.charCodeAt(a + 1) : -1;
150
+ return (r === 32 || r === 9 || i >= 48 && i <= 57) && (t = !1), (i === 32 || i === 9) && (l = !1), {
147
151
  can_open: l,
148
152
  can_close: t
149
153
  };
150
- }, Ne = (e, o) => {
151
- let l, t, n, a;
154
+ }, Ne = (e, a) => {
155
+ let l, t, n, r;
152
156
  if (e.src[e.pos] !== "$")
153
157
  return !1;
154
- if (n = W(e, e.pos), !n.can_open)
155
- return o || (e.pending += "$"), e.pos += 1, !0;
158
+ if (n = Z(e, e.pos), !n.can_open)
159
+ return a || (e.pending += "$"), e.pos += 1, !0;
156
160
  const i = e.pos + 1;
157
161
  for (l = i; (l = e.src.indexOf("$", l)) !== -1; ) {
158
- for (a = l - 1; e.src[a] === "\\"; )
159
- a -= 1;
160
- if ((l - a) % 2 == 1)
162
+ for (r = l - 1; e.src[r] === "\\"; )
163
+ r -= 1;
164
+ if ((l - r) % 2 == 1)
161
165
  break;
162
166
  l += 1;
163
167
  }
164
- return l === -1 ? (o || (e.pending += "$"), e.pos = i, !0) : l - i === 0 ? (o || (e.pending += "$$"), e.pos = i + 1, !0) : (n = W(e, l), n.can_close ? (o || (t = e.push("math_inline", "math", 0), t.markup = "$", t.content = e.src.slice(i, l)), e.pos = l + 1, !0) : (o || (e.pending += "$"), e.pos = i, !0));
165
- }, Be = (e, o, l, t) => {
166
- let n, a, i, c, d = !1, s = e.bMarks[o] + e.tShift[o], r = e.eMarks[o];
167
- if (s + 2 > r || e.src.slice(s, s + 2) !== "$$")
168
+ return l === -1 ? (a || (e.pending += "$"), e.pos = i, !0) : l - i === 0 ? (a || (e.pending += "$$"), e.pos = i + 1, !0) : (n = Z(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));
169
+ }, je = (e, a, l, t) => {
170
+ let n, r, i, c, u = !1, s = e.bMarks[a] + e.tShift[a], o = e.eMarks[a];
171
+ if (s + 2 > o || e.src.slice(s, s + 2) !== "$$")
168
172
  return !1;
169
- if (s += 2, n = e.src.slice(s, r), t)
173
+ if (s += 2, n = e.src.slice(s, o), t)
170
174
  return !0;
171
- for (n.trim().slice(-2) === "$$" && (n = n.trim().slice(0, -2), d = !0), i = o; !d && (i++, !(i >= l || (s = e.bMarks[i] + e.tShift[i], r = e.eMarks[i], s < r && e.tShift[i] < e.blkIndent))); )
172
- e.src.slice(s, r).trim().slice(-2) === "$$" && (c = e.src.slice(0, r).lastIndexOf("$$"), a = e.src.slice(s, c), d = !0);
175
+ for (n.trim().slice(-2) === "$$" && (n = n.trim().slice(0, -2), u = !0), i = a; !u && (i++, !(i >= l || (s = e.bMarks[i] + e.tShift[i], o = e.eMarks[i], s < o && e.tShift[i] < e.blkIndent))); )
176
+ e.src.slice(s, o).trim().slice(-2) === "$$" && (c = e.src.slice(0, o).lastIndexOf("$$"), r = e.src.slice(s, c), u = !0);
173
177
  e.line = i + 1;
174
178
  const m = e.push("math_block", "math", 0);
175
179
  return m.block = !0, m.content = (n && n.trim() ? n + `
176
- ` : "") + e.getLines(o + 1, i, e.tShift[o], !0) + (a && a.trim() ? a : ""), m.map = [o, e.line], m.markup = "$$", !0;
177
- }, je = (e, o) => {
180
+ ` : "") + e.getLines(a + 1, i, e.tShift[a], !0) + (r && r.trim() ? r : ""), m.map = [a, e.line], m.markup = "$$", !0;
181
+ }, Oe = (e, a) => {
178
182
  const l = (n) => {
179
- if (o.katexRef.value) {
180
- const a = o.katexRef.value.renderToString(n, {
183
+ if (a.katexRef.value) {
184
+ const r = a.katexRef.value.renderToString(n, {
181
185
  throwOnError: !1
182
186
  });
183
- return `<span class="${h}-katex-inline" data-processed>${a}</span>`;
187
+ return `<span class="${h}-katex-inline" data-processed>${r}</span>`;
184
188
  } else
185
189
  return `<span class="${h}-katex-inline">${n}</span>`;
186
- }, t = (n, a) => {
187
- if (o.katexRef.value) {
188
- const i = o.katexRef.value.renderToString(n, {
190
+ }, t = (n, r) => {
191
+ if (a.katexRef.value) {
192
+ const i = a.katexRef.value.renderToString(n, {
189
193
  throwOnError: !1,
190
194
  displayMode: !0
191
195
  });
192
- return `<p class="${h}-katex-block" data-line=${a} data-processed>${i}</p>`;
196
+ return `<p class="${h}-katex-block" data-line=${r} data-processed>${i}</p>`;
193
197
  } else
194
- return `<p class="${h}-katex-block" data-line=${a}>${n}</p>`;
198
+ return `<p class="${h}-katex-block" data-line=${r}>${n}</p>`;
195
199
  };
196
- e.inline.ruler.after("escape", "math_inline", Ne), e.block.ruler.after("blockquote", "math_block", Be, {
200
+ e.inline.ruler.after("escape", "math_inline", Ne), e.block.ruler.after("blockquote", "math_block", je, {
197
201
  alt: ["paragraph", "reference", "blockquote", "list"]
198
- }), e.renderer.rules.math_inline = (n, a) => l(n[a].content), e.renderer.rules.math_block = (n, a) => t(n[a].content, n[a].map[0]) + `
202
+ }), 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]) + `
199
203
  `;
200
- }, Oe = je, Ue = (e, o) => {
201
- o = o || {};
202
- const l = 3, t = o.marker || "!", n = t.charCodeAt(0), a = t.length;
204
+ }, Ve = Oe, Ue = (e, a) => {
205
+ a = a || {};
206
+ const l = 3, t = a.marker || "!", n = t.charCodeAt(0), r = t.length;
203
207
  let i = "", c = "";
204
- const d = (r, m, b, y, u) => {
205
- const p = r[m];
206
- return p.type === "admonition_open" ? (r[m].attrPush([
208
+ const u = (o, m, b, y, d) => {
209
+ const p = o[m];
210
+ return p.type === "admonition_open" ? (o[m].attrPush([
207
211
  "class",
208
212
  `${h}-admonition ${h}-admonition-${p.info}`
209
- ]), r[m].attrSet("data-line", String(r[m].map[0]))) : p.type === "admonition_title_open" && r[m].attrPush(["class", `${h}-admonition-title`]), u.renderToken(r, m, b);
210
- }, s = (r) => {
211
- const m = r.trim().split(" ", 2);
212
- c = "", i = m[0], m.length > 1 && (c = r.substring(i.length + 2)), (c === "" || !c) && (c = i);
213
+ ]), o[m].attrSet("data-line", String(o[m].map[0]))) : p.type === "admonition_title_open" && o[m].attrPush(["class", `${h}-admonition-title`]), d.renderToken(o, m, b);
214
+ }, s = (o) => {
215
+ const m = o.trim().split(" ", 2);
216
+ c = "", i = m[0], m.length > 1 && (c = o.substring(i.length + 2)), (c === "" || !c) && (c = i);
213
217
  };
214
218
  e.block.ruler.before(
215
219
  "code",
216
220
  "admonition",
217
- (r, m, b, y) => {
218
- let u, p, f, k = !1, v = r.bMarks[m] + r.tShift[m], w = r.eMarks[m];
219
- if (n !== r.src.charCodeAt(v))
221
+ (o, m, b, y) => {
222
+ let d, p, f, k = !1, v = o.bMarks[m] + o.tShift[m], w = o.eMarks[m];
223
+ if (n !== o.src.charCodeAt(v))
220
224
  return !1;
221
- for (u = v + 1; u <= w && t[(u - v) % a] === r.src[u]; u++)
225
+ for (d = v + 1; d <= w && t[(d - v) % r] === o.src[d]; d++)
222
226
  ;
223
- const C = Math.floor((u - v) / a);
227
+ const C = Math.floor((d - v) / r);
224
228
  if (C !== l)
225
229
  return !1;
226
- u -= (u - v) % a;
227
- const I = r.src.slice(v, u), E = r.src.slice(u, w);
230
+ d -= (d - v) % r;
231
+ const S = o.src.slice(v, d), E = o.src.slice(d, w);
228
232
  if (s(E), y)
229
233
  return !0;
230
- for (p = m; p++, !(p >= b || (v = r.bMarks[p] + r.tShift[p], w = r.eMarks[p], v < w && r.sCount[p] < r.blkIndent)); )
231
- if (n === r.src.charCodeAt(v) && !(r.sCount[p] - r.blkIndent >= 4)) {
232
- for (u = v + 1; u <= w && t[(u - v) % a] === r.src[u]; u++)
234
+ for (p = m; p++, !(p >= b || (v = o.bMarks[p] + o.tShift[p], w = o.eMarks[p], v < w && o.sCount[p] < o.blkIndent)); )
235
+ if (n === o.src.charCodeAt(v) && !(o.sCount[p] - o.blkIndent >= 4)) {
236
+ for (d = v + 1; d <= w && t[(d - v) % r] === o.src[d]; d++)
233
237
  ;
234
- if (!(Math.floor((u - v) / a) < C) && (u -= (u - v) % a, u = r.skipSpaces(u), !(u < w))) {
238
+ if (!(Math.floor((d - v) / r) < C) && (d -= (d - v) % r, d = o.skipSpaces(d), !(d < w))) {
235
239
  k = !0;
236
240
  break;
237
241
  }
238
242
  }
239
- const N = r.parentType, ae = r.lineMax;
240
- return r.parentType = "root", r.lineMax = p, f = r.push("admonition_open", "div", 1), f.markup = I, f.block = !0, f.info = i, f.map = [m, p], f = r.push("admonition_title_open", "p", 1), f.markup = I + " " + i, f.map = [m, p], f = r.push("inline", "", 0), f.content = c, f.map = [m, r.line - 1], f.children = [], f = r.push("admonition_title_close", "p", -1), f.markup = I + " " + i, r.md.block.tokenize(r, m + 1, p), f = r.push("admonition_close", "div", -1), f.markup = r.src.slice(v, u), f.block = !0, r.parentType = N, r.lineMax = ae, r.line = p + (k ? 1 : 0), !0;
243
+ const L = o.parentType, le = o.lineMax;
244
+ return o.parentType = "root", o.lineMax = p, f = o.push("admonition_open", "div", 1), f.markup = S, f.block = !0, f.info = i, f.map = [m, p], f = o.push("admonition_title_open", "p", 1), f.markup = S + " " + i, f.map = [m, p], f = o.push("inline", "", 0), f.content = c, f.map = [m, o.line - 1], f.children = [], f = o.push("admonition_title_close", "p", -1), f.markup = S + " " + i, o.md.block.tokenize(o, m + 1, p), f = o.push("admonition_close", "div", -1), f.markup = o.src.slice(v, d), f.block = !0, o.parentType = L, o.lineMax = le, o.line = p + (k ? 1 : 0), !0;
241
245
  },
242
246
  {
243
247
  alt: ["paragraph", "reference", "blockquote", "list"]
244
248
  }
245
- ), e.renderer.rules.admonition_open = d, e.renderer.rules.admonition_title_open = d, e.renderer.rules.admonition_title_close = d, e.renderer.rules.admonition_close = d;
246
- }, Ve = Ue, Ge = (e, o) => {
249
+ ), 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;
250
+ }, Ge = Ue, De = (e, a) => {
247
251
  e.renderer.rules.heading_open = (l, t) => {
248
- const n = l[t], a = l[t + 1].content, i = n.markup.length;
249
- return o.headsRef.value.push({
250
- text: a,
252
+ const n = l[t], r = l[t + 1].content, i = n.markup.length;
253
+ return a.headsRef.value.push({
254
+ text: r,
251
255
  level: i
252
256
  }), n.map && n.level === 0 && (n.attrSet("data-line", String(n.map[0])), n.attrSet(
253
257
  "id",
254
- o.mdHeadingId(a, i, o.headsRef.value.length)
255
- )), e.renderer.renderToken(l, t, o);
256
- }, e.renderer.rules.heading_close = (l, t, n, a, i) => i.renderToken(l, t, n);
257
- }, ze = Ge, De = (e, o) => {
258
+ a.mdHeadingId(r, i, a.headsRef.value.length)
259
+ )), e.renderer.renderToken(l, t, a);
260
+ }, e.renderer.rules.heading_close = (l, t, n, r, i) => i.renderToken(l, t, n);
261
+ }, ze = De, Ke = (e, a) => {
258
262
  const l = e.renderer.rules.fence, t = e.utils.unescapeAll, n = /\[(\w*)(?::([\w ]*))?\]/;
259
- function a(s) {
263
+ function r(s) {
260
264
  return s.info ? t(s.info).trim() : "";
261
265
  }
262
266
  function i(s) {
263
- const r = a(s), [m = null, b = ""] = (n.exec(r) || []).slice(1);
267
+ const o = r(s), [m = null, b = ""] = (n.exec(o) || []).slice(1);
264
268
  return [m, b];
265
269
  }
266
270
  function c(s) {
267
- const r = a(s);
268
- return r ? r.split(/(\s+)/g)[0] : "";
271
+ const o = r(s);
272
+ return o ? o.split(/(\s+)/g)[0] : "";
269
273
  }
270
- const d = (s, r, m, b, y) => {
271
- if (s[r].hidden)
274
+ const u = (s, o, m, b, y) => {
275
+ if (s[o].hidden)
272
276
  return "";
273
- const [u, p] = i(s[r]);
274
- if (u === null)
275
- return l(s, r, m, b, y);
276
- let f, k, v, w, C = "", I = "";
277
- for (let E = r; E < s.length && (f = s[E], [k, v] = i(f), k === u); E++)
278
- f.info = f.info.replace(n, ""), f.hidden = !0, w = E - r > 0 ? "" : " checked", C += `<li><input type="radio" name="label-group-${o.editorId}-${r}"${w}><label for="group-${o.editorId}-${r}-tab-${E - r}" onclick="this.previousElementSibling.click()">${v || c(f)}</label></li>
279
- `, I += `<input type="radio" id="group-${o.editorId}-${r}-tab-${E - r}" name="group-${o.editorId}-${r}"${w}>
277
+ const [d, p] = i(s[o]);
278
+ if (d === null)
279
+ return l(s, o, m, b, y);
280
+ let f, k, v, w, C = "", S = "";
281
+ for (let E = o; E < s.length && (f = s[E], [k, v] = i(f), k === d); E++)
282
+ f.info = f.info.replace(n, ""), f.hidden = !0, w = E - o > 0 ? "" : " checked", C += `<li><input type="radio" name="label-group-${a.editorId}-${o}"${w}><label for="group-${a.editorId}-${o}-tab-${E - o}" onclick="this.previousElementSibling.click()">${v || c(f)}</label></li>
283
+ `, S += `<input type="radio" id="group-${a.editorId}-${o}-tab-${E - o}" name="group-${a.editorId}-${o}"${w}>
280
284
  ` + l(s, E, m, b, y);
281
285
  return `<div class="code-tabs">
282
286
  <ul>
283
287
  ` + C + `</ul>
284
- ` + I + "</div>";
288
+ ` + S + "</div>";
285
289
  };
286
- e.renderer.rules.fence = d;
287
- }, Ke = De, qe = (e) => {
290
+ e.renderer.rules.fence = u;
291
+ }, qe = Ke, Ze = (e) => {
288
292
  [
289
293
  "paragraph_open",
290
294
  "table_open",
@@ -294,91 +298,91 @@ const Y = "onSave", ee = "changeCatalogVisible", Ce = "changeFullscreen", G = "p
294
298
  "hr",
295
299
  "html_block",
296
300
  "fence"
297
- ].forEach((o) => {
298
- const l = e.renderer.rules[o];
299
- l ? e.renderer.rules[o] = (t, n, a, i, c) => {
300
- let d;
301
- const s = l(t, n, a, i, c);
302
- return t[n].map && t[n].level === 0 ? (d = t[n].map[0], s.replace(/^(<[^>]*)/, `$1 data-line="${d}"`)) : s;
303
- } : e.renderer.rules[o] = (t, n, a, i, c) => {
304
- let d;
305
- return t[n].map && t[n].level === 0 && (d = t[n].map[0], t[n].attrSet("data-line", String(d))), c.renderToken(t, n, a);
301
+ ].forEach((a) => {
302
+ const l = e.renderer.rules[a];
303
+ l ? e.renderer.rules[a] = (t, n, r, i, c) => {
304
+ let u;
305
+ const s = l(t, n, r, i, c);
306
+ return t[n].map && t[n].level === 0 ? (u = t[n].map[0], s.replace(/^(<[^>]*)/, `$1 data-line="${u}"`)) : s;
307
+ } : e.renderer.rules[a] = (t, n, r, i, c) => {
308
+ let u;
309
+ 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);
306
310
  };
307
311
  });
308
- }, We = (e, o) => {
309
- const { editorConfig: l, markdownItConfig: t, markdownItPlugins: n } = P, a = T("editorId"), i = T("showCodeRowNumber"), c = T("theme"), d = L([]), s = Fe(e), r = Re(e), { reRenderRef: m, replaceMermaid: b } = Me(e), y = be({
312
+ }, We = (e, a) => {
313
+ const { editorConfig: l, markdownItConfig: t, markdownItPlugins: n } = P, r = T("editorId"), i = T("showCodeRowNumber"), c = T("theme"), u = B([]), s = He(e), o = Ae(e), { reRenderRef: m, replaceMermaid: b } = xe(e), y = we({
310
314
  html: !0,
311
315
  breaks: !0
312
316
  });
313
317
  t(y);
314
- const u = [
318
+ const d = [
315
319
  {
316
320
  type: "katex",
317
- plugin: Oe,
318
- options: { katexRef: r }
321
+ plugin: Ve,
322
+ options: { katexRef: o }
319
323
  },
320
324
  {
321
325
  type: "image",
322
- plugin: we,
326
+ plugin: ke,
323
327
  options: { figcaption: !0, classes: "md-zoom" }
324
328
  },
325
329
  {
326
330
  type: "admonition",
327
- plugin: Ve,
331
+ plugin: Ge,
328
332
  options: {}
329
333
  },
330
334
  {
331
335
  type: "taskList",
332
- plugin: ke,
336
+ plugin: $e,
333
337
  options: {}
334
338
  },
335
339
  {
336
340
  type: "heading",
337
341
  plugin: ze,
338
- options: { mdHeadingId: e.mdHeadingId, headsRef: d }
342
+ options: { mdHeadingId: e.mdHeadingId, headsRef: u }
339
343
  },
340
344
  {
341
345
  type: "codeTabs",
342
- plugin: Ke,
343
- options: { editorId: a }
346
+ plugin: qe,
347
+ options: { editorId: r }
344
348
  }
345
349
  ];
346
- e.noMermaid || u.push({
350
+ e.noMermaid || d.push({
347
351
  type: "mermaid",
348
352
  plugin: Le,
349
353
  options: { themeRef: c }
350
- }), n(u).forEach((w) => {
354
+ }), n(d).forEach((w) => {
351
355
  y.use(w.plugin, w.options);
352
356
  }), y.set({
353
357
  highlight: (w, C) => {
354
- let I;
355
- !e.noHighlight && s.value ? s.value.getLanguage(C) ? I = s.value.highlight(w, {
358
+ let S;
359
+ !e.noHighlight && s.value ? s.value.getLanguage(C) ? S = s.value.highlight(w, {
356
360
  language: C,
357
361
  ignoreIllegals: !0
358
- }).value : I = s.value.highlightAuto(w).value : I = y.utils.escapeHtml(w);
359
- const E = i ? he(I.trim()) : `<span class="code-block">${I.trim()}</span>`;
362
+ }).value : S = s.value.highlightAuto(w).value : S = y.utils.escapeHtml(w);
363
+ const E = i ? ge(S.trim()) : `<span class="code-block">${S.trim()}</span>`;
360
364
  return `<pre><code class="language-${C}" language=${C}>${E}</code></pre>`;
361
365
  }
362
- }), qe(y);
363
- const p = L(e.sanitize(y.render(e.modelValue))), f = () => {
364
- g.emit(a, "buildFinished", p.value), e.onHtmlChanged(p.value), e.onGetCatalog(d.value), g.emit(a, "catalogChanged", d.value), b();
366
+ }), Ze(y);
367
+ const p = B(e.sanitize(y.render(e.modelValue))), f = () => {
368
+ g.emit(r, "buildFinished", p.value), e.onHtmlChanged(p.value), e.onGetCatalog(u.value), g.emit(r, "catalogChanged", u.value), b();
365
369
  };
366
- S(f);
370
+ I(f);
367
371
  const k = Q(
368
372
  async () => {
369
- d.value = [], p.value = e.sanitize(y.render(e.modelValue)), f();
373
+ u.value = [], p.value = e.sanitize(y.render(e.modelValue)), f();
370
374
  },
371
- (l == null ? void 0 : l.renderDelay) !== void 0 ? l == null ? void 0 : l.renderDelay : o ? 0 : 500
372
- ), v = M(() => (e.noKatex || r.value) && (e.noHighlight || s.value));
373
- return $([Z(e, "modelValue"), v, m], k), S(() => {
374
- g.on(a, {
375
+ (l == null ? void 0 : l.renderDelay) !== void 0 ? l == null ? void 0 : l.renderDelay : a ? 0 : 500
376
+ ), v = M(() => (e.noKatex || o.value) && (e.noHighlight || s.value));
377
+ return $([W(e, "modelValue"), v, m], k), I(() => {
378
+ g.on(r, {
375
379
  name: "pushCatalog",
376
380
  callback() {
377
- g.emit(a, "catalogChanged", d.value);
381
+ g.emit(r, "catalogChanged", u.value);
378
382
  }
379
383
  });
380
384
  }), { html: p };
381
- }, Ze = We, Je = {
385
+ }, Je = We, te = {
382
386
  modelValue: {
383
387
  type: String,
384
388
  default: ""
@@ -425,25 +429,89 @@ const Y = "onSave", ee = "changeCatalogVisible", Ce = "changeFullscreen", G = "p
425
429
  previewOnly: {
426
430
  type: Boolean,
427
431
  default: !1
432
+ },
433
+ noImgZoomIn: {
434
+ type: Boolean
435
+ }
436
+ }, dt = {
437
+ ...te,
438
+ onChange: {
439
+ type: Function,
440
+ default: () => {
441
+ }
442
+ },
443
+ placeholder: {
444
+ type: String,
445
+ default: ""
446
+ },
447
+ scrollAuto: {
448
+ type: Boolean
449
+ },
450
+ autofocus: {
451
+ type: Boolean
452
+ },
453
+ disabled: {
454
+ type: Boolean
455
+ },
456
+ readonly: {
457
+ type: Boolean
458
+ },
459
+ maxlength: {
460
+ type: Number
461
+ },
462
+ autoDetectCode: {
463
+ type: Boolean
464
+ },
465
+ /**
466
+ * 输入框失去焦点时触发事件
467
+ */
468
+ onBlur: {
469
+ type: Function,
470
+ default: () => {
471
+ }
472
+ },
473
+ /**
474
+ * 输入框获得焦点时触发事件
475
+ */
476
+ onFocus: {
477
+ type: Function,
478
+ default: () => {
479
+ }
480
+ },
481
+ noPrettier: {
482
+ type: Boolean
483
+ },
484
+ completions: {
485
+ type: Array
486
+ },
487
+ catalogVisible: {
488
+ type: Boolean
489
+ },
490
+ theme: {
491
+ type: String,
492
+ default: "light"
493
+ },
494
+ onInput: {
495
+ type: Function
428
496
  }
429
497
  }, Xe = /* @__PURE__ */ J({
430
498
  name: "ContentPreview",
431
- props: Je,
499
+ props: te,
432
500
  setup(e) {
433
- const o = T("editorId"), l = T("previewTheme"), t = T("showCodeRowNumber"), {
501
+ const a = T("editorId"), l = T("previewTheme"), t = T("showCodeRowNumber"), {
434
502
  html: n
435
- } = Ze(e, e.previewOnly);
436
- return Te(e, n), Ee(e, n), () => H(le, null, [H("div", {
437
- id: `${o}-preview-wrapper`,
503
+ } = Je(e, e.previewOnly);
504
+ return Fe(e, n), Pe(e, n), () => H(ie, null, [H("div", {
505
+ id: `${a}-preview-wrapper`,
438
506
  class: `${h}-preview-wrapper`,
439
507
  "data-show": e.setting.preview,
440
508
  key: "content-preview-wrapper"
441
509
  }, [H("article", {
442
- id: `${o}-preview`,
510
+ id: `${a}-preview`,
443
511
  class: [`${h}-preview`, `${l == null ? void 0 : l.value}-theme`, t && `${h}-scrn`],
444
512
  innerHTML: n.value
445
513
  }, null)]), !e.previewOnly && H("div", {
446
- id: `${o}-html-wrapper`,
514
+ id: `${a}-html-wrapper`,
447
515
  class: `${h}-preview-wrapper`,
448
516
  "data-show": e.setting.htmlPreview,
449
517
  key: "html-preview-wrapper"
@@ -451,7 +519,7 @@ const Y = "onSave", ee = "changeCatalogVisible", Ce = "changeFullscreen", G = "p
451
519
  class: `${h}-html`
452
520
  }, [n.value])])]);
453
521
  }
454
- }), ut = (e, o) => {
522
+ }), mt = (e, a) => {
455
523
  const { editorId: l } = e, t = X({
456
524
  // 是否已编译成html
457
525
  buildFinished: !1,
@@ -463,7 +531,7 @@ const Y = "onSave", ee = "changeCatalogVisible", Ce = "changeFullscreen", G = "p
463
531
  () => {
464
532
  t.buildFinished = !1;
465
533
  }
466
- ), S(() => {
534
+ ), I(() => {
467
535
  g.on(l, {
468
536
  name: "buildFinished",
469
537
  callback(n) {
@@ -472,12 +540,12 @@ const Y = "onSave", ee = "changeCatalogVisible", Ce = "changeFullscreen", G = "p
472
540
  }), g.on(l, {
473
541
  name: Y,
474
542
  callback() {
475
- const n = new Promise((a) => {
543
+ const n = new Promise((r) => {
476
544
  if (t.buildFinished)
477
- a(t.html);
545
+ r(t.html);
478
546
  else {
479
547
  const i = (c) => {
480
- a(c), g.remove(l, "buildFinished", i);
548
+ r(c), g.remove(l, "buildFinished", i);
481
549
  };
482
550
  g.on(l, {
483
551
  name: "buildFinished",
@@ -485,17 +553,17 @@ const Y = "onSave", ee = "changeCatalogVisible", Ce = "changeFullscreen", G = "p
485
553
  });
486
554
  }
487
555
  });
488
- e.onSave ? e.onSave(e.modelValue, n) : o.emit("onSave", e.modelValue, n);
556
+ e.onSave ? e.onSave(e.modelValue, n) : a.emit("onSave", e.modelValue, n);
489
557
  }
490
558
  });
491
559
  });
492
- }, te = (e) => {
493
- var n, a;
494
- const { editorId: o } = e, l = (a = (n = P) == null ? void 0 : n.editorExtensions) == null ? void 0 : a.highlight;
495
- F("editorId", o), F(
560
+ }, ne = (e) => {
561
+ var n, r;
562
+ const { editorId: a } = e, l = (r = (n = P) == null ? void 0 : n.editorExtensions) == null ? void 0 : r.highlight;
563
+ _("editorId", a), _(
496
564
  "theme",
497
565
  M(() => e.theme)
498
- ), F(
566
+ ), _(
499
567
  "highlight",
500
568
  M(() => {
501
569
  const i = {
@@ -503,159 +571,159 @@ const Y = "onSave", ee = "changeCatalogVisible", Ce = "changeFullscreen", G = "p
503
571
  ...l == null ? void 0 : l.css
504
572
  }, c = e.codeStyleReverse && e.codeStyleReverseList.includes(e.previewTheme) ? "dark" : e.theme;
505
573
  return {
506
- js: (l == null ? void 0 : l.js) || se,
574
+ js: (l == null ? void 0 : l.js) || ue,
507
575
  css: i[e.codeTheme] ? i[e.codeTheme][c] : j.atom[c]
508
576
  };
509
577
  })
510
- ), F("showCodeRowNumber", e.showCodeRowNumber);
578
+ ), _("showCodeRowNumber", e.showCodeRowNumber);
511
579
  const t = M(() => {
512
- var c, d;
580
+ var c, u;
513
581
  const i = {
514
582
  ...O,
515
- ...(d = (c = P) == null ? void 0 : c.editorConfig) == null ? void 0 : d.languageUserDefined
583
+ ...(u = (c = P) == null ? void 0 : c.editorConfig) == null ? void 0 : u.languageUserDefined
516
584
  };
517
585
  return i[e.language] ? i[e.language] : O["zh-CN"];
518
586
  });
519
- F("usedLanguageText", t), F(
587
+ _("usedLanguageText", t), _(
520
588
  "previewTheme",
521
589
  M(() => e.previewTheme)
522
590
  );
523
- }, mt = (e) => {
524
- te(e), F("tabWidth", e.tabWidth);
525
- }, ne = (e) => {
526
- S(() => {
591
+ }, ft = (e) => {
592
+ ne(e), _("tabWidth", e.tabWidth);
593
+ }, oe = (e) => {
594
+ I(() => {
527
595
  var l;
528
- const o = document.createElement("script");
529
- o.src = ((l = P.editorExtensions) == null ? void 0 : l.iconfont) || de, o.id = `${h}-icon`, e.noIconfont || _(o);
596
+ const a = document.createElement("script");
597
+ a.src = ((l = P.editorExtensions) == null ? void 0 : l.iconfont) || de, a.id = `${h}-icon`, e.noIconfont || F(a);
530
598
  });
531
- }, ft = (e) => {
532
- var c, d, s, r, m, b;
533
- const { noPrettier: o, noUploadImg: l } = e, { editorExtensions: t } = P, n = o || !!((d = (c = P.editorExtensions) == null ? void 0 : c.prettier) != null && d.prettierInstance), a = o || !!((r = (s = P.editorExtensions) == null ? void 0 : s.prettier) != null && r.parserMarkdownInstance), i = l || !!((b = (m = P.editorExtensions) == null ? void 0 : m.cropper) != null && b.instance);
534
- S(() => {
599
+ }, pt = (e) => {
600
+ var c, u, s, o, m, b;
601
+ const { noPrettier: a, noUploadImg: l } = e, { editorExtensions: t } = P, n = a || !!((u = (c = P.editorExtensions) == null ? void 0 : c.prettier) != null && u.prettierInstance), r = a || !!((o = (s = P.editorExtensions) == null ? void 0 : s.prettier) != null && o.parserMarkdownInstance), i = l || !!((b = (m = P.editorExtensions) == null ? void 0 : m.cropper) != null && b.instance);
602
+ I(() => {
535
603
  var k, v, w, C;
536
- const y = document.createElement("script"), u = document.createElement("script");
537
- y.src = ((k = t == null ? void 0 : t.prettier) == null ? void 0 : k.standaloneJs) || U.main, y.id = `${h}-prettier`, u.src = ((v = t == null ? void 0 : t.prettier) == null ? void 0 : v.parserMarkdownJs) || U.markdown, u.id = `${h}-prettierMD`;
604
+ const y = document.createElement("script"), d = document.createElement("script");
605
+ y.src = ((k = t == null ? void 0 : t.prettier) == null ? void 0 : k.standaloneJs) || V.main, y.id = `${h}-prettier`, d.src = ((v = t == null ? void 0 : t.prettier) == null ? void 0 : v.parserMarkdownJs) || V.markdown, d.id = `${h}-prettierMD`;
538
606
  const p = document.createElement("link");
539
- p.rel = "stylesheet", p.href = ((w = t == null ? void 0 : t.cropper) == null ? void 0 : w.css) || V.css, p.id = `${h}-cropperCss`;
607
+ p.rel = "stylesheet", p.href = ((w = t == null ? void 0 : t.cropper) == null ? void 0 : w.css) || U.css, p.id = `${h}-cropperCss`;
540
608
  const f = document.createElement("script");
541
- f.src = ((C = t == null ? void 0 : t.cropper) == null ? void 0 : C.js) || V.js, f.id = `${h}-cropper`, i || (_(p), _(f)), n || _(y), a || _(u);
542
- }), ne(e);
543
- }, pt = (e, o) => {
609
+ f.src = ((C = t == null ? void 0 : t.cropper) == null ? void 0 : C.js) || U.js, f.id = `${h}-cropper`, i || (F(p), F(f)), n || F(y), r || F(d);
610
+ }), oe(e);
611
+ }, ht = (e, a) => {
544
612
  const { editorId: l } = e;
545
- S(() => {
613
+ I(() => {
546
614
  g.on(l, {
547
615
  name: "errorCatcher",
548
616
  callback: (t) => {
549
- e.onError instanceof Function ? e.onError(t) : o.emit("onError", t);
617
+ e.onError instanceof Function ? e.onError(t) : a.emit("onError", t);
550
618
  }
551
619
  });
552
620
  });
553
- }, ht = (e, o) => {
621
+ }, gt = (e, a) => {
554
622
  const { editorId: l } = e, t = X({
555
623
  pageFullscreen: e.pageFullscreen,
556
624
  fullscreen: !1,
557
625
  preview: e.preview,
558
626
  htmlPreview: e.preview ? !1 : e.htmlPreview
559
- }), n = (c, d) => {
560
- t[c] = d === void 0 ? !t[c] : d, c === "preview" && t.preview ? t.htmlPreview = !1 : c === "htmlPreview" && t.htmlPreview && (t.preview = !1);
627
+ }), n = (c, u) => {
628
+ t[c] = u === void 0 ? !t[c] : u, c === "preview" && t.preview ? t.htmlPreview = !1 : c === "htmlPreview" && t.htmlPreview && (t.preview = !1);
561
629
  };
562
- let a = "";
630
+ let r = "";
563
631
  const i = () => {
564
- t.pageFullscreen || t.fullscreen ? document.body.style.overflow = "hidden" : document.body.style.overflow = a;
632
+ t.pageFullscreen || t.fullscreen ? document.body.style.overflow = "hidden" : document.body.style.overflow = r;
565
633
  };
566
- return $(() => [t.pageFullscreen, t.fullscreen], i), S(() => {
634
+ return $(() => [t.pageFullscreen, t.fullscreen], i), I(() => {
567
635
  g.on(l, {
568
636
  name: "uploadImage",
569
- callback(c, d) {
570
- const s = (r) => {
637
+ callback(c, u) {
638
+ const s = (o) => {
571
639
  g.emit(l, "replace", "image", {
572
640
  desc: "",
573
- urls: r
574
- }), d && d();
641
+ urls: o
642
+ }), u && u();
575
643
  };
576
- e.onUploadImg ? e.onUploadImg(c, s) : o.emit("onUploadImg", c, s);
644
+ e.onUploadImg ? e.onUploadImg(c, s) : a.emit("onUploadImg", c, s);
577
645
  }
578
- }), a = document.body.style.overflow, i();
646
+ }), r = document.body.style.overflow, i();
579
647
  }), [t, n];
580
- }, gt = (e) => {
581
- const { editorId: o } = e, l = L(!1);
582
- return S(() => {
583
- g.on(o, {
648
+ }, vt = (e) => {
649
+ const { editorId: a } = e, l = B(!1);
650
+ return I(() => {
651
+ g.on(a, {
584
652
  name: ee,
585
653
  callback: (n) => {
586
654
  n === void 0 ? l.value = !l.value : l.value = n;
587
655
  }
588
656
  });
589
657
  }), M(() => !e.toolbarsExclude.includes("catalog") && e.toolbars.includes("catalog") && l.value);
590
- }, vt = (e, o, l, t, n) => {
591
- const { editorId: a } = e;
658
+ }, yt = (e, a, l, t, n) => {
659
+ const { editorId: r } = e;
592
660
  $(
593
661
  () => t.pageFullscreen,
594
662
  (c) => {
595
- g.emit(a, G, c);
663
+ g.emit(r, G, c);
596
664
  }
597
665
  ), $(
598
666
  () => t.fullscreen,
599
667
  (c) => {
600
- g.emit(a, z, c);
668
+ g.emit(r, D, c);
601
669
  }
602
670
  ), $(
603
671
  () => t.preview,
604
672
  (c) => {
605
- g.emit(a, D, c);
673
+ g.emit(r, z, c);
606
674
  }
607
675
  ), $(
608
676
  () => t.htmlPreview,
609
677
  (c) => {
610
- g.emit(a, K, c);
678
+ g.emit(r, K, c);
611
679
  }
612
680
  ), $(l, (c) => {
613
- g.emit(a, q, c);
681
+ g.emit(r, q, c);
614
682
  });
615
683
  const i = {
616
- on(c, d) {
684
+ on(c, u) {
617
685
  switch (c) {
618
686
  case "pageFullscreen": {
619
- g.on(a, {
687
+ g.on(r, {
620
688
  name: G,
621
689
  callback(s) {
622
- d(s);
690
+ u(s);
623
691
  }
624
692
  });
625
693
  break;
626
694
  }
627
695
  case "fullscreen": {
628
- g.on(a, {
629
- name: z,
696
+ g.on(r, {
697
+ name: D,
630
698
  callback(s) {
631
- d(s);
699
+ u(s);
632
700
  }
633
701
  });
634
702
  break;
635
703
  }
636
704
  case "preview": {
637
- g.on(a, {
638
- name: D,
705
+ g.on(r, {
706
+ name: z,
639
707
  callback(s) {
640
- d(s);
708
+ u(s);
641
709
  }
642
710
  });
643
711
  break;
644
712
  }
645
713
  case "htmlPreview": {
646
- g.on(a, {
714
+ g.on(r, {
647
715
  name: K,
648
716
  callback(s) {
649
- d(s);
717
+ u(s);
650
718
  }
651
719
  });
652
720
  break;
653
721
  }
654
722
  case "catalog": {
655
- g.on(a, {
723
+ g.on(r, {
656
724
  name: q,
657
725
  callback(s) {
658
- d(s);
726
+ u(s);
659
727
  }
660
728
  });
661
729
  break;
@@ -666,7 +734,7 @@ const Y = "onSave", ee = "changeCatalogVisible", Ce = "changeFullscreen", G = "p
666
734
  n("pageFullscreen", c);
667
735
  },
668
736
  toggleFullscreen(c) {
669
- g.emit(a, Ce, c);
737
+ g.emit(r, Ie, c);
670
738
  },
671
739
  togglePreview(c) {
672
740
  n("preview", c);
@@ -675,19 +743,19 @@ const Y = "onSave", ee = "changeCatalogVisible", Ce = "changeFullscreen", G = "p
675
743
  n("htmlPreview", c);
676
744
  },
677
745
  toggleCatalog(c) {
678
- g.emit(a, ee, c);
746
+ g.emit(r, ee, c);
679
747
  },
680
748
  triggerSave() {
681
- g.emit(a, Y);
749
+ g.emit(r, Y);
682
750
  },
683
751
  insert(c) {
684
- g.emit(a, "replace", "universal", { generate: c });
752
+ g.emit(r, "replace", "universal", { generate: c });
685
753
  },
686
754
  focus(c) {
687
- g.emit(a, Se, c);
755
+ g.emit(r, Se, c);
688
756
  }
689
757
  };
690
- o.expose(i);
758
+ a.expose(i);
691
759
  }, Qe = (e) => e, re = {
692
760
  /**
693
761
  * markdown content.
@@ -744,7 +812,7 @@ const Y = "onSave", ee = "changeCatalogVisible", Ce = "changeFullscreen", G = "p
744
812
  */
745
813
  editorId: {
746
814
  type: String,
747
- default: ue
815
+ default: me
748
816
  },
749
817
  /**
750
818
  * 预览中代码是否显示行号
@@ -857,8 +925,15 @@ const Y = "onSave", ee = "changeCatalogVisible", Ce = "changeFullscreen", G = "p
857
925
  noHighlight: {
858
926
  type: Boolean,
859
927
  default: !1
928
+ },
929
+ /**
930
+ * 是否关闭编辑器默认的放大缩小功能
931
+ */
932
+ noImgZoomIn: {
933
+ type: Boolean,
934
+ default: !1
860
935
  }
861
- }, yt = {
936
+ }, bt = {
862
937
  ...re,
863
938
  /**
864
939
  * input回调事件
@@ -923,7 +998,7 @@ const Y = "onSave", ee = "changeCatalogVisible", Ce = "changeFullscreen", G = "p
923
998
  */
924
999
  toolbars: {
925
1000
  type: Array,
926
- default: me
1001
+ default: fe
927
1002
  },
928
1003
  /**
929
1004
  * 工具栏选择不显示
@@ -987,7 +1062,7 @@ const Y = "onSave", ee = "changeCatalogVisible", Ce = "changeFullscreen", G = "p
987
1062
  */
988
1063
  footers: {
989
1064
  type: Array,
990
- default: fe
1065
+ default: pe
991
1066
  },
992
1067
  /**
993
1068
  * 是否默认激活输入框和预览框同步滚动
@@ -1091,8 +1166,8 @@ const Y = "onSave", ee = "changeCatalogVisible", Ce = "changeFullscreen", G = "p
1091
1166
  onInput: {
1092
1167
  type: Function
1093
1168
  }
1094
- }, oe = ["onHtmlChanged", "onGetCatalog"], bt = [
1095
- ...oe,
1169
+ }, ae = ["onHtmlChanged", "onGetCatalog"], wt = [
1170
+ ...ae,
1096
1171
  "onChange",
1097
1172
  "onSave",
1098
1173
  "onUploadImg",
@@ -1104,15 +1179,15 @@ const Y = "onSave", ee = "changeCatalogVisible", Ce = "changeFullscreen", G = "p
1104
1179
  ], Ye = /* @__PURE__ */ J({
1105
1180
  name: "MdPreview",
1106
1181
  props: re,
1107
- emits: oe,
1108
- setup(e, o) {
1182
+ emits: ae,
1183
+ setup(e, a) {
1109
1184
  const {
1110
1185
  editorId: l,
1111
1186
  noKatex: t,
1112
1187
  noMermaid: n,
1113
- noHighlight: a
1188
+ noHighlight: r
1114
1189
  } = e;
1115
- return te(e), ne(e), ie(() => {
1190
+ return ne(e), oe(e), ce(() => {
1116
1191
  g.clear(l);
1117
1192
  }), () => H("div", {
1118
1193
  id: l,
@@ -1121,36 +1196,38 @@ const Y = "onSave", ee = "changeCatalogVisible", Ce = "changeFullscreen", G = "p
1121
1196
  }, [H(Xe, {
1122
1197
  modelValue: e.modelValue,
1123
1198
  onHtmlChanged: (i) => {
1124
- e.onHtmlChanged ? e.onHtmlChanged(i) : o.emit("onHtmlChanged", i);
1199
+ e.onHtmlChanged ? e.onHtmlChanged(i) : a.emit("onHtmlChanged", i);
1125
1200
  },
1126
1201
  onGetCatalog: (i) => {
1127
- e.onGetCatalog ? e.onGetCatalog(i) : o.emit("onGetCatalog", i);
1202
+ e.onGetCatalog ? e.onGetCatalog(i) : a.emit("onGetCatalog", i);
1128
1203
  },
1129
1204
  mdHeadingId: e.mdHeadingId,
1130
1205
  noMermaid: n,
1131
1206
  sanitize: e.sanitize,
1132
1207
  noKatex: t,
1133
1208
  formatCopiedText: e.formatCopiedText,
1134
- noHighlight: a,
1209
+ noHighlight: r,
1210
+ noImgZoomIn: e.noImgZoomIn,
1135
1211
  previewOnly: !0
1136
1212
  }, null)]);
1137
1213
  }
1138
1214
  }), R = Ye;
1139
1215
  R.install = (e) => (e.component(R.name, R), e);
1140
1216
  export {
1141
- Ce as C,
1217
+ Ie as C,
1142
1218
  R as M,
1143
1219
  Y as O,
1144
1220
  Se as T,
1145
1221
  ee as a,
1146
1222
  Xe as b,
1147
- bt as c,
1148
- mt as d,
1149
- yt as e,
1223
+ dt as c,
1224
+ wt as d,
1225
+ bt as e,
1150
1226
  ft as f,
1151
1227
  pt as g,
1152
1228
  ht as h,
1153
1229
  gt as i,
1154
1230
  vt as j,
1155
- ut as u
1231
+ yt as k,
1232
+ mt as u
1156
1233
  };