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