md-editor-v3 7.0.0 → 7.1.0-1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/chunks/config.cjs +14 -14
- package/lib/cjs/chunks/index2.cjs +1 -1
- package/lib/cjs/chunks/index3.cjs +1 -1
- package/lib/cjs/chunks/index4.cjs +47 -44
- package/lib/cjs/chunks/index5.cjs +7 -7
- package/lib/es/chunks/config.mjs +602 -466
- package/lib/es/chunks/index2.mjs +11 -11
- package/lib/es/chunks/index3.mjs +3 -1
- package/lib/es/chunks/index4.mjs +859 -850
- package/lib/es/chunks/index5.mjs +80 -80
- package/lib/types/index.d.ts +91 -80
- package/package.json +1 -1
package/lib/es/chunks/index4.mjs
CHANGED
|
@@ -1,125 +1,125 @@
|
|
|
1
|
-
import { useId as
|
|
2
|
-
import { b, g as
|
|
3
|
-
import { deepMerge as
|
|
4
|
-
import { p as
|
|
5
|
-
import { a as
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import { p as
|
|
12
|
-
import
|
|
13
|
-
const
|
|
1
|
+
import { useId as ze, provide as I, computed as H, reactive as fe, watch as S, onMounted as _, ref as Q, inject as E, nextTick as Y, shallowRef as de, onBeforeUnmount as re, toRef as be, defineComponent as ge, createVNode as Z, Fragment as Ge, h as Ue } from "vue";
|
|
2
|
+
import { b as w, g as ve, R as We, U as qe, C as Oe, B as ie, O as _e, E as ce, h as Ce, F as we, i as $e, j as Ee, H as xe, k as Se, e as Ke, d as Ze, f as ue, P as Je, T as Xe } from "./event-bus.mjs";
|
|
3
|
+
import { deepMerge as Qe, deepClone as Ye, randomId as he, debounce as et } from "@vavt/util";
|
|
4
|
+
import { p as f, g as j, f as Te, s as Ie, m as ke, h as le, r as ae, a as tt, b as nt } from "./config.mjs";
|
|
5
|
+
import { a as z, u as ot, S as at, c as rt, z as st } from "./dom.mjs";
|
|
6
|
+
import it from "@vavt/copy2clipboard";
|
|
7
|
+
import lt from "markdown-it";
|
|
8
|
+
import ct from "markdown-it-image-figures";
|
|
9
|
+
import dt from "markdown-it-sub";
|
|
10
|
+
import ut from "markdown-it-sup";
|
|
11
|
+
import { p as mt, a as ft } from "./index5.mjs";
|
|
12
|
+
import ht from "medium-zoom";
|
|
13
|
+
const pt = (e, t, a) => {
|
|
14
14
|
const { editorId: o } = a, n = {
|
|
15
15
|
rerender() {
|
|
16
|
-
|
|
16
|
+
w.emit(o, ve);
|
|
17
17
|
}
|
|
18
18
|
};
|
|
19
19
|
t.expose(n);
|
|
20
|
-
},
|
|
21
|
-
hljs: `${
|
|
22
|
-
hlcss: `${
|
|
23
|
-
prettier: `${
|
|
24
|
-
prettierMD: `${
|
|
25
|
-
cropperjs: `${
|
|
26
|
-
croppercss: `${
|
|
27
|
-
screenfull: `${
|
|
28
|
-
mermaidM: `${
|
|
29
|
-
mermaid: `${
|
|
30
|
-
katexjs: `${
|
|
31
|
-
katexcss: `${
|
|
32
|
-
echarts: `${
|
|
33
|
-
},
|
|
34
|
-
|
|
35
|
-
},
|
|
36
|
-
const { editorId: o } = a, n =
|
|
20
|
+
}, B = {
|
|
21
|
+
hljs: `${f}-hljs`,
|
|
22
|
+
hlcss: `${f}-hlCss`,
|
|
23
|
+
prettier: `${f}-prettier`,
|
|
24
|
+
prettierMD: `${f}-prettierMD`,
|
|
25
|
+
cropperjs: `${f}-cropper`,
|
|
26
|
+
croppercss: `${f}-cropperCss`,
|
|
27
|
+
screenfull: `${f}-screenfull`,
|
|
28
|
+
mermaidM: `${f}-mermaid-m`,
|
|
29
|
+
mermaid: `${f}-mermaid`,
|
|
30
|
+
katexjs: `${f}-katex`,
|
|
31
|
+
katexcss: `${f}-katexCss`,
|
|
32
|
+
echarts: `${f}-echarts`
|
|
33
|
+
}, pe = (e, t) => {
|
|
34
|
+
w.emit(e, We, t);
|
|
35
|
+
}, dn = (e, t, a) => {
|
|
36
|
+
const { editorId: o } = a, n = fe({
|
|
37
37
|
// 是否已编译成html
|
|
38
38
|
buildFinished: !1,
|
|
39
39
|
// 存储当前最新的html
|
|
40
40
|
html: ""
|
|
41
41
|
});
|
|
42
|
-
|
|
42
|
+
S(
|
|
43
43
|
() => e.modelValue,
|
|
44
44
|
() => {
|
|
45
45
|
n.buildFinished = !1;
|
|
46
46
|
}
|
|
47
|
-
),
|
|
48
|
-
|
|
49
|
-
name:
|
|
50
|
-
callback(
|
|
51
|
-
n.buildFinished = !0, n.html =
|
|
47
|
+
), _(() => {
|
|
48
|
+
w.on(o, {
|
|
49
|
+
name: ie,
|
|
50
|
+
callback(s) {
|
|
51
|
+
n.buildFinished = !0, n.html = s;
|
|
52
52
|
}
|
|
53
|
-
}),
|
|
54
|
-
name:
|
|
53
|
+
}), w.on(o, {
|
|
54
|
+
name: _e,
|
|
55
55
|
callback() {
|
|
56
|
-
const
|
|
56
|
+
const s = new Promise((c) => {
|
|
57
57
|
if (n.buildFinished)
|
|
58
|
-
|
|
58
|
+
c(n.html);
|
|
59
59
|
else {
|
|
60
|
-
const
|
|
61
|
-
|
|
60
|
+
const u = (d) => {
|
|
61
|
+
c(d), w.remove(o, ie, u);
|
|
62
62
|
};
|
|
63
|
-
|
|
64
|
-
name:
|
|
65
|
-
callback:
|
|
63
|
+
w.on(o, {
|
|
64
|
+
name: ie,
|
|
65
|
+
callback: u
|
|
66
66
|
});
|
|
67
67
|
}
|
|
68
68
|
});
|
|
69
|
-
e.onSave ? e.onSave(e.modelValue,
|
|
69
|
+
e.onSave ? e.onSave(e.modelValue, s) : t.emit("onSave", e.modelValue, s);
|
|
70
70
|
}
|
|
71
71
|
});
|
|
72
72
|
});
|
|
73
|
-
},
|
|
73
|
+
}, Ne = (e, {
|
|
74
74
|
editorId: t,
|
|
75
75
|
rootRef: a,
|
|
76
76
|
setting: o
|
|
77
77
|
}) => {
|
|
78
|
-
const n =
|
|
78
|
+
const n = j.editorExtensions.highlight, s = j.editorExtensionsAttrs.highlight;
|
|
79
79
|
I("editorId", t), I("rootRef", a), I(
|
|
80
80
|
"theme",
|
|
81
|
-
|
|
81
|
+
H(() => e.theme)
|
|
82
82
|
), I(
|
|
83
83
|
"language",
|
|
84
|
-
|
|
84
|
+
H(() => e.language)
|
|
85
85
|
), I(
|
|
86
86
|
"highlight",
|
|
87
|
-
|
|
88
|
-
const { js:
|
|
89
|
-
...
|
|
87
|
+
H(() => {
|
|
88
|
+
const { js: u } = n, d = {
|
|
89
|
+
...Te,
|
|
90
90
|
...n.css
|
|
91
|
-
}, { js: r, css:
|
|
91
|
+
}, { js: r, css: i = {} } = s || {}, l = e.codeStyleReverse && e.codeStyleReverseList.includes(e.previewTheme) ? "dark" : e.theme, m = d[e.codeTheme] ? d[e.codeTheme][l] : Te.atom[l], h = d[e.codeTheme] && i[e.codeTheme] ? i[e.codeTheme][l] : i.atom ? i.atom[l] : {};
|
|
92
92
|
return {
|
|
93
93
|
js: {
|
|
94
|
-
src:
|
|
94
|
+
src: u,
|
|
95
95
|
...r
|
|
96
96
|
},
|
|
97
97
|
css: {
|
|
98
98
|
href: m,
|
|
99
|
-
...
|
|
99
|
+
...h
|
|
100
100
|
}
|
|
101
101
|
};
|
|
102
102
|
})
|
|
103
103
|
), I("showCodeRowNumber", e.showCodeRowNumber);
|
|
104
|
-
const
|
|
105
|
-
const
|
|
104
|
+
const c = H(() => {
|
|
105
|
+
const u = {
|
|
106
106
|
...Ie,
|
|
107
|
-
...
|
|
107
|
+
...j.editorConfig.languageUserDefined
|
|
108
108
|
};
|
|
109
|
-
return
|
|
110
|
-
|
|
111
|
-
|
|
109
|
+
return Qe(
|
|
110
|
+
Ye(Ie["en-US"]),
|
|
111
|
+
u[e.language] || {}
|
|
112
112
|
);
|
|
113
113
|
});
|
|
114
|
-
return I("usedLanguageText",
|
|
114
|
+
return I("usedLanguageText", c), I(
|
|
115
115
|
"previewTheme",
|
|
116
|
-
|
|
116
|
+
H(() => e.previewTheme)
|
|
117
117
|
), I(
|
|
118
118
|
"customIcon",
|
|
119
|
-
|
|
119
|
+
H(() => e.customIcon)
|
|
120
120
|
), I(
|
|
121
121
|
"setting",
|
|
122
|
-
|
|
122
|
+
H(() => o ? {
|
|
123
123
|
// setting是reactive,不转化是可以直接赋值的
|
|
124
124
|
...o
|
|
125
125
|
} : {
|
|
@@ -130,79 +130,79 @@ const ft = (e, t, a) => {
|
|
|
130
130
|
fullscreen: !1
|
|
131
131
|
})
|
|
132
132
|
), { editorId: t };
|
|
133
|
-
},
|
|
133
|
+
}, un = (e, t) => (I("tabWidth", e.tabWidth), I(
|
|
134
134
|
"disabled",
|
|
135
|
-
|
|
135
|
+
H(() => e.disabled)
|
|
136
136
|
), I(
|
|
137
137
|
"contentDisabled",
|
|
138
|
-
|
|
138
|
+
H(() => e.disabled || e.readOnly)
|
|
139
139
|
), I(
|
|
140
140
|
"showToolbarName",
|
|
141
|
-
|
|
141
|
+
H(() => e.showToolbarName)
|
|
142
142
|
), I("noUploadImg", e.noUploadImg), I(
|
|
143
143
|
"tableShape",
|
|
144
|
-
|
|
144
|
+
H(() => e.tableShape)
|
|
145
145
|
), I("noPrettier", e.noPrettier), I(
|
|
146
146
|
"codeTheme",
|
|
147
|
-
|
|
147
|
+
H(() => e.codeTheme)
|
|
148
148
|
), I("updateSetting", t.updateSetting), I(
|
|
149
149
|
"catalogVisible",
|
|
150
|
-
|
|
150
|
+
H(() => t.catalogVisible.value)
|
|
151
151
|
), I("defToolbars", t.defToolbars), I(
|
|
152
152
|
"floatingToolbars",
|
|
153
|
-
|
|
154
|
-
),
|
|
155
|
-
const { noPrettier: t, noUploadImg: a } = e, { editorExtensions: o, editorExtensionsAttrs: n } =
|
|
156
|
-
|
|
157
|
-
if (!
|
|
158
|
-
const { js:
|
|
159
|
-
|
|
153
|
+
H(() => e.floatingToolbars)
|
|
154
|
+
), Ne(e, t)), mn = (e) => {
|
|
155
|
+
const { noPrettier: t, noUploadImg: a } = e, { editorExtensions: o, editorExtensionsAttrs: n } = j, s = t || o.prettier.prettierInstance, c = t || o.prettier.parserMarkdownInstance, u = a || o.cropper.instance;
|
|
156
|
+
_(() => {
|
|
157
|
+
if (!u) {
|
|
158
|
+
const { js: d = {}, css: r = {} } = n.cropper || {};
|
|
159
|
+
z("link", {
|
|
160
160
|
...r,
|
|
161
161
|
rel: "stylesheet",
|
|
162
162
|
href: o.cropper.css,
|
|
163
|
-
id:
|
|
164
|
-
}),
|
|
165
|
-
...
|
|
163
|
+
id: B.croppercss
|
|
164
|
+
}), z("script", {
|
|
165
|
+
...d,
|
|
166
166
|
src: o.cropper.js,
|
|
167
|
-
id:
|
|
167
|
+
id: B.cropperjs
|
|
168
168
|
});
|
|
169
169
|
}
|
|
170
|
-
if (!
|
|
171
|
-
const { standaloneJs:
|
|
172
|
-
|
|
173
|
-
...
|
|
170
|
+
if (!s) {
|
|
171
|
+
const { standaloneJs: d = {} } = n.prettier || {};
|
|
172
|
+
z("script", {
|
|
173
|
+
...d,
|
|
174
174
|
src: o.prettier.standaloneJs,
|
|
175
|
-
id:
|
|
175
|
+
id: B.prettier
|
|
176
176
|
});
|
|
177
177
|
}
|
|
178
|
-
if (!
|
|
179
|
-
const { parserMarkdownJs:
|
|
180
|
-
|
|
181
|
-
...
|
|
178
|
+
if (!c) {
|
|
179
|
+
const { parserMarkdownJs: d = {} } = n.prettier || {};
|
|
180
|
+
z("script", {
|
|
181
|
+
...d,
|
|
182
182
|
src: o.prettier.parserMarkdownJs,
|
|
183
|
-
id:
|
|
183
|
+
id: B.prettierMD
|
|
184
184
|
});
|
|
185
185
|
}
|
|
186
186
|
});
|
|
187
|
-
},
|
|
187
|
+
}, fn = (e, t, a) => {
|
|
188
188
|
const { editorId: o } = a;
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
name:
|
|
189
|
+
_(() => {
|
|
190
|
+
w.on(o, {
|
|
191
|
+
name: ce,
|
|
192
192
|
callback: (n) => {
|
|
193
193
|
e.onError?.(n), t.emit("onError", n);
|
|
194
194
|
}
|
|
195
195
|
});
|
|
196
196
|
});
|
|
197
|
-
},
|
|
198
|
-
const { editorId: o } = a, n =
|
|
197
|
+
}, hn = (e, t, a) => {
|
|
198
|
+
const { editorId: o } = a, n = fe({
|
|
199
199
|
pageFullscreen: e.pageFullscreen,
|
|
200
200
|
fullscreen: !1,
|
|
201
201
|
preview: e.preview,
|
|
202
202
|
htmlPreview: e.preview ? !1 : e.htmlPreview,
|
|
203
203
|
previewOnly: !1
|
|
204
|
-
}),
|
|
205
|
-
const
|
|
204
|
+
}), s = fe({ ...n }), c = (r, i) => {
|
|
205
|
+
const l = i === void 0 ? !n[r] : i;
|
|
206
206
|
switch (r) {
|
|
207
207
|
case "preview": {
|
|
208
208
|
n.htmlPreview = !1, n.previewOnly = !1;
|
|
@@ -213,126 +213,126 @@ const ft = (e, t, a) => {
|
|
|
213
213
|
break;
|
|
214
214
|
}
|
|
215
215
|
case "previewOnly": {
|
|
216
|
-
|
|
216
|
+
l ? !n.preview && !n.htmlPreview && (n.preview = !0) : (s.preview || (n.preview = !1), s.htmlPreview || (n.htmlPreview = !1));
|
|
217
217
|
break;
|
|
218
218
|
}
|
|
219
219
|
}
|
|
220
|
-
|
|
220
|
+
s[r] = l, n[r] = l;
|
|
221
221
|
};
|
|
222
|
-
let
|
|
223
|
-
const
|
|
224
|
-
n.pageFullscreen || n.fullscreen ? document.body.style.overflow = "hidden" : document.body.style.overflow =
|
|
222
|
+
let u = "";
|
|
223
|
+
const d = () => {
|
|
224
|
+
n.pageFullscreen || n.fullscreen ? document.body.style.overflow = "hidden" : document.body.style.overflow = u;
|
|
225
225
|
};
|
|
226
|
-
return
|
|
227
|
-
|
|
228
|
-
name:
|
|
229
|
-
callback(r,
|
|
230
|
-
const
|
|
231
|
-
|
|
226
|
+
return S(() => [n.pageFullscreen, n.fullscreen], d), _(() => {
|
|
227
|
+
w.on(o, {
|
|
228
|
+
name: qe,
|
|
229
|
+
callback(r, i) {
|
|
230
|
+
const l = (m) => {
|
|
231
|
+
pe(o, {
|
|
232
232
|
direct: "image",
|
|
233
233
|
params: {
|
|
234
234
|
desc: "",
|
|
235
235
|
urls: m
|
|
236
236
|
}
|
|
237
|
-
}),
|
|
237
|
+
}), i?.();
|
|
238
238
|
};
|
|
239
|
-
e.onUploadImg ? e.onUploadImg(r,
|
|
239
|
+
e.onUploadImg ? e.onUploadImg(r, l) : t.emit("onUploadImg", r, l);
|
|
240
240
|
}
|
|
241
|
-
}),
|
|
242
|
-
}), [n,
|
|
243
|
-
},
|
|
244
|
-
const { editorId: a } = t, o =
|
|
245
|
-
return
|
|
246
|
-
|
|
247
|
-
name:
|
|
241
|
+
}), u = document.body.style.overflow, d();
|
|
242
|
+
}), [n, c];
|
|
243
|
+
}, pn = (e, t) => {
|
|
244
|
+
const { editorId: a } = t, o = Q(!1);
|
|
245
|
+
return _(() => {
|
|
246
|
+
w.on(a, {
|
|
247
|
+
name: Oe,
|
|
248
248
|
callback: (n) => {
|
|
249
249
|
n === void 0 ? o.value = !o.value : o.value = n;
|
|
250
250
|
}
|
|
251
251
|
});
|
|
252
252
|
}), o;
|
|
253
|
-
},
|
|
254
|
-
const { editorId: o, catalogVisible: n, setting:
|
|
255
|
-
|
|
256
|
-
() =>
|
|
253
|
+
}, gn = (e, t, a) => {
|
|
254
|
+
const { editorId: o, catalogVisible: n, setting: s, updateSetting: c, codeRef: u } = a;
|
|
255
|
+
S(
|
|
256
|
+
() => s.pageFullscreen,
|
|
257
257
|
(r) => {
|
|
258
|
-
|
|
258
|
+
w.emit(o, Ce, r);
|
|
259
259
|
}
|
|
260
|
-
),
|
|
261
|
-
() =>
|
|
260
|
+
), S(
|
|
261
|
+
() => s.fullscreen,
|
|
262
262
|
(r) => {
|
|
263
|
-
|
|
263
|
+
w.emit(o, we, r);
|
|
264
264
|
}
|
|
265
|
-
),
|
|
266
|
-
() =>
|
|
265
|
+
), S(
|
|
266
|
+
() => s.preview,
|
|
267
267
|
(r) => {
|
|
268
|
-
|
|
268
|
+
w.emit(o, $e, r);
|
|
269
269
|
}
|
|
270
|
-
),
|
|
271
|
-
() =>
|
|
270
|
+
), S(
|
|
271
|
+
() => s.previewOnly,
|
|
272
272
|
(r) => {
|
|
273
|
-
|
|
273
|
+
w.emit(o, Ee, r);
|
|
274
274
|
}
|
|
275
|
-
),
|
|
276
|
-
() =>
|
|
275
|
+
), S(
|
|
276
|
+
() => s.htmlPreview,
|
|
277
277
|
(r) => {
|
|
278
|
-
|
|
278
|
+
w.emit(o, xe, r);
|
|
279
279
|
}
|
|
280
|
-
),
|
|
281
|
-
|
|
280
|
+
), S(n, (r) => {
|
|
281
|
+
w.emit(o, Se, r);
|
|
282
282
|
});
|
|
283
|
-
const
|
|
284
|
-
on(r,
|
|
283
|
+
const d = {
|
|
284
|
+
on(r, i) {
|
|
285
285
|
switch (r) {
|
|
286
286
|
case "pageFullscreen": {
|
|
287
|
-
|
|
288
|
-
name:
|
|
289
|
-
callback(
|
|
290
|
-
l
|
|
287
|
+
w.on(o, {
|
|
288
|
+
name: Ce,
|
|
289
|
+
callback(l) {
|
|
290
|
+
i(l);
|
|
291
291
|
}
|
|
292
292
|
});
|
|
293
293
|
break;
|
|
294
294
|
}
|
|
295
295
|
case "fullscreen": {
|
|
296
|
-
|
|
297
|
-
name:
|
|
298
|
-
callback(
|
|
299
|
-
l
|
|
296
|
+
w.on(o, {
|
|
297
|
+
name: we,
|
|
298
|
+
callback(l) {
|
|
299
|
+
i(l);
|
|
300
300
|
}
|
|
301
301
|
});
|
|
302
302
|
break;
|
|
303
303
|
}
|
|
304
304
|
case "preview": {
|
|
305
|
-
|
|
306
|
-
name:
|
|
307
|
-
callback(
|
|
308
|
-
l
|
|
305
|
+
w.on(o, {
|
|
306
|
+
name: $e,
|
|
307
|
+
callback(l) {
|
|
308
|
+
i(l);
|
|
309
309
|
}
|
|
310
310
|
});
|
|
311
311
|
break;
|
|
312
312
|
}
|
|
313
313
|
case "previewOnly": {
|
|
314
|
-
|
|
315
|
-
name:
|
|
316
|
-
callback(
|
|
317
|
-
l
|
|
314
|
+
w.on(o, {
|
|
315
|
+
name: Ee,
|
|
316
|
+
callback(l) {
|
|
317
|
+
i(l);
|
|
318
318
|
}
|
|
319
319
|
});
|
|
320
320
|
break;
|
|
321
321
|
}
|
|
322
322
|
case "htmlPreview": {
|
|
323
|
-
|
|
324
|
-
name:
|
|
325
|
-
callback(
|
|
326
|
-
l
|
|
323
|
+
w.on(o, {
|
|
324
|
+
name: xe,
|
|
325
|
+
callback(l) {
|
|
326
|
+
i(l);
|
|
327
327
|
}
|
|
328
328
|
});
|
|
329
329
|
break;
|
|
330
330
|
}
|
|
331
331
|
case "catalog": {
|
|
332
|
-
|
|
333
|
-
name:
|
|
334
|
-
callback(
|
|
335
|
-
l
|
|
332
|
+
w.on(o, {
|
|
333
|
+
name: Se,
|
|
334
|
+
callback(l) {
|
|
335
|
+
i(l);
|
|
336
336
|
}
|
|
337
337
|
});
|
|
338
338
|
break;
|
|
@@ -340,220 +340,221 @@ const ft = (e, t, a) => {
|
|
|
340
340
|
}
|
|
341
341
|
},
|
|
342
342
|
togglePageFullscreen(r) {
|
|
343
|
-
|
|
343
|
+
c("pageFullscreen", r);
|
|
344
344
|
},
|
|
345
345
|
toggleFullscreen(r) {
|
|
346
|
-
|
|
346
|
+
w.emit(o, Ze, r);
|
|
347
347
|
},
|
|
348
348
|
togglePreview(r) {
|
|
349
|
-
|
|
349
|
+
c("preview", r);
|
|
350
350
|
},
|
|
351
351
|
togglePreviewOnly(r) {
|
|
352
|
-
|
|
352
|
+
c("previewOnly", r);
|
|
353
353
|
},
|
|
354
354
|
toggleHtmlPreview(r) {
|
|
355
|
-
|
|
355
|
+
c("htmlPreview", r);
|
|
356
356
|
},
|
|
357
357
|
toggleCatalog(r) {
|
|
358
|
-
|
|
358
|
+
w.emit(o, Oe, r);
|
|
359
359
|
},
|
|
360
360
|
triggerSave() {
|
|
361
|
-
|
|
361
|
+
w.emit(o, _e);
|
|
362
362
|
},
|
|
363
363
|
insert(r) {
|
|
364
|
-
|
|
364
|
+
pe(o, {
|
|
365
365
|
direct: "universal",
|
|
366
366
|
params: { generate: r },
|
|
367
367
|
source: "programmatic"
|
|
368
368
|
});
|
|
369
369
|
},
|
|
370
370
|
focus(r) {
|
|
371
|
-
|
|
371
|
+
u.value?.focus(r);
|
|
372
372
|
},
|
|
373
373
|
rerender() {
|
|
374
|
-
|
|
374
|
+
w.emit(o, ve);
|
|
375
375
|
},
|
|
376
376
|
getSelectedText() {
|
|
377
|
-
return
|
|
377
|
+
return u.value?.getSelectedText();
|
|
378
378
|
},
|
|
379
379
|
resetHistory() {
|
|
380
|
-
|
|
380
|
+
u.value?.resetHistory();
|
|
381
381
|
},
|
|
382
382
|
domEventHandlers(r) {
|
|
383
|
-
|
|
383
|
+
w.emit(o, Ke, r);
|
|
384
384
|
},
|
|
385
385
|
execCommand(r) {
|
|
386
|
-
|
|
386
|
+
pe(o, { direct: r, source: "programmatic" });
|
|
387
387
|
},
|
|
388
388
|
getEditorView() {
|
|
389
|
-
return
|
|
389
|
+
return u.value?.getEditorView();
|
|
390
390
|
}
|
|
391
391
|
};
|
|
392
|
-
t.expose(
|
|
393
|
-
},
|
|
394
|
-
const t =
|
|
395
|
-
return e.id || e.editorId || `${
|
|
396
|
-
},
|
|
397
|
-
const o =
|
|
398
|
-
n.value.querySelectorAll(`#${o} .${
|
|
399
|
-
let
|
|
400
|
-
const m =
|
|
401
|
-
`.${
|
|
392
|
+
t.expose(d);
|
|
393
|
+
}, gt = (e) => {
|
|
394
|
+
const t = ze();
|
|
395
|
+
return e.id || e.editorId || `${f}-${t}`;
|
|
396
|
+
}, vt = (e, t, a) => {
|
|
397
|
+
const o = E("editorId"), n = E("rootRef"), s = E("usedLanguageText"), c = E("setting"), u = () => {
|
|
398
|
+
n.value.querySelectorAll(`#${o} .${f}-preview .${f}-code`).forEach((i) => {
|
|
399
|
+
let l = -1;
|
|
400
|
+
const m = i.querySelector(
|
|
401
|
+
`.${f}-copy-button:not([data-processed])`
|
|
402
402
|
);
|
|
403
|
-
m && (m.onclick = (
|
|
404
|
-
|
|
405
|
-
const
|
|
406
|
-
let
|
|
407
|
-
|
|
408
|
-
|
|
403
|
+
m && (m.onclick = (h) => {
|
|
404
|
+
h.preventDefault(), clearTimeout(l);
|
|
405
|
+
const p = (i.querySelector("input:checked + pre code") || i.querySelector("pre code")).textContent, { text: v, successTips: $, failTips: y } = s.value.copyCode;
|
|
406
|
+
let b = $;
|
|
407
|
+
it(e.formatCopiedText(p || "")).catch(() => {
|
|
408
|
+
b = y;
|
|
409
409
|
}).finally(() => {
|
|
410
|
-
m.dataset.isIcon ? m.dataset.tips =
|
|
410
|
+
m.dataset.isIcon ? m.dataset.tips = b : m.textContent = b, l = window.setTimeout(() => {
|
|
411
411
|
m.dataset.isIcon ? m.dataset.tips = v : m.textContent = v;
|
|
412
412
|
}, 1500);
|
|
413
413
|
});
|
|
414
414
|
}, m.setAttribute("data-processed", "true"));
|
|
415
415
|
});
|
|
416
|
-
},
|
|
417
|
-
|
|
418
|
-
}, r = (
|
|
419
|
-
|
|
416
|
+
}, d = () => {
|
|
417
|
+
Y(u);
|
|
418
|
+
}, r = (i) => {
|
|
419
|
+
i && Y(u);
|
|
420
420
|
};
|
|
421
|
-
|
|
422
|
-
},
|
|
423
|
-
const t =
|
|
424
|
-
let
|
|
425
|
-
const
|
|
426
|
-
!e.noEcharts &&
|
|
421
|
+
S([t, a], d), S(() => c.value.preview, r), S(() => c.value.htmlPreview, r), _(u);
|
|
422
|
+
}, yt = (e) => {
|
|
423
|
+
const t = E("editorId"), a = E("theme"), o = E("rootRef"), { editorExtensions: n, editorExtensionsAttrs: s, echartsConfig: c } = j;
|
|
424
|
+
let u = n.echarts.instance;
|
|
425
|
+
const d = de(-1), r = () => {
|
|
426
|
+
!e.noEcharts && u && (d.value = d.value + 1);
|
|
427
427
|
};
|
|
428
|
-
|
|
428
|
+
S(
|
|
429
429
|
() => a.value,
|
|
430
430
|
() => {
|
|
431
431
|
r();
|
|
432
432
|
}
|
|
433
|
-
),
|
|
434
|
-
if (e.noEcharts ||
|
|
433
|
+
), _(() => {
|
|
434
|
+
if (e.noEcharts || u)
|
|
435
435
|
return;
|
|
436
|
-
const
|
|
437
|
-
|
|
436
|
+
const p = n.echarts.js;
|
|
437
|
+
z(
|
|
438
438
|
"script",
|
|
439
439
|
{
|
|
440
|
-
...
|
|
441
|
-
src:
|
|
442
|
-
id:
|
|
440
|
+
...s.echarts?.js,
|
|
441
|
+
src: p,
|
|
442
|
+
id: B.echarts,
|
|
443
443
|
onload() {
|
|
444
|
-
|
|
444
|
+
u = window.echarts, r();
|
|
445
445
|
}
|
|
446
446
|
},
|
|
447
447
|
"echarts"
|
|
448
448
|
);
|
|
449
449
|
});
|
|
450
|
-
let
|
|
451
|
-
const
|
|
452
|
-
if (!
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
}), m.forEach((
|
|
456
|
-
|
|
457
|
-
}),
|
|
450
|
+
let i = [], l = [], m = [];
|
|
451
|
+
const h = (p = !1) => {
|
|
452
|
+
if (!i.length) {
|
|
453
|
+
p && (l.forEach((b) => {
|
|
454
|
+
b.dispose?.();
|
|
455
|
+
}), m.forEach((b) => {
|
|
456
|
+
b.disconnect?.();
|
|
457
|
+
}), l = [], m = []);
|
|
458
458
|
return;
|
|
459
459
|
}
|
|
460
|
-
const v = [],
|
|
461
|
-
|
|
462
|
-
const
|
|
463
|
-
if (
|
|
464
|
-
|
|
460
|
+
const v = [], $ = [], y = [];
|
|
461
|
+
i.forEach((b, C) => {
|
|
462
|
+
const x = l[C], F = m[C];
|
|
463
|
+
if (p || !b || !b.isConnected || (o?.value ? !o.value.contains(b) : !1)) {
|
|
464
|
+
x?.dispose?.(), F?.disconnect?.();
|
|
465
465
|
return;
|
|
466
466
|
}
|
|
467
|
-
v.push(
|
|
468
|
-
}),
|
|
469
|
-
},
|
|
470
|
-
if (
|
|
471
|
-
const
|
|
472
|
-
if (!
|
|
467
|
+
v.push(b), x && $.push(x), F && y.push(F);
|
|
468
|
+
}), i = v, l = $, m = y;
|
|
469
|
+
}, g = () => {
|
|
470
|
+
if (h(), !e.noEcharts && u) {
|
|
471
|
+
const p = o.value;
|
|
472
|
+
if (!p) return;
|
|
473
473
|
Array.from(
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
)
|
|
477
|
-
).forEach((E) => {
|
|
478
|
-
if (E.dataset.closed === "false")
|
|
474
|
+
p.querySelectorAll(`div.${f}-echarts:not([data-processed])`)
|
|
475
|
+
).forEach(($) => {
|
|
476
|
+
if ($.dataset.closed === "false")
|
|
479
477
|
return !1;
|
|
478
|
+
const y = $.textContent || "";
|
|
479
|
+
let b, C;
|
|
480
480
|
try {
|
|
481
|
-
const
|
|
481
|
+
const x = {
|
|
482
482
|
editorId: t,
|
|
483
|
-
element:
|
|
484
|
-
}
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
483
|
+
element: $
|
|
484
|
+
}, F = n.echarts.parseOption(y, x), T = n.echarts.sanitizeOption(
|
|
485
|
+
c(F),
|
|
486
|
+
x
|
|
487
|
+
);
|
|
488
|
+
b = u.init($, a.value), b.setOption(T), C = new ResizeObserver(() => {
|
|
489
|
+
b.resize();
|
|
490
|
+
}), C.observe($), $.setAttribute("data-processed", ""), i.push($), l.push(b), m.push(C);
|
|
491
|
+
} catch (x) {
|
|
492
|
+
b && (C?.disconnect(), b.dispose(), $.textContent = y), w.emit(t, ce, {
|
|
492
493
|
name: "echarts",
|
|
493
|
-
message:
|
|
494
|
-
error:
|
|
494
|
+
message: x?.message,
|
|
495
|
+
error: x
|
|
495
496
|
});
|
|
496
497
|
}
|
|
497
498
|
});
|
|
498
499
|
}
|
|
499
500
|
};
|
|
500
|
-
return
|
|
501
|
-
|
|
502
|
-
}), { reRenderEcharts:
|
|
503
|
-
},
|
|
504
|
-
const t =
|
|
505
|
-
return
|
|
506
|
-
e.noHighlight || a.value || (
|
|
501
|
+
return re(() => {
|
|
502
|
+
h(!0);
|
|
503
|
+
}), { reRenderEcharts: d, replaceEcharts: g };
|
|
504
|
+
}, bt = (e) => {
|
|
505
|
+
const t = E("highlight"), a = de(j.editorExtensions.highlight.instance);
|
|
506
|
+
return _(() => {
|
|
507
|
+
e.noHighlight || a.value || (z("link", {
|
|
507
508
|
...t.value.css,
|
|
508
509
|
rel: "stylesheet",
|
|
509
|
-
id:
|
|
510
|
-
}),
|
|
510
|
+
id: B.hlcss
|
|
511
|
+
}), z(
|
|
511
512
|
"script",
|
|
512
513
|
{
|
|
513
514
|
...t.value.js,
|
|
514
|
-
id:
|
|
515
|
+
id: B.hljs,
|
|
515
516
|
onload() {
|
|
516
517
|
a.value = window.hljs;
|
|
517
518
|
}
|
|
518
519
|
},
|
|
519
520
|
"hljs"
|
|
520
521
|
));
|
|
521
|
-
}),
|
|
522
|
+
}), S(
|
|
522
523
|
() => t.value.css,
|
|
523
524
|
() => {
|
|
524
|
-
e.noHighlight ||
|
|
525
|
+
e.noHighlight || j.editorExtensions.highlight.instance || ot("link", {
|
|
525
526
|
...t.value.css,
|
|
526
527
|
rel: "stylesheet",
|
|
527
|
-
id:
|
|
528
|
+
id: B.hlcss
|
|
528
529
|
});
|
|
529
530
|
}
|
|
530
531
|
), a;
|
|
531
|
-
},
|
|
532
|
-
const t =
|
|
533
|
-
return
|
|
532
|
+
}, Ct = (e) => {
|
|
533
|
+
const t = de(j.editorExtensions.katex.instance);
|
|
534
|
+
return _(() => {
|
|
534
535
|
if (e.noKatex || t.value)
|
|
535
536
|
return;
|
|
536
|
-
const { editorExtensions: a, editorExtensionsAttrs: o } =
|
|
537
|
-
|
|
537
|
+
const { editorExtensions: a, editorExtensionsAttrs: o } = j;
|
|
538
|
+
z(
|
|
538
539
|
"script",
|
|
539
540
|
{
|
|
540
541
|
...o.katex?.js,
|
|
541
542
|
src: a.katex.js,
|
|
542
|
-
id:
|
|
543
|
+
id: B.katexjs,
|
|
543
544
|
onload() {
|
|
544
545
|
t.value = window.katex;
|
|
545
546
|
}
|
|
546
547
|
},
|
|
547
548
|
"katex"
|
|
548
|
-
),
|
|
549
|
+
), z("link", {
|
|
549
550
|
...o.katex?.css,
|
|
550
551
|
rel: "stylesheet",
|
|
551
552
|
href: a.katex.css,
|
|
552
|
-
id:
|
|
553
|
+
id: B.katexcss
|
|
553
554
|
});
|
|
554
555
|
}), t;
|
|
555
556
|
};
|
|
556
|
-
class
|
|
557
|
+
class wt {
|
|
557
558
|
constructor(t) {
|
|
558
559
|
this.options = t;
|
|
559
560
|
}
|
|
@@ -592,351 +593,361 @@ class bt {
|
|
|
592
593
|
this.cache.clear();
|
|
593
594
|
}
|
|
594
595
|
}
|
|
595
|
-
const
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
primaryTextColor: "#1f2329",
|
|
614
|
-
primaryBorderColor: "#b7c0cc",
|
|
615
|
-
secondaryColor: "#f7f8fa",
|
|
616
|
-
tertiaryColor: "#f7f8fa",
|
|
617
|
-
lineColor: "#596273",
|
|
618
|
-
edgeLabelBackground: "#ffffff",
|
|
619
|
-
clusterBkg: "#ffffff",
|
|
620
|
-
clusterBorder: "#b7c0cc"
|
|
621
|
-
}
|
|
622
|
-
};
|
|
623
|
-
d.initialize(i(s)), u.value = u.value + 1;
|
|
624
|
-
}
|
|
596
|
+
const Ae = /* @__PURE__ */ new WeakMap(), $t = (e, t) => {
|
|
597
|
+
const a = (Ae.get(e) || Promise.resolve()).then(t);
|
|
598
|
+
return Ae.set(
|
|
599
|
+
e,
|
|
600
|
+
a.then(
|
|
601
|
+
() => {
|
|
602
|
+
},
|
|
603
|
+
() => {
|
|
604
|
+
}
|
|
605
|
+
)
|
|
606
|
+
), a;
|
|
607
|
+
}, Et = (e) => {
|
|
608
|
+
const t = E("editorId"), a = E("theme"), o = E("rootRef"), { editorExtensions: n, editorExtensionsAttrs: s, mermaidConfig: c } = j;
|
|
609
|
+
let u = n.mermaid.instance;
|
|
610
|
+
const d = de(0), r = new wt({ max: 1e3, ttl: 6e5 }), i = /* @__PURE__ */ new WeakSet(), l = /* @__PURE__ */ new WeakMap();
|
|
611
|
+
let m = 0, h = !1;
|
|
612
|
+
const g = ($, y) => r.get(JSON.stringify([d.value, $, y])), p = () => {
|
|
613
|
+
m += 1, r.clear(), d.value += 1;
|
|
625
614
|
};
|
|
626
|
-
|
|
627
|
-
() =>
|
|
615
|
+
S([a, () => e.sanitizeMermaid], p, { flush: "sync" }), S(
|
|
616
|
+
() => e.modelValue,
|
|
628
617
|
() => {
|
|
629
|
-
|
|
630
|
-
}
|
|
631
|
-
|
|
632
|
-
|
|
618
|
+
m += 1;
|
|
619
|
+
},
|
|
620
|
+
{ flush: "sync" }
|
|
621
|
+
), _(() => {
|
|
622
|
+
if (e.noMermaid || u)
|
|
633
623
|
return;
|
|
634
|
-
const
|
|
635
|
-
|
|
636
|
-
|
|
624
|
+
const $ = n.mermaid.js, y = (b) => {
|
|
625
|
+
h || (u = b, p());
|
|
626
|
+
};
|
|
627
|
+
/\.mjs/.test($) ? (z("link", {
|
|
628
|
+
...s.mermaid?.js,
|
|
637
629
|
rel: "modulepreload",
|
|
638
|
-
href:
|
|
639
|
-
id:
|
|
630
|
+
href: $,
|
|
631
|
+
id: B.mermaidM
|
|
640
632
|
}), import(
|
|
641
633
|
/* @vite-ignore */
|
|
642
634
|
/* webpackIgnore: true */
|
|
643
|
-
|
|
644
|
-
).then((
|
|
645
|
-
|
|
646
|
-
}).catch((m) => {
|
|
647
|
-
b.emit(t, re, {
|
|
635
|
+
$
|
|
636
|
+
).then((b) => y(b.default)).catch((b) => {
|
|
637
|
+
h || w.emit(t, ce, {
|
|
648
638
|
name: "mermaid",
|
|
649
|
-
message: `Failed to load mermaid module: ${
|
|
650
|
-
error:
|
|
639
|
+
message: `Failed to load mermaid module: ${b.message}`,
|
|
640
|
+
error: b
|
|
651
641
|
});
|
|
652
|
-
})) :
|
|
642
|
+
})) : z(
|
|
653
643
|
"script",
|
|
654
644
|
{
|
|
655
|
-
...
|
|
656
|
-
src:
|
|
657
|
-
id:
|
|
645
|
+
...s.mermaid?.js,
|
|
646
|
+
src: $,
|
|
647
|
+
id: B.mermaid,
|
|
658
648
|
onload() {
|
|
659
|
-
|
|
649
|
+
y(window.mermaid);
|
|
660
650
|
}
|
|
661
651
|
},
|
|
662
652
|
"mermaid"
|
|
663
653
|
);
|
|
664
|
-
})
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
654
|
+
});
|
|
655
|
+
const v = async () => {
|
|
656
|
+
const $ = o.value;
|
|
657
|
+
if (h || e.noMermaid || !u || !$) return;
|
|
658
|
+
const y = u, b = $.querySelectorAll(
|
|
659
|
+
`div.${f}-mermaid, p.${f}-mermaid[data-processed]`
|
|
660
|
+
);
|
|
661
|
+
await Promise.all(
|
|
662
|
+
Array.from(b).filter((C) => C.dataset.closed !== "false" && C.dataset.mermaidRevision === String(d.value) && !i.has(C)).map((C) => {
|
|
663
|
+
const x = l.get(C);
|
|
664
|
+
if (x?.generation === m) return x.promise;
|
|
665
|
+
const T = (async () => {
|
|
666
|
+
const R = m, J = d.value, D = C.dataset.content ?? C.textContent ?? "", N = C.dataset.mermaidBlock, U = JSON.stringify([J, N, D]), W = e.sanitizeMermaid, X = a.value, V = () => !h && m === R && C.isConnected && $.contains(C);
|
|
667
|
+
if (V())
|
|
668
|
+
try {
|
|
669
|
+
let L = r.get(U);
|
|
670
|
+
if (L && C.dataset.processed !== void 0) {
|
|
671
|
+
L.bindFunctions?.(C), i.add(C);
|
|
672
|
+
return;
|
|
673
|
+
}
|
|
674
|
+
if (!L) {
|
|
675
|
+
const O = await $t(y, async () => {
|
|
676
|
+
if (!V()) return;
|
|
677
|
+
const K = {
|
|
678
|
+
startOnLoad: !1,
|
|
679
|
+
securityLevel: "strict",
|
|
680
|
+
secure: Array.from(
|
|
681
|
+
/* @__PURE__ */ new Set([
|
|
682
|
+
...y.mermaidAPI?.defaultConfig?.secure || [],
|
|
683
|
+
"secure",
|
|
684
|
+
"securityLevel",
|
|
685
|
+
"startOnLoad",
|
|
686
|
+
"maxTextSize",
|
|
687
|
+
"suppressErrorRendering",
|
|
688
|
+
"maxEdges",
|
|
689
|
+
"dompurifyConfig"
|
|
690
|
+
])
|
|
691
|
+
)
|
|
692
|
+
}, ee = {
|
|
693
|
+
...K,
|
|
694
|
+
...X === "dark" ? { theme: "dark" } : {
|
|
695
|
+
theme: "base",
|
|
696
|
+
themeVariables: {
|
|
697
|
+
background: "#ffffff",
|
|
698
|
+
primaryColor: "#ffffff",
|
|
699
|
+
primaryTextColor: "#1f2329",
|
|
700
|
+
primaryBorderColor: "#b7c0cc",
|
|
701
|
+
secondaryColor: "#f7f8fa",
|
|
702
|
+
tertiaryColor: "#f7f8fa",
|
|
703
|
+
lineColor: "#596273",
|
|
704
|
+
edgeLabelBackground: "#ffffff",
|
|
705
|
+
clusterBkg: "#ffffff",
|
|
706
|
+
clusterBorder: "#b7c0cc"
|
|
707
|
+
}
|
|
708
|
+
}
|
|
709
|
+
}, k = c(ee);
|
|
710
|
+
y.initialize({
|
|
711
|
+
...k,
|
|
712
|
+
// 返回部分主题配置时仍继承安全默认值,显式覆盖则尊重调用方选择。
|
|
713
|
+
startOnLoad: k?.startOnLoad ?? !1,
|
|
714
|
+
securityLevel: k?.securityLevel ?? "strict",
|
|
715
|
+
secure: k?.secure ?? K.secure
|
|
716
|
+
});
|
|
717
|
+
const A = document.createElement("div");
|
|
718
|
+
A.style.cssText = "position:fixed;z-index:-10000;top:-10000px;left:-10000px;", A.style.width = Math.max(document.body.offsetWidth, 1366) + "px", A.style.height = Math.max(document.body.offsetHeight, 768) + "px", document.body.appendChild(A);
|
|
719
|
+
try {
|
|
720
|
+
return await y.render(he(), D, A);
|
|
721
|
+
} finally {
|
|
722
|
+
A.remove();
|
|
723
|
+
}
|
|
693
724
|
});
|
|
725
|
+
if (!O || !V()) return;
|
|
726
|
+
const q = W ? await W(O.svg) : O.svg;
|
|
727
|
+
if (!V()) return;
|
|
728
|
+
if (typeof q != "string")
|
|
729
|
+
throw new TypeError("Mermaid sanitizer must return a string.");
|
|
730
|
+
L = { svg: q, bindFunctions: O.bindFunctions };
|
|
694
731
|
}
|
|
732
|
+
if (!V()) return;
|
|
733
|
+
const P = document.createElement("p");
|
|
734
|
+
for (const O of Array.from(C.attributes))
|
|
735
|
+
P.setAttribute(O.name, O.value);
|
|
736
|
+
P.setAttribute("data-processed", ""), P.setAttribute("data-content", D), P.innerHTML = L.svg, P.children[0]?.removeAttribute("height");
|
|
737
|
+
const M = { ...L, svg: P.innerHTML };
|
|
738
|
+
C.replaceWith(P);
|
|
739
|
+
try {
|
|
740
|
+
L.bindFunctions?.(P), i.add(P);
|
|
741
|
+
} catch (O) {
|
|
742
|
+
throw P.replaceWith(C), O;
|
|
743
|
+
}
|
|
744
|
+
r.set(U, M);
|
|
745
|
+
} catch (L) {
|
|
746
|
+
if (!V()) return;
|
|
747
|
+
C.dataset.processed !== void 0 && (C.textContent = D, C.removeAttribute("data-processed")), w.emit(t, ce, {
|
|
748
|
+
name: "mermaid",
|
|
749
|
+
message: L?.message,
|
|
750
|
+
error: L
|
|
751
|
+
});
|
|
695
752
|
}
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
}
|
|
701
|
-
|
|
702
|
-
}
|
|
703
|
-
|
|
753
|
+
})().finally(() => {
|
|
754
|
+
l.get(C)?.promise === T && l.delete(C);
|
|
755
|
+
});
|
|
756
|
+
return l.set(C, { generation: m, promise: T }), T;
|
|
757
|
+
})
|
|
758
|
+
);
|
|
759
|
+
};
|
|
760
|
+
return re(() => {
|
|
761
|
+
h = !0, m += 1, r.clear();
|
|
762
|
+
}), { reRenderRef: d, replaceMermaid: v, invalidateMermaid: p, getCachedMermaid: g };
|
|
763
|
+
}, xt = (e, t) => {
|
|
704
764
|
t = t || {};
|
|
705
|
-
const a = 3, o = t.marker || "!", n = o.charCodeAt(0),
|
|
706
|
-
let
|
|
707
|
-
const
|
|
708
|
-
const
|
|
709
|
-
return
|
|
765
|
+
const a = 3, o = t.marker || "!", n = o.charCodeAt(0), s = o.length;
|
|
766
|
+
let c = "", u = "";
|
|
767
|
+
const d = (i, l, m, h, g) => {
|
|
768
|
+
const p = i[l];
|
|
769
|
+
return p.type === "admonition_open" ? i[l].attrPush([
|
|
710
770
|
"class",
|
|
711
|
-
`${
|
|
712
|
-
]) :
|
|
713
|
-
}, r = (
|
|
714
|
-
const
|
|
715
|
-
|
|
771
|
+
`${f}-admonition ${f}-admonition-${p.info}`
|
|
772
|
+
]) : p.type === "admonition_title_open" && i[l].attrPush(["class", `${f}-admonition-title`]), g.renderToken(i, l, m);
|
|
773
|
+
}, r = (i) => {
|
|
774
|
+
const l = i.trim().split(" ", 2);
|
|
775
|
+
u = "", c = l[0], l.length > 1 && (u = i.substring(c.length + 2));
|
|
716
776
|
};
|
|
717
777
|
e.block.ruler.before(
|
|
718
778
|
"code",
|
|
719
779
|
"admonition",
|
|
720
|
-
(
|
|
721
|
-
let
|
|
722
|
-
if (n !==
|
|
780
|
+
(i, l, m, h) => {
|
|
781
|
+
let g, p, v, $ = !1, y = i.bMarks[l] + i.tShift[l], b = i.eMarks[l];
|
|
782
|
+
if (n !== i.src.charCodeAt(y))
|
|
723
783
|
return !1;
|
|
724
|
-
for (
|
|
784
|
+
for (g = y + 1; g <= b && o[(g - y) % s] === i.src[g]; g++)
|
|
725
785
|
;
|
|
726
|
-
const
|
|
727
|
-
if (
|
|
786
|
+
const C = Math.floor((g - y) / s);
|
|
787
|
+
if (C !== a)
|
|
728
788
|
return !1;
|
|
729
|
-
|
|
730
|
-
const
|
|
731
|
-
if (r(
|
|
789
|
+
g -= (g - y) % s;
|
|
790
|
+
const x = i.src.slice(y, g), F = i.src.slice(g, b);
|
|
791
|
+
if (r(F), h)
|
|
732
792
|
return !0;
|
|
733
|
-
for (
|
|
734
|
-
if (n ===
|
|
735
|
-
for (
|
|
793
|
+
for (p = l; p++, !(p >= m || (y = i.bMarks[p] + i.tShift[p], b = i.eMarks[p], y < b && i.sCount[p] < i.blkIndent)); )
|
|
794
|
+
if (n === i.src.charCodeAt(y) && !(i.sCount[p] - i.blkIndent >= 4)) {
|
|
795
|
+
for (g = y + 1; g <= b && o[(g - y) % s] === i.src[g]; g++)
|
|
736
796
|
;
|
|
737
|
-
if (!(Math.floor((
|
|
738
|
-
|
|
797
|
+
if (!(Math.floor((g - y) / s) < C) && (g -= (g - y) % s, g = i.skipSpaces(g), !(g < b))) {
|
|
798
|
+
$ = !0;
|
|
739
799
|
break;
|
|
740
800
|
}
|
|
741
801
|
}
|
|
742
|
-
const
|
|
743
|
-
return
|
|
802
|
+
const T = i.parentType, R = i.lineMax;
|
|
803
|
+
return i.parentType = "root", i.lineMax = p, v = i.push("admonition_open", "div", 1), v.markup = x, v.block = !0, v.info = c, v.map = [l, p], u && (v = i.push("admonition_title_open", "p", 1), v.markup = x + " " + c, v.map = [l, p], v = i.push("inline", "", 0), v.content = u, v.map = [l, i.line - 1], v.children = [], v = i.push("admonition_title_close", "p", -1), v.markup = x + " " + c), i.md.block.tokenize(i, l + 1, p), v = i.push("admonition_close", "div", -1), v.markup = i.src.slice(y, g), v.block = !0, i.parentType = T, i.lineMax = R, i.line = p + ($ ? 1 : 0), !0;
|
|
744
804
|
},
|
|
745
805
|
{
|
|
746
806
|
alt: ["paragraph", "reference", "blockquote", "list"]
|
|
747
807
|
}
|
|
748
|
-
), e.renderer.rules.admonition_open =
|
|
749
|
-
},
|
|
750
|
-
const t = e.search(/\s/);
|
|
751
|
-
let a = "", o = !1;
|
|
752
|
-
for (let n = 0; n < e.length; n += 1) {
|
|
753
|
-
const c = e[n];
|
|
754
|
-
if (a) {
|
|
755
|
-
if (o) {
|
|
756
|
-
o = !1;
|
|
757
|
-
continue;
|
|
758
|
-
}
|
|
759
|
-
if (c === "\\") {
|
|
760
|
-
o = !0;
|
|
761
|
-
continue;
|
|
762
|
-
}
|
|
763
|
-
c === a && (a = "");
|
|
764
|
-
continue;
|
|
765
|
-
}
|
|
766
|
-
if (c === '"' || c === "'" || c === "`") {
|
|
767
|
-
a = c;
|
|
768
|
-
continue;
|
|
769
|
-
}
|
|
770
|
-
if (c !== "{")
|
|
771
|
-
continue;
|
|
772
|
-
const i = e.indexOf("}", n + 1);
|
|
773
|
-
if (i === -1)
|
|
774
|
-
break;
|
|
775
|
-
const d = e.slice(n + 1, i);
|
|
776
|
-
if (!$t.test(d))
|
|
777
|
-
continue;
|
|
778
|
-
const u = e[n - 1] || "", r = e[i + 1] || "", l = !r || /\s/.test(r), s = (t === -1 || n < t) && (!u || !/[\s="'`]/.test(u)) && l, m = (!u || /\s/.test(u)) && l;
|
|
779
|
-
if (s || m)
|
|
780
|
-
return {
|
|
781
|
-
endIndex: i + 1,
|
|
782
|
-
startIndex: n,
|
|
783
|
-
value: d
|
|
784
|
-
};
|
|
785
|
-
}
|
|
786
|
-
return null;
|
|
787
|
-
}, ae = (e, t = "") => {
|
|
788
|
-
const a = `${e}${t ? ` ${t}` : ""}`.trim(), o = Et(a), n = o ? `${a.slice(0, o.startIndex)} ${a.slice(o.endIndex)}`.trim() : a, c = n.search(/\s/), i = c === -1 ? n : n.slice(0, c), d = c === -1 ? "" : n.slice(c).trim(), u = o ? o.value.split(",").reduce((r, l) => {
|
|
789
|
-
const [s, m] = l.split("-").map((p) => Number.parseInt(p.trim(), 10)), f = m ?? s;
|
|
790
|
-
return s > 0 && f >= s && r.push({ start: s, end: f }), r;
|
|
791
|
-
}, []) : [];
|
|
792
|
-
return {
|
|
793
|
-
attrs: d,
|
|
794
|
-
language: i,
|
|
795
|
-
lineHighlightRanges: u
|
|
796
|
-
};
|
|
797
|
-
}, te = (e, t, a) => `<${e.tag}${a.renderAttrs(e)}>${t}</${e.tag}>`, Te = (e, t) => {
|
|
798
|
-
const a = e.attrs ? e.attrs.slice() : [];
|
|
799
|
-
return t.forEach((o) => {
|
|
800
|
-
const n = e.attrIndex(o[0]);
|
|
801
|
-
n < 0 ? a.push(o) : (a[n] = a[n].slice(), a[n][1] += ` ${o[1]}`);
|
|
802
|
-
}), a;
|
|
803
|
-
}, xt = (e) => Array.from(e).map(
|
|
808
|
+
), 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;
|
|
809
|
+
}, St = (e) => Array.from(e).map(
|
|
804
810
|
(t) => /[A-Za-z0-9_-]/.test(t) ? t : `_${t.codePointAt(0).toString(16)}_`
|
|
805
|
-
).join(""),
|
|
806
|
-
const a = e.renderer.rules.fence, o = e.utils.unescapeAll, n = /\[(\w*)(?::([\w ]*))?\]/,
|
|
807
|
-
const
|
|
808
|
-
return [
|
|
809
|
-
}, r = (m) =>
|
|
810
|
-
const
|
|
811
|
-
`).length < t.autoFoldThreshold,
|
|
812
|
-
return { open:
|
|
813
|
-
},
|
|
814
|
-
if (m[
|
|
811
|
+
).join(""), Tt = (e, t) => {
|
|
812
|
+
const a = e.renderer.rules.fence, o = e.utils.unescapeAll, n = /\[(\w*)(?::([\w ]*))?\]/, s = /::(open|close)/, c = St(t.editorId), u = (m) => m.info ? o(m.info).trim() : "", d = (m) => {
|
|
813
|
+
const h = u(m), [g = null, p = ""] = (n.exec(h) || []).slice(1);
|
|
814
|
+
return [g, p];
|
|
815
|
+
}, r = (m) => le(u(m)).language, i = (m) => {
|
|
816
|
+
const h = m.info.match(s) || [], g = h[1] === "open" || h[1] !== "close" && t.codeFoldable && m.content.trim().split(`
|
|
817
|
+
`).length < t.autoFoldThreshold, p = h[1] || t.codeFoldable ? "details" : "div", v = h[1] || t.codeFoldable ? "summary" : "div";
|
|
818
|
+
return { open: g, tagContainer: p, tagHeader: v };
|
|
819
|
+
}, l = (m, h, g, p, v) => {
|
|
820
|
+
if (m[h].hidden)
|
|
815
821
|
return "";
|
|
816
|
-
const
|
|
817
|
-
if (
|
|
818
|
-
const { open:
|
|
819
|
-
|
|
820
|
-
const
|
|
821
|
-
attrs:
|
|
822
|
+
const $ = t.usedLanguageTextRef.value?.copyCode.text || "", y = t.customIconRef.value.copy, b = e.utils.escapeHtml($), C = y || b, x = !!y, F = `<span class="${f}-collapse-tips">${at("collapse-tips", t.customIconRef.value)}</span>`, [T] = d(m[h]);
|
|
823
|
+
if (T === null) {
|
|
824
|
+
const { open: k, tagContainer: A, tagHeader: G } = i(m[h]), te = [["class", `${f}-code`]];
|
|
825
|
+
k && te.push(["open", ""]);
|
|
826
|
+
const se = {
|
|
827
|
+
attrs: ke(m[h], te)
|
|
822
828
|
};
|
|
823
|
-
m[
|
|
824
|
-
const { attrs:
|
|
825
|
-
|
|
826
|
-
),
|
|
829
|
+
m[h].info = m[h].info.replace(s, "");
|
|
830
|
+
const { attrs: ne, language: oe } = le(
|
|
831
|
+
u(m[h])
|
|
832
|
+
), ye = [oe, ne].filter(Boolean).join(" "), Ve = a(m, h, g, p, v);
|
|
827
833
|
return `
|
|
828
|
-
<${
|
|
829
|
-
<${
|
|
830
|
-
<div class="${
|
|
831
|
-
<div class="${
|
|
832
|
-
<span class="${
|
|
833
|
-
<span class="${
|
|
834
|
-
${t.extraTools instanceof Function ? t.extraTools({ lang:
|
|
835
|
-
${
|
|
834
|
+
<${A} ${v.renderAttrs(se)}>
|
|
835
|
+
<${G} class="${f}-code-head">
|
|
836
|
+
<div class="${f}-code-flag"><span></span><span></span><span></span></div>
|
|
837
|
+
<div class="${f}-code-action">
|
|
838
|
+
<span class="${f}-code-lang">${e.utils.escapeHtml(ye)}</span>
|
|
839
|
+
<span class="${f}-copy-button" data-tips="${b}"${x ? " data-is-icon=true" : ""}>${C}</span>
|
|
840
|
+
${t.extraTools instanceof Function ? t.extraTools({ lang: ye }) : t.extraTools || ""}
|
|
841
|
+
${A === "details" ? F : ""}
|
|
836
842
|
</div>
|
|
837
|
-
</${
|
|
838
|
-
${
|
|
839
|
-
</${
|
|
843
|
+
</${G}>
|
|
844
|
+
${Ve}
|
|
845
|
+
</${A}>
|
|
840
846
|
`;
|
|
841
847
|
}
|
|
842
|
-
let R,
|
|
843
|
-
const { open:
|
|
844
|
-
|
|
845
|
-
const
|
|
846
|
-
attrs:
|
|
848
|
+
let R, J, D, N, U = "", W = "", X = "";
|
|
849
|
+
const { open: V, tagContainer: L, tagHeader: P } = i(m[h]), M = [["class", `${f}-code`]];
|
|
850
|
+
V && M.push(["open", ""]);
|
|
851
|
+
const O = {
|
|
852
|
+
attrs: ke(m[h], M)
|
|
847
853
|
};
|
|
848
|
-
for (let
|
|
849
|
-
R.info = R.info.replace(n, "").replace(
|
|
850
|
-
const
|
|
851
|
-
|
|
854
|
+
for (let k = h; k < m.length && (R = m[k], [J, D] = d(R), J === T); k++) {
|
|
855
|
+
R.info = R.info.replace(n, "").replace(s, ""), R.hidden = !0;
|
|
856
|
+
const A = `${f}-codetab-${c}-${h}-${k - h}`;
|
|
857
|
+
N = k - h > 0 ? "" : "checked", U += `
|
|
852
858
|
<li>
|
|
853
859
|
<input
|
|
854
860
|
type="radio"
|
|
855
|
-
id="label-${
|
|
856
|
-
name="${
|
|
857
|
-
class="${
|
|
858
|
-
${
|
|
861
|
+
id="label-${f}-codetab-label-1-${c}-${h}-${k - h}"
|
|
862
|
+
name="${f}-codetab-label-${c}-${h}"
|
|
863
|
+
class="${A}"
|
|
864
|
+
${N}
|
|
859
865
|
>
|
|
860
866
|
<label
|
|
861
|
-
for="label-${
|
|
862
|
-
onclick="this.getRootNode().querySelectorAll('.${
|
|
867
|
+
for="label-${f}-codetab-label-1-${c}-${h}-${k - h}"
|
|
868
|
+
onclick="this.getRootNode().querySelectorAll('.${A}').forEach(e => e.click())"
|
|
863
869
|
>
|
|
864
870
|
${e.utils.escapeHtml(D || r(R))}
|
|
865
871
|
</label>
|
|
866
|
-
</li>`,
|
|
872
|
+
</li>`, W += `
|
|
867
873
|
<div role="tabpanel">
|
|
868
874
|
<input
|
|
869
875
|
type="radio"
|
|
870
|
-
name="${
|
|
871
|
-
class="${
|
|
872
|
-
${
|
|
876
|
+
name="${f}-codetab-pre-${c}-${h}"
|
|
877
|
+
class="${A}"
|
|
878
|
+
${N}
|
|
873
879
|
role="presentation">
|
|
874
|
-
${a(m,
|
|
875
|
-
</div>`,
|
|
880
|
+
${a(m, k, g, p, v)}
|
|
881
|
+
</div>`, X += `
|
|
876
882
|
<input
|
|
877
883
|
type="radio"
|
|
878
|
-
name="${
|
|
879
|
-
class="${
|
|
880
|
-
${
|
|
884
|
+
name="${f}-codetab-lang-${c}-${h}"
|
|
885
|
+
class="${A}"
|
|
886
|
+
${N}
|
|
881
887
|
role="presentation">
|
|
882
|
-
<span class=${
|
|
888
|
+
<span class=${f}-code-lang role="note">${e.utils.escapeHtml(r(R))}</span>`;
|
|
883
889
|
}
|
|
884
|
-
const { attrs:
|
|
885
|
-
|
|
886
|
-
),
|
|
890
|
+
const { attrs: q, language: K } = le(
|
|
891
|
+
u(m[h])
|
|
892
|
+
), ee = [K, q].filter(Boolean).join(" ");
|
|
887
893
|
return `
|
|
888
|
-
<${
|
|
889
|
-
<${
|
|
890
|
-
<div class="${
|
|
891
|
-
<ul class="${
|
|
894
|
+
<${L} ${v.renderAttrs(O)}>
|
|
895
|
+
<${P} class="${f}-code-head">
|
|
896
|
+
<div class="${f}-code-flag">
|
|
897
|
+
<ul class="${f}-codetab-label" role="tablist">${U}</ul>
|
|
892
898
|
</div>
|
|
893
|
-
<div class="${
|
|
894
|
-
<span class="${
|
|
895
|
-
<span class="${
|
|
896
|
-
${t.extraTools instanceof Function ? t.extraTools({ lang:
|
|
897
|
-
${
|
|
899
|
+
<div class="${f}-code-action">
|
|
900
|
+
<span class="${f}-codetab-lang">${X}</span>
|
|
901
|
+
<span class="${f}-copy-button" data-tips="${b}"${x ? " data-is-icon=true" : ""}>${C}</span>
|
|
902
|
+
${t.extraTools instanceof Function ? t.extraTools({ lang: ee }) : t.extraTools || ""}
|
|
903
|
+
${L === "details" ? F : ""}
|
|
898
904
|
</div>
|
|
899
|
-
</${
|
|
900
|
-
${
|
|
901
|
-
</${
|
|
905
|
+
</${P}>
|
|
906
|
+
${W}
|
|
907
|
+
</${L}>
|
|
902
908
|
`;
|
|
903
909
|
};
|
|
904
|
-
e.renderer.rules.fence =
|
|
905
|
-
},
|
|
910
|
+
e.renderer.rules.fence = l, e.renderer.rules.code_block = l;
|
|
911
|
+
}, It = (e, t) => {
|
|
906
912
|
e.core.ruler.after("block", "echarts-token-attrs", (o) => {
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
n
|
|
913
|
+
let n;
|
|
914
|
+
o.tokens.forEach((s) => {
|
|
915
|
+
if (!(s.type !== "fence" || s.info.trim() !== "echarts") && (s.tag = "div", s.attrJoin("class", `${f}-echarts`), s.attrSet("data-echarts-theme", t.themeRef.value), s.attrSet("style", "width: 100%; aspect-ratio: 4 / 3;"), s.map)) {
|
|
916
|
+
n ??= o.src.split(`
|
|
917
|
+
`);
|
|
918
|
+
const c = s.content ? s.content.split(`
|
|
919
|
+
`).length - Number(s.content.endsWith(`
|
|
920
|
+
`)) : 0, u = n[s.map[1] - 1].trimEnd(), d = s.map[1] - s.map[0] === c + 2 && u.endsWith(s.markup);
|
|
921
|
+
s.attrSet("data-closed", `${d}`), s.level === 0 && s.attrSet("data-line", String(s.map[0]));
|
|
911
922
|
}
|
|
912
923
|
});
|
|
913
924
|
});
|
|
914
925
|
const a = e.renderer.rules.fence.bind(e.renderer.rules);
|
|
915
|
-
e.renderer.rules.fence = (o, n,
|
|
916
|
-
const
|
|
917
|
-
return
|
|
926
|
+
e.renderer.rules.fence = (o, n, s, c, u) => {
|
|
927
|
+
const d = o[n];
|
|
928
|
+
return d.info.trim() === "echarts" ? ae(d, e.utils.escapeHtml(d.content.trim()), u) : a(o, n, s, c, u);
|
|
918
929
|
};
|
|
919
|
-
},
|
|
930
|
+
}, kt = (e, t) => {
|
|
920
931
|
e.renderer.rules.heading_open = (a, o) => {
|
|
921
|
-
const n = a[o],
|
|
932
|
+
const n = a[o], s = a[o + 1].children?.reduce((u, d) => u + (["text", "code_inline", "math_inline"].includes(d.type) && d.content || ""), "") || "", c = n.markup.length;
|
|
922
933
|
return t.headsRef.value.push({
|
|
923
|
-
text:
|
|
924
|
-
level:
|
|
934
|
+
text: s,
|
|
935
|
+
level: c,
|
|
925
936
|
line: n.map[0],
|
|
926
937
|
currentToken: n,
|
|
927
938
|
nextToken: a[o + 1]
|
|
928
939
|
}), n.map && n.level === 0 && n.attrSet(
|
|
929
940
|
"id",
|
|
930
941
|
t.mdHeadingId({
|
|
931
|
-
text:
|
|
932
|
-
level:
|
|
942
|
+
text: s,
|
|
943
|
+
level: c,
|
|
933
944
|
index: t.headsRef.value.length,
|
|
934
945
|
currentToken: n,
|
|
935
946
|
nextToken: a[o + 1]
|
|
936
947
|
})
|
|
937
948
|
), e.renderer.renderToken(a, o, t);
|
|
938
|
-
}, e.renderer.rules.heading_close = (a, o, n,
|
|
939
|
-
},
|
|
949
|
+
}, e.renderer.rules.heading_close = (a, o, n, s, c) => c.renderToken(a, o, n);
|
|
950
|
+
}, Fe = {
|
|
940
951
|
block: [
|
|
941
952
|
{ open: "$$", close: "$$" },
|
|
942
953
|
{ open: "\\[", close: "\\]" }
|
|
@@ -947,350 +958,347 @@ const oe = new bt({
|
|
|
947
958
|
{ open: "\\[", close: "\\]" },
|
|
948
959
|
{ open: "\\(", close: "\\)" }
|
|
949
960
|
]
|
|
950
|
-
},
|
|
961
|
+
}, At = (e) => (t, a) => {
|
|
951
962
|
const o = e.delimiters;
|
|
952
963
|
for (const n of o) {
|
|
953
964
|
if (!t.src.startsWith(n.open, t.pos))
|
|
954
965
|
continue;
|
|
955
|
-
const
|
|
956
|
-
let
|
|
957
|
-
for (; (
|
|
958
|
-
let
|
|
959
|
-
for (;
|
|
960
|
-
|
|
961
|
-
if (
|
|
966
|
+
const s = t.pos + n.open.length;
|
|
967
|
+
let c = s;
|
|
968
|
+
for (; (c = t.src.indexOf(n.close, c)) !== -1; ) {
|
|
969
|
+
let u = 0, d = c - 1;
|
|
970
|
+
for (; d >= 0 && t.src[d] === "\\"; )
|
|
971
|
+
u++, d--;
|
|
972
|
+
if (u % 2 === 0)
|
|
962
973
|
break;
|
|
963
|
-
|
|
974
|
+
c += n.close.length;
|
|
964
975
|
}
|
|
965
|
-
if (
|
|
966
|
-
if (
|
|
967
|
-
return a || (t.pending += n.open + n.close), t.pos =
|
|
976
|
+
if (c !== -1) {
|
|
977
|
+
if (c - s === 0)
|
|
978
|
+
return a || (t.pending += n.open + n.close), t.pos = c + n.close.length, !0;
|
|
968
979
|
if (!a) {
|
|
969
|
-
const
|
|
970
|
-
|
|
980
|
+
const u = t.push("math_inline", e.tag, 0);
|
|
981
|
+
u.attrSet("class", e.className), u.markup = n.open, u.content = t.src.slice(s, c);
|
|
971
982
|
}
|
|
972
|
-
return t.pos =
|
|
983
|
+
return t.pos = c + n.close.length, !0;
|
|
973
984
|
}
|
|
974
985
|
}
|
|
975
986
|
return !1;
|
|
976
|
-
},
|
|
977
|
-
const
|
|
978
|
-
t.line =
|
|
987
|
+
}, Ft = (e) => (t, a, o, n) => {
|
|
988
|
+
const s = e.delimiters, c = t.bMarks[a] + t.tShift[a], u = t.eMarks[a], d = (r, i, l) => {
|
|
989
|
+
t.line = i;
|
|
979
990
|
const m = t.push("math_block", e.tag, 0);
|
|
980
|
-
return m.attrSet("class", e.className), m.block = !0, m.content = r, m.map = [a, t.line], m.markup =
|
|
991
|
+
return m.attrSet("class", e.className), m.block = !0, m.content = r, m.map = [a, t.line], m.markup = l, !0;
|
|
981
992
|
};
|
|
982
|
-
for (const r of
|
|
983
|
-
const
|
|
984
|
-
if (t.src.slice(
|
|
993
|
+
for (const r of s) {
|
|
994
|
+
const i = c;
|
|
995
|
+
if (t.src.slice(i, i + r.open.length) !== r.open)
|
|
985
996
|
continue;
|
|
986
|
-
const
|
|
987
|
-
if (!
|
|
997
|
+
const l = i + r.open.length, m = t.src.slice(l, u).trim(), h = m === "", g = m === r.close, p = m.endsWith(r.close);
|
|
998
|
+
if (!h && !g && !p)
|
|
988
999
|
continue;
|
|
989
1000
|
if (n)
|
|
990
1001
|
return !0;
|
|
991
|
-
if (
|
|
992
|
-
return
|
|
993
|
-
if (!
|
|
994
|
-
const
|
|
995
|
-
return
|
|
1002
|
+
if (g)
|
|
1003
|
+
return d("", a + 1, r.open);
|
|
1004
|
+
if (!h && p) {
|
|
1005
|
+
const x = m.slice(0, -r.close.length);
|
|
1006
|
+
return d(x, a + 1, r.open);
|
|
996
1007
|
}
|
|
997
|
-
let v = a + 1,
|
|
1008
|
+
let v = a + 1, $ = !1, y = "";
|
|
998
1009
|
for (; v < o; v++) {
|
|
999
|
-
const
|
|
1000
|
-
if (
|
|
1010
|
+
const x = t.bMarks[v] + t.tShift[v], F = t.eMarks[v];
|
|
1011
|
+
if (x < F && t.tShift[v] < t.blkIndent)
|
|
1001
1012
|
break;
|
|
1002
|
-
if (t.src.slice(
|
|
1003
|
-
const R = t.src.slice(0,
|
|
1004
|
-
y = t.src.slice(
|
|
1013
|
+
if (t.src.slice(x, F).trim().endsWith(r.close)) {
|
|
1014
|
+
const R = t.src.slice(0, F).lastIndexOf(r.close);
|
|
1015
|
+
y = t.src.slice(x, R), $ = !0;
|
|
1005
1016
|
break;
|
|
1006
1017
|
}
|
|
1007
1018
|
}
|
|
1008
|
-
if (
|
|
1019
|
+
if (!$)
|
|
1009
1020
|
continue;
|
|
1010
|
-
const
|
|
1011
|
-
return
|
|
1021
|
+
const C = t.getLines(a + 1, v, t.tShift[a], !0) + (y.trim() ? y : "");
|
|
1022
|
+
return d(C, v + 1, r.open);
|
|
1012
1023
|
}
|
|
1013
1024
|
return !1;
|
|
1014
|
-
},
|
|
1015
|
-
const n = (
|
|
1025
|
+
}, Rt = (e, { katexRef: t, inlineDelimiters: a, blockDelimiters: o }) => {
|
|
1026
|
+
const n = (u, d, r = !1) => {
|
|
1016
1027
|
if (!t.value)
|
|
1017
|
-
return
|
|
1018
|
-
const l = t.value.renderToString(
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
);
|
|
1025
|
-
|
|
1026
|
-
}, c = (d, u, r, l, s) => n(d[u], s), i = (d, u, r, l, s) => n(d[u], s, !0);
|
|
1028
|
+
return ae(u, e.utils.escapeHtml(u.content), d);
|
|
1029
|
+
const i = { throwOnError: !1, displayMode: r, trust: !1 }, l = j.katexConfig(i), m = t.value.renderToString(u.content, {
|
|
1030
|
+
...i,
|
|
1031
|
+
...l,
|
|
1032
|
+
// 配置其他选项不应隐式开放 HTML 命令;调用方仍可显式传 true 或判断函数。
|
|
1033
|
+
trust: l?.trust ?? !1
|
|
1034
|
+
});
|
|
1035
|
+
return u.attrSet("data-processed", ""), ae(u, String(m), d);
|
|
1036
|
+
}, s = (u, d, r, i, l) => n(u[d], l), c = (u, d, r, i, l) => n(u[d], l, !0);
|
|
1027
1037
|
e.inline.ruler.before(
|
|
1028
1038
|
"escape",
|
|
1029
1039
|
"math_inline",
|
|
1030
|
-
|
|
1031
|
-
delimiters: a ||
|
|
1032
|
-
className: `${
|
|
1040
|
+
At({
|
|
1041
|
+
delimiters: a || Fe.inline,
|
|
1042
|
+
className: `${f}-katex-inline`,
|
|
1033
1043
|
tag: "span"
|
|
1034
1044
|
})
|
|
1035
1045
|
), e.block.ruler.after(
|
|
1036
1046
|
"blockquote",
|
|
1037
1047
|
"math_block",
|
|
1038
|
-
|
|
1039
|
-
delimiters: o ||
|
|
1040
|
-
className: `${
|
|
1048
|
+
Ft({
|
|
1049
|
+
delimiters: o || Fe.block,
|
|
1050
|
+
className: `${f}-katex-block`,
|
|
1041
1051
|
tag: "p"
|
|
1042
1052
|
}),
|
|
1043
1053
|
{
|
|
1044
1054
|
alt: ["paragraph", "reference", "blockquote", "list"]
|
|
1045
1055
|
}
|
|
1046
|
-
), e.renderer.rules.math_inline =
|
|
1047
|
-
},
|
|
1056
|
+
), e.renderer.rules.math_inline = s, e.renderer.rules.math_block = c;
|
|
1057
|
+
}, Mt = (e, t) => {
|
|
1048
1058
|
e.core.ruler.after("block", "mermaid-token-attrs", (o) => {
|
|
1049
|
-
o.tokens.forEach((n) => {
|
|
1050
|
-
if (!(n.type !== "fence" || n.info !== "mermaid") && (n.tag = "div", n.attrJoin("class", `${
|
|
1059
|
+
o.tokens.forEach((n, s) => {
|
|
1060
|
+
if (!(n.type !== "fence" || n.info !== "mermaid") && (n.tag = "div", n.attrJoin("class", `${f}-mermaid`), n.attrSet("data-mermaid-theme", t.themeRef.value), n.attrSet("data-mermaid-block", String(n.map?.[0] ?? s)), n.attrSet("data-mermaid-revision", String(t.revision?.value ?? 0)), n.map && n.level === 0)) {
|
|
1051
1061
|
const c = n.map[1] - 1, d = !!o.env.srcLines?.[c]?.trim()?.startsWith("```");
|
|
1052
1062
|
n.attrSet("data-closed", `${d}`), n.attrSet("data-line", String(n.map[0]));
|
|
1053
1063
|
}
|
|
1054
1064
|
});
|
|
1055
1065
|
});
|
|
1056
1066
|
const a = e.renderer.rules.fence.bind(e.renderer.rules);
|
|
1057
|
-
e.renderer.rules.fence = (o, n,
|
|
1058
|
-
const
|
|
1059
|
-
if (
|
|
1060
|
-
const
|
|
1061
|
-
return
|
|
1067
|
+
e.renderer.rules.fence = (o, n, s, c, u) => {
|
|
1068
|
+
const d = o[n], r = d.content.trim();
|
|
1069
|
+
if (d.info === "mermaid") {
|
|
1070
|
+
const i = d.attrGet("data-closed") !== "false" ? t.getCached?.(d.attrGet("data-mermaid-block") ?? void 0, r) : void 0;
|
|
1071
|
+
return i ? (d.tag = "p", d.attrSet("data-processed", ""), d.attrSet("data-content", r), ae(d, i.svg, u)) : ae(d, e.utils.escapeHtml(r), u);
|
|
1062
1072
|
}
|
|
1063
|
-
return a(o, n,
|
|
1073
|
+
return a(o, n, s, c, u);
|
|
1064
1074
|
};
|
|
1065
|
-
},
|
|
1075
|
+
}, Re = (e, t, a) => {
|
|
1066
1076
|
const o = e.attrIndex(t), n = [t, a];
|
|
1067
1077
|
o < 0 ? e.attrPush(n) : (e.attrs = e.attrs || [], e.attrs[o] = n);
|
|
1068
|
-
},
|
|
1078
|
+
}, Lt = (e) => e.type === "inline", Ht = (e) => e.type === "paragraph_open", Pt = (e) => e.type === "list_item_open", Ot = (e) => e.content.indexOf("[ ] ") === 0 || e.content.indexOf("[x] ") === 0 || e.content.indexOf("[X] ") === 0, _t = (e, t) => Lt(e[t]) && Ht(e[t - 1]) && Pt(e[t - 2]) && Ot(e[t]), Nt = (e, t) => {
|
|
1069
1079
|
const a = e[t].level - 1;
|
|
1070
1080
|
for (let o = t - 1; o >= 0; o--)
|
|
1071
1081
|
if (e[o].level === a)
|
|
1072
1082
|
return o;
|
|
1073
1083
|
return -1;
|
|
1074
|
-
},
|
|
1075
|
-
const t = new e("html_inline", "", 0);
|
|
1076
|
-
return t.content = "<label>", t;
|
|
1077
|
-
}, Bt = (e) => {
|
|
1078
|
-
const t = new e("html_inline", "", 0);
|
|
1079
|
-
return t.content = "</label>", t;
|
|
1080
|
-
}, jt = (e, t, a) => {
|
|
1081
|
-
const o = new a("html_inline", "", 0);
|
|
1082
|
-
return o.content = '<label class="task-list-item-label" for="' + t + '">' + e + "</label>", o.attrs = [["for", t]], o;
|
|
1083
|
-
}, Dt = (e, t, a) => {
|
|
1084
|
+
}, Me = (e) => new e("label_open", "label", 1), Le = (e) => new e("label_close", "label", -1), Bt = (e, t, a) => {
|
|
1084
1085
|
const o = new t("html_inline", "", 0), n = a.enabled ? " " : ' disabled="" ';
|
|
1085
1086
|
return e.content.indexOf("[ ] ") === 0 ? o.content = '<input class="task-list-item-checkbox"' + n + 'type="checkbox">' : (e.content.indexOf("[x] ") === 0 || e.content.indexOf("[X] ") === 0) && (o.content = '<input class="task-list-item-checkbox" checked=""' + n + 'type="checkbox">'), o;
|
|
1086
|
-
},
|
|
1087
|
-
if (e.children = e.children || [], e.children.unshift(
|
|
1087
|
+
}, jt = (e, t, a) => {
|
|
1088
|
+
if (e.children = e.children || [], e.children.unshift(Bt(e, t, a)), e.children[1].content = e.children[1].content.slice(3), e.content = e.content.slice(3), a.label)
|
|
1088
1089
|
if (a.labelAfter) {
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1090
|
+
const o = "task-item-" + Math.ceil(Math.random() * 1e7 - 1e3);
|
|
1091
|
+
e.children[0].content = e.children[0].content.slice(0, -1) + ' id="' + o + '">';
|
|
1092
|
+
const n = Me(t);
|
|
1093
|
+
n.attrSet("class", "task-list-item-label"), n.attrSet("for", o), e.children.splice(1, 0, n), e.children.push(Le(t));
|
|
1092
1094
|
} else
|
|
1093
|
-
e.children.unshift(
|
|
1094
|
-
},
|
|
1095
|
+
e.children.unshift(Me(t)), e.children.push(Le(t));
|
|
1096
|
+
}, Dt = (e, t = {}) => {
|
|
1095
1097
|
e.core.ruler.after("inline", "github-task-lists", (a) => {
|
|
1096
1098
|
const o = a.tokens;
|
|
1097
1099
|
for (let n = 2; n < o.length; n++)
|
|
1098
|
-
_t(o, n) && (
|
|
1100
|
+
_t(o, n) && (jt(o[n], a.Token, t), Re(
|
|
1099
1101
|
o[n - 2],
|
|
1100
1102
|
"class",
|
|
1101
1103
|
"task-list-item" + (t.enabled ? " enabled" : " ")
|
|
1102
|
-
),
|
|
1104
|
+
), Re(o[Nt(o, n - 2)], "class", "contains-task-list"));
|
|
1103
1105
|
});
|
|
1104
|
-
},
|
|
1106
|
+
}, Vt = (e) => {
|
|
1105
1107
|
e.core.ruler.push("init-line-number", (t) => (t.tokens.forEach((a) => {
|
|
1106
1108
|
a.map && a.attrSet("data-line", a.map[0].toString());
|
|
1107
1109
|
}), !0));
|
|
1108
|
-
},
|
|
1109
|
-
const { editorConfig: a, markdownItConfig: o, markdownItPlugins: n, editorExtensions:
|
|
1110
|
+
}, zt = (e, t) => {
|
|
1111
|
+
const { editorConfig: a, markdownItConfig: o, markdownItPlugins: n, editorExtensions: s } = j, c = E("editorId"), u = E("language"), d = E(
|
|
1110
1112
|
"usedLanguageText"
|
|
1111
|
-
), r =
|
|
1113
|
+
), r = E("showCodeRowNumber"), i = E("theme"), l = E("customIcon"), m = E("rootRef"), h = E("setting"), g = Q([]), p = bt(e), v = Ct(e), { reRenderRef: $, replaceMermaid: y, invalidateMermaid: b, getCachedMermaid: C } = Et(e), { reRenderEcharts: x, replaceEcharts: F } = yt(e), T = lt({
|
|
1112
1114
|
// 关闭源文本中的原生 HTML 解析,插件生成的 HTML 不受影响。
|
|
1113
1115
|
html: !1,
|
|
1114
1116
|
breaks: !0,
|
|
1115
1117
|
linkify: !0
|
|
1116
1118
|
});
|
|
1117
|
-
o(
|
|
1118
|
-
editorId:
|
|
1119
|
+
o(T, {
|
|
1120
|
+
editorId: c
|
|
1119
1121
|
});
|
|
1120
|
-
const
|
|
1122
|
+
const R = [
|
|
1121
1123
|
{
|
|
1122
1124
|
type: "image",
|
|
1123
|
-
plugin:
|
|
1125
|
+
plugin: ct,
|
|
1124
1126
|
options: { figcaption: !0, classes: "md-zoom" }
|
|
1125
1127
|
},
|
|
1126
1128
|
{
|
|
1127
1129
|
type: "admonition",
|
|
1128
|
-
plugin:
|
|
1130
|
+
plugin: xt,
|
|
1129
1131
|
options: {}
|
|
1130
1132
|
},
|
|
1131
1133
|
{
|
|
1132
1134
|
type: "taskList",
|
|
1133
|
-
plugin:
|
|
1135
|
+
plugin: Dt,
|
|
1134
1136
|
options: {}
|
|
1135
1137
|
},
|
|
1136
1138
|
{
|
|
1137
1139
|
type: "heading",
|
|
1138
|
-
plugin:
|
|
1139
|
-
options: { mdHeadingId: e.mdHeadingId, headsRef:
|
|
1140
|
+
plugin: kt,
|
|
1141
|
+
options: { mdHeadingId: e.mdHeadingId, headsRef: g }
|
|
1140
1142
|
},
|
|
1141
1143
|
{
|
|
1142
1144
|
type: "code",
|
|
1143
|
-
plugin:
|
|
1145
|
+
plugin: Tt,
|
|
1144
1146
|
options: {
|
|
1145
|
-
editorId:
|
|
1146
|
-
usedLanguageTextRef:
|
|
1147
|
+
editorId: c,
|
|
1148
|
+
usedLanguageTextRef: d,
|
|
1147
1149
|
// showCodeRowNumber,
|
|
1148
1150
|
codeFoldable: e.codeFoldable,
|
|
1149
1151
|
autoFoldThreshold: e.autoFoldThreshold,
|
|
1150
|
-
customIconRef:
|
|
1152
|
+
customIconRef: l
|
|
1151
1153
|
}
|
|
1152
1154
|
},
|
|
1153
1155
|
{
|
|
1154
1156
|
type: "sub",
|
|
1155
|
-
plugin:
|
|
1157
|
+
plugin: dt,
|
|
1156
1158
|
options: {}
|
|
1157
1159
|
},
|
|
1158
1160
|
{
|
|
1159
1161
|
type: "sup",
|
|
1160
|
-
plugin:
|
|
1162
|
+
plugin: ut,
|
|
1161
1163
|
options: {}
|
|
1162
1164
|
}
|
|
1163
1165
|
];
|
|
1164
|
-
e.noKatex ||
|
|
1166
|
+
e.noKatex || R.push({
|
|
1165
1167
|
type: "katex",
|
|
1166
|
-
plugin:
|
|
1168
|
+
plugin: Rt,
|
|
1167
1169
|
options: { katexRef: v }
|
|
1168
|
-
}), e.noMermaid ||
|
|
1170
|
+
}), e.noMermaid || R.push({
|
|
1169
1171
|
type: "mermaid",
|
|
1170
|
-
plugin:
|
|
1171
|
-
options: { themeRef:
|
|
1172
|
-
}), e.noEcharts ||
|
|
1172
|
+
plugin: Mt,
|
|
1173
|
+
options: { themeRef: i, revision: $, getCached: C }
|
|
1174
|
+
}), e.noEcharts || R.push({
|
|
1173
1175
|
type: "echarts",
|
|
1174
|
-
plugin:
|
|
1175
|
-
options: { themeRef:
|
|
1176
|
-
}), n(
|
|
1177
|
-
editorId:
|
|
1178
|
-
}).forEach((
|
|
1179
|
-
|
|
1176
|
+
plugin: It,
|
|
1177
|
+
options: { themeRef: i }
|
|
1178
|
+
}), n(R, {
|
|
1179
|
+
editorId: c
|
|
1180
|
+
}).forEach((M) => {
|
|
1181
|
+
T.use(M.plugin, M.options);
|
|
1180
1182
|
});
|
|
1181
|
-
const
|
|
1182
|
-
|
|
1183
|
-
highlight: (
|
|
1184
|
-
const
|
|
1185
|
-
let
|
|
1186
|
-
if (
|
|
1187
|
-
const
|
|
1188
|
-
if (
|
|
1189
|
-
const
|
|
1190
|
-
lineHighlightRanges:
|
|
1183
|
+
const J = T.options.highlight;
|
|
1184
|
+
T.set({
|
|
1185
|
+
highlight: (M, O, q) => {
|
|
1186
|
+
const K = le(O, q), { attrs: ee, language: k, lineHighlightRanges: A } = K;
|
|
1187
|
+
let G = "";
|
|
1188
|
+
if (J) {
|
|
1189
|
+
const ne = J(M, k, ee);
|
|
1190
|
+
if (ne) {
|
|
1191
|
+
const oe = mt(ne, M, {
|
|
1192
|
+
lineHighlightRanges: A,
|
|
1191
1193
|
showLineNumber: r
|
|
1192
1194
|
});
|
|
1193
|
-
if (
|
|
1194
|
-
return
|
|
1195
|
-
|
|
1195
|
+
if (oe.shouldReturnDirectly)
|
|
1196
|
+
return oe.html;
|
|
1197
|
+
G = oe.html;
|
|
1196
1198
|
}
|
|
1197
1199
|
}
|
|
1198
|
-
|
|
1199
|
-
language:
|
|
1200
|
+
G || (!e.noHighlight && p.value ? p.value.getLanguage(k) ? G = p.value.highlight(M, {
|
|
1201
|
+
language: k,
|
|
1200
1202
|
ignoreIllegals: !0
|
|
1201
|
-
}).value :
|
|
1202
|
-
const
|
|
1203
|
-
let
|
|
1204
|
-
return (r ||
|
|
1205
|
-
lineHighlightRanges:
|
|
1203
|
+
}).value : G = p.value.highlightAuto(M).value : G = T.utils.escapeHtml(M));
|
|
1204
|
+
const te = T.utils.escapeHtml(k);
|
|
1205
|
+
let se = `<span class="${f}-code-block">${G.replace(/^\n+|\n+$/g, "")}</span>`;
|
|
1206
|
+
return (r || A.length) && (se = ft(G, M, {
|
|
1207
|
+
lineHighlightRanges: A,
|
|
1206
1208
|
showLineNumber: r
|
|
1207
|
-
})), `<pre><code class="language-${
|
|
1209
|
+
})), `<pre><code class="language-${te}" language="${te}">${se}</code></pre>`;
|
|
1208
1210
|
}
|
|
1209
|
-
}),
|
|
1210
|
-
const
|
|
1211
|
+
}), Vt(T);
|
|
1212
|
+
const D = Q(`_article-key_${he()}`), N = Q(
|
|
1211
1213
|
e.sanitize(
|
|
1212
|
-
|
|
1214
|
+
T.render(e.modelValue, {
|
|
1213
1215
|
srcLines: e.modelValue.split(`
|
|
1214
1216
|
`)
|
|
1215
1217
|
})
|
|
1216
1218
|
)
|
|
1217
1219
|
);
|
|
1218
|
-
let
|
|
1219
|
-
},
|
|
1220
|
+
let U = () => {
|
|
1221
|
+
}, W = () => {
|
|
1220
1222
|
};
|
|
1221
|
-
const
|
|
1222
|
-
const
|
|
1223
|
-
`#${
|
|
1223
|
+
const X = () => {
|
|
1224
|
+
const M = m.value?.querySelectorAll(
|
|
1225
|
+
`#${c} p.${f}-mermaid:not([data-closed=false])`
|
|
1224
1226
|
);
|
|
1225
|
-
|
|
1226
|
-
customIcon:
|
|
1227
|
-
}),
|
|
1228
|
-
customIcon:
|
|
1227
|
+
W(), W = rt(M, {
|
|
1228
|
+
customIcon: l.value
|
|
1229
|
+
}), s.mermaid?.enableZoom && (U(), U = st(M, {
|
|
1230
|
+
customIcon: l.value
|
|
1229
1231
|
}));
|
|
1230
|
-
},
|
|
1231
|
-
|
|
1232
|
-
y().then(
|
|
1232
|
+
}, V = () => {
|
|
1233
|
+
w.emit(c, ie, N.value), e.onHtmlChanged(N.value), e.onGetCatalog(g.value), w.emit(c, ue, g.value), Y(() => {
|
|
1234
|
+
y().then(X), F();
|
|
1233
1235
|
});
|
|
1234
|
-
},
|
|
1235
|
-
|
|
1236
|
-
|
|
1236
|
+
}, L = () => {
|
|
1237
|
+
g.value = [], N.value = e.sanitize(
|
|
1238
|
+
T.render(e.modelValue, {
|
|
1237
1239
|
srcLines: e.modelValue.split(`
|
|
1238
1240
|
`)
|
|
1239
1241
|
})
|
|
1240
1242
|
);
|
|
1241
|
-
},
|
|
1242
|
-
return
|
|
1243
|
-
[
|
|
1244
|
-
|
|
1245
|
-
|
|
1243
|
+
}, P = H(() => (e.noKatex || !!v.value) && (e.noHighlight || !!p.value));
|
|
1244
|
+
return S(
|
|
1245
|
+
[
|
|
1246
|
+
be(e, "modelValue"),
|
|
1247
|
+
be(e, "sanitize"),
|
|
1248
|
+
P,
|
|
1249
|
+
$,
|
|
1250
|
+
u
|
|
1251
|
+
],
|
|
1252
|
+
(M, O, q) => {
|
|
1253
|
+
const K = window.setTimeout(
|
|
1246
1254
|
() => {
|
|
1247
|
-
|
|
1255
|
+
L();
|
|
1248
1256
|
},
|
|
1249
1257
|
t ? 0 : a.renderDelay
|
|
1250
1258
|
);
|
|
1251
|
-
|
|
1252
|
-
clearTimeout(
|
|
1259
|
+
q(() => {
|
|
1260
|
+
clearTimeout(K);
|
|
1253
1261
|
});
|
|
1254
1262
|
}
|
|
1255
|
-
),
|
|
1256
|
-
() =>
|
|
1263
|
+
), S(
|
|
1264
|
+
() => h.value.preview,
|
|
1257
1265
|
() => {
|
|
1258
|
-
|
|
1259
|
-
y().then(
|
|
1266
|
+
h.value.preview && Y(() => {
|
|
1267
|
+
y().then(X), F(), w.emit(c, ue, g.value);
|
|
1260
1268
|
});
|
|
1261
1269
|
}
|
|
1262
|
-
),
|
|
1263
|
-
|
|
1264
|
-
}),
|
|
1265
|
-
|
|
1266
|
-
name:
|
|
1270
|
+
), S([N, x, D], () => {
|
|
1271
|
+
V();
|
|
1272
|
+
}), _(V), _(() => {
|
|
1273
|
+
w.on(c, {
|
|
1274
|
+
name: Je,
|
|
1267
1275
|
callback() {
|
|
1268
|
-
|
|
1276
|
+
w.emit(c, ue, g.value);
|
|
1269
1277
|
}
|
|
1270
|
-
}),
|
|
1271
|
-
name:
|
|
1278
|
+
}), w.on(c, {
|
|
1279
|
+
name: ve,
|
|
1272
1280
|
callback: () => {
|
|
1273
|
-
|
|
1281
|
+
b(), D.value = `_article-key_${he()}`, L();
|
|
1274
1282
|
}
|
|
1275
1283
|
});
|
|
1276
|
-
}),
|
|
1277
|
-
|
|
1278
|
-
}), { html: N, key:
|
|
1279
|
-
},
|
|
1280
|
-
const a =
|
|
1281
|
-
const
|
|
1284
|
+
}), re(() => {
|
|
1285
|
+
U(), W();
|
|
1286
|
+
}), { html: N, key: D };
|
|
1287
|
+
}, Gt = (e, t) => {
|
|
1288
|
+
const a = E("editorId"), o = E("setting"), { noImgZoomIn: n } = e, s = et(() => {
|
|
1289
|
+
const c = document.querySelectorAll(
|
|
1282
1290
|
`#${a}-preview img:not(.not-zoom):not(.medium-zoom-image)`
|
|
1283
1291
|
);
|
|
1284
|
-
|
|
1292
|
+
c.length !== 0 && ht(c, {
|
|
1285
1293
|
background: "#00000073"
|
|
1286
1294
|
});
|
|
1287
1295
|
});
|
|
1288
|
-
|
|
1289
|
-
!n && o.value.preview && await
|
|
1290
|
-
}),
|
|
1291
|
-
!n && o.value.preview && await
|
|
1296
|
+
_(async () => {
|
|
1297
|
+
!n && o.value.preview && await s();
|
|
1298
|
+
}), S([t, () => o.value.preview], async () => {
|
|
1299
|
+
!n && o.value.preview && await s();
|
|
1292
1300
|
});
|
|
1293
|
-
},
|
|
1301
|
+
}, He = {
|
|
1294
1302
|
checked: {
|
|
1295
1303
|
regexp: /- \[x\]/,
|
|
1296
1304
|
value: "- [ ]"
|
|
@@ -1299,55 +1307,55 @@ const oe = new bt({
|
|
|
1299
1307
|
regexp: /- \[\s\]/,
|
|
1300
1308
|
value: "- [x]"
|
|
1301
1309
|
}
|
|
1302
|
-
},
|
|
1303
|
-
const a =
|
|
1310
|
+
}, Ut = (e, t) => {
|
|
1311
|
+
const a = E("editorId"), o = E("rootRef");
|
|
1304
1312
|
let n = () => {
|
|
1305
1313
|
};
|
|
1306
|
-
const
|
|
1314
|
+
const s = () => {
|
|
1307
1315
|
if (!o.value)
|
|
1308
1316
|
return !1;
|
|
1309
|
-
const
|
|
1310
|
-
|
|
1311
|
-
const r =
|
|
1312
|
-
if (!
|
|
1317
|
+
const c = o.value.querySelectorAll(".task-list-item.enabled"), u = (d) => {
|
|
1318
|
+
d.preventDefault();
|
|
1319
|
+
const r = d.target.checked ? "unChecked" : "checked", i = d.target.parentElement?.dataset.line;
|
|
1320
|
+
if (!i)
|
|
1313
1321
|
return;
|
|
1314
|
-
const
|
|
1315
|
-
`),
|
|
1316
|
-
|
|
1317
|
-
|
|
1322
|
+
const l = Number(i), m = e.modelValue.split(`
|
|
1323
|
+
`), h = m[Number(l)].replace(
|
|
1324
|
+
He[r].regexp,
|
|
1325
|
+
He[r].value
|
|
1318
1326
|
);
|
|
1319
|
-
e.previewOnly ? (m[Number(
|
|
1320
|
-
`))) :
|
|
1327
|
+
e.previewOnly ? (m[Number(l)] = h, e.onChange(m.join(`
|
|
1328
|
+
`))) : w.emit(a, Xe, l + 1, h);
|
|
1321
1329
|
};
|
|
1322
|
-
|
|
1323
|
-
|
|
1330
|
+
c.forEach((d) => {
|
|
1331
|
+
d.addEventListener("click", u);
|
|
1324
1332
|
}), n = () => {
|
|
1325
|
-
|
|
1326
|
-
|
|
1333
|
+
c.forEach((d) => {
|
|
1334
|
+
d.removeEventListener("click", u);
|
|
1327
1335
|
});
|
|
1328
1336
|
};
|
|
1329
1337
|
};
|
|
1330
|
-
|
|
1338
|
+
re(() => {
|
|
1331
1339
|
n();
|
|
1332
|
-
}),
|
|
1340
|
+
}), S(
|
|
1333
1341
|
[t],
|
|
1334
1342
|
() => {
|
|
1335
|
-
n(),
|
|
1343
|
+
n(), Y(s);
|
|
1336
1344
|
},
|
|
1337
1345
|
{
|
|
1338
1346
|
immediate: !0
|
|
1339
1347
|
}
|
|
1340
1348
|
);
|
|
1341
|
-
},
|
|
1342
|
-
const o =
|
|
1343
|
-
|
|
1349
|
+
}, Wt = (e, t, a) => {
|
|
1350
|
+
const o = E("setting"), n = () => {
|
|
1351
|
+
Y(() => {
|
|
1344
1352
|
e.onRemount?.();
|
|
1345
1353
|
});
|
|
1346
|
-
},
|
|
1347
|
-
|
|
1354
|
+
}, s = (c) => {
|
|
1355
|
+
c && n();
|
|
1348
1356
|
};
|
|
1349
|
-
|
|
1350
|
-
},
|
|
1357
|
+
S([t, a], n), S(() => o.value.preview, s), S(() => o.value.htmlPreview, s), _(n);
|
|
1358
|
+
}, Be = {
|
|
1351
1359
|
modelValue: {
|
|
1352
1360
|
type: String,
|
|
1353
1361
|
default: ""
|
|
@@ -1418,8 +1426,8 @@ const oe = new bt({
|
|
|
1418
1426
|
type: [Object, Function],
|
|
1419
1427
|
default: void 0
|
|
1420
1428
|
}
|
|
1421
|
-
},
|
|
1422
|
-
...
|
|
1429
|
+
}, vn = {
|
|
1430
|
+
...Be,
|
|
1423
1431
|
updateModelValue: {
|
|
1424
1432
|
type: Function,
|
|
1425
1433
|
default: () => {
|
|
@@ -1487,10 +1495,10 @@ const oe = new bt({
|
|
|
1487
1495
|
catalogMaxDepth: {
|
|
1488
1496
|
type: Number
|
|
1489
1497
|
}
|
|
1490
|
-
},
|
|
1498
|
+
}, Pe = (e) => {
|
|
1491
1499
|
const a = new DOMParser().parseFromString(e, "text/html");
|
|
1492
1500
|
return Array.from(a.body.childNodes);
|
|
1493
|
-
},
|
|
1501
|
+
}, qt = (e, t) => e.nodeType !== t.nodeType ? !1 : e.nodeType === Node.TEXT_NODE || e.nodeType === Node.COMMENT_NODE ? e.textContent === t.textContent : e.nodeType === Node.ELEMENT_NODE ? e.outerHTML === t.outerHTML : e.isEqualNode ? e.isEqualNode(t) : !1, Kt = /* @__PURE__ */ ge({
|
|
1494
1502
|
name: "UpdateOnDemand",
|
|
1495
1503
|
props: {
|
|
1496
1504
|
id: {
|
|
@@ -1507,74 +1515,74 @@ const oe = new bt({
|
|
|
1507
1515
|
}
|
|
1508
1516
|
},
|
|
1509
1517
|
setup(e) {
|
|
1510
|
-
const t =
|
|
1518
|
+
const t = Q(), a = e.html, o = (n, s) => {
|
|
1511
1519
|
if (!t.value) return;
|
|
1512
|
-
const
|
|
1520
|
+
const c = t.value, u = Array.from(c.childNodes), d = Math.min(n.length, s.length);
|
|
1513
1521
|
let r = -1;
|
|
1514
|
-
for (let
|
|
1515
|
-
if (!
|
|
1516
|
-
r =
|
|
1522
|
+
for (let l = 0; l < d; l++)
|
|
1523
|
+
if (!qt(n[l], s[l])) {
|
|
1524
|
+
r = l;
|
|
1517
1525
|
break;
|
|
1518
1526
|
}
|
|
1519
1527
|
if (r === -1)
|
|
1520
|
-
if (
|
|
1528
|
+
if (s.length > n.length)
|
|
1521
1529
|
r = n.length;
|
|
1522
|
-
else if (n.length >
|
|
1523
|
-
r =
|
|
1530
|
+
else if (n.length > s.length)
|
|
1531
|
+
r = s.length;
|
|
1524
1532
|
else
|
|
1525
1533
|
return;
|
|
1526
|
-
const
|
|
1527
|
-
for (let
|
|
1528
|
-
|
|
1529
|
-
for (let
|
|
1530
|
-
|
|
1534
|
+
const i = Math.min(r, u.length);
|
|
1535
|
+
for (let l = u.length - 1; l >= i; l--)
|
|
1536
|
+
u[l].remove();
|
|
1537
|
+
for (let l = r; l < n.length; l++)
|
|
1538
|
+
c.appendChild(n[l].cloneNode(!0));
|
|
1531
1539
|
};
|
|
1532
|
-
return
|
|
1533
|
-
const
|
|
1534
|
-
o(
|
|
1535
|
-
}), () =>
|
|
1540
|
+
return S(() => e.html, (n, s) => {
|
|
1541
|
+
const c = Pe(n), u = Pe(s || "");
|
|
1542
|
+
o(c, u);
|
|
1543
|
+
}), () => Z("div", {
|
|
1536
1544
|
id: e.id,
|
|
1537
1545
|
class: e.class,
|
|
1538
1546
|
innerHTML: a,
|
|
1539
1547
|
ref: t
|
|
1540
1548
|
}, null);
|
|
1541
1549
|
}
|
|
1542
|
-
}),
|
|
1550
|
+
}), Zt = /* @__PURE__ */ ge({
|
|
1543
1551
|
name: "ContentPreview",
|
|
1544
|
-
props:
|
|
1552
|
+
props: Be,
|
|
1545
1553
|
setup(e) {
|
|
1546
|
-
const t =
|
|
1547
|
-
html:
|
|
1548
|
-
key:
|
|
1549
|
-
} =
|
|
1550
|
-
|
|
1551
|
-
const
|
|
1554
|
+
const t = E("editorId"), a = E("setting"), o = E("previewTheme"), n = E("showCodeRowNumber"), {
|
|
1555
|
+
html: s,
|
|
1556
|
+
key: c
|
|
1557
|
+
} = zt(e, e.previewOnly);
|
|
1558
|
+
vt(e, s, c), Gt(e, s), Ut(e, s), Wt(e, s, c);
|
|
1559
|
+
const u = H(() => [`${f}-preview`, `${o?.value}-theme`, n && `${f}-scrn`].filter(Boolean)), d = () => {
|
|
1552
1560
|
const r = `${t}-preview`;
|
|
1553
|
-
return e.previewComponent ?
|
|
1554
|
-
key:
|
|
1555
|
-
html:
|
|
1561
|
+
return e.previewComponent ? Ue(e.previewComponent, {
|
|
1562
|
+
key: c.value,
|
|
1563
|
+
html: s.value,
|
|
1556
1564
|
id: r,
|
|
1557
|
-
class:
|
|
1558
|
-
}) :
|
|
1559
|
-
key:
|
|
1560
|
-
html:
|
|
1565
|
+
class: u.value
|
|
1566
|
+
}) : Z(Kt, {
|
|
1567
|
+
key: c.value,
|
|
1568
|
+
html: s.value,
|
|
1561
1569
|
id: r,
|
|
1562
|
-
class:
|
|
1570
|
+
class: u.value
|
|
1563
1571
|
}, null);
|
|
1564
1572
|
};
|
|
1565
|
-
return () =>
|
|
1573
|
+
return () => Z(Ge, null, [a.value.preview && (e.previewOnly ? d() : Z("div", {
|
|
1566
1574
|
id: `${t}-preview-wrapper`,
|
|
1567
|
-
class: `${
|
|
1575
|
+
class: `${f}-preview-wrapper`,
|
|
1568
1576
|
key: "content-preview-wrapper"
|
|
1569
|
-
}, [
|
|
1577
|
+
}, [d()])), a.value.htmlPreview && Z("div", {
|
|
1570
1578
|
id: `${t}-html-wrapper`,
|
|
1571
|
-
class: `${
|
|
1579
|
+
class: `${f}-preview-wrapper`,
|
|
1572
1580
|
key: "html-preview-wrapper"
|
|
1573
|
-
}, [
|
|
1574
|
-
class: `${
|
|
1575
|
-
}, [
|
|
1581
|
+
}, [Z("div", {
|
|
1582
|
+
class: `${f}-html`
|
|
1583
|
+
}, [s.value])])]);
|
|
1576
1584
|
}
|
|
1577
|
-
}),
|
|
1585
|
+
}), Jt = ({ text: e }) => e, je = {
|
|
1578
1586
|
/**
|
|
1579
1587
|
* markdown content.
|
|
1580
1588
|
*
|
|
@@ -1683,12 +1691,12 @@ const oe = new bt({
|
|
|
1683
1691
|
*/
|
|
1684
1692
|
mdHeadingId: {
|
|
1685
1693
|
type: Function,
|
|
1686
|
-
default:
|
|
1694
|
+
default: Jt
|
|
1687
1695
|
},
|
|
1688
1696
|
/**
|
|
1689
1697
|
*
|
|
1690
|
-
*
|
|
1691
|
-
*
|
|
1698
|
+
* Markdown 编译后的 HTML 后处理入口。原生 HTML 默认关闭;显式开启或使用
|
|
1699
|
+
* 自定义 renderer 时,可在这里接入 DOMPurify、sanitize-html 等业务清洗策略。
|
|
1692
1700
|
*
|
|
1693
1701
|
* @default (text: string) => text
|
|
1694
1702
|
*/
|
|
@@ -1769,6 +1777,7 @@ const oe = new bt({
|
|
|
1769
1777
|
type: Object,
|
|
1770
1778
|
default: {}
|
|
1771
1779
|
},
|
|
1780
|
+
/** Mermaid 在默认 strict 渲染之后的异步 SVG 后处理入口。 */
|
|
1772
1781
|
sanitizeMermaid: {
|
|
1773
1782
|
type: Function,
|
|
1774
1783
|
default: (e) => Promise.resolve(e)
|
|
@@ -1812,8 +1821,8 @@ const oe = new bt({
|
|
|
1812
1821
|
type: [Object, Function],
|
|
1813
1822
|
default: void 0
|
|
1814
1823
|
}
|
|
1815
|
-
},
|
|
1816
|
-
...
|
|
1824
|
+
}, yn = {
|
|
1825
|
+
...je,
|
|
1817
1826
|
/**
|
|
1818
1827
|
* input回调事件
|
|
1819
1828
|
*/
|
|
@@ -1873,7 +1882,7 @@ const oe = new bt({
|
|
|
1873
1882
|
*/
|
|
1874
1883
|
toolbars: {
|
|
1875
1884
|
type: Array,
|
|
1876
|
-
default:
|
|
1885
|
+
default: nt
|
|
1877
1886
|
},
|
|
1878
1887
|
/**
|
|
1879
1888
|
* 浮动工具栏
|
|
@@ -1951,7 +1960,7 @@ const oe = new bt({
|
|
|
1951
1960
|
*/
|
|
1952
1961
|
footers: {
|
|
1953
1962
|
type: Array,
|
|
1954
|
-
default:
|
|
1963
|
+
default: tt
|
|
1955
1964
|
},
|
|
1956
1965
|
/**
|
|
1957
1966
|
* 是否默认激活输入框和预览框同步滚动
|
|
@@ -2118,14 +2127,14 @@ const oe = new bt({
|
|
|
2118
2127
|
type: Number,
|
|
2119
2128
|
default: void 0
|
|
2120
2129
|
}
|
|
2121
|
-
},
|
|
2130
|
+
}, De = [
|
|
2122
2131
|
"onHtmlChanged",
|
|
2123
2132
|
"onGetCatalog",
|
|
2124
2133
|
"onChange",
|
|
2125
2134
|
"onRemount",
|
|
2126
2135
|
"update:modelValue"
|
|
2127
|
-
],
|
|
2128
|
-
...
|
|
2136
|
+
], bn = [
|
|
2137
|
+
...De,
|
|
2129
2138
|
"onSave",
|
|
2130
2139
|
"onUploadImg",
|
|
2131
2140
|
"onError",
|
|
@@ -2134,43 +2143,43 @@ const oe = new bt({
|
|
|
2134
2143
|
"onInput",
|
|
2135
2144
|
"onDrop",
|
|
2136
2145
|
"onInputBoxWidthChange"
|
|
2137
|
-
],
|
|
2146
|
+
], me = /* @__PURE__ */ ge({
|
|
2138
2147
|
name: "MdPreview",
|
|
2139
|
-
props:
|
|
2140
|
-
emits:
|
|
2148
|
+
props: je,
|
|
2149
|
+
emits: De,
|
|
2141
2150
|
setup(e, t) {
|
|
2142
2151
|
const {
|
|
2143
2152
|
noKatex: a,
|
|
2144
2153
|
noMermaid: o,
|
|
2145
2154
|
noHighlight: n
|
|
2146
|
-
} = e,
|
|
2147
|
-
|
|
2148
|
-
rootRef:
|
|
2149
|
-
editorId:
|
|
2150
|
-
}),
|
|
2151
|
-
editorId:
|
|
2152
|
-
}),
|
|
2153
|
-
|
|
2155
|
+
} = e, s = Q(), c = gt(e);
|
|
2156
|
+
Ne(e, {
|
|
2157
|
+
rootRef: s,
|
|
2158
|
+
editorId: c
|
|
2159
|
+
}), pt(e, t, {
|
|
2160
|
+
editorId: c
|
|
2161
|
+
}), re(() => {
|
|
2162
|
+
w.clear(c);
|
|
2154
2163
|
});
|
|
2155
|
-
const
|
|
2156
|
-
e.onChange?.(
|
|
2157
|
-
},
|
|
2158
|
-
e.onHtmlChanged?.(
|
|
2159
|
-
}, r = (
|
|
2160
|
-
e.onGetCatalog?.(
|
|
2161
|
-
},
|
|
2164
|
+
const u = (l) => {
|
|
2165
|
+
e.onChange?.(l), t.emit("onChange", l), t.emit("update:modelValue", l);
|
|
2166
|
+
}, d = (l) => {
|
|
2167
|
+
e.onHtmlChanged?.(l), t.emit("onHtmlChanged", l);
|
|
2168
|
+
}, r = (l) => {
|
|
2169
|
+
e.onGetCatalog?.(l), t.emit("onGetCatalog", l);
|
|
2170
|
+
}, i = () => {
|
|
2162
2171
|
e.onRemount?.(), t.emit("onRemount");
|
|
2163
2172
|
};
|
|
2164
|
-
return () =>
|
|
2165
|
-
id:
|
|
2166
|
-
class: [
|
|
2173
|
+
return () => Z("div", {
|
|
2174
|
+
id: c,
|
|
2175
|
+
class: [f, e.class, `${f}-previewOnly`],
|
|
2167
2176
|
"data-theme": e.theme,
|
|
2168
2177
|
style: e.style,
|
|
2169
|
-
ref:
|
|
2170
|
-
}, [
|
|
2178
|
+
ref: s
|
|
2179
|
+
}, [Z(Zt, {
|
|
2171
2180
|
modelValue: e.modelValue,
|
|
2172
|
-
onChange:
|
|
2173
|
-
onHtmlChanged:
|
|
2181
|
+
onChange: u,
|
|
2182
|
+
onHtmlChanged: d,
|
|
2174
2183
|
onGetCatalog: r,
|
|
2175
2184
|
mdHeadingId: e.mdHeadingId,
|
|
2176
2185
|
noMermaid: o,
|
|
@@ -2183,27 +2192,27 @@ const oe = new bt({
|
|
|
2183
2192
|
sanitizeMermaid: e.sanitizeMermaid,
|
|
2184
2193
|
codeFoldable: e.codeFoldable,
|
|
2185
2194
|
autoFoldThreshold: e.autoFoldThreshold,
|
|
2186
|
-
onRemount:
|
|
2195
|
+
onRemount: i,
|
|
2187
2196
|
noEcharts: e.noEcharts,
|
|
2188
2197
|
previewComponent: e.previewComponent
|
|
2189
2198
|
}, null)]);
|
|
2190
2199
|
}
|
|
2191
2200
|
});
|
|
2192
|
-
|
|
2201
|
+
me.install = (e) => (e.component(me.name, me), e);
|
|
2193
2202
|
export {
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2203
|
+
B as C,
|
|
2204
|
+
me as M,
|
|
2205
|
+
Zt as a,
|
|
2206
|
+
bn as b,
|
|
2207
|
+
vn as c,
|
|
2208
|
+
yn as d,
|
|
2209
|
+
pe as e,
|
|
2210
|
+
hn as f,
|
|
2211
|
+
pn as g,
|
|
2212
|
+
dn as h,
|
|
2213
|
+
mn as i,
|
|
2214
|
+
fn as j,
|
|
2215
|
+
gn as k,
|
|
2216
|
+
un as l,
|
|
2217
|
+
gt as u
|
|
2209
2218
|
};
|