md-editor-v3 4.9.0 → 4.10.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +36 -0
- package/lib/cjs/MdEditor.cjs +3 -3
- package/lib/cjs/chunks/config.cjs +1 -1
- package/lib/cjs/chunks/index.cjs +7 -7
- package/lib/es/MdEditor.mjs +53 -51
- package/lib/es/chunks/config.mjs +10 -9
- package/lib/es/chunks/index.mjs +303 -287
- package/lib/types/MdEditor/Editor.d.ts +9 -0
- package/lib/types/MdEditor/index.d.ts +15 -0
- package/lib/types/MdEditor/layouts/Content/ContentPreview.d.ts +6 -0
- package/lib/types/MdEditor/layouts/Content/index.d.ts +6 -0
- package/lib/types/MdEditor/layouts/Content/props.d.ts +6 -0
- package/lib/types/MdEditor/props.d.ts +8 -0
- package/lib/types/MdEditor/type.d.ts +13 -2
- package/lib/types/MdPreview/MdPreview.d.ts +9 -0
- package/lib/types/MdPreview/index.d.ts +15 -0
- package/lib/umd/index.js +3 -3
- package/package.json +1 -1
package/lib/es/chunks/index.mjs
CHANGED
|
@@ -1,304 +1,308 @@
|
|
|
1
|
-
import { inject as P, onMounted as S, watch as C, toRef as Y, nextTick as O, shallowRef as R, ref as U, computed as H, defineComponent as ee, createVNode as
|
|
2
|
-
import { e as I, p, m as fe, k as j, f as G, h as pe, s as D, a as he, i as ge, g as V, j as z, l as ye, b as ve, d as be } from "./config.mjs";
|
|
3
|
-
import { u as we, a as ke, b as
|
|
1
|
+
import { inject as P, onMounted as S, watch as C, toRef as Y, nextTick as O, shallowRef as R, ref as U, computed as H, defineComponent as ee, createVNode as x, Fragment as de, reactive as te, provide as F, onBeforeUnmount as me } from "vue";
|
|
2
|
+
import { e as I, p as h, m as fe, k as j, f as G, h as pe, s as D, a as he, i as ge, g as V, j as z, l as ye, b as ve, d as be } from "./config.mjs";
|
|
3
|
+
import { u as we, a as ke, b as v, P as $e, C as W, B as A, O as ne, E as Ce, U as Ie, c as oe, d as K, F as q, e as Z, H as J, f as X, R as re, h as Se, T as Ee } from "./index4.mjs";
|
|
4
4
|
import { a as _, u as Pe } from "./dom.mjs";
|
|
5
5
|
import Te from "medium-zoom";
|
|
6
6
|
import { debounce as ae } from "@vavt/util";
|
|
7
7
|
import _e from "copy-to-clipboard";
|
|
8
8
|
import Fe from "markdown-it";
|
|
9
9
|
import He from "markdown-it-image-figures";
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
const
|
|
10
|
+
import Me from "markdown-it-task-lists";
|
|
11
|
+
import xe from "lru-cache";
|
|
12
|
+
const Ae = (e, r) => {
|
|
13
13
|
const l = P("editorId"), { noImgZoomIn: t } = e, n = ae(() => {
|
|
14
|
-
const
|
|
15
|
-
|
|
14
|
+
const o = document.querySelectorAll(`#${l}-preview img`);
|
|
15
|
+
o.length !== 0 && Te(o, {
|
|
16
16
|
background: "#00000073"
|
|
17
17
|
});
|
|
18
18
|
});
|
|
19
19
|
S(() => {
|
|
20
20
|
!t && n();
|
|
21
|
-
}), C([
|
|
21
|
+
}), C([r, Y(e.setting, "preview")], () => {
|
|
22
22
|
!t && n();
|
|
23
23
|
});
|
|
24
|
-
}, Re =
|
|
25
|
-
if (typeof
|
|
26
|
-
return
|
|
27
|
-
const l = `<i class="${
|
|
24
|
+
}, Re = Ae, Be = (e, r) => {
|
|
25
|
+
if (typeof r[e] == "string")
|
|
26
|
+
return r[e];
|
|
27
|
+
const l = `<i class="${h}-iconfont ${h}-icon-${e}"></i>`;
|
|
28
28
|
switch (I.iconfontType) {
|
|
29
29
|
case "svg":
|
|
30
|
-
return `<svg class="${
|
|
30
|
+
return `<svg class="${h}-icon" aria-hidden="true"><use xlink:href="#${h}-icon-${e}"></use></svg>`;
|
|
31
31
|
default:
|
|
32
32
|
return l;
|
|
33
33
|
}
|
|
34
|
-
}, Le = (e,
|
|
35
|
-
const l = P("editorId"), t = P("usedLanguageText"), n = P("customIcon"),
|
|
36
|
-
document.querySelectorAll(`#${l}-preview pre`).forEach((
|
|
34
|
+
}, Le = (e, r) => {
|
|
35
|
+
const l = P("editorId"), t = P("usedLanguageText"), n = P("customIcon"), o = () => {
|
|
36
|
+
document.querySelectorAll(`#${l}-preview pre`).forEach((d) => {
|
|
37
37
|
var b, y;
|
|
38
38
|
let s = -1;
|
|
39
|
-
(b =
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
var
|
|
39
|
+
(b = d.querySelector(".copy-button")) == null || b.remove();
|
|
40
|
+
const a = ((y = t.value.copyCode) == null ? void 0 : y.text) || "复制代码", u = document.createElement("span");
|
|
41
|
+
u.setAttribute("class", "copy-button"), u.dataset.tips = a, u.innerHTML = Be("copy", n.value), u.addEventListener("click", () => {
|
|
42
|
+
var g, w;
|
|
43
43
|
clearTimeout(s);
|
|
44
|
-
const m =
|
|
45
|
-
|
|
46
|
-
|
|
44
|
+
const m = d.querySelector("code").innerText, p = _e(e.formatCopiedText(m)), f = ((g = t.value.copyCode) == null ? void 0 : g.successTips) || "已复制!", $ = ((w = t.value.copyCode) == null ? void 0 : w.failTips) || "已复制!";
|
|
45
|
+
u.dataset.tips = p ? f : $, s = window.setTimeout(() => {
|
|
46
|
+
u.dataset.tips = a;
|
|
47
47
|
}, 1500);
|
|
48
|
-
}),
|
|
48
|
+
}), d.appendChild(u);
|
|
49
49
|
});
|
|
50
50
|
}, i = () => {
|
|
51
|
-
O(
|
|
52
|
-
}, c = (
|
|
53
|
-
|
|
51
|
+
O(o);
|
|
52
|
+
}, c = (d) => {
|
|
53
|
+
d && O(o);
|
|
54
54
|
};
|
|
55
|
-
C(() =>
|
|
55
|
+
C(() => r.value, i), C(() => e.setting.preview, c), C(() => e.setting.htmlPreview, c), C(() => t.value, o), S(o);
|
|
56
56
|
}, Ne = Le, Oe = (e) => {
|
|
57
|
-
var
|
|
58
|
-
const
|
|
57
|
+
var o;
|
|
58
|
+
const r = (o = I.editorExtensions) == null ? void 0 : o.highlight, l = r == null ? void 0 : r.instance, t = P("highlight"), n = R(l);
|
|
59
59
|
return S(() => {
|
|
60
60
|
if (!e.noHighlight && !n.value) {
|
|
61
61
|
const i = document.createElement("script");
|
|
62
62
|
i.src = t.value.js, i.onload = () => {
|
|
63
63
|
n.value = window.hljs;
|
|
64
|
-
}, i.id = `${
|
|
64
|
+
}, i.id = `${h}-hljs`, _(i, "hljs");
|
|
65
65
|
const c = document.createElement("link");
|
|
66
|
-
c.rel = "stylesheet", c.href = t.value.css, c.id = `${
|
|
66
|
+
c.rel = "stylesheet", c.href = t.value.css, c.id = `${h}-hlCss`, _(c);
|
|
67
67
|
}
|
|
68
68
|
}), C(
|
|
69
69
|
() => t.value.css,
|
|
70
70
|
(i) => {
|
|
71
|
-
Pe(`${
|
|
71
|
+
Pe(`${h}-hlCss`, "href", i);
|
|
72
72
|
}
|
|
73
73
|
), n;
|
|
74
74
|
}, Ue = Oe, je = (e) => {
|
|
75
|
-
const
|
|
75
|
+
const r = P("theme"), { editorExtensions: l, mermaidConfig: t } = I, n = l == null ? void 0 : l.mermaid, o = R(n == null ? void 0 : n.instance), i = R(-1), c = new xe({
|
|
76
76
|
max: 1e3,
|
|
77
77
|
// 缓存10分钟
|
|
78
78
|
ttl: 6e5
|
|
79
|
-
}),
|
|
80
|
-
const
|
|
81
|
-
!e.noMermaid &&
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
79
|
+
}), d = () => {
|
|
80
|
+
const a = o.value;
|
|
81
|
+
!e.noMermaid && a && (a.initialize(
|
|
82
|
+
t({
|
|
83
|
+
startOnLoad: !1,
|
|
84
|
+
theme: r.value === "dark" ? "dark" : "default"
|
|
85
|
+
})
|
|
86
|
+
), i.value = i.value + 1);
|
|
85
87
|
};
|
|
86
88
|
return C(
|
|
87
|
-
() =>
|
|
89
|
+
() => r.value,
|
|
88
90
|
() => {
|
|
89
|
-
|
|
91
|
+
c.clear(), d();
|
|
90
92
|
}
|
|
91
93
|
), S(() => {
|
|
92
|
-
if (!e.noMermaid && !(
|
|
93
|
-
const
|
|
94
|
-
if (/\.mjs/.test(
|
|
94
|
+
if (!e.noMermaid && !(n != null && n.instance)) {
|
|
95
|
+
const a = (n == null ? void 0 : n.js) || fe;
|
|
96
|
+
if (/\.mjs/.test(a))
|
|
95
97
|
import(
|
|
96
98
|
/* @vite-ignore */
|
|
97
99
|
/* webpackIgnore: true */
|
|
98
|
-
|
|
99
|
-
).then((
|
|
100
|
-
|
|
100
|
+
a
|
|
101
|
+
).then((u) => {
|
|
102
|
+
o.value = u.default, d();
|
|
101
103
|
});
|
|
102
104
|
else {
|
|
103
|
-
const
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
}, _(
|
|
105
|
+
const u = document.createElement("script");
|
|
106
|
+
u.id = `${h}-mermaid`, u.src = a, u.onload = () => {
|
|
107
|
+
o.value = window.mermaid, d();
|
|
108
|
+
}, _(u, "mermaid");
|
|
107
109
|
}
|
|
108
110
|
}
|
|
109
|
-
}), { mermaidRef:
|
|
111
|
+
}), { mermaidRef: o, reRenderRef: i, replaceMermaid: () => {
|
|
110
112
|
O(() => {
|
|
111
|
-
if (!e.noMermaid &&
|
|
112
|
-
const
|
|
113
|
-
`div.${
|
|
114
|
-
),
|
|
115
|
-
|
|
116
|
-
let
|
|
117
|
-
|
|
118
|
-
let
|
|
119
|
-
if (!
|
|
120
|
-
const
|
|
121
|
-
let
|
|
113
|
+
if (!e.noMermaid && o.value) {
|
|
114
|
+
const a = document.querySelectorAll(
|
|
115
|
+
`div.${h}-mermaid`
|
|
116
|
+
), u = document.createElement("div");
|
|
117
|
+
u.style.width = document.body.offsetWidth + "px", u.style.height = document.body.offsetHeight + "px", u.style.position = "fixed", u.style.zIndex = "-10000", u.style.top = "-10000";
|
|
118
|
+
let b = a.length;
|
|
119
|
+
b > 0 && document.body.appendChild(u), a.forEach(async (y) => {
|
|
120
|
+
let m = c.get(y.innerText);
|
|
121
|
+
if (!m) {
|
|
122
|
+
const f = we(), $ = o.value.renderAsync || o.value.render;
|
|
123
|
+
let g = "";
|
|
122
124
|
try {
|
|
123
|
-
|
|
125
|
+
g = await $(f, y.innerText, u);
|
|
124
126
|
} catch {
|
|
125
127
|
}
|
|
126
|
-
|
|
128
|
+
m = await e.sanitizeMermaid(
|
|
129
|
+
typeof g == "string" ? g : g.svg
|
|
130
|
+
), c.set(y.innerText, m);
|
|
127
131
|
}
|
|
128
|
-
const
|
|
129
|
-
|
|
132
|
+
const p = document.createElement("p");
|
|
133
|
+
p.className = `${h}-mermaid`, p.setAttribute("data-processed", ""), p.innerHTML = m, y.dataset.line !== void 0 && (p.dataset.line = y.dataset.line), y.replaceWith(p), --b === 0 && u.remove();
|
|
130
134
|
});
|
|
131
135
|
}
|
|
132
136
|
});
|
|
133
137
|
} };
|
|
134
138
|
}, Ge = je, De = (e) => {
|
|
135
139
|
var n;
|
|
136
|
-
const
|
|
140
|
+
const r = (n = I.editorExtensions) == null ? void 0 : n.katex, l = r == null ? void 0 : r.instance, t = R(l);
|
|
137
141
|
return S(() => {
|
|
138
142
|
if (!e.noKatex && !t.value) {
|
|
139
|
-
const
|
|
140
|
-
|
|
143
|
+
const o = document.createElement("script");
|
|
144
|
+
o.src = (r == null ? void 0 : r.js) || j.js, o.onload = () => {
|
|
141
145
|
t.value = window.katex;
|
|
142
|
-
},
|
|
146
|
+
}, o.id = `${h}-katex`;
|
|
143
147
|
const i = document.createElement("link");
|
|
144
|
-
i.rel = "stylesheet", i.href = (
|
|
148
|
+
i.rel = "stylesheet", i.href = (r == null ? void 0 : r.css) || j.css, i.id = `${h}-katexCss`, _(o, "katex"), _(i);
|
|
145
149
|
}
|
|
146
150
|
}), t;
|
|
147
|
-
}, Ve = De, ze = (e,
|
|
151
|
+
}, Ve = De, ze = (e, r) => {
|
|
148
152
|
const l = e.renderer.rules.fence.bind(e.renderer.rules);
|
|
149
|
-
e.renderer.rules.fence = (t, n,
|
|
150
|
-
const
|
|
151
|
-
if (
|
|
152
|
-
let
|
|
153
|
-
return t[n].map && t[n].level === 0 && (
|
|
153
|
+
e.renderer.rules.fence = (t, n, o, i, c) => {
|
|
154
|
+
const d = t[n], s = d.content.trim();
|
|
155
|
+
if (d.info === "mermaid") {
|
|
156
|
+
let a;
|
|
157
|
+
return t[n].map && t[n].level === 0 && (a = t[n].map[0], t[n].attrSet("data-line", String(a))), `<div class="${h}-mermaid" ${a !== void 0 ? "data-line=" + a : ""} data-mermaid-theme=${r.themeRef.value}>${s}</div>`;
|
|
154
158
|
}
|
|
155
|
-
return l(t, n,
|
|
159
|
+
return l(t, n, o, i, c);
|
|
156
160
|
};
|
|
157
|
-
}, We = ze, Q = (e,
|
|
161
|
+
}, We = ze, Q = (e, r) => {
|
|
158
162
|
let l = !0, t = !0;
|
|
159
|
-
const n = e.posMax,
|
|
160
|
-
return (
|
|
163
|
+
const n = e.posMax, o = r > 0 ? e.src.charCodeAt(r - 1) : -1, i = r + 1 <= n ? e.src.charCodeAt(r + 1) : -1;
|
|
164
|
+
return (o === 32 || o === 9 || i >= 48 && i <= 57) && (t = !1), (i === 32 || i === 9) && (l = !1), {
|
|
161
165
|
can_open: l,
|
|
162
166
|
can_close: t
|
|
163
167
|
};
|
|
164
|
-
}, Ke = (e,
|
|
165
|
-
let l, t, n,
|
|
168
|
+
}, Ke = (e, r) => {
|
|
169
|
+
let l, t, n, o;
|
|
166
170
|
if (e.src[e.pos] !== "$")
|
|
167
171
|
return !1;
|
|
168
172
|
if (n = Q(e, e.pos), !n.can_open)
|
|
169
|
-
return
|
|
173
|
+
return r || (e.pending += "$"), e.pos += 1, !0;
|
|
170
174
|
const i = e.pos + 1;
|
|
171
175
|
for (l = i; (l = e.src.indexOf("$", l)) !== -1; ) {
|
|
172
|
-
for (
|
|
173
|
-
|
|
174
|
-
if ((l -
|
|
176
|
+
for (o = l - 1; e.src[o] === "\\"; )
|
|
177
|
+
o -= 1;
|
|
178
|
+
if ((l - o) % 2 == 1)
|
|
175
179
|
break;
|
|
176
180
|
l += 1;
|
|
177
181
|
}
|
|
178
|
-
return l === -1 ? (
|
|
179
|
-
}, qe = (e,
|
|
180
|
-
let n,
|
|
181
|
-
if (s + 2 >
|
|
182
|
+
return l === -1 ? (r || (e.pending += "$"), e.pos = i, !0) : l - i === 0 ? (r || (e.pending += "$$"), e.pos = i + 1, !0) : (n = Q(e, l), n.can_close ? (r || (t = e.push("math_inline", "math", 0), t.markup = "$", t.content = e.src.slice(i, l)), e.pos = l + 1, !0) : (r || (e.pending += "$"), e.pos = i, !0));
|
|
183
|
+
}, qe = (e, r, l, t) => {
|
|
184
|
+
let n, o, i, c, d = !1, s = e.bMarks[r] + e.tShift[r], a = e.eMarks[r];
|
|
185
|
+
if (s + 2 > a || e.src.slice(s, s + 2) !== "$$")
|
|
182
186
|
return !1;
|
|
183
|
-
if (s += 2, n = e.src.slice(s,
|
|
187
|
+
if (s += 2, n = e.src.slice(s, a), t)
|
|
184
188
|
return !0;
|
|
185
|
-
for (n.trim().slice(-2) === "$$" && (n = n.trim().slice(0, -2),
|
|
186
|
-
e.src.slice(s,
|
|
189
|
+
for (n.trim().slice(-2) === "$$" && (n = n.trim().slice(0, -2), d = !0), i = r; !d && (i++, !(i >= l || (s = e.bMarks[i] + e.tShift[i], a = e.eMarks[i], s < a && e.tShift[i] < e.blkIndent))); )
|
|
190
|
+
e.src.slice(s, a).trim().slice(-2) === "$$" && (c = e.src.slice(0, a).lastIndexOf("$$"), o = e.src.slice(s, c), d = !0);
|
|
187
191
|
e.line = i + 1;
|
|
188
|
-
const
|
|
189
|
-
return
|
|
190
|
-
` : "") + e.getLines(
|
|
191
|
-
}, Ze = (e,
|
|
192
|
+
const u = e.push("math_block", "math", 0);
|
|
193
|
+
return u.block = !0, u.content = (n && n.trim() ? n + `
|
|
194
|
+
` : "") + e.getLines(r + 1, i, e.tShift[r], !0) + (o && o.trim() ? o : ""), u.map = [r, e.line], u.markup = "$$", !0;
|
|
195
|
+
}, Ze = (e, r) => {
|
|
192
196
|
const l = (n) => {
|
|
193
|
-
if (
|
|
194
|
-
const
|
|
197
|
+
if (r.katexRef.value) {
|
|
198
|
+
const o = r.katexRef.value.renderToString(n, {
|
|
195
199
|
throwOnError: !1
|
|
196
200
|
});
|
|
197
|
-
return `<span class="${
|
|
201
|
+
return `<span class="${h}-katex-inline" data-processed>${o}</span>`;
|
|
198
202
|
} else
|
|
199
|
-
return `<span class="${
|
|
200
|
-
}, t = (n,
|
|
201
|
-
if (
|
|
202
|
-
const i =
|
|
203
|
+
return `<span class="${h}-katex-inline">${n}</span>`;
|
|
204
|
+
}, t = (n, o) => {
|
|
205
|
+
if (r.katexRef.value) {
|
|
206
|
+
const i = r.katexRef.value.renderToString(n, {
|
|
203
207
|
throwOnError: !1,
|
|
204
208
|
displayMode: !0
|
|
205
209
|
});
|
|
206
|
-
return `<p class="${
|
|
210
|
+
return `<p class="${h}-katex-block" data-line=${o} data-processed>${i}</p>`;
|
|
207
211
|
} else
|
|
208
|
-
return `<p class="${
|
|
212
|
+
return `<p class="${h}-katex-block" data-line=${o}>${n}</p>`;
|
|
209
213
|
};
|
|
210
214
|
e.inline.ruler.after("escape", "math_inline", Ke), e.block.ruler.after("blockquote", "math_block", qe, {
|
|
211
215
|
alt: ["paragraph", "reference", "blockquote", "list"]
|
|
212
|
-
}), e.renderer.rules.math_inline = (n,
|
|
216
|
+
}), e.renderer.rules.math_inline = (n, o) => l(n[o].content), e.renderer.rules.math_block = (n, o) => t(n[o].content, n[o].map[0]) + `
|
|
213
217
|
`;
|
|
214
|
-
}, Je = Ze, Xe = (e,
|
|
215
|
-
|
|
216
|
-
const l = 3, t =
|
|
218
|
+
}, Je = Ze, Xe = (e, r) => {
|
|
219
|
+
r = r || {};
|
|
220
|
+
const l = 3, t = r.marker || "!", n = t.charCodeAt(0), o = t.length;
|
|
217
221
|
let i = "", c = "";
|
|
218
|
-
const
|
|
219
|
-
const
|
|
220
|
-
return
|
|
222
|
+
const d = (a, u, b, y, m) => {
|
|
223
|
+
const p = a[u];
|
|
224
|
+
return p.type === "admonition_open" ? (a[u].attrPush([
|
|
221
225
|
"class",
|
|
222
|
-
`${
|
|
223
|
-
]),
|
|
224
|
-
}, s = (
|
|
225
|
-
const
|
|
226
|
-
c = "", i =
|
|
226
|
+
`${h}-admonition ${h}-admonition-${p.info}`
|
|
227
|
+
]), a[u].attrSet("data-line", String(a[u].map[0]))) : p.type === "admonition_title_open" && a[u].attrPush(["class", `${h}-admonition-title`]), m.renderToken(a, u, b);
|
|
228
|
+
}, s = (a) => {
|
|
229
|
+
const u = a.trim().split(" ", 2);
|
|
230
|
+
c = "", i = u[0], u.length > 1 && (c = a.substring(i.length + 2)), (c === "" || !c) && (c = i);
|
|
227
231
|
};
|
|
228
232
|
e.block.ruler.before(
|
|
229
233
|
"code",
|
|
230
234
|
"admonition",
|
|
231
|
-
(
|
|
232
|
-
let m,
|
|
233
|
-
if (n !==
|
|
235
|
+
(a, u, b, y) => {
|
|
236
|
+
let m, p, f, $ = !1, g = a.bMarks[u] + a.tShift[u], w = a.eMarks[u];
|
|
237
|
+
if (n !== a.src.charCodeAt(g))
|
|
234
238
|
return !1;
|
|
235
|
-
for (m =
|
|
239
|
+
for (m = g + 1; m <= w && t[(m - g) % o] === a.src[m]; m++)
|
|
236
240
|
;
|
|
237
|
-
const
|
|
238
|
-
if (
|
|
241
|
+
const k = Math.floor((m - g) / o);
|
|
242
|
+
if (k !== l)
|
|
239
243
|
return !1;
|
|
240
|
-
m -= (m -
|
|
241
|
-
const E =
|
|
244
|
+
m -= (m - g) % o;
|
|
245
|
+
const E = a.src.slice(g, m), T = a.src.slice(m, w);
|
|
242
246
|
if (s(T), y)
|
|
243
247
|
return !0;
|
|
244
|
-
for (
|
|
245
|
-
if (n ===
|
|
246
|
-
for (m =
|
|
248
|
+
for (p = u; p++, !(p >= b || (g = a.bMarks[p] + a.tShift[p], w = a.eMarks[p], g < w && a.sCount[p] < a.blkIndent)); )
|
|
249
|
+
if (n === a.src.charCodeAt(g) && !(a.sCount[p] - a.blkIndent >= 4)) {
|
|
250
|
+
for (m = g + 1; m <= w && t[(m - g) % o] === a.src[m]; m++)
|
|
247
251
|
;
|
|
248
|
-
if (!(Math.floor((m -
|
|
249
|
-
|
|
252
|
+
if (!(Math.floor((m - g) / o) < k) && (m -= (m - g) % o, m = a.skipSpaces(m), !(m < w))) {
|
|
253
|
+
$ = !0;
|
|
250
254
|
break;
|
|
251
255
|
}
|
|
252
256
|
}
|
|
253
|
-
const
|
|
254
|
-
return
|
|
257
|
+
const M = a.parentType, B = a.lineMax;
|
|
258
|
+
return a.parentType = "root", a.lineMax = p, f = a.push("admonition_open", "div", 1), f.markup = E, f.block = !0, f.info = i, f.map = [u, p], f = a.push("admonition_title_open", "p", 1), f.markup = E + " " + i, f.map = [u, p], f = a.push("inline", "", 0), f.content = c, f.map = [u, a.line - 1], f.children = [], f = a.push("admonition_title_close", "p", -1), f.markup = E + " " + i, a.md.block.tokenize(a, u + 1, p), f = a.push("admonition_close", "div", -1), f.markup = a.src.slice(g, m), f.block = !0, a.parentType = M, a.lineMax = B, a.line = p + ($ ? 1 : 0), !0;
|
|
255
259
|
},
|
|
256
260
|
{
|
|
257
261
|
alt: ["paragraph", "reference", "blockquote", "list"]
|
|
258
262
|
}
|
|
259
|
-
), e.renderer.rules.admonition_open =
|
|
260
|
-
}, Qe = Xe, Ye = (e,
|
|
263
|
+
), 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;
|
|
264
|
+
}, Qe = Xe, Ye = (e, r) => {
|
|
261
265
|
e.renderer.rules.heading_open = (l, t) => {
|
|
262
266
|
var c;
|
|
263
|
-
const n = l[t],
|
|
264
|
-
return
|
|
265
|
-
text:
|
|
267
|
+
const n = l[t], o = ((c = l[t + 1].children) == null ? void 0 : c.reduce((d, s) => d + (s.content || ""), "")) || "", i = n.markup.length;
|
|
268
|
+
return r.headsRef.value.push({
|
|
269
|
+
text: o,
|
|
266
270
|
level: i
|
|
267
271
|
}), n.map && n.level === 0 && (n.attrSet("data-line", String(n.map[0])), n.attrSet(
|
|
268
272
|
"id",
|
|
269
|
-
|
|
270
|
-
)), e.renderer.renderToken(l, t,
|
|
271
|
-
}, e.renderer.rules.heading_close = (l, t, n,
|
|
272
|
-
}, et = Ye, tt = (e,
|
|
273
|
+
r.mdHeadingId(o, i, r.headsRef.value.length)
|
|
274
|
+
)), e.renderer.renderToken(l, t, r);
|
|
275
|
+
}, e.renderer.rules.heading_close = (l, t, n, o, i) => i.renderToken(l, t, n);
|
|
276
|
+
}, et = Ye, tt = (e, r) => {
|
|
273
277
|
const l = e.renderer.rules.fence, t = e.utils.unescapeAll, n = /\[(\w*)(?::([\w ]*))?\]/;
|
|
274
|
-
function
|
|
278
|
+
function o(s) {
|
|
275
279
|
return s.info ? t(s.info).trim() : "";
|
|
276
280
|
}
|
|
277
281
|
function i(s) {
|
|
278
|
-
const
|
|
279
|
-
return [
|
|
282
|
+
const a = o(s), [u = null, b = ""] = (n.exec(a) || []).slice(1);
|
|
283
|
+
return [u, b];
|
|
280
284
|
}
|
|
281
285
|
function c(s) {
|
|
282
|
-
const
|
|
283
|
-
return
|
|
286
|
+
const a = o(s);
|
|
287
|
+
return a ? a.split(/(\s+)/g)[0] : "";
|
|
284
288
|
}
|
|
285
|
-
const
|
|
286
|
-
if (s[
|
|
289
|
+
const d = (s, a, u, b, y) => {
|
|
290
|
+
if (s[a].hidden)
|
|
287
291
|
return "";
|
|
288
|
-
const [m,
|
|
292
|
+
const [m, p] = i(s[a]);
|
|
289
293
|
if (m === null)
|
|
290
|
-
return l(s,
|
|
291
|
-
let f,
|
|
292
|
-
for (let T =
|
|
293
|
-
f.info = f.info.replace(n, ""), f.hidden = !0,
|
|
294
|
-
`, E += `<input type="radio" id="group-${
|
|
295
|
-
` + l(s, T,
|
|
294
|
+
return l(s, a, u, b, y);
|
|
295
|
+
let f, $, g, w, k = "", E = "";
|
|
296
|
+
for (let T = a; T < s.length && (f = s[T], [$, g] = i(f), $ === m); T++)
|
|
297
|
+
f.info = f.info.replace(n, ""), f.hidden = !0, w = T - a > 0 ? "" : " checked", k += `<li><input type="radio" name="label-group-${r.editorId}-${a}"${w}><label for="group-${r.editorId}-${a}-tab-${T - a}" onclick="this.previousElementSibling.click()">${g || c(f)}</label></li>
|
|
298
|
+
`, E += `<input type="radio" id="group-${r.editorId}-${a}-tab-${T - a}" name="group-${r.editorId}-${a}"${w}>
|
|
299
|
+
` + l(s, T, u, b, y);
|
|
296
300
|
return `<div class="code-tabs">
|
|
297
301
|
<ul>
|
|
298
|
-
` +
|
|
302
|
+
` + k + `</ul>
|
|
299
303
|
` + E + "</div>";
|
|
300
304
|
};
|
|
301
|
-
e.renderer.rules.fence =
|
|
305
|
+
e.renderer.rules.fence = d;
|
|
302
306
|
}, nt = tt, ot = (e) => {
|
|
303
307
|
[
|
|
304
308
|
"paragraph_open",
|
|
@@ -309,28 +313,30 @@ const Me = (e, a) => {
|
|
|
309
313
|
"hr",
|
|
310
314
|
"html_block",
|
|
311
315
|
"fence"
|
|
312
|
-
].forEach((
|
|
313
|
-
const l = e.renderer.rules[
|
|
314
|
-
l ? e.renderer.rules[
|
|
315
|
-
let
|
|
316
|
-
const s = l(t, n,
|
|
317
|
-
return t[n].map && t[n].level === 0 && !/^<!--/.test(s) ? (
|
|
318
|
-
} : e.renderer.rules[
|
|
319
|
-
let
|
|
320
|
-
return t[n].map && t[n].level === 0 && (
|
|
316
|
+
].forEach((r) => {
|
|
317
|
+
const l = e.renderer.rules[r];
|
|
318
|
+
l ? e.renderer.rules[r] = (t, n, o, i, c) => {
|
|
319
|
+
let d;
|
|
320
|
+
const s = l(t, n, o, i, c);
|
|
321
|
+
return t[n].map && t[n].level === 0 && !/^<!--/.test(s) ? (d = t[n].map[0], s.replace(/^(<[^>]*)/, `$1 data-line="${d}"`)) : s;
|
|
322
|
+
} : e.renderer.rules[r] = (t, n, o, i, c) => {
|
|
323
|
+
let d;
|
|
324
|
+
return t[n].map && t[n].level === 0 && (d = t[n].map[0], t[n].attrSet("data-line", String(d))), c.renderToken(t, n, o);
|
|
321
325
|
};
|
|
322
326
|
});
|
|
323
|
-
}, rt = (e,
|
|
324
|
-
const { editorConfig: l, markdownItConfig: t, markdownItPlugins: n } = I,
|
|
327
|
+
}, rt = (e, r) => {
|
|
328
|
+
const { editorConfig: l, markdownItConfig: t, markdownItPlugins: n } = I, o = P("editorId"), i = P("showCodeRowNumber"), c = P("theme"), d = U([]), s = Ue(e), a = Ve(e), { reRenderRef: u, replaceMermaid: b } = Ge(e), y = Fe({
|
|
325
329
|
html: !0,
|
|
326
330
|
breaks: !0
|
|
327
331
|
});
|
|
328
|
-
t(y
|
|
332
|
+
t(y, {
|
|
333
|
+
editorId: o
|
|
334
|
+
});
|
|
329
335
|
const m = [
|
|
330
336
|
{
|
|
331
337
|
type: "katex",
|
|
332
338
|
plugin: Je,
|
|
333
|
-
options: { katexRef:
|
|
339
|
+
options: { katexRef: a }
|
|
334
340
|
},
|
|
335
341
|
{
|
|
336
342
|
type: "image",
|
|
@@ -344,59 +350,61 @@ const Me = (e, a) => {
|
|
|
344
350
|
},
|
|
345
351
|
{
|
|
346
352
|
type: "taskList",
|
|
347
|
-
plugin:
|
|
353
|
+
plugin: Me,
|
|
348
354
|
options: {}
|
|
349
355
|
},
|
|
350
356
|
{
|
|
351
357
|
type: "heading",
|
|
352
358
|
plugin: et,
|
|
353
|
-
options: { mdHeadingId: e.mdHeadingId, headsRef:
|
|
359
|
+
options: { mdHeadingId: e.mdHeadingId, headsRef: d }
|
|
354
360
|
},
|
|
355
361
|
{
|
|
356
362
|
type: "codeTabs",
|
|
357
363
|
plugin: nt,
|
|
358
|
-
options: { editorId:
|
|
364
|
+
options: { editorId: o }
|
|
359
365
|
}
|
|
360
366
|
];
|
|
361
367
|
e.noMermaid || m.push({
|
|
362
368
|
type: "mermaid",
|
|
363
369
|
plugin: We,
|
|
364
370
|
options: { themeRef: c }
|
|
365
|
-
}), n(m
|
|
366
|
-
|
|
371
|
+
}), n(m, {
|
|
372
|
+
editorId: o
|
|
373
|
+
}).forEach((k) => {
|
|
374
|
+
y.use(k.plugin, k.options);
|
|
367
375
|
});
|
|
368
|
-
const
|
|
376
|
+
const p = y.options.highlight;
|
|
369
377
|
y.set({
|
|
370
|
-
highlight: (
|
|
371
|
-
if (
|
|
372
|
-
const L =
|
|
378
|
+
highlight: (k, E, T) => {
|
|
379
|
+
if (p) {
|
|
380
|
+
const L = p(k, E, T);
|
|
373
381
|
if (L)
|
|
374
382
|
return L;
|
|
375
383
|
}
|
|
376
|
-
let
|
|
377
|
-
!e.noHighlight && s.value ? s.value.getLanguage(E) ?
|
|
384
|
+
let M;
|
|
385
|
+
!e.noHighlight && s.value ? s.value.getLanguage(E) ? M = s.value.highlight(k, {
|
|
378
386
|
language: E,
|
|
379
387
|
ignoreIllegals: !0
|
|
380
|
-
}).value :
|
|
381
|
-
const B = i ? ke(
|
|
388
|
+
}).value : M = s.value.highlightAuto(k).value : M = y.utils.escapeHtml(k);
|
|
389
|
+
const B = i ? ke(M.replace(/^\n+|\n+$/g, "")) : `<span class="code-block">${M.replace(/^\n+|\n+$/g, "")}</span>`;
|
|
382
390
|
return `<pre><code class="language-${E}" language=${E}>${B}</code></pre>`;
|
|
383
391
|
}
|
|
384
392
|
}), ot(y);
|
|
385
|
-
const f = U(e.sanitize(y.render(e.modelValue))),
|
|
386
|
-
|
|
393
|
+
const f = U(e.sanitize(y.render(e.modelValue))), $ = () => {
|
|
394
|
+
v.emit(o, A, f.value), e.onHtmlChanged(f.value), e.onGetCatalog(d.value), v.emit(o, W, d.value), b();
|
|
387
395
|
};
|
|
388
|
-
S(
|
|
389
|
-
const
|
|
396
|
+
S($);
|
|
397
|
+
const g = ae(
|
|
390
398
|
async () => {
|
|
391
|
-
|
|
399
|
+
d.value = [], f.value = e.sanitize(y.render(e.modelValue)), $();
|
|
392
400
|
},
|
|
393
|
-
(l == null ? void 0 : l.renderDelay) !== void 0 ? l == null ? void 0 : l.renderDelay :
|
|
394
|
-
),
|
|
395
|
-
return C([Y(e, "modelValue"),
|
|
396
|
-
|
|
401
|
+
(l == null ? void 0 : l.renderDelay) !== void 0 ? l == null ? void 0 : l.renderDelay : r ? 0 : 500
|
|
402
|
+
), w = H(() => (e.noKatex || a.value) && (e.noHighlight || s.value));
|
|
403
|
+
return C([Y(e, "modelValue"), w, u], g), S(() => {
|
|
404
|
+
v.on(o, {
|
|
397
405
|
name: $e,
|
|
398
406
|
callback() {
|
|
399
|
-
|
|
407
|
+
v.emit(o, W, d.value);
|
|
400
408
|
}
|
|
401
409
|
});
|
|
402
410
|
}), { html: f };
|
|
@@ -450,6 +458,9 @@ const Me = (e, a) => {
|
|
|
450
458
|
},
|
|
451
459
|
noImgZoomIn: {
|
|
452
460
|
type: Boolean
|
|
461
|
+
},
|
|
462
|
+
sanitizeMermaid: {
|
|
463
|
+
type: Function
|
|
453
464
|
}
|
|
454
465
|
}, wt = {
|
|
455
466
|
...le,
|
|
@@ -527,28 +538,28 @@ const Me = (e, a) => {
|
|
|
527
538
|
name: "ContentPreview",
|
|
528
539
|
props: le,
|
|
529
540
|
setup(e) {
|
|
530
|
-
const
|
|
541
|
+
const r = P("editorId"), l = P("previewTheme"), t = P("showCodeRowNumber"), {
|
|
531
542
|
html: n
|
|
532
543
|
} = at(e, e.previewOnly);
|
|
533
|
-
return Ne(e, n), Re(e, n), () =>
|
|
534
|
-
id: `${
|
|
535
|
-
class: `${
|
|
544
|
+
return Ne(e, n), Re(e, n), () => x(de, null, [x("div", {
|
|
545
|
+
id: `${r}-preview-wrapper`,
|
|
546
|
+
class: `${h}-preview-wrapper`,
|
|
536
547
|
"data-show": e.setting.preview,
|
|
537
548
|
key: "content-preview-wrapper"
|
|
538
|
-
}, [
|
|
539
|
-
id: `${
|
|
540
|
-
class: [`${
|
|
549
|
+
}, [x("article", {
|
|
550
|
+
id: `${r}-preview`,
|
|
551
|
+
class: [`${h}-preview`, `${l == null ? void 0 : l.value}-theme`, t && `${h}-scrn`],
|
|
541
552
|
innerHTML: n.value
|
|
542
|
-
}, null)]), !e.previewOnly &&
|
|
543
|
-
id: `${
|
|
544
|
-
class: `${
|
|
553
|
+
}, null)]), !e.previewOnly && x("div", {
|
|
554
|
+
id: `${r}-html-wrapper`,
|
|
555
|
+
class: `${h}-preview-wrapper`,
|
|
545
556
|
"data-show": e.setting.htmlPreview,
|
|
546
557
|
key: "html-preview-wrapper"
|
|
547
|
-
}, [
|
|
548
|
-
class: `${
|
|
558
|
+
}, [x("div", {
|
|
559
|
+
class: `${h}-html`
|
|
549
560
|
}, [n.value])])]);
|
|
550
561
|
}
|
|
551
|
-
}), kt = (e,
|
|
562
|
+
}), kt = (e, r) => {
|
|
552
563
|
const { editorId: l } = e, t = te({
|
|
553
564
|
// 是否已编译成html
|
|
554
565
|
buildFinished: !1,
|
|
@@ -561,35 +572,35 @@ const Me = (e, a) => {
|
|
|
561
572
|
t.buildFinished = !1;
|
|
562
573
|
}
|
|
563
574
|
), S(() => {
|
|
564
|
-
|
|
565
|
-
name:
|
|
575
|
+
v.on(l, {
|
|
576
|
+
name: A,
|
|
566
577
|
callback(n) {
|
|
567
578
|
t.buildFinished = !0, t.html = n;
|
|
568
579
|
}
|
|
569
|
-
}),
|
|
580
|
+
}), v.on(l, {
|
|
570
581
|
name: ne,
|
|
571
582
|
callback() {
|
|
572
|
-
const n = new Promise((
|
|
583
|
+
const n = new Promise((o) => {
|
|
573
584
|
if (t.buildFinished)
|
|
574
|
-
|
|
585
|
+
o(t.html);
|
|
575
586
|
else {
|
|
576
587
|
const i = (c) => {
|
|
577
|
-
|
|
588
|
+
o(c), v.remove(l, A, i);
|
|
578
589
|
};
|
|
579
|
-
|
|
580
|
-
name:
|
|
590
|
+
v.on(l, {
|
|
591
|
+
name: A,
|
|
581
592
|
callback: i
|
|
582
593
|
});
|
|
583
594
|
}
|
|
584
595
|
});
|
|
585
|
-
e.onSave ? e.onSave(e.modelValue, n) :
|
|
596
|
+
e.onSave ? e.onSave(e.modelValue, n) : r.emit("onSave", e.modelValue, n);
|
|
586
597
|
}
|
|
587
598
|
});
|
|
588
599
|
});
|
|
589
600
|
}, ie = (e) => {
|
|
590
|
-
var n,
|
|
591
|
-
const { editorId:
|
|
592
|
-
F("editorId",
|
|
601
|
+
var n, o;
|
|
602
|
+
const { editorId: r } = e, l = (o = (n = I) == null ? void 0 : n.editorExtensions) == null ? void 0 : o.highlight;
|
|
603
|
+
F("editorId", r), F(
|
|
593
604
|
"theme",
|
|
594
605
|
H(() => e.theme)
|
|
595
606
|
), F(
|
|
@@ -609,10 +620,10 @@ const Me = (e, a) => {
|
|
|
609
620
|
})
|
|
610
621
|
), F("showCodeRowNumber", e.showCodeRowNumber);
|
|
611
622
|
const t = H(() => {
|
|
612
|
-
var c,
|
|
623
|
+
var c, d;
|
|
613
624
|
const i = {
|
|
614
625
|
...D,
|
|
615
|
-
...(
|
|
626
|
+
...(d = (c = I) == null ? void 0 : c.editorConfig) == null ? void 0 : d.languageUserDefined
|
|
616
627
|
};
|
|
617
628
|
return i[e.language] ? i[e.language] : D["zh-CN"];
|
|
618
629
|
});
|
|
@@ -627,144 +638,144 @@ const Me = (e, a) => {
|
|
|
627
638
|
ie(e), F("tabWidth", e.tabWidth);
|
|
628
639
|
}, ce = (e) => {
|
|
629
640
|
S(() => {
|
|
630
|
-
var
|
|
641
|
+
var r, l;
|
|
631
642
|
if (!e.noIconfont)
|
|
632
643
|
if (I.iconfontType === "svg") {
|
|
633
644
|
const t = document.createElement("script");
|
|
634
|
-
t.src = ((
|
|
645
|
+
t.src = ((r = I.editorExtensions) == null ? void 0 : r.iconfont) || he, t.id = `${h}-icon`, _(t);
|
|
635
646
|
} else {
|
|
636
647
|
const t = document.createElement("link");
|
|
637
|
-
t.rel = "stylesheet", t.href = ((l = I.editorExtensions) == null ? void 0 : l.iconfontClass) || ge, t.id = `${
|
|
648
|
+
t.rel = "stylesheet", t.href = ((l = I.editorExtensions) == null ? void 0 : l.iconfontClass) || ge, t.id = `${h}-icon-class`, _(t);
|
|
638
649
|
}
|
|
639
650
|
});
|
|
640
651
|
}, Ct = (e) => {
|
|
641
|
-
var c,
|
|
642
|
-
const { noPrettier:
|
|
652
|
+
var c, d, s, a, u, b;
|
|
653
|
+
const { noPrettier: r, noUploadImg: l } = e, { editorExtensions: t } = I, n = r || !!((d = (c = I.editorExtensions) == null ? void 0 : c.prettier) != null && d.prettierInstance), o = r || !!((a = (s = I.editorExtensions) == null ? void 0 : s.prettier) != null && a.parserMarkdownInstance), i = l || !!((b = (u = I.editorExtensions) == null ? void 0 : u.cropper) != null && b.instance);
|
|
643
654
|
S(() => {
|
|
644
|
-
var
|
|
655
|
+
var $, g, w, k;
|
|
645
656
|
const y = document.createElement("script"), m = document.createElement("script");
|
|
646
|
-
y.src = ((
|
|
647
|
-
const
|
|
648
|
-
|
|
657
|
+
y.src = (($ = t == null ? void 0 : t.prettier) == null ? void 0 : $.standaloneJs) || V.main, y.id = `${h}-prettier`, m.src = ((g = t == null ? void 0 : t.prettier) == null ? void 0 : g.parserMarkdownJs) || V.markdown, m.id = `${h}-prettierMD`;
|
|
658
|
+
const p = document.createElement("link");
|
|
659
|
+
p.rel = "stylesheet", p.href = ((w = t == null ? void 0 : t.cropper) == null ? void 0 : w.css) || z.css, p.id = `${h}-cropperCss`;
|
|
649
660
|
const f = document.createElement("script");
|
|
650
|
-
f.src = ((
|
|
661
|
+
f.src = ((k = t == null ? void 0 : t.cropper) == null ? void 0 : k.js) || z.js, f.id = `${h}-cropper`, i || (_(p), _(f)), n || _(y), o || _(m);
|
|
651
662
|
}), ce(e);
|
|
652
|
-
}, It = (e,
|
|
663
|
+
}, It = (e, r) => {
|
|
653
664
|
const { editorId: l } = e;
|
|
654
665
|
S(() => {
|
|
655
|
-
|
|
666
|
+
v.on(l, {
|
|
656
667
|
name: Ce,
|
|
657
668
|
callback: (t) => {
|
|
658
|
-
e.onError instanceof Function ? e.onError(t) :
|
|
669
|
+
e.onError instanceof Function ? e.onError(t) : r.emit("onError", t);
|
|
659
670
|
}
|
|
660
671
|
});
|
|
661
672
|
});
|
|
662
|
-
}, St = (e,
|
|
673
|
+
}, St = (e, r) => {
|
|
663
674
|
const { editorId: l } = e, t = te({
|
|
664
675
|
pageFullscreen: e.pageFullscreen,
|
|
665
676
|
fullscreen: !1,
|
|
666
677
|
preview: e.preview,
|
|
667
678
|
htmlPreview: e.preview ? !1 : e.htmlPreview
|
|
668
|
-
}), n = (c,
|
|
669
|
-
t[c] =
|
|
679
|
+
}), n = (c, d) => {
|
|
680
|
+
t[c] = d === void 0 ? !t[c] : d, c === "preview" && t.preview ? t.htmlPreview = !1 : c === "htmlPreview" && t.htmlPreview && (t.preview = !1);
|
|
670
681
|
};
|
|
671
|
-
let
|
|
682
|
+
let o = "";
|
|
672
683
|
const i = () => {
|
|
673
|
-
t.pageFullscreen || t.fullscreen ? document.body.style.overflow = "hidden" : document.body.style.overflow =
|
|
684
|
+
t.pageFullscreen || t.fullscreen ? document.body.style.overflow = "hidden" : document.body.style.overflow = o;
|
|
674
685
|
};
|
|
675
686
|
return C(() => [t.pageFullscreen, t.fullscreen], i), S(() => {
|
|
676
|
-
|
|
687
|
+
v.on(l, {
|
|
677
688
|
name: Ie,
|
|
678
|
-
callback(c,
|
|
679
|
-
const s = (
|
|
680
|
-
|
|
689
|
+
callback(c, d) {
|
|
690
|
+
const s = (a) => {
|
|
691
|
+
v.emit(l, re, "image", {
|
|
681
692
|
desc: "",
|
|
682
|
-
urls:
|
|
683
|
-
}),
|
|
693
|
+
urls: a
|
|
694
|
+
}), d && d();
|
|
684
695
|
};
|
|
685
|
-
e.onUploadImg ? e.onUploadImg(c, s) :
|
|
696
|
+
e.onUploadImg ? e.onUploadImg(c, s) : r.emit("onUploadImg", c, s);
|
|
686
697
|
}
|
|
687
|
-
}),
|
|
698
|
+
}), o = document.body.style.overflow, i();
|
|
688
699
|
}), [t, n];
|
|
689
700
|
}, Et = (e) => {
|
|
690
|
-
const { editorId:
|
|
701
|
+
const { editorId: r } = e, l = U(!1);
|
|
691
702
|
return S(() => {
|
|
692
|
-
|
|
703
|
+
v.on(r, {
|
|
693
704
|
name: oe,
|
|
694
705
|
callback: (n) => {
|
|
695
706
|
n === void 0 ? l.value = !l.value : l.value = n;
|
|
696
707
|
}
|
|
697
708
|
});
|
|
698
709
|
}), H(() => !e.toolbarsExclude.includes("catalog") && e.toolbars.includes("catalog") && l.value);
|
|
699
|
-
}, Pt = (e,
|
|
700
|
-
const { editorId:
|
|
710
|
+
}, Pt = (e, r, l, t, n) => {
|
|
711
|
+
const { editorId: o } = e;
|
|
701
712
|
C(
|
|
702
713
|
() => t.pageFullscreen,
|
|
703
714
|
(c) => {
|
|
704
|
-
|
|
715
|
+
v.emit(o, K, c);
|
|
705
716
|
}
|
|
706
717
|
), C(
|
|
707
718
|
() => t.fullscreen,
|
|
708
719
|
(c) => {
|
|
709
|
-
|
|
720
|
+
v.emit(o, q, c);
|
|
710
721
|
}
|
|
711
722
|
), C(
|
|
712
723
|
() => t.preview,
|
|
713
724
|
(c) => {
|
|
714
|
-
|
|
725
|
+
v.emit(o, Z, c);
|
|
715
726
|
}
|
|
716
727
|
), C(
|
|
717
728
|
() => t.htmlPreview,
|
|
718
729
|
(c) => {
|
|
719
|
-
|
|
730
|
+
v.emit(o, J, c);
|
|
720
731
|
}
|
|
721
732
|
), C(l, (c) => {
|
|
722
|
-
|
|
733
|
+
v.emit(o, X, c);
|
|
723
734
|
});
|
|
724
735
|
const i = {
|
|
725
|
-
on(c,
|
|
736
|
+
on(c, d) {
|
|
726
737
|
switch (c) {
|
|
727
738
|
case "pageFullscreen": {
|
|
728
|
-
|
|
739
|
+
v.on(o, {
|
|
729
740
|
name: K,
|
|
730
741
|
callback(s) {
|
|
731
|
-
|
|
742
|
+
d(s);
|
|
732
743
|
}
|
|
733
744
|
});
|
|
734
745
|
break;
|
|
735
746
|
}
|
|
736
747
|
case "fullscreen": {
|
|
737
|
-
|
|
748
|
+
v.on(o, {
|
|
738
749
|
name: q,
|
|
739
750
|
callback(s) {
|
|
740
|
-
|
|
751
|
+
d(s);
|
|
741
752
|
}
|
|
742
753
|
});
|
|
743
754
|
break;
|
|
744
755
|
}
|
|
745
756
|
case "preview": {
|
|
746
|
-
|
|
757
|
+
v.on(o, {
|
|
747
758
|
name: Z,
|
|
748
759
|
callback(s) {
|
|
749
|
-
|
|
760
|
+
d(s);
|
|
750
761
|
}
|
|
751
762
|
});
|
|
752
763
|
break;
|
|
753
764
|
}
|
|
754
765
|
case "htmlPreview": {
|
|
755
|
-
|
|
766
|
+
v.on(o, {
|
|
756
767
|
name: J,
|
|
757
768
|
callback(s) {
|
|
758
|
-
|
|
769
|
+
d(s);
|
|
759
770
|
}
|
|
760
771
|
});
|
|
761
772
|
break;
|
|
762
773
|
}
|
|
763
774
|
case "catalog": {
|
|
764
|
-
|
|
775
|
+
v.on(o, {
|
|
765
776
|
name: X,
|
|
766
777
|
callback(s) {
|
|
767
|
-
|
|
778
|
+
d(s);
|
|
768
779
|
}
|
|
769
780
|
});
|
|
770
781
|
break;
|
|
@@ -775,7 +786,7 @@ const Me = (e, a) => {
|
|
|
775
786
|
n("pageFullscreen", c);
|
|
776
787
|
},
|
|
777
788
|
toggleFullscreen(c) {
|
|
778
|
-
|
|
789
|
+
v.emit(o, Se, c);
|
|
779
790
|
},
|
|
780
791
|
togglePreview(c) {
|
|
781
792
|
n("preview", c);
|
|
@@ -784,19 +795,19 @@ const Me = (e, a) => {
|
|
|
784
795
|
n("htmlPreview", c);
|
|
785
796
|
},
|
|
786
797
|
toggleCatalog(c) {
|
|
787
|
-
|
|
798
|
+
v.emit(o, oe, c);
|
|
788
799
|
},
|
|
789
800
|
triggerSave() {
|
|
790
|
-
|
|
801
|
+
v.emit(o, ne);
|
|
791
802
|
},
|
|
792
803
|
insert(c) {
|
|
793
|
-
|
|
804
|
+
v.emit(o, re, "universal", { generate: c });
|
|
794
805
|
},
|
|
795
806
|
focus(c) {
|
|
796
|
-
|
|
807
|
+
v.emit(o, Ee, c);
|
|
797
808
|
}
|
|
798
809
|
};
|
|
799
|
-
|
|
810
|
+
r.expose(i);
|
|
800
811
|
}, it = (e) => e, se = {
|
|
801
812
|
/**
|
|
802
813
|
* markdown content.
|
|
@@ -980,6 +991,10 @@ const Me = (e, a) => {
|
|
|
980
991
|
customIcon: {
|
|
981
992
|
type: Object,
|
|
982
993
|
default: {}
|
|
994
|
+
},
|
|
995
|
+
sanitizeMermaid: {
|
|
996
|
+
type: Function,
|
|
997
|
+
default: (e) => Promise.resolve(e)
|
|
983
998
|
}
|
|
984
999
|
}, Tt = {
|
|
985
1000
|
...se,
|
|
@@ -1249,35 +1264,36 @@ const Me = (e, a) => {
|
|
|
1249
1264
|
name: "MdPreview",
|
|
1250
1265
|
props: se,
|
|
1251
1266
|
emits: ue,
|
|
1252
|
-
setup(e,
|
|
1267
|
+
setup(e, r) {
|
|
1253
1268
|
const {
|
|
1254
1269
|
editorId: l,
|
|
1255
1270
|
noKatex: t,
|
|
1256
1271
|
noMermaid: n,
|
|
1257
|
-
noHighlight:
|
|
1272
|
+
noHighlight: o
|
|
1258
1273
|
} = e;
|
|
1259
1274
|
return ie(e), ce(e), me(() => {
|
|
1260
|
-
|
|
1261
|
-
}), () =>
|
|
1275
|
+
v.clear(l);
|
|
1276
|
+
}), () => x("div", {
|
|
1262
1277
|
id: l,
|
|
1263
|
-
class: [
|
|
1278
|
+
class: [h, e.class, e.theme === "dark" && `${h}-dark`, `${h}-previewOnly`],
|
|
1264
1279
|
style: e.style
|
|
1265
|
-
}, [
|
|
1280
|
+
}, [x(lt, {
|
|
1266
1281
|
modelValue: e.modelValue,
|
|
1267
1282
|
onHtmlChanged: (i) => {
|
|
1268
|
-
e.onHtmlChanged ? e.onHtmlChanged(i) :
|
|
1283
|
+
e.onHtmlChanged ? e.onHtmlChanged(i) : r.emit("onHtmlChanged", i);
|
|
1269
1284
|
},
|
|
1270
1285
|
onGetCatalog: (i) => {
|
|
1271
|
-
e.onGetCatalog ? e.onGetCatalog(i) :
|
|
1286
|
+
e.onGetCatalog ? e.onGetCatalog(i) : r.emit("onGetCatalog", i);
|
|
1272
1287
|
},
|
|
1273
1288
|
mdHeadingId: e.mdHeadingId,
|
|
1274
1289
|
noMermaid: n,
|
|
1275
1290
|
sanitize: e.sanitize,
|
|
1276
1291
|
noKatex: t,
|
|
1277
1292
|
formatCopiedText: e.formatCopiedText,
|
|
1278
|
-
noHighlight:
|
|
1293
|
+
noHighlight: o,
|
|
1279
1294
|
noImgZoomIn: e.noImgZoomIn,
|
|
1280
|
-
previewOnly: !0
|
|
1295
|
+
previewOnly: !0,
|
|
1296
|
+
sanitizeMermaid: e.sanitizeMermaid
|
|
1281
1297
|
}, null)]);
|
|
1282
1298
|
}
|
|
1283
1299
|
}), N = ct;
|