md-editor-v3 4.6.1 → 4.6.2-beta.1

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 (58) hide show
  1. package/lib/cjs/MdCatalog.cjs +1 -1
  2. package/lib/cjs/MdEditor.cjs +3 -3
  3. package/lib/cjs/MdModal.cjs +1 -1
  4. package/lib/cjs/MdPreview.cjs +1 -1
  5. package/lib/cjs/ModalToolbar.cjs +1 -1
  6. package/lib/cjs/chunks/index.cjs +1 -8
  7. package/lib/cjs/chunks/index3.cjs +2 -1
  8. package/lib/cjs/chunks/index4.cjs +8 -2
  9. package/lib/cjs/index.cjs +1 -1
  10. package/lib/es/DropdownToolbar.mjs +2 -2
  11. package/lib/es/MdCatalog.mjs +9 -9
  12. package/lib/es/MdEditor.mjs +137 -135
  13. package/lib/es/MdModal.mjs +1 -1
  14. package/lib/es/MdPreview.mjs +2 -2
  15. package/lib/es/ModalToolbar.mjs +1 -1
  16. package/lib/es/chunks/config.mjs +11 -11
  17. package/lib/es/chunks/index.mjs +138 -1231
  18. package/lib/es/chunks/index2.mjs +2 -2
  19. package/lib/es/chunks/index3.mjs +79 -163
  20. package/lib/es/chunks/index4.mjs +1255 -77
  21. package/lib/es/config.mjs +1 -1
  22. package/lib/es/index.mjs +18 -17
  23. package/lib/preview.css +1 -1
  24. package/lib/style.css +1 -1
  25. package/lib/types/DropdownToolbar/DropdownToolbar.d.ts +1 -1
  26. package/lib/types/DropdownToolbar/index.d.ts +59 -33
  27. package/lib/types/MdCatalog/CatalogLink.d.ts +1 -1
  28. package/lib/types/MdCatalog/MdCatalog.d.ts +1 -1
  29. package/lib/types/MdCatalog/index.d.ts +59 -44
  30. package/lib/types/MdEditor/Editor.d.ts +1 -1
  31. package/lib/types/MdEditor/components/Checkbox/index.d.ts +1 -1
  32. package/lib/types/MdEditor/components/Divider/index.d.ts +1 -1
  33. package/lib/types/MdEditor/components/Dropdown/index.d.ts +1 -1
  34. package/lib/types/MdEditor/components/Icon/Icon.d.ts +1 -1
  35. package/lib/types/MdEditor/components/Icon/index.d.ts +1 -1
  36. package/lib/types/MdEditor/components/Modal/Modal.d.ts +1 -1
  37. package/lib/types/MdEditor/components/Modal/index.d.ts +60 -48
  38. package/lib/types/MdEditor/index.d.ts +101 -225
  39. package/lib/types/MdEditor/layouts/Content/ContentPreview.d.ts +1 -1
  40. package/lib/types/MdEditor/layouts/Content/index.d.ts +1 -1
  41. package/lib/types/MdEditor/layouts/Footer/MarkdownTotal.d.ts +1 -1
  42. package/lib/types/MdEditor/layouts/Footer/ScrollAuto.d.ts +1 -1
  43. package/lib/types/MdEditor/layouts/Footer/index.d.ts +1 -1
  44. package/lib/types/MdEditor/layouts/Modals/Clip.d.ts +1 -1
  45. package/lib/types/MdEditor/layouts/Modals/Link.d.ts +1 -1
  46. package/lib/types/MdEditor/layouts/Modals/index.d.ts +1 -1
  47. package/lib/types/MdEditor/layouts/Toolbar/TableShape.d.ts +1 -1
  48. package/lib/types/MdEditor/layouts/Toolbar/index.d.ts +1 -1
  49. package/lib/types/MdEditor/type.d.ts +3 -1
  50. package/lib/types/MdEditor/utils/vue-tsx.d.ts +1 -1
  51. package/lib/types/MdPreview/MdPreview.d.ts +1 -1
  52. package/lib/types/MdPreview/index.d.ts +72 -114
  53. package/lib/types/ModalToolbar/ModalToolbar.d.ts +1 -1
  54. package/lib/types/ModalToolbar/index.d.ts +64 -58
  55. package/lib/types/NormalToolbar/NormalToolbar.d.ts +1 -1
  56. package/lib/types/NormalToolbar/index.d.ts +56 -24
  57. package/lib/umd/index.js +32 -32
  58. package/package.json +9 -8
