md-editor-v3 4.12.0-beta.1 → 4.12.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 +12 -0
- package/lib/cjs/MdEditor.cjs +8 -8
- package/lib/cjs/chunks/index.cjs +6 -6
- package/lib/cjs/chunks/index3.cjs +1 -1
- package/lib/cjs/chunks/index4.cjs +2 -2
- package/lib/es/MdEditor.mjs +569 -541
- package/lib/es/chunks/index.mjs +231 -223
- package/lib/es/chunks/index3.mjs +66 -64
- package/lib/es/chunks/index4.mjs +19 -18
- package/lib/preview.css +1 -1
- package/lib/style.css +1 -1
- package/lib/types/MdEditor/components/Modal/Modal.d.ts +1 -1
- package/lib/types/MdEditor/components/Modal/index.d.ts +3 -3
- package/lib/types/MdEditor/layouts/Content/index.d.ts +9 -0
- package/lib/types/MdEditor/layouts/Content/props.d.ts +4 -0
- package/lib/types/MdEditor/static/event-name.d.ts +1 -0
- package/lib/types/MdEditor/type.d.ts +10 -1
- package/lib/umd/index.js +38 -38
- package/package.json +1 -1
package/lib/es/chunks/index.mjs
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { inject as P, watch as I, toRef as te, onMounted as _, nextTick as j, shallowRef as B, ref as R, computed as F, defineComponent as ne, createVNode as M, Fragment as pe, reactive as oe, provide as x, onBeforeUnmount as he } from "vue";
|
|
2
2
|
import { e as S, p as h, m as ge, k as D, f as V, h as ye, s as z, a as ve, i as be, g as W, j as q, b as we, d as ke } from "./config.mjs";
|
|
3
|
-
import { a as $e, b as
|
|
4
|
-
import { a as T, u as
|
|
5
|
-
import
|
|
3
|
+
import { a as $e, b as g, P as Ce, C as K, R as G, B as A, O as re, E as Ie, U as Se, c as ae, d as Z, F as J, e as X, H as Q, f as Y, h as le, i as Ee, j as Pe, k as _e } from "./index4.mjs";
|
|
4
|
+
import { a as T, u as Te } from "./dom.mjs";
|
|
5
|
+
import xe from "medium-zoom";
|
|
6
6
|
import { debounce as ie, uuid as U } from "@vavt/util";
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import { LRUCache as
|
|
13
|
-
const
|
|
7
|
+
import Fe from "copy-to-clipboard";
|
|
8
|
+
import He from "markdown-it";
|
|
9
|
+
import Me from "markdown-it-image-figures";
|
|
10
|
+
import Re from "markdown-it-task-lists";
|
|
11
|
+
import Ae from "markdown-it-xss";
|
|
12
|
+
import { LRUCache as Be } from "lru-cache";
|
|
13
|
+
const Le = (e, a) => {
|
|
14
14
|
const l = P("editorId"), { noImgZoomIn: t } = e, n = ie(() => {
|
|
15
15
|
const i = document.querySelectorAll(`#${l}-preview img`);
|
|
16
|
-
i.length !== 0 &&
|
|
16
|
+
i.length !== 0 && xe(i, {
|
|
17
17
|
background: "#00000073"
|
|
18
18
|
});
|
|
19
19
|
});
|
|
@@ -26,7 +26,7 @@ const Be = (e, a) => {
|
|
|
26
26
|
immediate: !0
|
|
27
27
|
}
|
|
28
28
|
);
|
|
29
|
-
},
|
|
29
|
+
}, Ne = (e, a) => {
|
|
30
30
|
if (typeof a[e] == "string")
|
|
31
31
|
return a[e];
|
|
32
32
|
const l = `<i class="${h}-iconfont ${h}-icon-${e}"></i>`;
|
|
@@ -36,59 +36,59 @@ const Be = (e, a) => {
|
|
|
36
36
|
default:
|
|
37
37
|
return l;
|
|
38
38
|
}
|
|
39
|
-
},
|
|
40
|
-
const t = P("editorId"), n = P("usedLanguageText"), i = P("customIcon"),
|
|
39
|
+
}, Oe = (e, a, l) => {
|
|
40
|
+
const t = P("editorId"), n = P("usedLanguageText"), i = P("customIcon"), o = () => {
|
|
41
41
|
document.querySelectorAll(`#${t}-preview pre`).forEach((s) => {
|
|
42
42
|
var v, m;
|
|
43
|
-
let
|
|
43
|
+
let r = -1;
|
|
44
44
|
(v = s.querySelector(".copy-button")) == null || v.remove();
|
|
45
45
|
const d = ((m = n.value.copyCode) == null ? void 0 : m.text) || "复制代码", b = document.createElement("span");
|
|
46
|
-
b.setAttribute("class", "copy-button"), b.dataset.tips = d, b.innerHTML =
|
|
46
|
+
b.setAttribute("class", "copy-button"), b.dataset.tips = d, b.innerHTML = Ne("copy", i.value), b.addEventListener("click", () => {
|
|
47
47
|
var w, E;
|
|
48
|
-
clearTimeout(
|
|
49
|
-
const p = s.querySelector("code").innerText, f =
|
|
50
|
-
b.dataset.tips = f ? k :
|
|
48
|
+
clearTimeout(r);
|
|
49
|
+
const p = s.querySelector("code").innerText, f = Fe(e.formatCopiedText(p)), k = ((w = n.value.copyCode) == null ? void 0 : w.successTips) || "已复制!", y = ((E = n.value.copyCode) == null ? void 0 : E.failTips) || "已复制!";
|
|
50
|
+
b.dataset.tips = f ? k : y, r = window.setTimeout(() => {
|
|
51
51
|
b.dataset.tips = d;
|
|
52
52
|
}, 1500);
|
|
53
53
|
}), s.appendChild(b);
|
|
54
54
|
});
|
|
55
55
|
}, u = () => {
|
|
56
|
-
j(
|
|
56
|
+
j(o);
|
|
57
57
|
}, c = (s) => {
|
|
58
|
-
s && j(
|
|
58
|
+
s && j(o);
|
|
59
59
|
};
|
|
60
|
-
I([a, l], u), I(() => e.setting.preview, c), I(() => e.setting.htmlPreview, c), I(() => n.value,
|
|
61
|
-
},
|
|
60
|
+
I([a, l], u), I(() => e.setting.preview, c), I(() => e.setting.htmlPreview, c), I(() => n.value, o), _(o);
|
|
61
|
+
}, je = (e) => {
|
|
62
62
|
var i;
|
|
63
63
|
const a = (i = S.editorExtensions) == null ? void 0 : i.highlight, l = a == null ? void 0 : a.instance, t = P("highlight"), n = B(l);
|
|
64
64
|
return _(() => {
|
|
65
65
|
if (!e.noHighlight && !n.value) {
|
|
66
|
-
const
|
|
67
|
-
|
|
66
|
+
const o = document.createElement("script");
|
|
67
|
+
o.src = t.value.js, o.onload = () => {
|
|
68
68
|
n.value = window.hljs;
|
|
69
|
-
},
|
|
69
|
+
}, o.id = `${h}-hljs`, T(o, "hljs");
|
|
70
70
|
const u = document.createElement("link");
|
|
71
71
|
u.rel = "stylesheet", u.href = t.value.css, u.id = `${h}-hlCss`, T(u);
|
|
72
72
|
}
|
|
73
73
|
}), I(
|
|
74
74
|
() => t.value.css,
|
|
75
|
-
(
|
|
76
|
-
|
|
75
|
+
(o) => {
|
|
76
|
+
Te(`${h}-hlCss`, "href", o);
|
|
77
77
|
}
|
|
78
78
|
), n;
|
|
79
|
-
},
|
|
80
|
-
const a = P("theme"), { editorExtensions: l, mermaidConfig: t } = S, n = l == null ? void 0 : l.mermaid, i = B(n == null ? void 0 : n.instance),
|
|
79
|
+
}, Ue = (e) => {
|
|
80
|
+
const a = P("theme"), { editorExtensions: l, mermaidConfig: t } = S, n = l == null ? void 0 : l.mermaid, i = B(n == null ? void 0 : n.instance), o = B(-1), u = new Be({
|
|
81
81
|
max: 1e3,
|
|
82
82
|
// 缓存10分钟
|
|
83
83
|
ttl: 6e5
|
|
84
84
|
}), c = () => {
|
|
85
|
-
const
|
|
86
|
-
!e.noMermaid &&
|
|
85
|
+
const r = i.value;
|
|
86
|
+
!e.noMermaid && r && (r.initialize(
|
|
87
87
|
t({
|
|
88
88
|
startOnLoad: !1,
|
|
89
89
|
theme: a.value === "dark" ? "dark" : "default"
|
|
90
90
|
})
|
|
91
|
-
),
|
|
91
|
+
), o.value = o.value + 1);
|
|
92
92
|
};
|
|
93
93
|
return I(
|
|
94
94
|
() => a.value,
|
|
@@ -97,41 +97,41 @@ const Be = (e, a) => {
|
|
|
97
97
|
}
|
|
98
98
|
), _(() => {
|
|
99
99
|
if (!e.noMermaid && !(n != null && n.instance)) {
|
|
100
|
-
const
|
|
101
|
-
if (/\.mjs/.test(
|
|
100
|
+
const r = (n == null ? void 0 : n.js) || ge;
|
|
101
|
+
if (/\.mjs/.test(r))
|
|
102
102
|
import(
|
|
103
103
|
/* @vite-ignore */
|
|
104
104
|
/* webpackIgnore: true */
|
|
105
|
-
|
|
105
|
+
r
|
|
106
106
|
).then((d) => {
|
|
107
107
|
i.value = d.default, c();
|
|
108
108
|
});
|
|
109
109
|
else {
|
|
110
110
|
const d = document.createElement("script");
|
|
111
|
-
d.id = `${h}-mermaid`, d.src =
|
|
111
|
+
d.id = `${h}-mermaid`, d.src = r, d.onload = () => {
|
|
112
112
|
i.value = window.mermaid, c();
|
|
113
113
|
}, T(d, "mermaid");
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
|
-
}), { mermaidRef: i, reRenderRef:
|
|
116
|
+
}), { mermaidRef: i, reRenderRef: o, replaceMermaid: () => {
|
|
117
117
|
j(() => {
|
|
118
118
|
if (!e.noMermaid && i.value) {
|
|
119
|
-
const
|
|
119
|
+
const r = document.querySelectorAll(
|
|
120
120
|
`div.${h}-mermaid`
|
|
121
121
|
), d = document.createElement("div");
|
|
122
122
|
d.style.width = document.body.offsetWidth + "px", d.style.height = document.body.offsetHeight + "px", d.style.position = "fixed", d.style.zIndex = "-10000", d.style.top = "-10000";
|
|
123
|
-
let b =
|
|
124
|
-
b > 0 && document.body.appendChild(d),
|
|
123
|
+
let b = r.length;
|
|
124
|
+
b > 0 && document.body.appendChild(d), r.forEach(async (v) => {
|
|
125
125
|
let m = u.get(v.innerText);
|
|
126
126
|
if (!m) {
|
|
127
127
|
const f = U(), k = i.value.renderAsync || i.value.render;
|
|
128
|
-
let
|
|
128
|
+
let y = "";
|
|
129
129
|
try {
|
|
130
|
-
|
|
130
|
+
y = await k(f, v.innerText, d);
|
|
131
131
|
} catch {
|
|
132
132
|
}
|
|
133
133
|
m = await e.sanitizeMermaid(
|
|
134
|
-
typeof
|
|
134
|
+
typeof y == "string" ? y : y.svg
|
|
135
135
|
), u.set(v.innerText, m);
|
|
136
136
|
}
|
|
137
137
|
const p = document.createElement("p");
|
|
@@ -140,7 +140,7 @@ const Be = (e, a) => {
|
|
|
140
140
|
}
|
|
141
141
|
});
|
|
142
142
|
} };
|
|
143
|
-
},
|
|
143
|
+
}, Ge = (e) => {
|
|
144
144
|
var n;
|
|
145
145
|
const a = (n = S.editorExtensions) == null ? void 0 : n.katex, l = a == null ? void 0 : a.instance, t = B(l);
|
|
146
146
|
return _(() => {
|
|
@@ -149,55 +149,55 @@ const Be = (e, a) => {
|
|
|
149
149
|
i.src = (a == null ? void 0 : a.js) || D.js, i.onload = () => {
|
|
150
150
|
t.value = window.katex;
|
|
151
151
|
}, i.id = `${h}-katex`;
|
|
152
|
-
const
|
|
153
|
-
|
|
152
|
+
const o = document.createElement("link");
|
|
153
|
+
o.rel = "stylesheet", o.href = (a == null ? void 0 : a.css) || D.css, o.id = `${h}-katexCss`, T(i, "katex"), T(o);
|
|
154
154
|
}
|
|
155
155
|
}), t;
|
|
156
|
-
},
|
|
156
|
+
}, De = (e, a) => {
|
|
157
157
|
const l = e.renderer.rules.fence.bind(e.renderer.rules);
|
|
158
|
-
e.renderer.rules.fence = (t, n, i,
|
|
158
|
+
e.renderer.rules.fence = (t, n, i, o, u) => {
|
|
159
159
|
const c = t[n], s = c.content.trim();
|
|
160
160
|
if (c.info === "mermaid") {
|
|
161
|
-
let
|
|
162
|
-
return t[n].map && t[n].level === 0 && (
|
|
161
|
+
let r;
|
|
162
|
+
return t[n].map && t[n].level === 0 && (r = t[n].map[0], t[n].attrSet("data-line", String(r))), `<div class="${h}-mermaid" ${r !== void 0 ? "data-line=" + r : ""} data-mermaid-theme=${a.themeRef.value}>${s}</div>`;
|
|
163
163
|
}
|
|
164
|
-
return l(t, n, i,
|
|
164
|
+
return l(t, n, i, o, u);
|
|
165
165
|
};
|
|
166
|
-
},
|
|
166
|
+
}, Ve = De, ee = (e, a) => {
|
|
167
167
|
let l = !0, t = !0;
|
|
168
|
-
const n = e.posMax, i = a > 0 ? e.src.charCodeAt(a - 1) : -1,
|
|
169
|
-
return (i === 32 || i === 9 ||
|
|
168
|
+
const n = e.posMax, i = a > 0 ? e.src.charCodeAt(a - 1) : -1, o = a + 1 <= n ? e.src.charCodeAt(a + 1) : -1;
|
|
169
|
+
return (i === 32 || i === 9 || o >= 48 && o <= 57) && (t = !1), (o === 32 || o === 9) && (l = !1), {
|
|
170
170
|
can_open: l,
|
|
171
171
|
can_close: t
|
|
172
172
|
};
|
|
173
|
-
},
|
|
173
|
+
}, ze = (e, a) => {
|
|
174
174
|
let l, t, n, i;
|
|
175
175
|
if (e.src[e.pos] !== "$")
|
|
176
176
|
return !1;
|
|
177
177
|
if (n = ee(e, e.pos), !n.can_open)
|
|
178
178
|
return a || (e.pending += "$"), e.pos += 1, !0;
|
|
179
|
-
const
|
|
180
|
-
for (l =
|
|
179
|
+
const o = e.pos + 1;
|
|
180
|
+
for (l = o; (l = e.src.indexOf("$", l)) !== -1; ) {
|
|
181
181
|
for (i = l - 1; e.src[i] === "\\"; )
|
|
182
182
|
i -= 1;
|
|
183
183
|
if ((l - i) % 2 == 1)
|
|
184
184
|
break;
|
|
185
185
|
l += 1;
|
|
186
186
|
}
|
|
187
|
-
return l === -1 ? (a || (e.pending += "$"), e.pos =
|
|
188
|
-
},
|
|
189
|
-
let n, i,
|
|
190
|
-
if (s + 2 >
|
|
187
|
+
return l === -1 ? (a || (e.pending += "$"), e.pos = o, !0) : l - o === 0 ? (a || (e.pending += "$$"), e.pos = o + 1, !0) : (n = ee(e, l), n.can_close ? (a || (t = e.push("math_inline", "math", 0), t.markup = "$", t.content = e.src.slice(o, l)), e.pos = l + 1, !0) : (a || (e.pending += "$"), e.pos = o, !0));
|
|
188
|
+
}, We = (e, a, l, t) => {
|
|
189
|
+
let n, i, o, u, c = !1, s = e.bMarks[a] + e.tShift[a], r = e.eMarks[a];
|
|
190
|
+
if (s + 2 > r || e.src.slice(s, s + 2) !== "$$")
|
|
191
191
|
return !1;
|
|
192
|
-
if (s += 2, n = e.src.slice(s,
|
|
192
|
+
if (s += 2, n = e.src.slice(s, r), t)
|
|
193
193
|
return !0;
|
|
194
|
-
for (n.trim().slice(-2) === "$$" && (n = n.trim().slice(0, -2), c = !0),
|
|
195
|
-
e.src.slice(s,
|
|
196
|
-
e.line =
|
|
194
|
+
for (n.trim().slice(-2) === "$$" && (n = n.trim().slice(0, -2), c = !0), o = a; !c && (o++, !(o >= l || (s = e.bMarks[o] + e.tShift[o], r = e.eMarks[o], s < r && e.tShift[o] < e.blkIndent))); )
|
|
195
|
+
e.src.slice(s, r).trim().slice(-2) === "$$" && (u = e.src.slice(0, r).lastIndexOf("$$"), i = e.src.slice(s, u), c = !0);
|
|
196
|
+
e.line = o + 1;
|
|
197
197
|
const d = e.push("math_block", "math", 0);
|
|
198
198
|
return d.block = !0, d.content = (n && n.trim() ? n + `
|
|
199
|
-
` : "") + e.getLines(a + 1,
|
|
200
|
-
},
|
|
199
|
+
` : "") + e.getLines(a + 1, o, e.tShift[a], !0) + (i && i.trim() ? i : ""), d.map = [a, e.line], d.markup = "$$", !0;
|
|
200
|
+
}, qe = (e, a) => {
|
|
201
201
|
const l = (n) => {
|
|
202
202
|
if (a.katexRef.value) {
|
|
203
203
|
const i = a.katexRef.value.renderToString(n, {
|
|
@@ -208,99 +208,99 @@ const Be = (e, a) => {
|
|
|
208
208
|
return `<span class="${h}-katex-inline">${n}</span>`;
|
|
209
209
|
}, t = (n, i) => {
|
|
210
210
|
if (a.katexRef.value) {
|
|
211
|
-
const
|
|
211
|
+
const o = a.katexRef.value.renderToString(n, {
|
|
212
212
|
throwOnError: !1,
|
|
213
213
|
displayMode: !0
|
|
214
214
|
});
|
|
215
|
-
return `<p class="${h}-katex-block" data-line=${i} data-processed>${
|
|
215
|
+
return `<p class="${h}-katex-block" data-line=${i} data-processed>${o}</p>`;
|
|
216
216
|
} else
|
|
217
217
|
return `<p class="${h}-katex-block" data-line=${i}>${n}</p>`;
|
|
218
218
|
};
|
|
219
|
-
e.inline.ruler.after("escape", "math_inline",
|
|
219
|
+
e.inline.ruler.after("escape", "math_inline", ze), e.block.ruler.after("blockquote", "math_block", We, {
|
|
220
220
|
alt: ["paragraph", "reference", "blockquote", "list"]
|
|
221
221
|
}), e.renderer.rules.math_inline = (n, i) => l(n[i].content), e.renderer.rules.math_block = (n, i) => t(n[i].content, n[i].map[0]) + `
|
|
222
222
|
`;
|
|
223
|
-
},
|
|
223
|
+
}, Ke = qe, Ze = (e, a) => {
|
|
224
224
|
a = a || {};
|
|
225
225
|
const l = 3, t = a.marker || "!", n = t.charCodeAt(0), i = t.length;
|
|
226
|
-
let
|
|
227
|
-
const c = (
|
|
228
|
-
const p =
|
|
229
|
-
return p.type === "admonition_open" ? (
|
|
226
|
+
let o = "", u = "";
|
|
227
|
+
const c = (r, d, b, v, m) => {
|
|
228
|
+
const p = r[d];
|
|
229
|
+
return p.type === "admonition_open" ? (r[d].attrPush([
|
|
230
230
|
"class",
|
|
231
231
|
`${h}-admonition ${h}-admonition-${p.info}`
|
|
232
|
-
]),
|
|
233
|
-
}, s = (
|
|
234
|
-
const d =
|
|
235
|
-
u = "",
|
|
232
|
+
]), r[d].attrSet("data-line", String(r[d].map[0]))) : p.type === "admonition_title_open" && r[d].attrPush(["class", `${h}-admonition-title`]), m.renderToken(r, d, b);
|
|
233
|
+
}, s = (r) => {
|
|
234
|
+
const d = r.trim().split(" ", 2);
|
|
235
|
+
u = "", o = d[0], d.length > 1 && (u = r.substring(o.length + 2)), (u === "" || !u) && (u = o);
|
|
236
236
|
};
|
|
237
237
|
e.block.ruler.before(
|
|
238
238
|
"code",
|
|
239
239
|
"admonition",
|
|
240
|
-
(
|
|
241
|
-
let m, p, f, k = !1,
|
|
242
|
-
if (n !==
|
|
240
|
+
(r, d, b, v) => {
|
|
241
|
+
let m, p, f, k = !1, y = r.bMarks[d] + r.tShift[d], w = r.eMarks[d];
|
|
242
|
+
if (n !== r.src.charCodeAt(y))
|
|
243
243
|
return !1;
|
|
244
|
-
for (m =
|
|
244
|
+
for (m = y + 1; m <= w && t[(m - y) % i] === r.src[m]; m++)
|
|
245
245
|
;
|
|
246
|
-
const E = Math.floor((m -
|
|
246
|
+
const E = Math.floor((m - y) / i);
|
|
247
247
|
if (E !== l)
|
|
248
248
|
return !1;
|
|
249
|
-
m -= (m -
|
|
250
|
-
const $ =
|
|
249
|
+
m -= (m - y) % i;
|
|
250
|
+
const $ = r.src.slice(y, m), C = r.src.slice(m, w);
|
|
251
251
|
if (s(C), v)
|
|
252
252
|
return !0;
|
|
253
|
-
for (p = d; p++, !(p >= b || (
|
|
254
|
-
if (n ===
|
|
255
|
-
for (m =
|
|
253
|
+
for (p = d; p++, !(p >= b || (y = r.bMarks[p] + r.tShift[p], w = r.eMarks[p], y < w && r.sCount[p] < r.blkIndent)); )
|
|
254
|
+
if (n === r.src.charCodeAt(y) && !(r.sCount[p] - r.blkIndent >= 4)) {
|
|
255
|
+
for (m = y + 1; m <= w && t[(m - y) % i] === r.src[m]; m++)
|
|
256
256
|
;
|
|
257
|
-
if (!(Math.floor((m -
|
|
257
|
+
if (!(Math.floor((m - y) / i) < E) && (m -= (m - y) % i, m = r.skipSpaces(m), !(m < w))) {
|
|
258
258
|
k = !0;
|
|
259
259
|
break;
|
|
260
260
|
}
|
|
261
261
|
}
|
|
262
|
-
const L =
|
|
263
|
-
return
|
|
262
|
+
const L = r.parentType, H = r.lineMax;
|
|
263
|
+
return r.parentType = "root", r.lineMax = p, f = r.push("admonition_open", "div", 1), f.markup = $, f.block = !0, f.info = o, f.map = [d, p], f = r.push("admonition_title_open", "p", 1), f.markup = $ + " " + o, f.map = [d, p], f = r.push("inline", "", 0), f.content = u, f.map = [d, r.line - 1], f.children = [], f = r.push("admonition_title_close", "p", -1), f.markup = $ + " " + o, r.md.block.tokenize(r, d + 1, p), f = r.push("admonition_close", "div", -1), f.markup = r.src.slice(y, m), f.block = !0, r.parentType = L, r.lineMax = H, r.line = p + (k ? 1 : 0), !0;
|
|
264
264
|
},
|
|
265
265
|
{
|
|
266
266
|
alt: ["paragraph", "reference", "blockquote", "list"]
|
|
267
267
|
}
|
|
268
268
|
), e.renderer.rules.admonition_open = c, e.renderer.rules.admonition_title_open = c, e.renderer.rules.admonition_title_close = c, e.renderer.rules.admonition_close = c;
|
|
269
|
-
},
|
|
269
|
+
}, Je = Ze, Xe = (e, a) => {
|
|
270
270
|
e.renderer.rules.heading_open = (l, t) => {
|
|
271
271
|
var u;
|
|
272
|
-
const n = l[t], i = ((u = l[t + 1].children) == null ? void 0 : u.reduce((c, s) => c + (s.content || ""), "")) || "",
|
|
272
|
+
const n = l[t], i = ((u = l[t + 1].children) == null ? void 0 : u.reduce((c, s) => c + (s.content || ""), "")) || "", o = n.markup.length;
|
|
273
273
|
return a.headsRef.value.push({
|
|
274
274
|
text: i,
|
|
275
|
-
level:
|
|
275
|
+
level: o
|
|
276
276
|
}), n.map && n.level === 0 && (n.attrSet("data-line", String(n.map[0])), n.attrSet(
|
|
277
277
|
"id",
|
|
278
|
-
a.mdHeadingId(i,
|
|
278
|
+
a.mdHeadingId(i, o, a.headsRef.value.length)
|
|
279
279
|
)), e.renderer.renderToken(l, t, a);
|
|
280
|
-
}, e.renderer.rules.heading_close = (l, t, n, i,
|
|
281
|
-
},
|
|
280
|
+
}, e.renderer.rules.heading_close = (l, t, n, i, o) => o.renderToken(l, t, n);
|
|
281
|
+
}, Qe = Xe, Ye = (e, a) => {
|
|
282
282
|
const l = e.renderer.rules.fence, t = e.utils.unescapeAll, n = /\[(\w*)(?::([\w ]*))?\]/;
|
|
283
283
|
function i(s) {
|
|
284
284
|
return s.info ? t(s.info).trim() : "";
|
|
285
285
|
}
|
|
286
|
-
function
|
|
287
|
-
const
|
|
286
|
+
function o(s) {
|
|
287
|
+
const r = i(s), [d = null, b = ""] = (n.exec(r) || []).slice(1);
|
|
288
288
|
return [d, b];
|
|
289
289
|
}
|
|
290
290
|
function u(s) {
|
|
291
|
-
const
|
|
292
|
-
return
|
|
291
|
+
const r = i(s);
|
|
292
|
+
return r ? r.split(/(\s+)/g)[0] : "";
|
|
293
293
|
}
|
|
294
|
-
const c = (s,
|
|
295
|
-
if (s[
|
|
294
|
+
const c = (s, r, d, b, v) => {
|
|
295
|
+
if (s[r].hidden)
|
|
296
296
|
return "";
|
|
297
|
-
const [m, p] =
|
|
297
|
+
const [m, p] = o(s[r]);
|
|
298
298
|
if (m === null)
|
|
299
|
-
return l(s,
|
|
300
|
-
let f, k,
|
|
301
|
-
for (let C =
|
|
302
|
-
f.info = f.info.replace(n, ""), f.hidden = !0, w = C -
|
|
303
|
-
`, $ += `<input type="radio" id="group-${a.editorId}-${
|
|
299
|
+
return l(s, r, d, b, v);
|
|
300
|
+
let f, k, y, w, E = "", $ = "";
|
|
301
|
+
for (let C = r; C < s.length && (f = s[C], [k, y] = o(f), k === m); C++)
|
|
302
|
+
f.info = f.info.replace(n, ""), f.hidden = !0, w = C - r > 0 ? "" : " checked", E += `<li><input type="radio" name="label-group-${a.editorId}-${r}"${w}><label for="group-${a.editorId}-${r}-tab-${C - r}" onclick="this.previousElementSibling.click()">${y || u(f)}</label></li>
|
|
303
|
+
`, $ += `<input type="radio" id="group-${a.editorId}-${r}-tab-${C - r}" name="group-${a.editorId}-${r}"${w}>
|
|
304
304
|
` + l(s, C, d, b, v);
|
|
305
305
|
return `<div class="code-tabs">
|
|
306
306
|
<ul>
|
|
@@ -308,7 +308,7 @@ const Be = (e, a) => {
|
|
|
308
308
|
` + $ + "</div>";
|
|
309
309
|
};
|
|
310
310
|
e.renderer.rules.fence = c;
|
|
311
|
-
},
|
|
311
|
+
}, et = Ye, tt = (e) => {
|
|
312
312
|
[
|
|
313
313
|
"paragraph_open",
|
|
314
314
|
"table_open",
|
|
@@ -320,17 +320,17 @@ const Be = (e, a) => {
|
|
|
320
320
|
"fence"
|
|
321
321
|
].forEach((a) => {
|
|
322
322
|
const l = e.renderer.rules[a];
|
|
323
|
-
l ? e.renderer.rules[a] = (t, n, i,
|
|
323
|
+
l ? e.renderer.rules[a] = (t, n, i, o, u) => {
|
|
324
324
|
let c;
|
|
325
|
-
const s = l(t, n, i,
|
|
325
|
+
const s = l(t, n, i, o, u);
|
|
326
326
|
return t[n].map && t[n].level === 0 && !/^<!--/.test(s) ? (c = t[n].map[0], s.replace(/^(<[^>]*)/, `$1 data-line="${c}"`)) : s;
|
|
327
|
-
} : e.renderer.rules[a] = (t, n, i,
|
|
327
|
+
} : e.renderer.rules[a] = (t, n, i, o, u) => {
|
|
328
328
|
let c;
|
|
329
329
|
return t[n].map && t[n].level === 0 && (c = t[n].map[0], t[n].attrSet("data-line", String(c))), u.renderToken(t, n, i);
|
|
330
330
|
};
|
|
331
331
|
});
|
|
332
|
-
},
|
|
333
|
-
const { editorConfig: l, markdownItConfig: t, markdownItPlugins: n } = S, i = P("editorId"),
|
|
332
|
+
}, nt = (e, a) => {
|
|
333
|
+
const { editorConfig: l, markdownItConfig: t, markdownItPlugins: n } = S, i = P("editorId"), o = P("showCodeRowNumber"), u = P("theme"), c = R([]), s = je(e), r = Ge(e), { reRenderRef: d, replaceMermaid: b } = Ue(e), v = He({
|
|
334
334
|
html: !0,
|
|
335
335
|
breaks: !0
|
|
336
336
|
});
|
|
@@ -340,37 +340,37 @@ const Be = (e, a) => {
|
|
|
340
340
|
const m = [
|
|
341
341
|
{
|
|
342
342
|
type: "katex",
|
|
343
|
-
plugin:
|
|
344
|
-
options: { katexRef:
|
|
343
|
+
plugin: Ke,
|
|
344
|
+
options: { katexRef: r }
|
|
345
345
|
},
|
|
346
346
|
{
|
|
347
347
|
type: "image",
|
|
348
|
-
plugin:
|
|
348
|
+
plugin: Me,
|
|
349
349
|
options: { figcaption: !0, classes: "md-zoom" }
|
|
350
350
|
},
|
|
351
351
|
{
|
|
352
352
|
type: "admonition",
|
|
353
|
-
plugin:
|
|
353
|
+
plugin: Je,
|
|
354
354
|
options: {}
|
|
355
355
|
},
|
|
356
356
|
{
|
|
357
357
|
type: "taskList",
|
|
358
|
-
plugin:
|
|
358
|
+
plugin: Re,
|
|
359
359
|
options: {}
|
|
360
360
|
},
|
|
361
361
|
{
|
|
362
362
|
type: "heading",
|
|
363
|
-
plugin:
|
|
363
|
+
plugin: Qe,
|
|
364
364
|
options: { mdHeadingId: e.mdHeadingId, headsRef: c }
|
|
365
365
|
},
|
|
366
366
|
{
|
|
367
367
|
type: "codeTabs",
|
|
368
|
-
plugin:
|
|
368
|
+
plugin: et,
|
|
369
369
|
options: { editorId: i }
|
|
370
370
|
},
|
|
371
371
|
{
|
|
372
372
|
type: "xss",
|
|
373
|
-
plugin:
|
|
373
|
+
plugin: Ae,
|
|
374
374
|
options: {
|
|
375
375
|
// https://github.com/leizongmin/js-xss/blob/master/README.zh.md
|
|
376
376
|
xss($) {
|
|
@@ -399,7 +399,7 @@ const Be = (e, a) => {
|
|
|
399
399
|
];
|
|
400
400
|
e.noMermaid || m.push({
|
|
401
401
|
type: "mermaid",
|
|
402
|
-
plugin:
|
|
402
|
+
plugin: Ve,
|
|
403
403
|
options: { themeRef: u }
|
|
404
404
|
}), n(m, {
|
|
405
405
|
editorId: i
|
|
@@ -419,17 +419,17 @@ const Be = (e, a) => {
|
|
|
419
419
|
language: C,
|
|
420
420
|
ignoreIllegals: !0
|
|
421
421
|
}).value : H = s.value.highlightAuto($).value : H = v.utils.escapeHtml($);
|
|
422
|
-
const fe =
|
|
422
|
+
const fe = o ? $e(H.replace(/^\n+|\n+$/g, "")) : `<span class="code-block">${H.replace(/^\n+|\n+$/g, "")}</span>`;
|
|
423
423
|
return `<pre><code class="language-${C}" language=${C}>${fe}</code></pre>`;
|
|
424
424
|
}
|
|
425
|
-
}),
|
|
426
|
-
const f = R(`_article-key_${U()}`), k = R(e.sanitize(v.render(e.modelValue))),
|
|
427
|
-
|
|
425
|
+
}), tt(v);
|
|
426
|
+
const f = R(`_article-key_${U()}`), k = R(e.sanitize(v.render(e.modelValue))), y = () => {
|
|
427
|
+
g.emit(i, A, k.value), e.onHtmlChanged(k.value), e.onGetCatalog(c.value), g.emit(i, K, c.value), b();
|
|
428
428
|
};
|
|
429
|
-
_(
|
|
429
|
+
_(y);
|
|
430
430
|
const w = () => {
|
|
431
|
-
c.value = [], k.value = e.sanitize(v.render(e.modelValue)),
|
|
432
|
-
}, E = F(() => (e.noKatex ||
|
|
431
|
+
c.value = [], k.value = e.sanitize(v.render(e.modelValue)), y();
|
|
432
|
+
}, E = F(() => (e.noKatex || r.value) && (e.noHighlight || s.value));
|
|
433
433
|
return I(
|
|
434
434
|
[te(e, "modelValue"), E, d],
|
|
435
435
|
ie(
|
|
@@ -437,19 +437,19 @@ const Be = (e, a) => {
|
|
|
437
437
|
(l == null ? void 0 : l.renderDelay) !== void 0 ? l == null ? void 0 : l.renderDelay : a ? 0 : 500
|
|
438
438
|
)
|
|
439
439
|
), _(() => {
|
|
440
|
-
|
|
440
|
+
g.on(i, {
|
|
441
441
|
name: Ce,
|
|
442
442
|
callback() {
|
|
443
|
-
|
|
443
|
+
g.emit(i, K, c.value);
|
|
444
444
|
}
|
|
445
|
-
}),
|
|
445
|
+
}), g.on(i, {
|
|
446
446
|
name: G,
|
|
447
447
|
callback: () => {
|
|
448
448
|
w(), f.value = `_article-key_${U()}`;
|
|
449
449
|
}
|
|
450
450
|
});
|
|
451
451
|
}), { html: k, key: f };
|
|
452
|
-
},
|
|
452
|
+
}, ot = nt, ce = {
|
|
453
453
|
modelValue: {
|
|
454
454
|
type: String,
|
|
455
455
|
default: ""
|
|
@@ -503,8 +503,13 @@ const Be = (e, a) => {
|
|
|
503
503
|
sanitizeMermaid: {
|
|
504
504
|
type: Function
|
|
505
505
|
}
|
|
506
|
-
},
|
|
506
|
+
}, bt = {
|
|
507
507
|
...ce,
|
|
508
|
+
updateModelValue: {
|
|
509
|
+
type: Function,
|
|
510
|
+
default: () => {
|
|
511
|
+
}
|
|
512
|
+
},
|
|
508
513
|
onChange: {
|
|
509
514
|
type: Function,
|
|
510
515
|
default: () => {
|
|
@@ -575,15 +580,15 @@ const Be = (e, a) => {
|
|
|
575
580
|
onInputBoxWitdhChange: {
|
|
576
581
|
type: Function
|
|
577
582
|
}
|
|
578
|
-
},
|
|
583
|
+
}, rt = /* @__PURE__ */ ne({
|
|
579
584
|
name: "ContentPreview",
|
|
580
585
|
props: ce,
|
|
581
586
|
setup(e) {
|
|
582
587
|
const a = P("editorId"), l = P("previewTheme"), t = P("showCodeRowNumber"), {
|
|
583
588
|
html: n,
|
|
584
589
|
key: i
|
|
585
|
-
} =
|
|
586
|
-
return
|
|
590
|
+
} = ot(e, e.previewOnly);
|
|
591
|
+
return Oe(e, n, i), Le(e, n), () => M(pe, null, [e.setting.preview && M("div", {
|
|
587
592
|
id: `${a}-preview-wrapper`,
|
|
588
593
|
class: `${h}-preview-wrapper`,
|
|
589
594
|
key: "content-preview-wrapper"
|
|
@@ -600,7 +605,7 @@ const Be = (e, a) => {
|
|
|
600
605
|
class: `${h}-html`
|
|
601
606
|
}, [n.value])])]);
|
|
602
607
|
}
|
|
603
|
-
}),
|
|
608
|
+
}), wt = (e, a) => {
|
|
604
609
|
const { editorId: l } = e, t = oe({
|
|
605
610
|
// 是否已编译成html
|
|
606
611
|
buildFinished: !1,
|
|
@@ -613,24 +618,24 @@ const Be = (e, a) => {
|
|
|
613
618
|
t.buildFinished = !1;
|
|
614
619
|
}
|
|
615
620
|
), _(() => {
|
|
616
|
-
|
|
621
|
+
g.on(l, {
|
|
617
622
|
name: A,
|
|
618
623
|
callback(n) {
|
|
619
624
|
t.buildFinished = !0, t.html = n;
|
|
620
625
|
}
|
|
621
|
-
}),
|
|
626
|
+
}), g.on(l, {
|
|
622
627
|
name: re,
|
|
623
628
|
callback() {
|
|
624
629
|
const n = new Promise((i) => {
|
|
625
630
|
if (t.buildFinished)
|
|
626
631
|
i(t.html);
|
|
627
632
|
else {
|
|
628
|
-
const
|
|
629
|
-
i(u),
|
|
633
|
+
const o = (u) => {
|
|
634
|
+
i(u), g.remove(l, A, o);
|
|
630
635
|
};
|
|
631
|
-
|
|
636
|
+
g.on(l, {
|
|
632
637
|
name: A,
|
|
633
|
-
callback:
|
|
638
|
+
callback: o
|
|
634
639
|
});
|
|
635
640
|
}
|
|
636
641
|
});
|
|
@@ -650,23 +655,23 @@ const Be = (e, a) => {
|
|
|
650
655
|
), x(
|
|
651
656
|
"highlight",
|
|
652
657
|
F(() => {
|
|
653
|
-
const
|
|
658
|
+
const o = {
|
|
654
659
|
...V,
|
|
655
660
|
...l == null ? void 0 : l.css
|
|
656
661
|
}, u = e.codeStyleReverse && e.codeStyleReverseList.includes(e.previewTheme) ? "dark" : e.theme;
|
|
657
662
|
return {
|
|
658
663
|
js: (l == null ? void 0 : l.js) || ye,
|
|
659
|
-
css:
|
|
664
|
+
css: o[e.codeTheme] ? o[e.codeTheme][u] : V.atom[u]
|
|
660
665
|
};
|
|
661
666
|
})
|
|
662
667
|
), x("showCodeRowNumber", e.showCodeRowNumber);
|
|
663
668
|
const t = F(() => {
|
|
664
669
|
var u, c;
|
|
665
|
-
const
|
|
670
|
+
const o = {
|
|
666
671
|
...z,
|
|
667
672
|
...(c = (u = S) == null ? void 0 : u.editorConfig) == null ? void 0 : c.languageUserDefined
|
|
668
673
|
};
|
|
669
|
-
return
|
|
674
|
+
return o[e.language] ? o[e.language] : z["zh-CN"];
|
|
670
675
|
});
|
|
671
676
|
x("usedLanguageText", t), x(
|
|
672
677
|
"previewTheme",
|
|
@@ -675,7 +680,7 @@ const Be = (e, a) => {
|
|
|
675
680
|
"customIcon",
|
|
676
681
|
F(() => e.customIcon)
|
|
677
682
|
);
|
|
678
|
-
},
|
|
683
|
+
}, kt = (e) => {
|
|
679
684
|
se(e), x("tabWidth", e.tabWidth);
|
|
680
685
|
}, ue = (e) => {
|
|
681
686
|
_(() => {
|
|
@@ -689,29 +694,29 @@ const Be = (e, a) => {
|
|
|
689
694
|
t.rel = "stylesheet", t.href = ((l = S.editorExtensions) == null ? void 0 : l.iconfontClass) || be, t.id = `${h}-icon-class`, T(t);
|
|
690
695
|
}
|
|
691
696
|
});
|
|
692
|
-
},
|
|
693
|
-
var u, c, s,
|
|
694
|
-
const { noPrettier: a, noUploadImg: l } = e, { editorExtensions: t } = S, n = a || !!((c = (u = S.editorExtensions) == null ? void 0 : u.prettier) != null && c.prettierInstance), i = a || !!((
|
|
697
|
+
}, $t = (e) => {
|
|
698
|
+
var u, c, s, r, d, b;
|
|
699
|
+
const { noPrettier: a, noUploadImg: l } = e, { editorExtensions: t } = S, n = a || !!((c = (u = S.editorExtensions) == null ? void 0 : u.prettier) != null && c.prettierInstance), i = a || !!((r = (s = S.editorExtensions) == null ? void 0 : s.prettier) != null && r.parserMarkdownInstance), o = l || !!((b = (d = S.editorExtensions) == null ? void 0 : d.cropper) != null && b.instance);
|
|
695
700
|
_(() => {
|
|
696
|
-
var k,
|
|
701
|
+
var k, y, w, E;
|
|
697
702
|
const v = document.createElement("script"), m = document.createElement("script");
|
|
698
|
-
v.src = ((k = t == null ? void 0 : t.prettier) == null ? void 0 : k.standaloneJs) || W.main, v.id = `${h}-prettier`, m.src = ((
|
|
703
|
+
v.src = ((k = t == null ? void 0 : t.prettier) == null ? void 0 : k.standaloneJs) || W.main, v.id = `${h}-prettier`, m.src = ((y = t == null ? void 0 : t.prettier) == null ? void 0 : y.parserMarkdownJs) || W.markdown, m.id = `${h}-prettierMD`;
|
|
699
704
|
const p = document.createElement("link");
|
|
700
705
|
p.rel = "stylesheet", p.href = ((w = t == null ? void 0 : t.cropper) == null ? void 0 : w.css) || q.css, p.id = `${h}-cropperCss`;
|
|
701
706
|
const f = document.createElement("script");
|
|
702
|
-
f.src = ((E = t == null ? void 0 : t.cropper) == null ? void 0 : E.js) || q.js, f.id = `${h}-cropper`,
|
|
707
|
+
f.src = ((E = t == null ? void 0 : t.cropper) == null ? void 0 : E.js) || q.js, f.id = `${h}-cropper`, o || (T(p), T(f)), n || T(v), i || T(m);
|
|
703
708
|
}), ue(e);
|
|
704
|
-
},
|
|
709
|
+
}, Ct = (e, a) => {
|
|
705
710
|
const { editorId: l } = e;
|
|
706
711
|
_(() => {
|
|
707
|
-
|
|
712
|
+
g.on(l, {
|
|
708
713
|
name: Ie,
|
|
709
714
|
callback: (t) => {
|
|
710
715
|
e.onError instanceof Function ? e.onError(t) : a.emit("onError", t);
|
|
711
716
|
}
|
|
712
717
|
});
|
|
713
718
|
});
|
|
714
|
-
},
|
|
719
|
+
}, It = (e, a) => {
|
|
715
720
|
const { editorId: l } = e, t = oe({
|
|
716
721
|
pageFullscreen: e.pageFullscreen,
|
|
717
722
|
fullscreen: !1,
|
|
@@ -721,102 +726,102 @@ const Be = (e, a) => {
|
|
|
721
726
|
t[u] = c === void 0 ? !t[u] : c, u === "preview" && t.preview ? t.htmlPreview = !1 : u === "htmlPreview" && t.htmlPreview && (t.preview = !1);
|
|
722
727
|
};
|
|
723
728
|
let i = "";
|
|
724
|
-
const
|
|
729
|
+
const o = () => {
|
|
725
730
|
t.pageFullscreen || t.fullscreen ? document.body.style.overflow = "hidden" : document.body.style.overflow = i;
|
|
726
731
|
};
|
|
727
|
-
return I(() => [t.pageFullscreen, t.fullscreen],
|
|
728
|
-
|
|
732
|
+
return I(() => [t.pageFullscreen, t.fullscreen], o), _(() => {
|
|
733
|
+
g.on(l, {
|
|
729
734
|
name: Se,
|
|
730
735
|
callback(u, c) {
|
|
731
|
-
const s = (
|
|
732
|
-
|
|
736
|
+
const s = (r) => {
|
|
737
|
+
g.emit(l, le, "image", {
|
|
733
738
|
desc: "",
|
|
734
|
-
urls:
|
|
739
|
+
urls: r
|
|
735
740
|
}), c && c();
|
|
736
741
|
};
|
|
737
742
|
e.onUploadImg ? e.onUploadImg(u, s) : a.emit("onUploadImg", u, s);
|
|
738
743
|
}
|
|
739
|
-
}), i = document.body.style.overflow,
|
|
744
|
+
}), i = document.body.style.overflow, o();
|
|
740
745
|
}), [t, n];
|
|
741
|
-
},
|
|
746
|
+
}, St = (e) => {
|
|
742
747
|
const { editorId: a } = e, l = R(!1);
|
|
743
748
|
return _(() => {
|
|
744
|
-
|
|
749
|
+
g.on(a, {
|
|
745
750
|
name: ae,
|
|
746
751
|
callback: (n) => {
|
|
747
752
|
n === void 0 ? l.value = !l.value : l.value = n;
|
|
748
753
|
}
|
|
749
754
|
});
|
|
750
755
|
}), F(() => !e.toolbarsExclude.includes("catalog") && e.toolbars.includes("catalog") && l.value);
|
|
751
|
-
},
|
|
752
|
-
const { editorId:
|
|
756
|
+
}, Et = (e, a, l, t, n, i) => {
|
|
757
|
+
const { editorId: o } = e;
|
|
753
758
|
I(
|
|
754
759
|
() => t.pageFullscreen,
|
|
755
760
|
(c) => {
|
|
756
|
-
|
|
761
|
+
g.emit(o, Z, c);
|
|
757
762
|
}
|
|
758
763
|
), I(
|
|
759
764
|
() => t.fullscreen,
|
|
760
765
|
(c) => {
|
|
761
|
-
|
|
766
|
+
g.emit(o, J, c);
|
|
762
767
|
}
|
|
763
768
|
), I(
|
|
764
769
|
() => t.preview,
|
|
765
770
|
(c) => {
|
|
766
|
-
|
|
771
|
+
g.emit(o, X, c);
|
|
767
772
|
}
|
|
768
773
|
), I(
|
|
769
774
|
() => t.htmlPreview,
|
|
770
775
|
(c) => {
|
|
771
|
-
|
|
776
|
+
g.emit(o, Q, c);
|
|
772
777
|
}
|
|
773
778
|
), I(l, (c) => {
|
|
774
|
-
|
|
779
|
+
g.emit(o, Y, c);
|
|
775
780
|
});
|
|
776
781
|
const u = {
|
|
777
782
|
on(c, s) {
|
|
778
783
|
switch (c) {
|
|
779
784
|
case "pageFullscreen": {
|
|
780
|
-
|
|
785
|
+
g.on(o, {
|
|
781
786
|
name: Z,
|
|
782
|
-
callback(
|
|
783
|
-
s(
|
|
787
|
+
callback(r) {
|
|
788
|
+
s(r);
|
|
784
789
|
}
|
|
785
790
|
});
|
|
786
791
|
break;
|
|
787
792
|
}
|
|
788
793
|
case "fullscreen": {
|
|
789
|
-
|
|
794
|
+
g.on(o, {
|
|
790
795
|
name: J,
|
|
791
|
-
callback(
|
|
792
|
-
s(
|
|
796
|
+
callback(r) {
|
|
797
|
+
s(r);
|
|
793
798
|
}
|
|
794
799
|
});
|
|
795
800
|
break;
|
|
796
801
|
}
|
|
797
802
|
case "preview": {
|
|
798
|
-
|
|
803
|
+
g.on(o, {
|
|
799
804
|
name: X,
|
|
800
|
-
callback(
|
|
801
|
-
s(
|
|
805
|
+
callback(r) {
|
|
806
|
+
s(r);
|
|
802
807
|
}
|
|
803
808
|
});
|
|
804
809
|
break;
|
|
805
810
|
}
|
|
806
811
|
case "htmlPreview": {
|
|
807
|
-
|
|
812
|
+
g.on(o, {
|
|
808
813
|
name: Q,
|
|
809
|
-
callback(
|
|
810
|
-
s(
|
|
814
|
+
callback(r) {
|
|
815
|
+
s(r);
|
|
811
816
|
}
|
|
812
817
|
});
|
|
813
818
|
break;
|
|
814
819
|
}
|
|
815
820
|
case "catalog": {
|
|
816
|
-
|
|
821
|
+
g.on(o, {
|
|
817
822
|
name: Y,
|
|
818
|
-
callback(
|
|
819
|
-
s(
|
|
823
|
+
callback(r) {
|
|
824
|
+
s(r);
|
|
820
825
|
}
|
|
821
826
|
});
|
|
822
827
|
break;
|
|
@@ -827,7 +832,7 @@ const Be = (e, a) => {
|
|
|
827
832
|
n("pageFullscreen", c);
|
|
828
833
|
},
|
|
829
834
|
toggleFullscreen(c) {
|
|
830
|
-
|
|
835
|
+
g.emit(o, Ee, c);
|
|
831
836
|
},
|
|
832
837
|
togglePreview(c) {
|
|
833
838
|
n("preview", c);
|
|
@@ -836,20 +841,20 @@ const Be = (e, a) => {
|
|
|
836
841
|
n("htmlPreview", c);
|
|
837
842
|
},
|
|
838
843
|
toggleCatalog(c) {
|
|
839
|
-
|
|
844
|
+
g.emit(o, ae, c);
|
|
840
845
|
},
|
|
841
846
|
triggerSave() {
|
|
842
|
-
|
|
847
|
+
g.emit(o, re);
|
|
843
848
|
},
|
|
844
849
|
insert(c) {
|
|
845
|
-
|
|
850
|
+
g.emit(o, le, "universal", { generate: c });
|
|
846
851
|
},
|
|
847
852
|
focus(c) {
|
|
848
853
|
var s;
|
|
849
854
|
(s = i.value) == null || s.focus(c);
|
|
850
855
|
},
|
|
851
856
|
rerender() {
|
|
852
|
-
|
|
857
|
+
g.emit(o, G);
|
|
853
858
|
},
|
|
854
859
|
getSelectedText() {
|
|
855
860
|
var c;
|
|
@@ -858,10 +863,13 @@ const Be = (e, a) => {
|
|
|
858
863
|
resetHistory() {
|
|
859
864
|
var c;
|
|
860
865
|
(c = i.value) == null || c.resetHistory();
|
|
866
|
+
},
|
|
867
|
+
domEventHandlers(c) {
|
|
868
|
+
g.emit(o, Pe, c);
|
|
861
869
|
}
|
|
862
870
|
};
|
|
863
871
|
a.expose(u);
|
|
864
|
-
},
|
|
872
|
+
}, at = (e) => e, de = {
|
|
865
873
|
/**
|
|
866
874
|
* markdown content.
|
|
867
875
|
*
|
|
@@ -917,7 +925,7 @@ const Be = (e, a) => {
|
|
|
917
925
|
*/
|
|
918
926
|
editorId: {
|
|
919
927
|
type: String,
|
|
920
|
-
default: () =>
|
|
928
|
+
default: () => _e("md-editor-v3_")
|
|
921
929
|
},
|
|
922
930
|
/**
|
|
923
931
|
* 预览中代码是否显示行号
|
|
@@ -951,7 +959,7 @@ const Be = (e, a) => {
|
|
|
951
959
|
*/
|
|
952
960
|
mdHeadingId: {
|
|
953
961
|
type: Function,
|
|
954
|
-
default:
|
|
962
|
+
default: at
|
|
955
963
|
},
|
|
956
964
|
/**
|
|
957
965
|
*
|
|
@@ -1049,7 +1057,7 @@ const Be = (e, a) => {
|
|
|
1049
1057
|
type: Function,
|
|
1050
1058
|
default: (e) => Promise.resolve(e)
|
|
1051
1059
|
}
|
|
1052
|
-
},
|
|
1060
|
+
}, Pt = {
|
|
1053
1061
|
...de,
|
|
1054
1062
|
/**
|
|
1055
1063
|
* input回调事件
|
|
@@ -1301,7 +1309,7 @@ const Be = (e, a) => {
|
|
|
1301
1309
|
onInputBoxWitdhChange: {
|
|
1302
1310
|
type: Function
|
|
1303
1311
|
}
|
|
1304
|
-
}, me = ["onHtmlChanged", "onGetCatalog"],
|
|
1312
|
+
}, me = ["onHtmlChanged", "onGetCatalog"], _t = [
|
|
1305
1313
|
...me,
|
|
1306
1314
|
"onChange",
|
|
1307
1315
|
"onSave",
|
|
@@ -1313,10 +1321,10 @@ const Be = (e, a) => {
|
|
|
1313
1321
|
"onInput",
|
|
1314
1322
|
"onDrop",
|
|
1315
1323
|
"onInputBoxWitdhChange"
|
|
1316
|
-
],
|
|
1324
|
+
], lt = (e, a) => {
|
|
1317
1325
|
const { editorId: l } = e, t = {
|
|
1318
1326
|
rerender() {
|
|
1319
|
-
|
|
1327
|
+
g.emit(l, G);
|
|
1320
1328
|
}
|
|
1321
1329
|
};
|
|
1322
1330
|
a.expose(t);
|
|
@@ -1331,19 +1339,19 @@ const Be = (e, a) => {
|
|
|
1331
1339
|
noMermaid: n,
|
|
1332
1340
|
noHighlight: i
|
|
1333
1341
|
} = e;
|
|
1334
|
-
return se(e), ue(e),
|
|
1335
|
-
|
|
1342
|
+
return se(e), ue(e), lt(e, a), he(() => {
|
|
1343
|
+
g.clear(l);
|
|
1336
1344
|
}), () => M("div", {
|
|
1337
1345
|
id: l,
|
|
1338
1346
|
class: [h, e.class, e.theme === "dark" && `${h}-dark`, `${h}-previewOnly`],
|
|
1339
1347
|
style: e.style
|
|
1340
|
-
}, [M(
|
|
1348
|
+
}, [M(rt, {
|
|
1341
1349
|
modelValue: e.modelValue,
|
|
1342
|
-
onHtmlChanged: (
|
|
1343
|
-
e.onHtmlChanged ? e.onHtmlChanged(
|
|
1350
|
+
onHtmlChanged: (o) => {
|
|
1351
|
+
e.onHtmlChanged ? e.onHtmlChanged(o) : a.emit("onHtmlChanged", o);
|
|
1344
1352
|
},
|
|
1345
|
-
onGetCatalog: (
|
|
1346
|
-
e.onGetCatalog ? e.onGetCatalog(
|
|
1353
|
+
onGetCatalog: (o) => {
|
|
1354
|
+
e.onGetCatalog ? e.onGetCatalog(o) : a.emit("onGetCatalog", o);
|
|
1347
1355
|
},
|
|
1348
1356
|
mdHeadingId: e.mdHeadingId,
|
|
1349
1357
|
noMermaid: n,
|
|
@@ -1359,16 +1367,16 @@ const Be = (e, a) => {
|
|
|
1359
1367
|
});
|
|
1360
1368
|
O.install = (e) => (e.component(O.name, O), e);
|
|
1361
1369
|
export {
|
|
1362
|
-
|
|
1370
|
+
rt as C,
|
|
1363
1371
|
O as M,
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1372
|
+
_t as a,
|
|
1373
|
+
kt as b,
|
|
1374
|
+
bt as c,
|
|
1375
|
+
$t as d,
|
|
1376
|
+
Pt as e,
|
|
1377
|
+
Ct as f,
|
|
1378
|
+
It as g,
|
|
1379
|
+
St as h,
|
|
1380
|
+
Et as i,
|
|
1381
|
+
wt as u
|
|
1374
1382
|
};
|