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