@@ -1,1264 +1,171 @@
1
- import { inject as P, onMounted as S, watch as $, toRef as X, nextTick as L, shallowRef as R, ref as B, computed as F, defineComponent as Q, createVNode as A, Fragment as ue, reactive as Y, provide as H, onBeforeUnmount as de } from "vue";
2
- import { a as C, p, m as me, k as O, e as U, h as fe, f as j, i as pe, g as he, j as G, l as D, n as ge, b as ye, d as ve } from "./config.mjs";
3
- import { u as be, g as we, b as g, P as ke, h as V, B as M, d as ee, E as $e, U as Ce, c as te, i as z, F as K, j as q, H as Z, k as W, R as ne, C as Ie, T as Se } from "./index4.mjs";
4
- import { a as _, u as Ee } from "./dom.mjs";
5
- import Pe from "medium-zoom";
6
- import { debounce as oe } from "@vavt/util";
7
- import Te from "copy-to-clipboard";
8
- import _e from "markdown-it";
9
- import He from "markdown-it-image-figures";
10
- import Fe from "markdown-it-task-lists";
11
- import Ae from "lru-cache";
12
- const Me = (e, a) => {
13
- const l = P("editorId"), { noImgZoomIn: t } = e, n = oe(() => {
14
- const r = document.querySelectorAll(`#${l}-preview img`);
15
- r.length !== 0 && Pe(r, {
16
- background: "#00000073"
17
- });
18
- });
19
- S(() => {
20
- !t && n();
21
- }), $([a, X(e.setting, "preview")], () => {
22
- !t && n();
23
- });
24
- }, Re = Me, xe = (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
- }, Le = (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, v;
38
- let s = -1;
39
- (b = u.querySelector(".copy-button")) == null || b.remove();
40
- const o = ((v = t.value.copyCode) == null ? void 0 : v.text) || "复制代码", d = document.createElement("span");
41
- d.setAttribute("class", "copy-button"), d.dataset.tips = o, d.innerHTML = xe("copy", n.value), d.addEventListener("click", () => {
42
- var y, w;
43
- clearTimeout(s);
44
- const m = u.querySelector("code").innerText, h = Te(e.formatCopiedText(m)), f = ((y = t.value.copyCode) == null ? void 0 : y.successTips) || "已复制!", k = ((w = t.value.copyCode) == null ? void 0 : w.failTips) || "已复制!";
45
- d.dataset.tips = h ? f : k, s = window.setTimeout(() => {
46
- d.dataset.tips = o;
47
- }, 1500);
48
- }), u.appendChild(d);
49
- });
50
- }, i = () => {
51
- L(r);
52
- }, c = (u) => {
53
- u && L(r);
54
- };
55
- $(() => a.value, i), $(() => e.setting.preview, c), $(() => e.setting.htmlPreview, c), $(() => t.value, r), S(r);
56
- }, Be = Le, Ne = (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 = R(l);
59
- return S(() => {
60
- if (!e.noHighlight && !n.value) {
61
- const i = document.createElement("script");
62
- i.src = t.value.js, i.onload = () => {
63
- n.value = window.hljs;
64
- }, i.id = `${p}-hljs`, _(i, "hljs");
65
- const c = document.createElement("link");
66
- c.rel = "stylesheet", c.href = t.value.css, c.id = `${p}-hlCss`, _(c);
67
- }
68
- }), $(
69
- () => t.value.css,
70
- (i) => {
71
- Ee(`${p}-hlCss`, "href", i);
72
- }
73
- ), n;
74
- }, Oe = Ne, Ue = (e) => {
75
- const a = P("theme"), { editorExtensions: l } = C, t = l == null ? void 0 : l.mermaid, n = R(t == null ? void 0 : t.instance), r = R(-1), i = new Ae({
76
- max: 1e3,
77
- // 缓存10分钟
78
- ttl: 6e5
79
- }), c = () => {
80
- const s = n.value;
81
- !e.noMermaid && s && (s.initialize({
82
- startOnLoad: !1,
83
- theme: a.value === "dark" ? "dark" : "default"
84
- }), r.value = r.value + 1);
85
- };
86
- return $(
87
- () => a.value,
88
- () => {
89
- i.clear(), c();
90
- }
91
- ), S(() => {
92
- if (!e.noMermaid && !(t != null && t.instance)) {
93
- const s = (t == null ? void 0 : t.js) || me;
94
- if (/\.mjs/.test(s))
95
- import(
96
- /* @vite-ignore */
97
- /* webpackIgnore: true */
98
- s
99
- ).then((o) => {
100
- n.value = o.default, c();
101
- });
102
- else {
103
- const o = document.createElement("script");
104
- o.id = `${p}-mermaid`, o.src = s, o.onload = () => {
105
- n.value = window.mermaid, c();
106
- }, _(o, "mermaid");
107
- }
108
- }
109
- }), { mermaidRef: n, reRenderRef: r, replaceMermaid: () => {
110
- L(() => {
111
- if (!e.noMermaid && n.value) {
112
- const s = document.querySelectorAll(
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) => {
118
- let v = i.get(b.innerText);
119
- if (!v) {
120
- const h = be(), f = n.value.renderAsync || n.value.render;
121
- let k = "";
122
- try {
123
- k = await f(h, b.innerText, o);
124
- } catch {
125
- }
126
- v = typeof k == "string" ? k : k.svg, i.set(b.innerText, v);
127
- }
128
- const m = document.createElement("p");
129
- m.className = `${p}-mermaid`, m.setAttribute("data-processed", ""), m.innerHTML = v, b.dataset.line !== void 0 && (m.dataset.line = b.dataset.line), b.replaceWith(m), --d === 0 && o.remove();
130
- });
131
- }
132
- });
133
- } };
134
- }, je = Ue, Ge = (e) => {
135
- var n;
136
- const a = (n = C.editorExtensions) == null ? void 0 : n.katex, l = a == null ? void 0 : a.instance, t = R(l);
137
- return S(() => {
138
- if (!e.noKatex && !t.value) {
139
- const r = document.createElement("script");
140
- r.src = (a == null ? void 0 : a.js) || O.js, r.onload = () => {
141
- t.value = window.katex;
142
- }, r.id = `${p}-katex`;
143
- const i = document.createElement("link");
144
- i.rel = "stylesheet", i.href = (a == null ? void 0 : a.css) || O.css, i.id = `${p}-katexCss`, _(r, "katex"), _(i);
145
- }
146
- }), t;
147
- }, De = Ge, Ve = (e, a) => {
148
- const l = e.renderer.rules.fence.bind(e.renderer.rules);
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>`;
1
+ import { defineComponent as v, createVNode as t, inject as k, h as M, ref as f, reactive as b, computed as j, onMounted as F, onBeforeUnmount as w, watch as p, nextTick as S } from "vue";
2
+ import { p as l, c as H } from "./config.mjs";
3
+ import { g as y } from "./vue-tsx.mjs";
4
+ import { k as g } from "./dom.mjs";
5
+ const T = /* @__PURE__ */ v({
6
+ props: {
7
+ name: {
8
+ type: String,
9
+ default: ""
154
10
  }
155
- return l(t, n, r, i, c);
156
- };
157
- }, ze = Ve, J = (e, a) => {
158
- let l = !0, t = !0;
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), {
161
- can_open: l,
162
- can_close: t
163
- };
164
- }, Ke = (e, a) => {
165
- let l, t, n, r;
166
- if (e.src[e.pos] !== "$")
167
- return !1;
168
- if (n = J(e, e.pos), !n.can_open)
169
- return a || (e.pending += "$"), e.pos += 1, !0;
170
- const i = e.pos + 1;
171
- for (l = i; (l = e.src.indexOf("$", l)) !== -1; ) {
172
- for (r = l - 1; e.src[r] === "\\"; )
173
- r -= 1;
174
- if ((l - r) % 2 == 1)
175
- break;
176
- l += 1;
11
+ },
12
+ setup(e) {
13
+ return () => H.iconfontType === "svg" ? t("svg", {
14
+ class: `${l}-icon`,
15
+ "aria-hidden": "true"
16
+ }, [t("use", {
17
+ "xlink:href": `#${l}-icon-${e.name}`
18
+ }, null)]) : t("i", {
19
+ class: `${l}-iconfont ${l}-icon-${e.name}`
20
+ }, null);
177
21
  }
