md-editor-v3 4.3.0-beta.0 → 4.3.0-beta.2

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,212 +1,212 @@
1
- import { inject as I, onMounted as C, watch as $, toRef as W, nextTick as A, shallowRef as x, ref as L, computed as M, defineComponent as Z, createVNode as H, Fragment as le, reactive as J, provide as F, onBeforeUnmount as ie } from "vue";
2
- import { p, a as S, m as ce, k as N, e as B, h as se, f as j, i as de, g as O, j as U, l as ue, b as me, d as fe } from "./config.mjs";
3
- import { u as he, g as pe, b as y } from "./index4.mjs";
4
- import { a as T, u as ge } from "./dom.mjs";
1
+ import { inject as E, onMounted as I, 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 T, 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
5
  import ve from "medium-zoom";
6
- import { debounce as X } from "@vavt/util";
6
+ import { debounce as Q } from "@vavt/util";
7
7
  import ye from "copy-to-clipboard";
8
8
  import be from "markdown-it";
9
9
  import we from "markdown-it-image-figures";
10
10
  import ke from "markdown-it-task-lists";
11
11
  import $e from "lru-cache";
12
- const Q = "onSave", Y = "changeCatalogVisible", Ce = "changeFullscreen", V = "pageFullscreenChanged", G = "fullscreenChanged", D = "previewChanged", z = "htmlPreviewChanged", K = "catalogVisibleChanged", Se = "textareaFocus", Ie = (e, o) => {
13
- const a = I("editorId"), n = X(() => {
14
- const t = document.querySelectorAll(`#${a}-preview img`);
15
- t.length !== 0 && ve(t, {
12
+ const Y = "onSave", ee = "changeCatalogVisible", Ce = "changeFullscreen", G = "pageFullscreenChanged", z = "fullscreenChanged", D = "previewChanged", K = "htmlPreviewChanged", q = "catalogVisibleChanged", Se = "textareaFocus", Ie = (e, a) => {
13
+ const l = E("editorId"), t = Q(() => {
14
+ const n = document.querySelectorAll(`#${l}-preview img.md-zoom`);
15
+ n.length !== 0 && ve(n, {
16
16
  background: "#00000073"
17
17
  });
18
18
  });
19
- C(n), $([o, W(e.setting, "preview")], n);
20
- }, Pe = Ie, Te = (e, o) => {
21
- const a = I("editorId"), n = I("usedLanguageText"), t = () => {
22
- document.querySelectorAll(`#${a}-preview pre`).forEach((c) => {
23
- var m, f;
19
+ I(t), $([a, Z(e.setting, "preview")], t);
20
+ }, Pe = Ie, Te = (e, a) => {
21
+ const l = E("editorId"), t = E("usedLanguageText"), n = () => {
22
+ document.querySelectorAll(`#${l}-preview pre`).forEach((c) => {
23
+ var m, b;
24
24
  let d = -1;
25
25
  (m = c.querySelector(".copy-button")) == null || m.remove();
26
- const s = ((f = n.value.copyCode) == null ? void 0 : f.text) || "复制代码", r = document.createElement("span");
27
- r.setAttribute("class", "copy-button"), r.dataset.tips = s, r.innerHTML = `<svg class="${p}-icon" aria-hidden="true"><use xlink:href="#${p}-icon-copy"></use></svg>`, r.addEventListener("click", () => {
28
- var w, v;
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", () => {
28
+ var k, v;
29
29
  clearTimeout(d);
30
- const b = c.querySelector("code").innerText, u = ye(e.formatCopiedText(b)), g = ((w = n.value.copyCode) == null ? void 0 : w.successTips) || "已复制!", h = ((v = n.value.copyCode) == null ? void 0 : v.failTips) || "已复制!";
31
- r.dataset.tips = u ? g : h, d = window.setTimeout(() => {
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
32
  r.dataset.tips = s;
33
33
  }, 1500);
34
34
  }), c.appendChild(r);
35
35
  });
36
- }, l = () => {
37
- A(t);
36
+ }, o = () => {
37
+ A(n);
38
38
  }, i = (c) => {
39
- c && A(t);
39
+ c && A(n);
40
40
  };
41
- $(() => o.value, l), $(() => e.setting.preview, i), $(() => e.setting.htmlPreview, i), $(() => n.value, t), C(t);
41
+ $(() => a.value, o), $(() => e.setting.preview, i), $(() => e.setting.htmlPreview, i), $(() => t.value, n), I(n);
42
42
  }, Ee = Te, _e = (e) => {
43
- var l;
44
- const o = (l = S.editorExtensions) == null ? void 0 : l.highlight, a = o == null ? void 0 : o.instance, n = I("highlight"), t = x(a);
45
- return C(() => {
46
- if (!e.noHighlight && !t.value) {
43
+ var o;
44
+ const a = (o = T.editorExtensions) == null ? void 0 : o.highlight, l = a == null ? void 0 : a.instance, t = E("highlight"), n = x(l);
45
+ return I(() => {
46
+ if (!e.noHighlight && !n.value) {
47
47
  const i = document.createElement("script");
48
- i.src = n.value.js, i.onload = () => {
49
- t.value = window.hljs;
50
- }, i.id = `${p}-hljs`, T(i, "hljs");
48
+ i.src = t.value.js, i.onload = () => {
49
+ n.value = window.hljs;
50
+ }, i.id = `${h}-hljs`, _(i, "hljs");
51
51
  const c = document.createElement("link");
52
- c.rel = "stylesheet", c.href = n.value.css, c.id = `${p}-hlCss`, T(c);
52
+ c.rel = "stylesheet", c.href = t.value.css, c.id = `${h}-hlCss`, _(c);
53
53
  }
54
54
  }), $(
55
- () => n.value.css,
55
+ () => t.value.css,
56
56
  (i) => {
57
- ge(`${p}-hlCss`, "href", i);
57
+ ge(`${h}-hlCss`, "href", i);
58
58
  }
59
- ), t;
59
+ ), n;
60
60
  }, Fe = _e, He = (e) => {
61
- const o = I("theme"), { editorExtensions: a } = S, n = a == null ? void 0 : a.mermaid, t = x(n == null ? void 0 : n.instance), l = x(-1), i = new $e({
61
+ const a = E("theme"), { editorExtensions: l } = T, t = l == null ? void 0 : l.mermaid, n = x(t == null ? void 0 : t.instance), o = x(-1), i = new $e({
62
62
  max: 1e3,
63
63
  // 缓存10分钟
64
64
  ttl: 6e5
65
65
  }), c = () => {
66
- const s = t.value;
66
+ const s = n.value;
67
67
  !e.noMermaid && s && (s.initialize({
68
68
  startOnLoad: !1,
69
- theme: o.value === "dark" ? "dark" : "default"
70
- }), l.value = l.value + 1);
69
+ theme: a.value === "dark" ? "dark" : "default"
70
+ }), o.value = o.value + 1);
71
71
  };
72
72
  return $(
73
- () => o.value,
73
+ () => a.value,
74
74
  () => {
75
75
  i.clear(), c();
76
76
  }
77
- ), C(() => {
78
- if (!e.noMermaid && !(n != null && n.instance)) {
79
- const s = (n == null ? void 0 : n.js) || ce;
77
+ ), I(() => {
78
+ if (!e.noMermaid && !(t != null && t.instance)) {
79
+ const s = (t == null ? void 0 : t.js) || ce;
80
80
  if (/\.mjs/.test(s))
81
81
  import(
82
82
  /* @vite-ignore */
83
83
  /* webpackIgnore: true */
84
84
  s
85
85
  ).then((r) => {
86
- t.value = r.default, c();
86
+ n.value = r.default, c();
87
87
  });
88
88
  else {
89
89
  const r = document.createElement("script");
90
- r.id = `${p}-mermaid`, r.src = s, r.onload = () => {
91
- t.value = window.mermaid, c();
92
- }, T(r, "mermaid");
90
+ r.id = `${h}-mermaid`, r.src = s, r.onload = () => {
91
+ n.value = window.mermaid, c();
92
+ }, _(r, "mermaid");
93
93
  }
94
94
  }
95
- }), { mermaidRef: t, reRenderRef: l, replaceMermaid: () => {
95
+ }), { mermaidRef: n, reRenderRef: o, replaceMermaid: () => {
96
96
  A(() => {
97
- if (!e.noMermaid && t.value) {
97
+ if (!e.noMermaid && n.value) {
98
98
  const s = document.querySelectorAll(
99
- `div.${p}-mermaid`
99
+ `div.${h}-mermaid`
100
100
  ), r = document.createElement("div");
101
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";
102
102
  let m = s.length;
103
- m > 0 && document.body.appendChild(r), s.forEach(async (f) => {
104
- let b = i.get(f.innerText);
105
- if (!b) {
106
- const g = he(), h = t.value.renderAsync || t.value.render;
107
- let w = "";
103
+ m > 0 && document.body.appendChild(r), s.forEach(async (b) => {
104
+ let y = i.get(b.innerText);
105
+ if (!y) {
106
+ const p = pe(), f = n.value.renderAsync || n.value.render;
107
+ let k = "";
108
108
  try {
109
- w = await h(g, f.innerText, r);
109
+ k = await f(p, b.innerText, r);
110
110
  } catch {
111
111
  }
112
- b = typeof w == "string" ? w : w.svg, i.set(f.innerText, b);
112
+ y = typeof k == "string" ? k : k.svg, i.set(b.innerText, y);
113
113
  }
114
114
  const u = document.createElement("p");
115
- u.className = `${p}-mermaid`, u.setAttribute("data-processed", ""), u.innerHTML = b, f.dataset.line !== void 0 && (u.dataset.line = f.dataset.line), f.replaceWith(u), --m === 0 && r.remove();
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();
116
116
  });
117
117
  }
118
118
  });
119
119
  } };
120
120
  }, Me = He, xe = (e) => {
121
- var t;
122
- const o = (t = S.editorExtensions) == null ? void 0 : t.katex, a = o == null ? void 0 : o.instance, n = x(a);
123
- return C(() => {
124
- if (!e.noKatex && !n.value) {
125
- const l = document.createElement("script");
126
- l.src = (o == null ? void 0 : o.js) || N.js, l.onload = () => {
127
- n.value = window.katex;
128
- }, l.id = `${p}-katex`;
121
+ var n;
122
+ const a = (n = T.editorExtensions) == null ? void 0 : n.katex, l = a == null ? void 0 : a.instance, t = x(l);
123
+ return I(() => {
124
+ if (!e.noKatex && !t.value) {
125
+ const o = document.createElement("script");
126
+ o.src = (a == null ? void 0 : a.js) || B.js, o.onload = () => {
127
+ t.value = window.katex;
128
+ }, o.id = `${h}-katex`;
129
129
  const i = document.createElement("link");
130
- i.rel = "stylesheet", i.href = (o == null ? void 0 : o.css) || N.css, i.id = `${p}-katexCss`, T(l, "katex"), T(i);
130
+ i.rel = "stylesheet", i.href = (a == null ? void 0 : a.css) || B.css, i.id = `${h}-katexCss`, _(o, "katex"), _(i);
131
131
  }
132
- }), n;
133
- }, Re = xe, Ae = (e, o) => {
134
- const a = e.renderer.rules.fence.bind(e.renderer.rules);
135
- e.renderer.rules.fence = (n, t, l, i, c) => {
136
- const d = n[t], s = d.content.trim();
132
+ }), t;
133
+ }, Re = xe, Ae = (e, a) => {
134
+ const l = e.renderer.rules.fence.bind(e.renderer.rules);
135
+ e.renderer.rules.fence = (t, n, o, i, c) => {
136
+ const d = t[n], s = d.content.trim();
137
137
  if (d.info === "mermaid") {
138
138
  let r;
139
- return n[t].map && n[t].level === 0 && (r = n[t].map[0], n[t].attrSet("data-line", String(r))), `<div class="${p}-mermaid" ${r !== void 0 ? "data-line=" + r : ""} data-mermaid-theme=${o.themeRef.value}>${s}</div>`;
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=${a.themeRef.value}>${s}</div>`;
140
140
  }
141
- return a(n, t, l, i, c);
141
+ return l(t, n, o, i, c);
142
142
  };
143
- }, Le = Ae, q = (e, o) => {
144
- let a = !0, n = !0;
145
- const t = e.posMax, l = o > 0 ? e.src.charCodeAt(o - 1) : -1, i = o + 1 <= t ? e.src.charCodeAt(o + 1) : -1;
146
- return (l === 32 || l === 9 || i >= 48 && i <= 57) && (n = !1), (i === 32 || i === 9) && (a = !1), {
147
- can_open: a,
148
- can_close: n
143
+ }, Le = Ae, W = (e, a) => {
144
+ let l = !0, t = !0;
145
+ const n = e.posMax, o = a > 0 ? e.src.charCodeAt(a - 1) : -1, i = a + 1 <= n ? e.src.charCodeAt(a + 1) : -1;
146
+ return (o === 32 || o === 9 || i >= 48 && i <= 57) && (t = !1), (i === 32 || i === 9) && (l = !1), {
147
+ can_open: l,
148
+ can_close: t
149
149
  };
150
- }, Ne = (e, o) => {
151
- let a, n, t, l;
150
+ }, Ne = (e, a) => {
151
+ let l, t, n, o;
152
152
  if (e.src[e.pos] !== "$")
153
153
  return !1;
154
- if (t = q(e, e.pos), !t.can_open)
155
- return o || (e.pending += "$"), e.pos += 1, !0;
154
+ if (n = W(e, e.pos), !n.can_open)
155
+ return a || (e.pending += "$"), e.pos += 1, !0;
156
156
  const i = e.pos + 1;
157
- for (a = i; (a = e.src.indexOf("$", a)) !== -1; ) {
158
- for (l = a - 1; e.src[l] === "\\"; )
159
- l -= 1;
160
- if ((a - l) % 2 == 1)
157
+ for (l = i; (l = e.src.indexOf("$", l)) !== -1; ) {
158
+ for (o = l - 1; e.src[o] === "\\"; )
159
+ o -= 1;
160
+ if ((l - o) % 2 == 1)
161
161
  break;
162
- a += 1;
162
+ l += 1;
163
163
  }
164
- return a === -1 ? (o || (e.pending += "$"), e.pos = i, !0) : a - i === 0 ? (o || (e.pending += "$$"), e.pos = i + 1, !0) : (t = q(e, a), t.can_close ? (o || (n = e.push("math_inline", "math", 0), n.markup = "$", n.content = e.src.slice(i, a)), e.pos = a + 1, !0) : (o || (e.pending += "$"), e.pos = i, !0));
165
- }, Be = (e, o, a, n) => {
166
- let t, l, i, c, d = !1, s = e.bMarks[o] + e.tShift[o], r = e.eMarks[o];
164
+ return l === -1 ? (a || (e.pending += "$"), e.pos = i, !0) : l - i === 0 ? (a || (e.pending += "$$"), e.pos = i + 1, !0) : (n = W(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));
165
+ }, Be = (e, a, l, t) => {
166
+ let n, o, i, c, d = !1, s = e.bMarks[a] + e.tShift[a], r = e.eMarks[a];
167
167
  if (s + 2 > r || e.src.slice(s, s + 2) !== "$$")
168
168
  return !1;
169
- if (s += 2, t = e.src.slice(s, r), n)
169
+ if (s += 2, n = e.src.slice(s, r), t)
170
170
  return !0;
171
- for (t.trim().slice(-2) === "$$" && (t = t.trim().slice(0, -2), d = !0), i = o; !d && (i++, !(i >= a || (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("$$"), l = e.src.slice(s, c), d = !0);
171
+ for (n.trim().slice(-2) === "$$" && (n = n.trim().slice(0, -2), d = !0), i = a; !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("$$"), o = e.src.slice(s, c), d = !0);
173
173
  e.line = i + 1;
174
174
  const m = e.push("math_block", "math", 0);
175
- return m.block = !0, m.content = (t && t.trim() ? t + `
176
- ` : "") + e.getLines(o + 1, i, e.tShift[o], !0) + (l && l.trim() ? l : ""), m.map = [o, e.line], m.markup = "$$", !0;
177
- }, je = (e, o) => {
178
- const a = (t) => {
179
- if (o.katexRef.value) {
180
- const l = o.katexRef.value.renderToString(t, {
175
+ return m.block = !0, m.content = (n && n.trim() ? n + `
176
+ ` : "") + e.getLines(a + 1, i, e.tShift[a], !0) + (o && o.trim() ? o : ""), m.map = [a, e.line], m.markup = "$$", !0;
177
+ }, je = (e, a) => {
178
+ const l = (n) => {
179
+ if (a.katexRef.value) {
180
+ const o = a.katexRef.value.renderToString(n, {
181
181
  throwOnError: !1
182
182
  });
183
- return `<span class="${p}-katex-inline" data-processed>${l}</span>`;
183
+ return `<span class="${h}-katex-inline" data-processed>${o}</span>`;
184
184
  } else
185
- return `<span class="${p}-katex-inline">${t}</span>`;
186
- }, n = (t, l) => {
187
- if (o.katexRef.value) {
188
- const i = o.katexRef.value.renderToString(t, {
185
+ return `<span class="${h}-katex-inline">${n}</span>`;
186
+ }, t = (n, o) => {
187
+ if (a.katexRef.value) {
188
+ const i = a.katexRef.value.renderToString(n, {
189
189
  throwOnError: !1,
190
190
  displayMode: !0
191
191
  });
192
- return `<p class="${p}-katex-block" data-line=${l} data-processed>${i}</p>`;
192
+ return `<p class="${h}-katex-block" data-line=${o} data-processed>${i}</p>`;
193
193
  } else
194
- return `<p class="${p}-katex-block" data-line=${l}>${t}</p>`;
194
+ return `<p class="${h}-katex-block" data-line=${o}>${n}</p>`;
195
195
  };
196
196
  e.inline.ruler.after("escape", "math_inline", Ne), e.block.ruler.after("blockquote", "math_block", Be, {
197
197
  alt: ["paragraph", "reference", "blockquote", "list"]
198
- }), e.renderer.rules.math_inline = (t, l) => a(t[l].content), e.renderer.rules.math_block = (t, l) => n(t[l].content, t[l].map[0]) + `
198
+ }), e.renderer.rules.math_inline = (n, o) => l(n[o].content), e.renderer.rules.math_block = (n, o) => t(n[o].content, n[o].map[0]) + `
199
199
  `;
200
- }, Oe = je, Ue = (e, o) => {
201
- o = o || {};
202
- const a = 3, n = o.marker || "!", t = n.charCodeAt(0), l = n.length;
200
+ }, Oe = je, Ue = (e, a) => {
201
+ a = a || {};
202
+ const l = 3, t = a.marker || "!", n = t.charCodeAt(0), o = t.length;
203
203
  let i = "", c = "";
204
- const d = (r, m, f, b, u) => {
205
- const g = r[m];
206
- return g.type === "admonition_open" ? (r[m].attrPush([
204
+ const d = (r, m, b, y, u) => {
205
+ const p = r[m];
206
+ return p.type === "admonition_open" ? (r[m].attrPush([
207
207
  "class",
208
- `${p}-admonition ${p}-admonition-${g.info}`
209
- ]), r[m].attrSet("data-line", String(r[m].map[0]))) : g.type === "admonition_title_open" && r[m].attrPush(["class", `${p}-admonition-title`]), u.renderToken(r, m, f);
208
+ `${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
210
  }, s = (r) => {
211
211
  const m = r.trim().split(" ", 2);
212
212
  c = "", i = m[0], m.length > 1 && (c = r.substring(i.length + 2)), (c === "" || !c) && (c = i);
@@ -214,77 +214,77 @@ const Q = "onSave", Y = "changeCatalogVisible", Ce = "changeFullscreen", V = "pa
214
214
  e.block.ruler.before(
215
215
  "code",
216
216
  "admonition",
217
- (r, m, f, b) => {
218
- let u, g, h, w = !1, v = r.bMarks[m] + r.tShift[m], k = r.eMarks[m];
219
- if (t !== r.src.charCodeAt(v))
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))
220
220
  return !1;
221
- for (u = v + 1; u <= k && n[(u - v) % l] === r.src[u]; u++)
221
+ for (u = v + 1; u <= w && t[(u - v) % o] === r.src[u]; u++)
222
222
  ;
223
- const P = Math.floor((u - v) / l);
224
- if (P !== a)
223
+ const C = Math.floor((u - v) / o);
224
+ if (C !== l)
225
225
  return !1;
226
- u -= (u - v) % l;
227
- const _ = r.src.slice(v, u), E = r.src.slice(u, k);
228
- if (s(E), b)
226
+ u -= (u - v) % o;
227
+ const S = r.src.slice(v, u), P = r.src.slice(u, w);
228
+ if (s(P), y)
229
229
  return !0;
230
- for (g = m; g++, !(g >= f || (v = r.bMarks[g] + r.tShift[g], k = r.eMarks[g], v < k && r.sCount[g] < r.blkIndent)); )
231
- if (t === r.src.charCodeAt(v) && !(r.sCount[g] - r.blkIndent >= 4)) {
232
- for (u = v + 1; u <= k && n[(u - v) % l] === r.src[u]; u++)
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) % o] === r.src[u]; u++)
233
233
  ;
234
- if (!(Math.floor((u - v) / l) < P) && (u -= (u - v) % l, u = r.skipSpaces(u), !(u < k))) {
235
- w = !0;
234
+ if (!(Math.floor((u - v) / o) < C) && (u -= (u - v) % o, u = r.skipSpaces(u), !(u < w))) {
235
+ k = !0;
236
236
  break;
237
237
  }
238
238
  }
239
- const oe = r.parentType, ae = r.lineMax;
240
- return r.parentType = "root", r.lineMax = g, h = r.push("admonition_open", "div", 1), h.markup = _, h.block = !0, h.info = i, h.map = [m, g], h = r.push("admonition_title_open", "p", 1), h.markup = _ + " " + i, h.map = [m, g], h = r.push("inline", "", 0), h.content = c, h.map = [m, r.line - 1], h.children = [], h = r.push("admonition_title_close", "p", -1), h.markup = _ + " " + i, r.md.block.tokenize(r, m + 1, g), h = r.push("admonition_close", "div", -1), h.markup = r.src.slice(v, u), h.block = !0, r.parentType = oe, r.lineMax = ae, r.line = g + (w ? 1 : 0), !0;
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 = S, f.block = !0, f.info = i, f.map = [m, p], f = r.push("admonition_title_open", "p", 1), f.markup = S + " " + 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 = S + " " + 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;
241
241
  },
242
242
  {
243
243
  alt: ["paragraph", "reference", "blockquote", "list"]
244
244
  }
245
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) => {
247
- e.renderer.rules.heading_open = (a, n) => {
248
- const t = a[n], l = a[n + 1].content, i = t.markup.length;
249
- return o.headsRef.value.push({
250
- text: l,
246
+ }, Ve = Ue, Ge = (e, a) => {
247
+ e.renderer.rules.heading_open = (l, t) => {
248
+ const n = l[t], o = l[t + 1].content, i = n.markup.length;
249
+ return a.headsRef.value.push({
250
+ text: o,
251
251
  level: i
252
- }), t.map && t.level === 0 && (t.attrSet("data-line", String(t.map[0])), t.attrSet(
252
+ }), n.map && n.level === 0 && (n.attrSet("data-line", String(n.map[0])), n.attrSet(
253
253
  "id",
254
- o.mdHeadingId(l, i, o.headsRef.value.length)
255
- )), e.renderer.renderToken(a, n, o);
256
- }, e.renderer.rules.heading_close = (a, n, t, l, i) => i.renderToken(a, n, t);
257
- }, De = Ge, ze = (e, o) => {
258
- const a = e.renderer.rules.fence, n = e.utils.unescapeAll, t = /\[(\w*)(?::([\w ]*))?\]/;
259
- function l(s) {
260
- return s.info ? n(s.info).trim() : "";
254
+ a.mdHeadingId(o, i, a.headsRef.value.length)
255
+ )), e.renderer.renderToken(l, t, a);
256
+ }, e.renderer.rules.heading_close = (l, t, n, o, i) => i.renderToken(l, t, n);
257
+ }, ze = Ge, De = (e, a) => {
258
+ const l = e.renderer.rules.fence, t = e.utils.unescapeAll, n = /\[(\w*)(?::([\w ]*))?\]/;
259
+ function o(s) {
260
+ return s.info ? t(s.info).trim() : "";
261
261
  }
262
262
  function i(s) {
263
- const r = l(s), [m = null, f = ""] = (t.exec(r) || []).slice(1);
264
- return [m, f];
263
+ const r = o(s), [m = null, b = ""] = (n.exec(r) || []).slice(1);
264
+ return [m, b];
265
265
  }
266
266
  function c(s) {
267
- const r = l(s);
267
+ const r = o(s);
268
268
  return r ? r.split(/(\s+)/g)[0] : "";
269
269
  }
270
- const d = (s, r, m, f, b) => {
270
+ const d = (s, r, m, b, y) => {
271
271
  if (s[r].hidden)
272
272
  return "";
273
- const [u, g] = i(s[r]);
273
+ const [u, p] = i(s[r]);
274
274
  if (u === null)
275
- return a(s, r, m, f, b);
276
- let h, w, v, k, P = "", _ = "";
277
- for (let E = r; E < s.length && (h = s[E], [w, v] = i(h), w === u); E++)
278
- h.info = h.info.replace(t, ""), h.hidden = !0, k = E - r > 0 ? "" : " checked", P += `<li><input type="radio" name="label-group-${o.editorId}-${r}"${k}><label for="group-${o.editorId}-${r}-tab-${E - r}" onclick="this.previousElementSibling.click()">${v || c(h)}</label></li>
279
- `, _ += `<input type="radio" id="group-${o.editorId}-${r}-tab-${E - r}" name="group-${o.editorId}-${r}"${k}>
280
- ` + a(s, E, m, f, b);
275
+ return l(s, r, m, b, y);
276
+ let f, k, v, w, C = "", S = "";
277
+ for (let P = r; P < s.length && (f = s[P], [k, v] = i(f), k === u); P++)
278
+ f.info = f.info.replace(n, ""), f.hidden = !0, w = P - r > 0 ? "" : " checked", C += `<li><input type="radio" name="label-group-${a.editorId}-${r}"${w}><label for="group-${a.editorId}-${r}-tab-${P - r}" onclick="this.previousElementSibling.click()">${v || c(f)}</label></li>
279
+ `, S += `<input type="radio" id="group-${a.editorId}-${r}-tab-${P - r}" name="group-${a.editorId}-${r}"${w}>
280
+ ` + l(s, P, m, b, y);
281
281
  return `<div class="code-tabs">
282
282
  <ul>
283
- ` + P + `</ul>
284
- ` + _ + "</div>";
283
+ ` + C + `</ul>
284
+ ` + S + "</div>";
285
285
  };
286
286
  e.renderer.rules.fence = d;
287
- }, Ke = ze, qe = (e) => {
287
+ }, Ke = De, qe = (e) => {
288
288
  [
289
289
  "paragraph_open",
290
290
  "table_open",
@@ -294,51 +294,90 @@ const Q = "onSave", Y = "changeCatalogVisible", Ce = "changeFullscreen", V = "pa
294
294
  "hr",
295
295
  "html_block",
296
296
  "fence"
297
- ].forEach((o) => {
298
- const a = e.renderer.rules[o];
299
- a ? e.renderer.rules[o] = (n, t, l, i, c) => {
297
+ ].forEach((a) => {
298
+ const l = e.renderer.rules[a];
299
+ l ? e.renderer.rules[a] = (t, n, o, i, c) => {
300
300
  let d;
301
- const s = a(n, t, l, i, c);
302
- return n[t].map && n[t].level === 0 ? (d = n[t].map[0], s.replace(/^(<[^>]*)/, `$1 data-line="${d}"`)) : s;
303
- } : e.renderer.rules[o] = (n, t, l, i, c) => {
301
+ const s = l(t, n, o, 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[a] = (t, n, o, i, c) => {
304
304
  let d;
305
- return n[t].map && n[t].level === 0 && (d = n[t].map[0], n[t].attrSet("data-line", String(d))), c.renderToken(n, t, l);
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, o);
306
306
  };
307
307
  });
308
- }, We = (e, o) => {
309
- const { editorConfig: a, markdownItConfig: n } = S, t = I("editorId"), l = I("showCodeRowNumber"), i = I("theme"), c = L([]), d = Fe(e), s = Re(e), { reRenderRef: r, replaceMermaid: m } = Me(e), f = be({
308
+ }, We = (e, a) => {
309
+ const { editorConfig: l, markdownItConfig: t, markdownItPlugins: n } = T, o = E("editorId"), i = E("showCodeRowNumber"), c = E("theme"), d = L([]), s = Fe(e), r = Re(e), { reRenderRef: m, replaceMermaid: b } = Me(e), y = be({
310
310
  html: !0,
311
311
  breaks: !0
312
312
  });
313
- n(f), f.use(Oe, { katexRef: s }), f.use(we, { figcaption: !0 }), f.use(Ve), f.use(ke), f.use(De, { mdHeadingId: e.mdHeadingId, headsRef: c }), f.use(Ke, { editorId: t }), e.noMermaid || f.use(Le, { themeRef: i }), f.set({
314
- highlight: (w, v) => {
315
- let k;
316
- !e.noHighlight && d.value ? d.value.getLanguage(v) ? k = d.value.highlight(w, {
317
- language: v,
313
+ t(y);
314
+ const u = [
315
+ {
316
+ type: "katex",
317
+ plugin: Oe,
318
+ options: { katexRef: r }
319
+ },
320
+ {
321
+ type: "image",
322
+ plugin: we,
323
+ options: { figcaption: !0, classes: "md-zoom" }
324
+ },
325
+ {
326
+ type: "admonition",
327
+ plugin: Ve,
328
+ options: {}
329
+ },
330
+ {
331
+ type: "taskList",
332
+ plugin: ke,
333
+ options: {}
334
+ },
335
+ {
336
+ type: "heading",
337
+ plugin: ze,
338
+ options: { mdHeadingId: e.mdHeadingId, headsRef: d }
339
+ },
340
+ {
341
+ type: "codeTabs",
342
+ plugin: Ke,
343
+ options: { editorId: o }
344
+ }
345
+ ];
346
+ e.noMermaid || u.push({
347
+ type: "mermaid",
348
+ plugin: Le,
349
+ options: { themeRef: c }
350
+ }), n(u).forEach((w) => {
351
+ y.use(w.plugin, w.options);
352
+ }), y.set({
353
+ highlight: (w, C) => {
354
+ let S;
355
+ !e.noHighlight && s.value ? s.value.getLanguage(C) ? S = s.value.highlight(w, {
356
+ language: C,
318
357
  ignoreIllegals: !0
319
- }).value : k = d.value.highlightAuto(w).value : k = f.utils.escapeHtml(w);
320
- const P = l ? pe(k.trim()) : `<span class="code-block">${k.trim()}</span>`;
321
- return `<pre><code class="language-${v}" language=${v}>${P}</code></pre>`;
358
+ }).value : S = s.value.highlightAuto(w).value : S = y.utils.escapeHtml(w);
359
+ const P = i ? he(S.trim()) : `<span class="code-block">${S.trim()}</span>`;
360
+ return `<pre><code class="language-${C}" language=${C}>${P}</code></pre>`;
322
361
  }
323
- }), qe(f);
324
- const b = L(e.sanitize(f.render(e.modelValue))), u = () => {
325
- y.emit(t, "buildFinished", b.value), e.onHtmlChanged(b.value), e.onGetCatalog(c.value), y.emit(t, "catalogChanged", c.value), m();
362
+ }), qe(y);
363
+ const p = L(e.sanitize(y.render(e.modelValue))), f = () => {
364
+ g.emit(o, "buildFinished", p.value), e.onHtmlChanged(p.value), e.onGetCatalog(d.value), g.emit(o, "catalogChanged", d.value), b();
326
365
  };
327
- C(u);
328
- const g = X(
366
+ I(f);
367
+ const k = Q(
329
368
  async () => {
330
- c.value = [], b.value = e.sanitize(f.render(e.modelValue)), u();
369
+ d.value = [], p.value = e.sanitize(y.render(e.modelValue)), f();
331
370
  },
332
- (a == null ? void 0 : a.renderDelay) !== void 0 ? a == null ? void 0 : a.renderDelay : o ? 0 : 500
333
- ), h = M(() => (e.noKatex || s.value) && (e.noHighlight || d.value));
334
- return $([W(e, "modelValue"), h, r], g), C(() => {
335
- y.on(t, {
371
+ (l == null ? void 0 : l.renderDelay) !== void 0 ? l == null ? void 0 : l.renderDelay : a ? 0 : 500
372
+ ), v = M(() => (e.noKatex || r.value) && (e.noHighlight || s.value));
373
+ return $([Z(e, "modelValue"), v, m], k), I(() => {
374
+ g.on(o, {
336
375
  name: "pushCatalog",
337
376
  callback() {
338
- y.emit(t, "catalogChanged", c.value);
377
+ g.emit(o, "catalogChanged", d.value);
339
378
  }
340
379
  });
341
- }), { html: b };
380
+ }), { html: p };
342
381
  }, Ze = We, Je = {
343
382
  modelValue: {
344
383
  type: String,
@@ -387,33 +426,33 @@ const Q = "onSave", Y = "changeCatalogVisible", Ce = "changeFullscreen", V = "pa
387
426
  type: Boolean,
388
427
  default: !1
389
428
  }
390
- }, Xe = /* @__PURE__ */ Z({
429
+ }, Xe = /* @__PURE__ */ J({
391
430
  name: "ContentPreview",
392
431
  props: Je,
393
432
  setup(e) {
394
- const o = I("editorId"), a = I("previewTheme"), n = I("showCodeRowNumber"), {
395
- html: t
433
+ const a = E("editorId"), l = E("previewTheme"), t = E("showCodeRowNumber"), {
434
+ html: n
396
435
  } = Ze(e, e.previewOnly);
397
- return Ee(e, t), Pe(e, t), () => H(le, null, [H("div", {
398
- id: `${o}-preview-wrapper`,
399
- class: `${p}-preview-wrapper`,
436
+ return Ee(e, n), Pe(e, n), () => H(le, null, [H("div", {
437
+ id: `${a}-preview-wrapper`,
438
+ class: `${h}-preview-wrapper`,
400
439
  "data-show": e.setting.preview,
401
440
  key: "content-preview-wrapper"
402
441
  }, [H("article", {
403
- id: `${o}-preview`,
404
- class: [`${p}-preview`, `${a == null ? void 0 : a.value}-theme`, n && `${p}-scrn`],
405
- innerHTML: t.value
442
+ id: `${a}-preview`,
443
+ class: [`${h}-preview`, `${l == null ? void 0 : l.value}-theme`, t && `${h}-scrn`],
444
+ innerHTML: n.value
406
445
  }, null)]), !e.previewOnly && H("div", {
407
- id: `${o}-html-wrapper`,
408
- class: `${p}-preview-wrapper`,
446
+ id: `${a}-html-wrapper`,
447
+ class: `${h}-preview-wrapper`,
409
448
  "data-show": e.setting.htmlPreview,
410
449
  key: "html-preview-wrapper"
411
450
  }, [H("div", {
412
- class: `${p}-html`
413
- }, [t.value])])]);
451
+ class: `${h}-html`
452
+ }, [n.value])])]);
414
453
  }
415
- }), ut = (e, o) => {
416
- const { editorId: a } = e, n = J({
454
+ }), ut = (e, a) => {
455
+ const { editorId: l } = e, t = X({
417
456
  // 是否已编译成html
418
457
  buildFinished: !1,
419
458
  // 存储当前最新的html
@@ -422,153 +461,153 @@ const Q = "onSave", Y = "changeCatalogVisible", Ce = "changeFullscreen", V = "pa
422
461
  $(
423
462
  () => e.modelValue,
424
463
  () => {
425
- n.buildFinished = !1;
464
+ t.buildFinished = !1;
426
465
  }
427
- ), C(() => {
428
- y.on(a, {
466
+ ), I(() => {
467
+ g.on(l, {
429
468
  name: "buildFinished",
430
- callback(t) {
431
- n.buildFinished = !0, n.html = t;
469
+ callback(n) {
470
+ t.buildFinished = !0, t.html = n;
432
471
  }
433
- }), y.on(a, {
434
- name: Q,
472
+ }), g.on(l, {
473
+ name: Y,
435
474
  callback() {
436
- const t = new Promise((l) => {
437
- if (n.buildFinished)
438
- l(n.html);
475
+ const n = new Promise((o) => {
476
+ if (t.buildFinished)
477
+ o(t.html);
439
478
  else {
440
479
  const i = (c) => {
441
- l(c), y.remove(a, "buildFinished", i);
480
+ o(c), g.remove(l, "buildFinished", i);
442
481
  };
443
- y.on(a, {
482
+ g.on(l, {
444
483
  name: "buildFinished",
445
484
  callback: i
446
485
  });
447
486
  }
448
487
  });
449
- e.onSave ? e.onSave(e.modelValue, t) : o.emit("onSave", e.modelValue, t);
488
+ e.onSave ? e.onSave(e.modelValue, n) : a.emit("onSave", e.modelValue, n);
450
489
  }
451
490
  });
452
491
  });
453
- }, ee = (e) => {
454
- var t, l;
455
- const { editorId: o } = e, a = (l = (t = S) == null ? void 0 : t.editorExtensions) == null ? void 0 : l.highlight;
456
- F("editorId", o), F(
492
+ }, te = (e) => {
493
+ var n, o;
494
+ const { editorId: a } = e, l = (o = (n = T) == null ? void 0 : n.editorExtensions) == null ? void 0 : o.highlight;
495
+ F("editorId", a), F(
457
496
  "theme",
458
497
  M(() => e.theme)
459
498
  ), F(
460
499
  "highlight",
461
500
  M(() => {
462
501
  const i = {
463
- ...B,
464
- ...a == null ? void 0 : a.css
502
+ ...j,
503
+ ...l == null ? void 0 : l.css
465
504
  }, c = e.codeStyleReverse && e.codeStyleReverseList.includes(e.previewTheme) ? "dark" : e.theme;
466
505
  return {
467
- js: (a == null ? void 0 : a.js) || se,
468
- css: i[e.codeTheme] ? i[e.codeTheme][c] : B.atom[c]
506
+ js: (l == null ? void 0 : l.js) || se,
507
+ css: i[e.codeTheme] ? i[e.codeTheme][c] : j.atom[c]
469
508
  };
470
509
  })
471
510
  ), F("showCodeRowNumber", e.showCodeRowNumber);
472
- const n = M(() => {
511
+ const t = M(() => {
473
512
  var c, d;
474
513
  const i = {
475
- ...j,
476
- ...(d = (c = S) == null ? void 0 : c.editorConfig) == null ? void 0 : d.languageUserDefined
514
+ ...O,
515
+ ...(d = (c = T) == null ? void 0 : c.editorConfig) == null ? void 0 : d.languageUserDefined
477
516
  };
478
- return i[e.language] ? i[e.language] : j["zh-CN"];
517
+ return i[e.language] ? i[e.language] : O["zh-CN"];
479
518
  });
480
- F("usedLanguageText", n), F(
519
+ F("usedLanguageText", t), F(
481
520
  "previewTheme",
482
521
  M(() => e.previewTheme)
483
522
  );
484
523
  }, mt = (e) => {
485
- ee(e), F("tabWidth", e.tabWidth);
486
- }, te = (e) => {
487
- C(() => {
488
- var a;
489
- const o = document.createElement("script");
490
- o.src = ((a = S.editorExtensions) == null ? void 0 : a.iconfont) || de, o.id = `${p}-icon`, e.noIconfont || T(o);
524
+ te(e), F("tabWidth", e.tabWidth);
525
+ }, ne = (e) => {
526
+ I(() => {
527
+ var l;
528
+ const a = document.createElement("script");
529
+ a.src = ((l = T.editorExtensions) == null ? void 0 : l.iconfont) || de, a.id = `${h}-icon`, e.noIconfont || _(a);
491
530
  });
492
531
  }, ft = (e) => {
493
- var c, d, s, r, m, f;
494
- const { noPrettier: o, noUploadImg: a } = e, { editorExtensions: n } = S, t = o || !!((d = (c = S.editorExtensions) == null ? void 0 : c.prettier) != null && d.prettierInstance), l = o || !!((r = (s = S.editorExtensions) == null ? void 0 : s.prettier) != null && r.parserMarkdownInstance), i = a || !!((f = (m = S.editorExtensions) == null ? void 0 : m.cropper) != null && f.instance);
495
- C(() => {
496
- var w, v, k, P;
497
- const b = document.createElement("script"), u = document.createElement("script");
498
- b.src = ((w = n == null ? void 0 : n.prettier) == null ? void 0 : w.standaloneJs) || O.main, b.id = `${p}-prettier`, u.src = ((v = n == null ? void 0 : n.prettier) == null ? void 0 : v.parserMarkdownJs) || O.markdown, u.id = `${p}-prettierMD`;
499
- const g = document.createElement("link");
500
- g.rel = "stylesheet", g.href = ((k = n == null ? void 0 : n.cropper) == null ? void 0 : k.css) || U.css, g.id = `${p}-cropperCss`;
501
- const h = document.createElement("script");
502
- h.src = ((P = n == null ? void 0 : n.cropper) == null ? void 0 : P.js) || U.js, h.id = `${p}-cropper`, i || (T(g), T(h)), t || T(b), l || T(u);
503
- }), te(e);
504
- }, ht = (e, o) => {
505
- const { editorId: a } = e, n = J({
532
+ var c, d, s, r, m, b;
533
+ const { noPrettier: a, noUploadImg: l } = e, { editorExtensions: t } = T, n = a || !!((d = (c = T.editorExtensions) == null ? void 0 : c.prettier) != null && d.prettierInstance), o = a || !!((r = (s = T.editorExtensions) == null ? void 0 : s.prettier) != null && r.parserMarkdownInstance), i = l || !!((b = (m = T.editorExtensions) == null ? void 0 : m.cropper) != null && b.instance);
534
+ I(() => {
535
+ 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`;
538
+ 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`;
540
+ 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), o || _(u);
542
+ }), ne(e);
543
+ }, pt = (e, a) => {
544
+ const { editorId: l } = e, t = X({
506
545
  pageFullscreen: e.pageFullscreen,
507
546
  fullscreen: !1,
508
547
  preview: e.preview,
509
548
  htmlPreview: e.preview ? !1 : e.htmlPreview
510
- }), t = (c, d) => {
511
- n[c] = d === void 0 ? !n[c] : d, c === "preview" && n.preview ? n.htmlPreview = !1 : c === "htmlPreview" && n.htmlPreview && (n.preview = !1);
549
+ }), n = (c, d) => {
550
+ t[c] = d === void 0 ? !t[c] : d, c === "preview" && t.preview ? t.htmlPreview = !1 : c === "htmlPreview" && t.htmlPreview && (t.preview = !1);
512
551
  };
513
- let l = "";
552
+ let o = "";
514
553
  const i = () => {
515
- n.pageFullscreen || n.fullscreen ? document.body.style.overflow = "hidden" : document.body.style.overflow = l;
554
+ t.pageFullscreen || t.fullscreen ? document.body.style.overflow = "hidden" : document.body.style.overflow = o;
516
555
  };
517
- return $(() => [n.pageFullscreen, n.fullscreen], i), C(() => {
518
- y.on(a, {
556
+ return $(() => [t.pageFullscreen, t.fullscreen], i), I(() => {
557
+ g.on(l, {
519
558
  name: "uploadImage",
520
559
  callback(c, d) {
521
560
  const s = (r) => {
522
- y.emit(a, "replace", "image", {
561
+ g.emit(l, "replace", "image", {
523
562
  desc: "",
524
563
  urls: r
525
564
  }), d && d();
526
565
  };
527
- e.onUploadImg ? e.onUploadImg(c, s) : o.emit("onUploadImg", c, s);
566
+ e.onUploadImg ? e.onUploadImg(c, s) : a.emit("onUploadImg", c, s);
528
567
  }
529
- }), l = document.body.style.overflow, i();
530
- }), [n, t];
531
- }, pt = (e) => {
532
- const { editorId: o } = e, a = L(!1);
533
- return C(() => {
534
- y.on(o, {
535
- name: Y,
536
- callback: (t) => {
537
- t === void 0 ? a.value = !a.value : a.value = t;
568
+ }), o = document.body.style.overflow, i();
569
+ }), [t, n];
570
+ }, ht = (e) => {
571
+ const { editorId: a } = e, l = L(!1);
572
+ return I(() => {
573
+ g.on(a, {
574
+ name: ee,
575
+ callback: (n) => {
576
+ n === void 0 ? l.value = !l.value : l.value = n;
538
577
  }
539
578
  });
540
- }), M(() => !e.toolbarsExclude.includes("catalog") && e.toolbars.includes("catalog") && a.value);
541
- }, gt = (e, o, a, n, t) => {
542
- const { editorId: l } = e;
579
+ }), M(() => !e.toolbarsExclude.includes("catalog") && e.toolbars.includes("catalog") && l.value);
580
+ }, gt = (e, a, l, t, n) => {
581
+ const { editorId: o } = e;
543
582
  $(
544
- () => n.pageFullscreen,
583
+ () => t.pageFullscreen,
545
584
  (c) => {
546
- y.emit(l, V, c);
585
+ g.emit(o, G, c);
547
586
  }
548
587
  ), $(
549
- () => n.fullscreen,
588
+ () => t.fullscreen,
550
589
  (c) => {
551
- y.emit(l, G, c);
590
+ g.emit(o, z, c);
552
591
  }
553
592
  ), $(
554
- () => n.preview,
593
+ () => t.preview,
555
594
  (c) => {
556
- y.emit(l, D, c);
595
+ g.emit(o, D, c);
557
596
  }
558
597
  ), $(
559
- () => n.htmlPreview,
598
+ () => t.htmlPreview,
560
599
  (c) => {
561
- y.emit(l, z, c);
600
+ g.emit(o, K, c);
562
601
  }
563
- ), $(a, (c) => {
564
- y.emit(l, K, c);
602
+ ), $(l, (c) => {
603
+ g.emit(o, q, c);
565
604
  });
566
605
  const i = {
567
606
  on(c, d) {
568
607
  switch (c) {
569
608
  case "pageFullscreen": {
570
- y.on(l, {
571
- name: V,
609
+ g.on(o, {
610
+ name: G,
572
611
  callback(s) {
573
612
  d(s);
574
613
  }
@@ -576,8 +615,8 @@ const Q = "onSave", Y = "changeCatalogVisible", Ce = "changeFullscreen", V = "pa
576
615
  break;
577
616
  }
578
617
  case "fullscreen": {
579
- y.on(l, {
580
- name: G,
618
+ g.on(o, {
619
+ name: z,
581
620
  callback(s) {
582
621
  d(s);
583
622
  }
@@ -585,7 +624,7 @@ const Q = "onSave", Y = "changeCatalogVisible", Ce = "changeFullscreen", V = "pa
585
624
  break;
586
625
  }
587
626
  case "preview": {
588
- y.on(l, {
627
+ g.on(o, {
589
628
  name: D,
590
629
  callback(s) {
591
630
  d(s);
@@ -594,8 +633,8 @@ const Q = "onSave", Y = "changeCatalogVisible", Ce = "changeFullscreen", V = "pa
594
633
  break;
595
634
  }
596
635
  case "htmlPreview": {
597
- y.on(l, {
598
- name: z,
636
+ g.on(o, {
637
+ name: K,
599
638
  callback(s) {
600
639
  d(s);
601
640
  }
@@ -603,8 +642,8 @@ const Q = "onSave", Y = "changeCatalogVisible", Ce = "changeFullscreen", V = "pa
603
642
  break;
604
643
  }
605
644
  case "catalog": {
606
- y.on(l, {
607
- name: K,
645
+ g.on(o, {
646
+ name: q,
608
647
  callback(s) {
609
648
  d(s);
610
649
  }
@@ -614,32 +653,32 @@ const Q = "onSave", Y = "changeCatalogVisible", Ce = "changeFullscreen", V = "pa
614
653
  }
615
654
  },
616
655
  togglePageFullscreen(c) {
617
- t("pageFullscreen", c);
656
+ n("pageFullscreen", c);
618
657
  },
619
658
  toggleFullscreen(c) {
620
- y.emit(l, Ce, c);
659
+ g.emit(o, Ce, c);
621
660
  },
622
661
  togglePreview(c) {
623
- t("preview", c);
662
+ n("preview", c);
624
663
  },
625
664
  toggleHtmlPreview(c) {
626
- t("htmlPreview", c);
665
+ n("htmlPreview", c);
627
666
  },
628
667
  toggleCatalog(c) {
629
- y.emit(l, Y, c);
668
+ g.emit(o, ee, c);
630
669
  },
631
670
  triggerSave() {
632
- y.emit(l, Q);
671
+ g.emit(o, Y);
633
672
  },
634
673
  insert(c) {
635
- y.emit(l, "replace", "universal", { generate: c });
674
+ g.emit(o, "replace", "universal", { generate: c });
636
675
  },
637
676
  focus(c) {
638
- y.emit(l, Se, c);
677
+ g.emit(o, Se, c);
639
678
  }
640
679
  };
641
- o.expose(i);
642
- }, Qe = (e) => e, ne = {
680
+ a.expose(i);
681
+ }, Qe = (e) => e, re = {
643
682
  /**
644
683
  * markdown content.
645
684
  *
@@ -810,7 +849,7 @@ const Q = "onSave", Y = "changeCatalogVisible", Ce = "changeFullscreen", V = "pa
810
849
  default: !1
811
850
  }
812
851
  }, vt = {
813
- ...ne,
852
+ ...re,
814
853
  /**
815
854
  * input回调事件
816
855
  */
@@ -1026,9 +1065,18 @@ const Q = "onSave", Y = "changeCatalogVisible", Ce = "changeFullscreen", V = "pa
1026
1065
  */
1027
1066
  completions: {
1028
1067
  type: Array
1068
+ },
1069
+ /**
1070
+ * 是否在工具栏下面显示对应的文字名称
1071
+ *
1072
+ * @default false
1073
+ */
1074
+ showToolbarName: {
1075
+ type: Boolean,
1076
+ default: !1
1029
1077
  }
1030
- }, re = ["onHtmlChanged", "onGetCatalog"], yt = [
1031
- ...re,
1078
+ }, oe = ["onHtmlChanged", "onGetCatalog"], yt = [
1079
+ ...oe,
1032
1080
  "onChange",
1033
1081
  "onSave",
1034
1082
  "onUploadImg",
@@ -1036,37 +1084,37 @@ const Q = "onSave", Y = "changeCatalogVisible", Ce = "changeFullscreen", V = "pa
1036
1084
  "update:modelValue",
1037
1085
  "onBlur",
1038
1086
  "onFocus"
1039
- ], Ye = /* @__PURE__ */ Z({
1087
+ ], Ye = /* @__PURE__ */ J({
1040
1088
  name: "MdPreview",
1041
- props: ne,
1042
- emits: re,
1043
- setup(e, o) {
1089
+ props: re,
1090
+ emits: oe,
1091
+ setup(e, a) {
1044
1092
  const {
1045
- editorId: a,
1046
- noKatex: n,
1047
- noMermaid: t,
1048
- noHighlight: l
1093
+ editorId: l,
1094
+ noKatex: t,
1095
+ noMermaid: n,
1096
+ noHighlight: o
1049
1097
  } = e;
1050
- return ee(e), te(e), ie(() => {
1051
- y.clear(a);
1098
+ return te(e), ne(e), ie(() => {
1099
+ g.clear(l);
1052
1100
  }), () => H("div", {
1053
- id: a,
1054
- class: [p, e.class, e.theme === "dark" && `${p}-dark`, `${p}-previewOnly`],
1101
+ id: l,
1102
+ class: [h, e.class, e.theme === "dark" && `${h}-dark`, `${h}-previewOnly`],
1055
1103
  style: e.style
1056
1104
  }, [H(Xe, {
1057
1105
  modelValue: e.modelValue,
1058
1106
  onHtmlChanged: (i) => {
1059
- e.onHtmlChanged ? e.onHtmlChanged(i) : o.emit("onHtmlChanged", i);
1107
+ e.onHtmlChanged ? e.onHtmlChanged(i) : a.emit("onHtmlChanged", i);
1060
1108
  },
1061
1109
  onGetCatalog: (i) => {
1062
- e.onGetCatalog ? e.onGetCatalog(i) : o.emit("onGetCatalog", i);
1110
+ e.onGetCatalog ? e.onGetCatalog(i) : a.emit("onGetCatalog", i);
1063
1111
  },
1064
1112
  mdHeadingId: e.mdHeadingId,
1065
- noMermaid: t,
1113
+ noMermaid: n,
1066
1114
  sanitize: e.sanitize,
1067
- noKatex: n,
1115
+ noKatex: t,
1068
1116
  formatCopiedText: e.formatCopiedText,
1069
- noHighlight: l,
1117
+ noHighlight: o,
1070
1118
  previewOnly: !0
1071
1119
  }, null)]);
1072
1120
  }
@@ -1075,16 +1123,16 @@ R.install = (e) => (e.component(R.name, R), e);
1075
1123
  export {
1076
1124
  Ce as C,
1077
1125
  R as M,
1078
- Q as O,
1126
+ Y as O,
1079
1127
  Se as T,
1080
- Y as a,
1128
+ ee as a,
1081
1129
  Xe as b,
1082
1130
  yt as c,
1083
1131
  mt as d,
1084
1132
  vt as e,
1085
1133
  ft as f,
1086
- ht as g,
1087
- pt as h,
1134
+ pt as g,
1135
+ ht as h,
1088
1136
  gt as i,
1089
1137
  ut as u
1090
1138
  };