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