178
- return l === -1 ? (a || (e.pending += "$"), e.pos = i, !0) : l - i === 0 ? (a || (e.pending += "$$"), e.pos = i + 1, !0) : (n = J(e, l), n.can_close ? (a || (t = e.push("math_inline", "math", 0), t.markup = "$", t.content = e.src.slice(i, l)), e.pos = l + 1, !0) : (a || (e.pending += "$"), e.pos = i, !0));
179
- }, qe = (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) !== "$$")
182
- return !1;
183
- if (s += 2, n = e.src.slice(s, o), t)
184
- return !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);
187
- e.line = i + 1;
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
- }, Ze = (e, a) => {
192
- const l = (n) => {
193
- if (a.katexRef.value) {
194
- const r = a.katexRef.value.renderToString(n, {
195
- throwOnError: !1
196
- });
197
- return `<span class="${p}-katex-inline" data-processed>${r}</span>`;
198
- } else
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, {
203
- throwOnError: !1,
204
- displayMode: !0
205
- });
206
- return `<p class="${p}-katex-block" data-line=${r} data-processed>${i}</p>`;
207
- } else
208
- return `<p class="${p}-katex-block" data-line=${r}>${n}</p>`;
209
- };
210
- e.inline.ruler.after("escape", "math_inline", Ke), e.block.ruler.after("blockquote", "math_block", qe, {
211
- alt: ["paragraph", "reference", "blockquote", "list"]
212
- }), e.renderer.rules.math_inline = (n, r) => l(n[r].content), e.renderer.rules.math_block = (n, r) => t(n[r].content, n[r].map[0]) + `
213
- `;
214
- }, We = Ze, Je = (e, a) => {
215
- a = a || {};
216
- const l = 3, t = a.marker || "!", n = t.charCodeAt(0), r = t.length;
217
- let i = "", c = "";
218
- const u = (o, d, b, v, m) => {
219
- const h = o[d];
220
- return h.type === "admonition_open" ? (o[d].attrPush([
221
- "class",
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);
227
- };
228
- e.block.ruler.before(
229
- "code",
230
- "admonition",
231
- (o, d, b, v) => {
232
- let m, h, f, k = !1, y = o.bMarks[d] + o.tShift[d], w = o.eMarks[d];
233
- if (n !== o.src.charCodeAt(y))
234
- return !1;
235
- for (m = y + 1; m <= w && t[(m - y) % r] === o.src[m]; m++)
236
- ;
237
- const I = Math.floor((m - y) / r);
238
- if (I !== l)
239
- return !1;
240
- m -= (m - y) % r;
241
- const E = o.src.slice(y, m), T = o.src.slice(m, w);
242
- if (s(T), v)
243
- return !0;
244
- for (h = d; h++, !(h >= b || (y = o.bMarks[h] + o.tShift[h], w = o.eMarks[h], y < w && o.sCount[h] < o.blkIndent)); )
245
- if (n === o.src.charCodeAt(y) && !(o.sCount[h] - o.blkIndent >= 4)) {
246
- for (m = y + 1; m <= w && t[(m - y) % r] === o.src[m]; m++)
247
- ;
248
- if (!(Math.floor((m - y) / r) < I) && (m -= (m - y) % r, m = o.skipSpaces(m), !(m < w))) {
249
- k = !0;
250
- break;
251
- }
252
- }
253
- const N = o.parentType, se = o.lineMax;
254
- return o.parentType = "root", o.lineMax = h, f = o.push("admonition_open", "div", 1), f.markup = E, f.block = !0, f.info = i, f.map = [d, h], f = o.push("admonition_title_open", "p", 1), f.markup = E + " " + i, f.map = [d, h], f = o.push("inline", "", 0), f.content = c, f.map = [d, o.line - 1], f.children = [], f = o.push("admonition_title_close", "p", -1), f.markup = E + " " + i, o.md.block.tokenize(o, d + 1, h), f = o.push("admonition_close", "div", -1), f.markup = o.src.slice(y, m), f.block = !0, o.parentType = N, o.lineMax = se, o.line = h + (k ? 1 : 0), !0;
255
- },
256
- {
257
- alt: ["paragraph", "reference", "blockquote", "list"]
22
+ }), C = /* @__PURE__ */ v({
23
+ props: {
24
+ name: {
25
+ type: String,
26
+ default: ""
258
27
  }
259
- ), e.renderer.rules.admonition_open = u, e.renderer.rules.admonition_title_open = u, e.renderer.rules.admonition_title_close = u, e.renderer.rules.admonition_close = u;
260
- }, Xe = Je, Qe = (e, a) => {
261
- e.renderer.rules.heading_open = (l, t) => {
262
- const n = l[t], r = l[t + 1].content, i = n.markup.length;
263
- return a.headsRef.value.push({
264
- text: r,
265
- level: i
266
- }), n.map && n.level === 0 && (n.attrSet("data-line", String(n.map[0])), n.attrSet(
267
- "id",
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
- }, Ye = Qe, et = (e, a) => {
272
- const l = e.renderer.rules.fence, t = e.utils.unescapeAll, n = /\[(\w*)(?::([\w ]*))?\]/;
273
- function r(s) {
274
- return s.info ? t(s.info).trim() : "";
275
- }
276
- function i(s) {
277
- const o = r(s), [d = null, b = ""] = (n.exec(o) || []).slice(1);
278
- return [d, b];
279
- }
280
- function c(s) {
281
- const o = r(s);
282
- return o ? o.split(/(\s+)/g)[0] : "";
283
- }
284
- const u = (s, o, d, b, v) => {
285
- if (s[o].hidden)
286
- return "";
287
- const [m, h] = i(s[o]);
288
- if (m === null)
289
- return l(s, o, d, b, v);
290
- let f, k, y, w, I = "", E = "";
291
- for (let T = o; T < s.length && (f = s[T], [k, y] = 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()">${y || 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, v);
295
- return `<div class="code-tabs">
296
- <ul>
297
- ` + I + `</ul>
298
- ` + E + "</div>";
299
- };
300
- e.renderer.rules.fence = u;
301
- }, tt = et, nt = (e) => {
302
- [
303
- "paragraph_open",
304
- "table_open",
305
- "ordered_list_open",
306
- "bullet_list_open",
307
- "blockquote_open",
308
- "hr",
309
- "html_block",
310
- "fence"
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);
28
+ },
29
+ setup(e) {
30
+ const c = k("customIcon");
31
+ return () => {
32
+ const i = c.value[e.name];
33
+ return typeof i == "object" ? typeof i.component == "object" ? M(i.component, i.props) : t("span", {
34
+ innerHTML: i.component
35
+ }, null) : t(T, {
36
+ name: e.name
37
+ }, null);
320
38
  };
321
- });
322
- }, ot = (e, a) => {
323
- const { editorConfig: l, markdownItConfig: t, markdownItPlugins: n } = C, r = P("editorId"), i = P("showCodeRowNumber"), c = P("theme"), u = B([]), s = Oe(e), o = De(e), { reRenderRef: d, replaceMermaid: b } = je(e), v = _e({
324
- html: !0,
325
- breaks: !0
326
- });
327
- t(v);
328
- const m = [
329
- {
330
- type: "katex",
331
- plugin: We,
332
- options: { katexRef: o }
333
- },
334
- {
335
- type: "image",
336
- plugin: He,
337
- options: { figcaption: !0, classes: "md-zoom" }
338
- },
339
- {
340
- type: "admonition",
341
- plugin: Xe,
342
- options: {}
343
- },
344
- {
345
- type: "taskList",
346
- plugin: Fe,
347
- options: {}
348
- },
349
- {
350
- type: "heading",
351
- plugin: Ye,
352
- options: { mdHeadingId: e.mdHeadingId, headsRef: u }
353
- },
354
- {
355
- type: "codeTabs",
356
- plugin: tt,
357
- options: { editorId: r }
358
- }
359
- ];
360
- e.noMermaid || m.push({
361
- type: "mermaid",
362
- plugin: ze,
363
- options: { themeRef: c }
364
- }), n(m).forEach((w) => {
365
- v.use(w.plugin, w.options);
366
- }), v.set({
367
- highlight: (w, I) => {
368
- let E;
369
- !e.noHighlight && s.value ? s.value.getLanguage(I) ? E = s.value.highlight(w, {
370
- language: I,
371
- ignoreIllegals: !0
372
- }).value : E = s.value.highlightAuto(w).value : E = v.utils.escapeHtml(w);
373
- const T = i ? we(E.trim()) : `<span class="code-block">${E.trim()}</span>`;
374
- return `<pre><code class="language-${I}" language=${I}>${T}</code></pre>`;
375
- }
376
- }), nt(v);
377
- const h = B(e.sanitize(v.render(e.modelValue))), f = () => {
378
- g.emit(r, M, h.value), e.onHtmlChanged(h.value), e.onGetCatalog(u.value), g.emit(r, V, u.value), b();
379
- };
380
- S(f);
381
- const k = oe(
382
- async () => {
383
- u.value = [], h.value = e.sanitize(v.render(e.modelValue)), f();
384
- },
385
- (l == null ? void 0 : l.renderDelay) !== void 0 ? l == null ? void 0 : l.renderDelay : a ? 0 : 500
386
- ), y = F(() => (e.noKatex || o.value) && (e.noHighlight || s.value));
387
- return $([X(e, "modelValue"), y, d], k), S(() => {
388
- g.on(r, {
389
- name: ke,
390
- callback() {
391
- g.emit(r, V, u.value);
392
- }
393
- });
394
- }), { html: h };
395
- }, rt = ot, re = {
396
- modelValue: {
39
+ }
40
+ }), z = {
41
+ title: {
397
42
  type: String,
398
43
  default: ""
399
44
  },
400
- setting: {
401
- type: Object,
402
- default: () => ({})
403
- },
404
- onHtmlChanged: {
405
- type: Function,
406
- default: () => {
407
- }
408
- },
409
- onGetCatalog: {
410
- type: Function,
411
- default: () => {
412
- }
413
- },
414
- mdHeadingId: {
415
- type: Function,
416
- default: () => ""
417
- },
418
- noMermaid: {
45
+ visible: {
419
46
  type: Boolean,
420
47
  default: !1
421
48
  },
422
- sanitize: {
423
- type: Function,
424
- default: (e) => e
49
+ width: {
50
+ type: String,
51
+ default: "auto"
425
52
  },
426
- // 不使用该函数功能
427
- noKatex: {
428
- type: Boolean,
429
- default: !1
53
+ height: {
54
+ type: String,
55
+ default: "auto"
430
56
  },
431
- formatCopiedText: {
432
- type: Function,
433
- default: (e) => e
57
+ onClose: {
58
+ type: Function
434
59
  },
435
- noHighlight: {
60
+ showAdjust: {
436
61
  type: Boolean,
437
62
  default: !1
438
63
  },
439
- previewOnly: {
64
+ isFullscreen: {
440
65
  type: Boolean,
441
66
  default: !1
442
67
  },
443
- noImgZoomIn: {
444
- type: Boolean
445
- }
446
- }, bt = {
447
- ...re,
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
506
- },
507
- onDrop: {
68
+ onAdjust: {
508
69
  type: Function,
509
70
  default: () => {
510
71
  }
511
72
  }
512
- }, at = /* @__PURE__ */ Q({
513
- name: "ContentPreview",
514
- props: re,
515
- setup(e) {
516
- const a = P("editorId"), l = P("previewTheme"), t = P("showCodeRowNumber"), {
517
- html: n
518
- } = rt(e, e.previewOnly);
519
- return Be(e, n), Re(e, n), () => A(ue, null, [A("div", {
520
- id: `${a}-preview-wrapper`,
521
- class: `${p}-preview-wrapper`,
522
- "data-show": e.setting.preview,
523
- key: "content-preview-wrapper"
524
- }, [A("article", {
525
- id: `${a}-preview`,
526
- class: [`${p}-preview`, `${l == null ? void 0 : l.value}-theme`, t && `${p}-scrn`],
527
- innerHTML: n.value
528
- }, null)]), !e.previewOnly && A("div", {
529
- id: `${a}-html-wrapper`,
530
- class: `${p}-preview-wrapper`,
531
- "data-show": e.setting.htmlPreview,
532
- key: "html-preview-wrapper"
533
- }, [A("div", {
534
- class: `${p}-html`
535
- }, [n.value])])]);
536
- }
537
- }), wt = (e, a) => {
538
- const { editorId: l } = e, t = Y({
539
- // 是否已编译成html
540
- buildFinished: !1,
541
- // 存储当前最新的html
542
- html: ""
543
- });
544
- $(
545
- () => e.modelValue,
546
- () => {
547
- t.buildFinished = !1;
548
- }
549
- ), S(() => {
550
- g.on(l, {
551
- name: M,
552
- callback(n) {
553
- t.buildFinished = !0, t.html = n;
554
- }
555
- }), g.on(l, {
556
- name: ee,
557
- callback() {
558
- const n = new Promise((r) => {
559
- if (t.buildFinished)
560
- r(t.html);
561
- else {
562
- const i = (c) => {
563
- r(c), g.remove(l, M, i);
564
- };
565
- g.on(l, {
566
- name: M,
567
- callback: i
568
- });
569
- }
570
- });
571
- e.onSave ? e.onSave(e.modelValue, n) : a.emit("onSave", e.modelValue, n);
572
- }
573
- });
574
- });
575
- }, ae = (e) => {
576
- var n, r;
577
- const { editorId: a } = e, l = (r = (n = C) == null ? void 0 : n.editorExtensions) == null ? void 0 : r.highlight;
578
- H("editorId", a), H(
579
- "theme",
580
- F(() => e.theme)
581
- ), H(
582
- "highlight",
583
- F(() => {
584
- const i = {
585
- ...U,
586
- ...l == null ? void 0 : l.css
587
- }, c = e.codeStyleReverse && e.codeStyleReverseList.includes(e.previewTheme) ? "dark" : e.theme;
588
- return {
589
- js: (l == null ? void 0 : l.js) || fe,
590
- css: i[e.codeTheme] ? i[e.codeTheme][c] : U.atom[c]
591
- };
592
- })
593
- ), H("showCodeRowNumber", e.showCodeRowNumber);
594
- const t = F(() => {
595
- var c, u;
596
- const i = {
597
- ...j,
598
- ...(u = (c = C) == null ? void 0 : c.editorConfig) == null ? void 0 : u.languageUserDefined
73
+ }, h = /* @__PURE__ */ v({
74
+ name: "MdModal",
75
+ props: z,
76
+ emits: ["onClose"],
77
+ setup(e, c) {
78
+ const i = f(e.visible), a = f([`${l}-modal`]), m = f(), r = f();
79
+ let d = () => {
599
80
  };
600
- return i[e.language] ? i[e.language] : j["zh-CN"];
601
- });
602
- H("usedLanguageText", t), H(
603
- "previewTheme",
604
- F(() => e.previewTheme)
605
- ), H(
606
- "customIcon",
607
- F(() => e.customIcon)
608
- );
609
- }, kt = (e) => {
610
- ae(e), H("tabWidth", e.tabWidth);
611
- }, le = (e) => {
612
- S(() => {
613
- var a, l;
614
- if (!e.noIconfont)
615
- if (C.iconfontType === "svg") {
616
- const t = document.createElement("script");
617
- t.src = ((a = C.editorExtensions) == null ? void 0 : a.iconfont) || pe, t.id = `${p}-icon`, _(t);
618
- } else {
619
- const t = document.createElement("link");
620
- t.rel = "stylesheet", t.href = ((l = C.editorExtensions) == null ? void 0 : l.iconfontClass) || he, t.id = `${p}-icon-class`, _(t);
621
- }
622
- });
623
- }, $t = (e) => {
624
- var c, u, s, o, d, b;
625
- 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);
626
- S(() => {
627
- var k, y, w, I;
628
- const v = document.createElement("script"), m = document.createElement("script");
629
- v.src = ((k = t == null ? void 0 : t.prettier) == null ? void 0 : k.standaloneJs) || G.main, v.id = `${p}-prettier`, m.src = ((y = t == null ? void 0 : t.prettier) == null ? void 0 : y.parserMarkdownJs) || G.markdown, m.id = `${p}-prettierMD`;
630
- const h = document.createElement("link");
631
- h.rel = "stylesheet", h.href = ((w = t == null ? void 0 : t.cropper) == null ? void 0 : w.css) || D.css, h.id = `${p}-cropperCss`;
632
- const f = document.createElement("script");
633
- f.src = ((I = t == null ? void 0 : t.cropper) == null ? void 0 : I.js) || D.js, f.id = `${p}-cropper`, i || (_(h), _(f)), n || _(v), r || _(m);
634
- }), le(e);
635
- }, Ct = (e, a) => {
636
- const { editorId: l } = e;
637
- S(() => {
638
- g.on(l, {
639
- name: $e,
640
- callback: (t) => {
641
- e.onError instanceof Function ? e.onError(t) : a.emit("onError", t);
642
- }
643
- });
644
- });
645
- }, It = (e, a) => {
646
- const { editorId: l } = e, t = Y({
647
- pageFullscreen: e.pageFullscreen,
648
- fullscreen: !1,
649
- preview: e.preview,
650
- htmlPreview: e.preview ? !1 : e.htmlPreview
651
- }), n = (c, u) => {
652
- t[c] = u === void 0 ? !t[c] : u, c === "preview" && t.preview ? t.htmlPreview = !1 : c === "htmlPreview" && t.htmlPreview && (t.preview = !1);
653
- };
654
- let r = "";
655
- const i = () => {
656
- t.pageFullscreen || t.fullscreen ? document.body.style.overflow = "hidden" : document.body.style.overflow = r;
657
- };
658
- return $(() => [t.pageFullscreen, t.fullscreen], i), S(() => {
659
- g.on(l, {
660
- name: Ce,
661
- callback(c, u) {
662
- const s = (o) => {
663
- g.emit(l, ne, "image", {
664
- desc: "",
665
- urls: o
666
- }), u && u();
667
- };
668
- e.onUploadImg ? e.onUploadImg(c, s) : a.emit("onUploadImg", c, s);
669
- }
670
- }), r = document.body.style.overflow, i();
671
- }), [t, n];
672
- }, St = (e) => {
673
- const { editorId: a } = e, l = B(!1);
674
- return S(() => {
675
- g.on(a, {
676
- name: te,
677
- callback: (n) => {
678
- n === void 0 ? l.value = !l.value : l.value = n;
81
+ const o = b({
82
+ initPos: {
83
+ left: "0px",
84
+ top: "0px"
85
+ },
86
+ historyPos: {
87
+ left: "0px",
88
+ top: "0px"
679
89
  }
90
+ }), P = j(() => e.isFullscreen ? {
91
+ width: "100%",
92
+ height: "100%"
93
+ } : {
94
+ width: e.width,
95
+ height: e.height
680
96
  });
681
- }), F(() => !e.toolbarsExclude.includes("catalog") && e.toolbars.includes("catalog") && l.value);
682
- }, Et = (e, a, l, t, n) => {
683
- const { editorId: r } = e;
684
- $(
685
- () => t.pageFullscreen,
686
- (c) => {
687
- g.emit(r, z, c);
688
- }
689
- ), $(
690
- () => t.fullscreen,
691
- (c) => {
692
- g.emit(r, K, c);
693
- }
694
- ), $(
695
- () => t.preview,
696
- (c) => {
697
- g.emit(r, q, c);
698
- }
699
- ), $(
700
- () => t.htmlPreview,
701
- (c) => {
702
- g.emit(r, Z, c);
703
- }
704
- ), $(l, (c) => {
705
- g.emit(r, W, c);
706
- });
707
- const i = {
708
- on(c, u) {
709
- switch (c) {
710
- case "pageFullscreen": {
711
- g.on(r, {
712
- name: z,
713
- callback(s) {
714
- u(s);
715
- }
716
- });
717
- break;
718
- }
719
- case "fullscreen": {
720
- g.on(r, {
721
- name: K,
722
- callback(s) {
723
- u(s);
724
- }
725
- });
726
- break;
97
+ return F(() => {
98
+ d = g(r.value, (s, n) => {
99
+ o.initPos.left = s + "px", o.initPos.top = n + "px";
100
+ });
101
+ }), w(() => {
102
+ d();
103
+ }), p(() => e.isFullscreen, (s) => {
104
+ s ? d() : d = g(r.value, (n, u) => {
105
+ o.initPos.left = n + "px", o.initPos.top = u + "px";
106
+ });
107
+ }), p(() => e.visible, (s) => {
108
+ s ? (a.value.push("zoom-in"), i.value = s, S(() => {
109
+ const n = m.value.offsetWidth / 2, u = m.value.offsetHeight / 2, $ = document.documentElement.clientWidth / 2, x = document.documentElement.clientHeight / 2;
110
+ o.initPos.left = $ - n + "px", o.initPos.top = x - u + "px";
111
+ }), setTimeout(() => {
112
+ a.value = a.value.filter((n) => n !== "zoom-in");
113
+ }, 140)) : (a.value.push("zoom-out"), setTimeout(() => {
114
+ a.value = a.value.filter((n) => n !== "zoom-out"), i.value = s;
115
+ }, 130));
116
+ }), () => {
117
+ const s = y({
118
+ ctx: c
119
+ }), n = y({
120
+ props: e,
121
+ ctx: c
122
+ }, "title");
123
+ return t("div", {
124
+ style: {
125
+ display: i.value ? "block" : "none"
727
126
  }
728
- case "preview": {
729
- g.on(r, {
730
- name: q,
731
- callback(s) {
732
- u(s);
733
- }
734
- });
735
- break;
127
+ }, [t("div", {
128
+ class: `${l}-modal-mask`,
129
+ onClick: () => {
130
+ e.onClose ? e.onClose() : c.emit("onClose");
736
131
  }
737
- case "htmlPreview": {
738
- g.on(r, {
739
- name: Z,
740
- callback(s) {
741
- u(s);
742
- }
743
- });
744
- break;
132
+ }, null), t("div", {
133
+ class: a.value,
134
+ style: {
135
+ ...o.initPos,
136
+ ...P.value
137
+ },
138
+ ref: m
139
+ }, [t("div", {
140
+ class: `${l}-modal-header`,
141
+ ref: r
142
+ }, [n || ""]), t("div", {
143
+ class: `${l}-modal-body`
144
+ }, [s]), t("div", {
145
+ class: `${l}-modal-func`
146
+ }, [e.showAdjust && t("div", {
147
+ class: `${l}-modal-adjust`,
148
+ onClick: (u) => {
149
+ u.stopPropagation(), e.isFullscreen ? o.initPos = o.historyPos : (o.historyPos = o.initPos, o.initPos = {
150
+ left: "0",
151
+ top: "0"
152
+ }), e.onAdjust(!e.isFullscreen);
745
153
  }
746
- case "catalog": {
747
- g.on(r, {
748
- name: W,
749
- callback(s) {
750
- u(s);
751
- }
752
- });
753
- break;
154
+ }, [t(C, {
155
+ name: e.isFullscreen ? "suoxiao" : "fangda"
156
+ }, null)]), t("div", {
157
+ class: `${l}-modal-close`,
158
+ onClick: (u) => {
159
+ u.stopPropagation(), e.onClose ? e.onClose() : c.emit("onClose");
754
160
  }
755
- }
756
- },
757
- togglePageFullscreen(c) {
758
- n("pageFullscreen", c);
759
- },
760
- toggleFullscreen(c) {
761
- g.emit(r, Ie, c);
762
- },
763
- togglePreview(c) {
764
- n("preview", c);
765
- },
766
- toggleHtmlPreview(c) {
767
- n("htmlPreview", c);
768
- },
769
- toggleCatalog(c) {
770
- g.emit(r, te, c);
771
- },
772
- triggerSave() {
773
- g.emit(r, ee);
774
- },
775
- insert(c) {
776
- g.emit(r, ne, "universal", { generate: c });
777
- },
778
- focus(c) {
779
- g.emit(r, Se, c);
780
- }
781
- };
782
- a.expose(i);
783
- }, lt = (e) => e, ie = {
784
- /**
785
- * markdown content.
786
- *
787
- * @default ''
788
- */
789
- modelValue: {
790
- type: String,
791
- default: ""
792
- },
793
- /**
794
- * 主题,支持light和dark
795
- *
796
- * @default 'light'
797
- */
798
- theme: {
799
- type: String,
800
- default: "light"
801
- },
802
- /**
803
- * 外层类名
804
- *
805
- * @default ''
806
- */
807
- class: {
808
- type: String,
809
- default: ""
810
- },
811
- /**
812
- * 预设语言名称
813
- *
814
- * @default 'zh-CN'
815
- */
816
- language: {
817
- type: String,
818
- default: "zh-CN"
819
- },
820
- /**
821
- * html变化事件
822
- */
823
- onHtmlChanged: {
824
- type: Function
825
- },
826
- /**
827
- * 获取目录结构
828
- */
829
- onGetCatalog: {
830
- type: Function
831
- },
832
- /**
833
- * 编辑器唯一标识
834
- *
835
- * @default 'md-editor-v3'
836
- */
837
- editorId: {
838
- type: String,
839
- default: ge
840
- },
841
- /**
842
- * 预览中代码是否显示行号
843
- *
844
- * @default false
845
- */
846
- showCodeRowNumber: {
847
- type: Boolean,
848
- default: !1
849
- },
850
- /**
851
- * 预览内容样式
852
- *
853
- * @default 'default'
854
- */
855
- previewTheme: {
856
- type: String,
857
- default: "default"
858
- },
859
- /**
860
- * 编辑器样式
861
- */
862
- style: {
863
- type: Object,
864
- default: () => ({})
865
- },
866
- /**
867
- * 标题的id生成方式
868
- *
869
- * @default (text: string) => text
870
- */
871
- mdHeadingId: {
872
- type: Function,
873
- default: lt
874
- },
875
- /**
876
- *
877
- * 不能保证文本正确的情况,在marked编译md文本后通过该方法处理
878
- * 推荐DOMPurify、sanitize-html
879
- *
880
- * @default (text: string) => text
881
- */
882
- sanitize: {
883
- type: Function,
884
- default: (e) => e
885
- },
886
- /**
887
- * 不使用该mermaid
888
- *
889
- * @default false
890
- */
891
- noMermaid: {
892
- type: Boolean,
893
- default: !1
894
- },
895
- /**
896
- * 不使用katex
897
- *
898
- * @default false
899
- */
900
- noKatex: {
901
- type: Boolean,
902
- default: !1
903
- },
904
- /**
905
- * 代码主题
906
- *
907
- * @default 'atom'
908
- */
909
- codeTheme: {
910
- type: String,
911
- default: "atom"
912
- },
913
- /**
914
- * 不插入iconfont链接
915
- *
916
- * @default false
917
- */
918
- noIconfont: {
919
- type: Boolean
920
- },
921
- /**
922
- * 复制代码格式化方法
923
- *
924
- * @default (text) => text
925
- */
926
- formatCopiedText: {
927
- type: Function,
928
- default: (e) => e
929
- },
930
- /**
931
- * 某些预览主题的代码模块背景是暗色系
932
- * 将这个属性设置为true,会自动在该主题下的light模式下使用暗色系的代码风格
933
- *
934
- * @default true
935
- */
936
- codeStyleReverse: {
937
- type: Boolean,
938
- default: !0
939
- },
940
- /**
941
- * 需要自动调整的预览主题
942
- *
943
- * @default ['default', 'mk-cute']
944
- */
945
- codeStyleReverseList: {
946
- type: Array,
947
- default: ["default", "mk-cute"]
948
- },
949
- noHighlight: {
950
- type: Boolean,
951
- default: !1
952
- },
953
- /**
954
- * 是否关闭编辑器默认的放大缩小功能
955
- */
956
- noImgZoomIn: {
957
- type: Boolean,
958
- default: !1
959
- },
960
- /**
961
- * 自定义的图标
962
- */
963
- customIcon: {
964
- type: Object,
965
- default: {}
966
- }
967
- }, Pt = {
968
- ...ie,
969
- /**
970
- * input回调事件
971
- */
972
- onChange: {
973
- type: Function
974
- },
975
- /**
976
- * input回调事件
977
- */
978
- onSave: {
979
- type: Function
980
- },
981
- /**
982
- * 上传图片事件
983
- */
984
- onUploadImg: {
985
- type: Function
986
- },
987
- /**
988
- * 是否页面内全屏
989
- *
990
- * @default false
991
- */
992
- pageFullscreen: {
993
- type: Boolean,
994
- default: !1
995
- },
996
- /**
997
- * 是否展开预览
998
- *
999
- * @default true
1000
- */
1001
- preview: {
1002
- type: Boolean,
1003
- default: !0
1004
- },
1005
- /**
1006
- * 是否展开html预览
1007
- *
1008
- * @default false
1009
- */
1010
- htmlPreview: {
1011
- type: Boolean,
1012
- default: !1
1013
- },
1014
- /**
1015
- * 仅预览模式,不显示toolbar和编辑框
1016
- *
1017
- * @4.0.0开始移除该设置,使用组件MdPreview替换
1018
- *
1019
- * @default false
1020
- */
1021
- // previewOnly: {
1022
- // type: Boolean as PropType<boolean>,
1023
- // default: false
1024
- // },
1025
- /**
1026
- * 工具栏选择显示
1027
- *
1028
- * @default allToolbar
1029
- */
1030
- toolbars: {
1031
- type: Array,
1032
- default: ye
1033
- },
1034
- /**
1035
- * 工具栏选择不显示
1036
- *
1037
- * @default []
1038
- */
1039
- toolbarsExclude: {
1040
- type: Array,
1041
- default: []
1042
- },
1043
- /**
1044
- * 格式化md
1045
- *
1046
- * @default true
1047
- */
1048
- noPrettier: {
1049
- type: Boolean,
1050
- default: !1
1051
- },
1052
- /**
1053
- * 一个tab等于空格数
1054
- *
1055
- * @default 2
1056
- */
1057
- tabWidth: {
1058
- type: Number,
1059
- default: 2
1060
- },
1061
- /**
1062
- * 表格预设格子数
1063
- *
1064
- * @default [6, 4]
1065
- */
1066
- tableShape: {
1067
- type: Array,
1068
- default: () => [6, 4]
1069
- },
1070
- /**
1071
- * 空提示
1072
- *
1073
- * @default ''
1074
- */
1075
- placeholder: {
1076
- type: String,
1077
- default: ""
1078
- },
1079
- /**
1080
- * 自定义的工具栏列表
1081
- */
1082
- defToolbars: {
1083
- type: [String, Object]
1084
- },
1085
- /**
1086
- * 内部错误捕获
1087
- */
1088
- onError: {
1089
- type: Function
1090
- },
1091
- /**
1092
- * 页脚列表显示顺序
1093
- */
1094
- footers: {
1095
- type: Array,
1096
- default: ve
1097
- },
1098
- /**
1099
- * 是否默认激活输入框和预览框同步滚动
1100
- *
1101
- * @default true
1102
- */
1103
- scrollAuto: {
1104
- type: Boolean,
1105
- default: !0
1106
- },
1107
- /**
1108
- * 自定义的也叫工具组件列表
1109
- */
1110
- defFooters: {
1111
- type: [String, Object]
1112
- },
1113
- /**
1114
- * 是否禁用上传图片
1115
- *
1116
- * @default false
1117
- */
1118
- noUploadImg: {
1119
- type: Boolean
1120
- },
1121
- /**
1122
- * 文本区域自动获得焦点
1123
- *
1124
- * @default false
1125
- */
1126
- autoFocus: {
1127
- type: Boolean
1128
- },
1129
- /**
1130
- * 禁用文本区域
1131
- *
1132
- * @default false
1133
- */
1134
- disabled: {
1135
- type: Boolean
1136
- },
1137
- /**
1138
- * 文本区域为只读
1139
- *
1140
- * @default false
1141
- */
1142
- readOnly: {
1143
- type: Boolean
1144
- },
1145
- /**
1146
- * 文本区域允许的最大字符数
1147
- */
1148
- maxLength: {
1149
- type: Number
1150
- },
1151
- /**
1152
- * 是否启用自动识别粘贴代码类别
1153
- * 目前支持 vscode 复制的代码识别
1154
- *
1155
- * @default false
1156
- */
1157
- autoDetectCode: {
1158
- type: Boolean
1159
- },
1160
- /**
1161
- * 输入框失去焦点时触发事件
1162
- */
1163
- onBlur: {
1164
- type: Function
1165
- },
1166
- /**
1167
- * 输入框获得焦点时触发事件
1168
- */
1169
- onFocus: {
1170
- type: Function
1171
- },
1172
- /**
1173
- * @codemirror/autocomplete匹配关键词的方法列表
1174
- *
1175
- * 它会被像下面这样嵌入编辑器
1176
- *
1177
- * import { autocompletion } from '@codemirror/autocomplete';
1178
- * autocompletion({
1179
- * override: [...completions]
1180
- * })
1181
- */
1182
- completions: {
1183
- type: Array
1184
- },
1185
- /**
1186
- * 是否在工具栏下面显示对应的文字名称
1187
- *
1188
- * @default false
1189
- */
1190
- showToolbarName: {
1191
- type: Boolean,
1192
- default: !1
1193
- },
1194
- /**
1195
- * 字符输入事件
1196
- */
1197
- onInput: {
1198
- type: Function
1199
- },
1200
- onDrop: {
1201
- type: Function
1202
- }
1203
- }, ce = ["onHtmlChanged", "onGetCatalog"], Tt = [
1204
- ...ce,
1205
- "onChange",
1206
- "onSave",
1207
- "onUploadImg",
1208
- "onError",
1209
- "update:modelValue",
1210
- "onBlur",
1211
- "onFocus",
1212
- "onInput",
1213
- "onDrop"
1214
- ], it = /* @__PURE__ */ Q({
1215
- name: "MdPreview",
1216
- props: ie,
1217
- emits: ce,
1218
- setup(e, a) {
1219
- const {
1220
- editorId: l,
1221
- noKatex: t,
1222
- noMermaid: n,
1223
- noHighlight: r
1224
- } = e;
1225
- return ae(e), le(e), de(() => {
1226
- g.clear(l);
1227
- }), () => A("div", {
1228
- id: l,
1229
- class: [p, e.class, e.theme === "dark" && `${p}-dark`, `${p}-previewOnly`],
1230
- style: e.style
1231
- }, [A(at, {
1232
- modelValue: e.modelValue,
1233
- onHtmlChanged: (i) => {
1234
- e.onHtmlChanged ? e.onHtmlChanged(i) : a.emit("onHtmlChanged", i);
1235
- },
1236
- onGetCatalog: (i) => {
1237
- e.onGetCatalog ? e.onGetCatalog(i) : a.emit("onGetCatalog", i);
1238
- },
1239
- mdHeadingId: e.mdHeadingId,
1240
- noMermaid: n,
1241
- sanitize: e.sanitize,
1242
- noKatex: t,
1243
- formatCopiedText: e.formatCopiedText,
1244
- noHighlight: r,
1245
- noImgZoomIn: e.noImgZoomIn,
1246
- previewOnly: !0
1247
- }, null)]);
161
+ }, [t(C, {
162
+ name: "close"
163
+ }, null)])])])]);
164
+ };
1248
165
  }
1249
- }), x = it;
1250
- x.install = (e) => (e.component(x.name, x), e);
166
+ });
167
+ h.install = (e) => (e.component(h.name, h), e);
1251
168
  export {
1252
- at as C,
1253
- x as M,
1254
- Tt as a,
1255
- kt as b,
1256
- bt as c,
1257
- $t as d,
1258
- Pt as e,
1259
- Ct as f,
1260
- It as g,
1261
- St as h,
1262
- Et as i,
1263
- wt as u
169
+ C as I,
170
+ h as M
1264
171
  };