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

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