md-editor-v3 6.5.1 → 6.5.3
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/MdCatalog.cjs +1 -1
- package/lib/cjs/MdEditor.cjs +2 -2
- package/lib/cjs/MdPreview.cjs +1 -1
- package/lib/cjs/chunks/index3.cjs +1 -65
- package/lib/cjs/chunks/index4.cjs +65 -1
- package/lib/cjs/index.cjs +2 -2
- package/lib/es/MdCatalog.mjs +1 -1
- package/lib/es/MdEditor.mjs +13 -9
- package/lib/es/MdPreview.mjs +1 -1
- package/lib/es/chunks/config.mjs +2 -2
- package/lib/es/chunks/event-bus.mjs +7 -7
- package/lib/es/chunks/index3.mjs +389 -2026
- package/lib/es/chunks/index4.mjs +2017 -378
- package/lib/es/chunks/index5.mjs +2 -2
- package/lib/es/config.mjs +1 -1
- package/lib/es/index.mjs +4 -4
- package/lib/preview.css +201 -1
- package/lib/style.css +898 -1
- package/lib/types/index.d.ts +1 -1
- package/package.json +3 -3
package/lib/es/chunks/index3.mjs
CHANGED
|
@@ -1,2012 +1,308 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
cropperjs: `${f}-cropper`,
|
|
19
|
-
croppercss: `${f}-cropperCss`,
|
|
20
|
-
screenfull: `${f}-screenfull`,
|
|
21
|
-
mermaidM: `${f}-mermaid-m`,
|
|
22
|
-
mermaid: `${f}-mermaid`,
|
|
23
|
-
katexjs: `${f}-katex`,
|
|
24
|
-
katexcss: `${f}-katexCss`,
|
|
25
|
-
echarts: `${f}-echarts`
|
|
26
|
-
}, Zt = (e, t, r) => {
|
|
27
|
-
const { editorId: n } = r, o = re({
|
|
28
|
-
// 是否已编译成html
|
|
29
|
-
buildFinished: !1,
|
|
30
|
-
// 存储当前最新的html
|
|
31
|
-
html: ""
|
|
32
|
-
});
|
|
33
|
-
E(
|
|
34
|
-
() => e.modelValue,
|
|
35
|
-
() => {
|
|
36
|
-
o.buildFinished = !1;
|
|
37
|
-
}
|
|
38
|
-
), H(() => {
|
|
39
|
-
v.on(n, {
|
|
40
|
-
name: X,
|
|
41
|
-
callback(m) {
|
|
42
|
-
o.buildFinished = !0, o.html = m;
|
|
43
|
-
}
|
|
44
|
-
}), v.on(n, {
|
|
45
|
-
name: ke,
|
|
46
|
-
callback() {
|
|
47
|
-
const m = new Promise((d) => {
|
|
48
|
-
if (o.buildFinished)
|
|
49
|
-
d(o.html);
|
|
50
|
-
else {
|
|
51
|
-
const u = (s) => {
|
|
52
|
-
d(s), v.remove(n, X, u);
|
|
53
|
-
};
|
|
54
|
-
v.on(n, {
|
|
55
|
-
name: X,
|
|
56
|
-
callback: u
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
e.onSave ? e.onSave(e.modelValue, m) : t.emit("onSave", e.modelValue, m);
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
});
|
|
64
|
-
}, Te = (e, {
|
|
65
|
-
editorId: t,
|
|
66
|
-
rootRef: r,
|
|
67
|
-
setting: n
|
|
68
|
-
}) => {
|
|
69
|
-
const o = P.editorExtensions.highlight, m = P.editorExtensionsAttrs.highlight;
|
|
70
|
-
I("editorId", t), I("rootRef", r), I(
|
|
71
|
-
"theme",
|
|
72
|
-
A(() => e.theme)
|
|
73
|
-
), I(
|
|
74
|
-
"language",
|
|
75
|
-
A(() => e.language)
|
|
76
|
-
), I(
|
|
77
|
-
"highlight",
|
|
78
|
-
A(() => {
|
|
79
|
-
const { js: u } = o, s = {
|
|
80
|
-
...ue,
|
|
81
|
-
...o.css
|
|
82
|
-
}, { js: l, css: i = {} } = m || {}, a = e.codeStyleReverse && e.codeStyleReverseList.includes(e.previewTheme) ? "dark" : e.theme, c = s[e.codeTheme] ? s[e.codeTheme][a] : ue.atom[a], $ = s[e.codeTheme] && i[e.codeTheme] ? i[e.codeTheme][a] : i.atom ? i.atom[a] : {};
|
|
83
|
-
return {
|
|
84
|
-
js: {
|
|
85
|
-
src: u,
|
|
86
|
-
...l
|
|
87
|
-
},
|
|
88
|
-
css: {
|
|
89
|
-
href: c,
|
|
90
|
-
...$
|
|
91
|
-
}
|
|
92
|
-
};
|
|
93
|
-
})
|
|
94
|
-
), I("showCodeRowNumber", e.showCodeRowNumber);
|
|
95
|
-
const d = A(() => {
|
|
96
|
-
const u = {
|
|
97
|
-
...me,
|
|
98
|
-
...P.editorConfig.languageUserDefined
|
|
99
|
-
};
|
|
100
|
-
return Me(
|
|
101
|
-
Pe(me["en-US"]),
|
|
102
|
-
u[e.language] || {}
|
|
103
|
-
);
|
|
104
|
-
});
|
|
105
|
-
return I("usedLanguageText", d), I(
|
|
106
|
-
"previewTheme",
|
|
107
|
-
A(() => e.previewTheme)
|
|
108
|
-
), I(
|
|
109
|
-
"customIcon",
|
|
110
|
-
A(() => e.customIcon)
|
|
111
|
-
), I(
|
|
112
|
-
"setting",
|
|
113
|
-
A(() => n ? {
|
|
114
|
-
// setting是reactive,不转化是可以直接赋值的
|
|
115
|
-
...n
|
|
116
|
-
} : {
|
|
117
|
-
preview: !0,
|
|
118
|
-
htmlPreview: !1,
|
|
119
|
-
previewOnly: !1,
|
|
120
|
-
pageFullscreen: !1,
|
|
121
|
-
fullscreen: !1
|
|
122
|
-
})
|
|
123
|
-
), { editorId: t };
|
|
124
|
-
}, Jt = (e, t) => (I("tabWidth", e.tabWidth), I(
|
|
125
|
-
"disabled",
|
|
126
|
-
A(() => e.disabled)
|
|
127
|
-
), I(
|
|
128
|
-
"showToolbarName",
|
|
129
|
-
A(() => e.showToolbarName)
|
|
130
|
-
), I("noUploadImg", e.noUploadImg), I(
|
|
131
|
-
"tableShape",
|
|
132
|
-
A(() => e.tableShape)
|
|
133
|
-
), I("noPrettier", e.noPrettier), I(
|
|
134
|
-
"codeTheme",
|
|
135
|
-
A(() => e.codeTheme)
|
|
136
|
-
), I("updateSetting", t.updateSetting), I(
|
|
137
|
-
"catalogVisible",
|
|
138
|
-
A(() => t.catalogVisible.value)
|
|
139
|
-
), I("defToolbars", t.defToolbars), I(
|
|
140
|
-
"floatingToolbars",
|
|
141
|
-
A(() => e.floatingToolbars)
|
|
142
|
-
), Te(e, t)), Xt = (e) => {
|
|
143
|
-
const { noPrettier: t, noUploadImg: r } = e, { editorExtensions: n, editorExtensionsAttrs: o } = P, m = t || n.prettier.prettierInstance, d = t || n.prettier.parserMarkdownInstance, u = r || n.cropper.instance;
|
|
144
|
-
H(() => {
|
|
145
|
-
if (!u) {
|
|
146
|
-
const { js: s = {}, css: l = {} } = o.cropper || {};
|
|
147
|
-
O("link", {
|
|
148
|
-
...l,
|
|
149
|
-
rel: "stylesheet",
|
|
150
|
-
href: n.cropper.css,
|
|
151
|
-
id: M.croppercss
|
|
152
|
-
}), O("script", {
|
|
153
|
-
...s,
|
|
154
|
-
src: n.cropper.js,
|
|
155
|
-
id: M.cropperjs
|
|
156
|
-
});
|
|
157
|
-
}
|
|
158
|
-
if (!m) {
|
|
159
|
-
const { standaloneJs: s = {} } = o.prettier || {};
|
|
160
|
-
O("script", {
|
|
161
|
-
...s,
|
|
162
|
-
src: n.prettier.standaloneJs,
|
|
163
|
-
id: M.prettier
|
|
164
|
-
});
|
|
165
|
-
}
|
|
166
|
-
if (!d) {
|
|
167
|
-
const { parserMarkdownJs: s = {} } = o.prettier || {};
|
|
168
|
-
O("script", {
|
|
169
|
-
...s,
|
|
170
|
-
src: n.prettier.parserMarkdownJs,
|
|
171
|
-
id: M.prettierMD
|
|
172
|
-
});
|
|
173
|
-
}
|
|
174
|
-
});
|
|
175
|
-
}, Yt = (e, t, r) => {
|
|
176
|
-
const { editorId: n } = r;
|
|
177
|
-
H(() => {
|
|
178
|
-
v.on(n, {
|
|
179
|
-
name: Q,
|
|
180
|
-
callback: (o) => {
|
|
181
|
-
e.onError?.(o), t.emit("onError", o);
|
|
182
|
-
}
|
|
183
|
-
});
|
|
184
|
-
});
|
|
185
|
-
}, Qt = (e, t, r) => {
|
|
186
|
-
const { editorId: n } = r, o = re({
|
|
187
|
-
pageFullscreen: e.pageFullscreen,
|
|
188
|
-
fullscreen: !1,
|
|
189
|
-
preview: e.preview,
|
|
190
|
-
htmlPreview: e.preview ? !1 : e.htmlPreview,
|
|
191
|
-
previewOnly: !1
|
|
192
|
-
}), m = re({ ...o }), d = (l, i) => {
|
|
193
|
-
const a = i === void 0 ? !o[l] : i;
|
|
194
|
-
switch (l) {
|
|
195
|
-
case "preview": {
|
|
196
|
-
o.htmlPreview = !1, o.previewOnly = !1;
|
|
197
|
-
break;
|
|
198
|
-
}
|
|
199
|
-
case "htmlPreview": {
|
|
200
|
-
o.preview = !1, o.previewOnly = !1;
|
|
201
|
-
break;
|
|
202
|
-
}
|
|
203
|
-
case "previewOnly": {
|
|
204
|
-
a ? !o.preview && !o.htmlPreview && (o.preview = !0) : (m.preview || (o.preview = !1), m.htmlPreview || (o.htmlPreview = !1));
|
|
205
|
-
break;
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
m[l] = a, o[l] = a;
|
|
209
|
-
};
|
|
210
|
-
let u = "";
|
|
211
|
-
const s = () => {
|
|
212
|
-
o.pageFullscreen || o.fullscreen ? document.body.style.overflow = "hidden" : document.body.style.overflow = u;
|
|
213
|
-
};
|
|
214
|
-
return E(() => [o.pageFullscreen, o.fullscreen], s), H(() => {
|
|
215
|
-
v.on(n, {
|
|
216
|
-
name: Be,
|
|
217
|
-
callback(l, i) {
|
|
218
|
-
const a = (c) => {
|
|
219
|
-
v.emit(n, ie, "image", {
|
|
220
|
-
desc: "",
|
|
221
|
-
urls: c
|
|
222
|
-
}), i?.();
|
|
223
|
-
};
|
|
224
|
-
e.onUploadImg ? e.onUploadImg(l, a) : t.emit("onUploadImg", l, a);
|
|
225
|
-
}
|
|
226
|
-
}), u = document.body.style.overflow, s();
|
|
227
|
-
}), [o, d];
|
|
228
|
-
}, en = (e, t) => {
|
|
229
|
-
const { editorId: r } = t, n = G(!1);
|
|
230
|
-
return H(() => {
|
|
231
|
-
v.on(r, {
|
|
232
|
-
name: Ee,
|
|
233
|
-
callback: (o) => {
|
|
234
|
-
o === void 0 ? n.value = !n.value : n.value = o;
|
|
235
|
-
}
|
|
236
|
-
});
|
|
237
|
-
}), n;
|
|
238
|
-
}, tn = (e, t, r) => {
|
|
239
|
-
const { editorId: n, catalogVisible: o, setting: m, updateSetting: d, codeRef: u } = r;
|
|
240
|
-
E(
|
|
241
|
-
() => m.pageFullscreen,
|
|
242
|
-
(l) => {
|
|
243
|
-
v.emit(n, fe, l);
|
|
244
|
-
}
|
|
245
|
-
), E(
|
|
246
|
-
() => m.fullscreen,
|
|
247
|
-
(l) => {
|
|
248
|
-
v.emit(n, he, l);
|
|
249
|
-
}
|
|
250
|
-
), E(
|
|
251
|
-
() => m.preview,
|
|
252
|
-
(l) => {
|
|
253
|
-
v.emit(n, pe, l);
|
|
254
|
-
}
|
|
255
|
-
), E(
|
|
256
|
-
() => m.previewOnly,
|
|
257
|
-
(l) => {
|
|
258
|
-
v.emit(n, ge, l);
|
|
259
|
-
}
|
|
260
|
-
), E(
|
|
261
|
-
() => m.htmlPreview,
|
|
262
|
-
(l) => {
|
|
263
|
-
v.emit(n, ve, l);
|
|
264
|
-
}
|
|
265
|
-
), E(o, (l) => {
|
|
266
|
-
v.emit(n, ye, l);
|
|
267
|
-
});
|
|
268
|
-
const s = {
|
|
269
|
-
on(l, i) {
|
|
270
|
-
switch (l) {
|
|
271
|
-
case "pageFullscreen": {
|
|
272
|
-
v.on(n, {
|
|
273
|
-
name: fe,
|
|
274
|
-
callback(a) {
|
|
275
|
-
i(a);
|
|
276
|
-
}
|
|
277
|
-
});
|
|
278
|
-
break;
|
|
279
|
-
}
|
|
280
|
-
case "fullscreen": {
|
|
281
|
-
v.on(n, {
|
|
282
|
-
name: he,
|
|
283
|
-
callback(a) {
|
|
284
|
-
i(a);
|
|
285
|
-
}
|
|
286
|
-
});
|
|
287
|
-
break;
|
|
288
|
-
}
|
|
289
|
-
case "preview": {
|
|
290
|
-
v.on(n, {
|
|
291
|
-
name: pe,
|
|
292
|
-
callback(a) {
|
|
293
|
-
i(a);
|
|
294
|
-
}
|
|
295
|
-
});
|
|
296
|
-
break;
|
|
297
|
-
}
|
|
298
|
-
case "previewOnly": {
|
|
299
|
-
v.on(n, {
|
|
300
|
-
name: ge,
|
|
301
|
-
callback(a) {
|
|
302
|
-
i(a);
|
|
303
|
-
}
|
|
304
|
-
});
|
|
305
|
-
break;
|
|
306
|
-
}
|
|
307
|
-
case "htmlPreview": {
|
|
308
|
-
v.on(n, {
|
|
309
|
-
name: ve,
|
|
310
|
-
callback(a) {
|
|
311
|
-
i(a);
|
|
312
|
-
}
|
|
313
|
-
});
|
|
314
|
-
break;
|
|
315
|
-
}
|
|
316
|
-
case "catalog": {
|
|
317
|
-
v.on(n, {
|
|
318
|
-
name: ye,
|
|
319
|
-
callback(a) {
|
|
320
|
-
i(a);
|
|
321
|
-
}
|
|
322
|
-
});
|
|
323
|
-
break;
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
},
|
|
327
|
-
togglePageFullscreen(l) {
|
|
328
|
-
d("pageFullscreen", l);
|
|
329
|
-
},
|
|
330
|
-
toggleFullscreen(l) {
|
|
331
|
-
v.emit(n, Ne, l);
|
|
332
|
-
},
|
|
333
|
-
togglePreview(l) {
|
|
334
|
-
d("preview", l);
|
|
335
|
-
},
|
|
336
|
-
togglePreviewOnly(l) {
|
|
337
|
-
d("previewOnly", l);
|
|
338
|
-
},
|
|
339
|
-
toggleHtmlPreview(l) {
|
|
340
|
-
d("htmlPreview", l);
|
|
341
|
-
},
|
|
342
|
-
toggleCatalog(l) {
|
|
343
|
-
v.emit(n, Ee, l);
|
|
344
|
-
},
|
|
345
|
-
triggerSave() {
|
|
346
|
-
v.emit(n, ke);
|
|
347
|
-
},
|
|
348
|
-
insert(l) {
|
|
349
|
-
v.emit(n, ie, "universal", { generate: l });
|
|
350
|
-
},
|
|
351
|
-
focus(l) {
|
|
352
|
-
u.value?.focus(l);
|
|
353
|
-
},
|
|
354
|
-
rerender() {
|
|
355
|
-
v.emit(n, de);
|
|
356
|
-
},
|
|
357
|
-
getSelectedText() {
|
|
358
|
-
return u.value?.getSelectedText();
|
|
359
|
-
},
|
|
360
|
-
resetHistory() {
|
|
361
|
-
u.value?.resetHistory();
|
|
362
|
-
},
|
|
363
|
-
domEventHandlers(l) {
|
|
364
|
-
v.emit(n, je, l);
|
|
365
|
-
},
|
|
366
|
-
execCommand(l) {
|
|
367
|
-
v.emit(n, ie, l);
|
|
368
|
-
},
|
|
369
|
-
getEditorView() {
|
|
370
|
-
return u.value?.getEditorView();
|
|
371
|
-
}
|
|
372
|
-
};
|
|
373
|
-
t.expose(s);
|
|
374
|
-
}, et = (e) => {
|
|
375
|
-
const t = Fe();
|
|
376
|
-
return e.id || e.editorId || `${f}-${t}`;
|
|
377
|
-
}, tt = (e, t, r) => {
|
|
378
|
-
const n = C("editorId"), o = C("rootRef"), m = C("usedLanguageText"), d = C("setting"), u = () => {
|
|
379
|
-
o.value.querySelectorAll(`#${n} .${f}-preview .${f}-code`).forEach((i) => {
|
|
380
|
-
let a = -1;
|
|
381
|
-
const c = i.querySelector(
|
|
382
|
-
`.${f}-copy-button:not([data-processed])`
|
|
383
|
-
);
|
|
384
|
-
c && (c.onclick = ($) => {
|
|
385
|
-
$.preventDefault(), clearTimeout(a);
|
|
386
|
-
const g = (i.querySelector("input:checked + pre code") || i.querySelector("pre code")).textContent, { text: h, successTips: T, failTips: y } = m.value.copyCode;
|
|
387
|
-
let b = T;
|
|
388
|
-
qe(e.formatCopiedText(g || "")).catch(() => {
|
|
389
|
-
b = y;
|
|
390
|
-
}).finally(() => {
|
|
391
|
-
c.dataset.isIcon ? c.dataset.tips = b : c.innerHTML = b, a = window.setTimeout(() => {
|
|
392
|
-
c.dataset.isIcon ? c.dataset.tips = h : c.innerHTML = h;
|
|
393
|
-
}, 1500);
|
|
394
|
-
});
|
|
395
|
-
}, c.setAttribute("data-processed", "true"));
|
|
396
|
-
});
|
|
397
|
-
}, s = () => {
|
|
398
|
-
U(u);
|
|
399
|
-
}, l = (i) => {
|
|
400
|
-
i && U(u);
|
|
401
|
-
};
|
|
402
|
-
E([t, r], s), E(() => d.value.preview, l), E(() => d.value.htmlPreview, l), H(u);
|
|
403
|
-
}, nt = (e) => {
|
|
404
|
-
const t = C("editorId"), r = C("theme"), n = C("rootRef"), { editorExtensions: o, editorExtensionsAttrs: m, echartsConfig: d } = P;
|
|
405
|
-
let u = o.echarts.instance;
|
|
406
|
-
const s = ee(-1), l = () => {
|
|
407
|
-
!e.noEcharts && u && (s.value = s.value + 1);
|
|
408
|
-
};
|
|
409
|
-
E(
|
|
410
|
-
() => r.value,
|
|
411
|
-
() => {
|
|
412
|
-
l();
|
|
413
|
-
}
|
|
414
|
-
), H(() => {
|
|
415
|
-
if (e.noEcharts || u)
|
|
416
|
-
return;
|
|
417
|
-
const g = o.echarts.js;
|
|
418
|
-
O(
|
|
419
|
-
"script",
|
|
420
|
-
{
|
|
421
|
-
...m.echarts?.js,
|
|
422
|
-
src: g,
|
|
423
|
-
id: M.echarts,
|
|
424
|
-
onload() {
|
|
425
|
-
u = window.echarts, l();
|
|
426
|
-
}
|
|
427
|
-
},
|
|
428
|
-
"echarts"
|
|
429
|
-
);
|
|
430
|
-
});
|
|
431
|
-
let i = [], a = [], c = [];
|
|
432
|
-
const $ = (g = !1) => {
|
|
433
|
-
if (!i.length) {
|
|
434
|
-
g && (a.forEach((b) => {
|
|
435
|
-
b.dispose?.();
|
|
436
|
-
}), c.forEach((b) => {
|
|
437
|
-
b.disconnect?.();
|
|
438
|
-
}), a = [], c = []);
|
|
439
|
-
return;
|
|
440
|
-
}
|
|
441
|
-
const h = [], T = [], y = [];
|
|
442
|
-
i.forEach((b, S) => {
|
|
443
|
-
const w = a[S], F = c[S];
|
|
444
|
-
if (g || !b || !b.isConnected || (n?.value ? !n.value.contains(b) : !1)) {
|
|
445
|
-
w?.dispose?.(), F?.disconnect?.();
|
|
446
|
-
return;
|
|
447
|
-
}
|
|
448
|
-
h.push(b), w && T.push(w), F && y.push(F);
|
|
449
|
-
}), i = h, a = T, c = y;
|
|
450
|
-
}, p = () => {
|
|
451
|
-
$(), !e.noEcharts && u && Array.from(
|
|
452
|
-
n.value.querySelectorAll(
|
|
453
|
-
`#${t} div.${f}-echarts:not([data-processed])`
|
|
454
|
-
)
|
|
455
|
-
).forEach((h) => {
|
|
456
|
-
if (h.dataset.closed === "false")
|
|
457
|
-
return !1;
|
|
458
|
-
try {
|
|
459
|
-
const T = o.echarts.parseOption(h.innerText, {
|
|
460
|
-
editorId: t,
|
|
461
|
-
element: h
|
|
462
|
-
}), y = d(T), b = u.init(h, r.value);
|
|
463
|
-
b.setOption(y), h.setAttribute("data-processed", ""), i.push(h), a.push(b);
|
|
464
|
-
const S = new ResizeObserver(() => {
|
|
465
|
-
b.resize();
|
|
466
|
-
});
|
|
467
|
-
S.observe(h), c.push(S);
|
|
468
|
-
} catch (T) {
|
|
469
|
-
v.emit(t, Q, {
|
|
470
|
-
name: "echarts",
|
|
471
|
-
message: T?.message,
|
|
472
|
-
error: T
|
|
473
|
-
});
|
|
474
|
-
}
|
|
475
|
-
});
|
|
1
|
+
import { defineComponent as z, inject as q, ref as D, watch as J, onMounted as K, createVNode as N, reactive as X, shallowRef as G, provide as V, computed as Y, onBeforeUnmount as Z, Fragment as ee } from "vue";
|
|
2
|
+
import { p as O } from "./config.mjs";
|
|
3
|
+
import { b as $, f as j, G as U, P as te, S as le } from "./event-bus.mjs";
|
|
4
|
+
import { g as ne } from "./index5.mjs";
|
|
5
|
+
import { createSmoothScroll as oe, debounce as ie } from "@vavt/util";
|
|
6
|
+
const ce = `.${O}-preview > [data-line]`, w = (e, l) => +getComputedStyle(e).getPropertyValue(l).replace("px", ""), ve = (e, l) => {
|
|
7
|
+
const b = ie(() => {
|
|
8
|
+
e.removeEventListener("scroll", o), e.addEventListener("scroll", o), l.removeEventListener("scroll", o), l.addEventListener("scroll", o);
|
|
9
|
+
}, 50), o = (E) => {
|
|
10
|
+
const m = e.clientHeight, y = l.clientHeight, f = e.scrollHeight, s = l.scrollHeight, r = (f - m) / (s - y);
|
|
11
|
+
E.target === e ? (l.removeEventListener("scroll", o), l.scrollTo({
|
|
12
|
+
top: e.scrollTop / r
|
|
13
|
+
// behavior: 'smooth'
|
|
14
|
+
}), b()) : (e.removeEventListener("scroll", o), e.scrollTo({
|
|
15
|
+
top: l.scrollTop * r
|
|
16
|
+
// behavior: 'smooth'
|
|
17
|
+
}), b());
|
|
476
18
|
};
|
|
477
|
-
return
|
|
478
|
-
$(!0);
|
|
479
|
-
}), { reRenderEcharts: s, replaceEcharts: p };
|
|
480
|
-
}, ot = (e) => {
|
|
481
|
-
const t = C("highlight"), r = ee(P.editorExtensions.highlight.instance);
|
|
482
|
-
return H(() => {
|
|
483
|
-
e.noHighlight || r.value || (O("link", {
|
|
484
|
-
...t.value.css,
|
|
485
|
-
rel: "stylesheet",
|
|
486
|
-
id: M.hlcss
|
|
487
|
-
}), O(
|
|
488
|
-
"script",
|
|
489
|
-
{
|
|
490
|
-
...t.value.js,
|
|
491
|
-
id: M.hljs,
|
|
492
|
-
onload() {
|
|
493
|
-
r.value = window.hljs;
|
|
494
|
-
}
|
|
495
|
-
},
|
|
496
|
-
"hljs"
|
|
497
|
-
));
|
|
498
|
-
}), E(
|
|
499
|
-
() => t.value.css,
|
|
19
|
+
return [
|
|
500
20
|
() => {
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
rel: "stylesheet",
|
|
504
|
-
id: M.hlcss
|
|
21
|
+
b().finally(() => {
|
|
22
|
+
e.dispatchEvent(new Event("scroll"));
|
|
505
23
|
});
|
|
506
|
-
}
|
|
507
|
-
), r;
|
|
508
|
-
}, at = (e) => {
|
|
509
|
-
const t = ee(P.editorExtensions.katex.instance);
|
|
510
|
-
return H(() => {
|
|
511
|
-
if (e.noKatex || t.value)
|
|
512
|
-
return;
|
|
513
|
-
const { editorExtensions: r, editorExtensionsAttrs: n } = P;
|
|
514
|
-
O(
|
|
515
|
-
"script",
|
|
516
|
-
{
|
|
517
|
-
...n.katex?.js,
|
|
518
|
-
src: r.katex.js,
|
|
519
|
-
id: M.katexjs,
|
|
520
|
-
onload() {
|
|
521
|
-
t.value = window.katex;
|
|
522
|
-
}
|
|
523
|
-
},
|
|
524
|
-
"katex"
|
|
525
|
-
), O("link", {
|
|
526
|
-
...n.katex?.css,
|
|
527
|
-
rel: "stylesheet",
|
|
528
|
-
href: r.katex.css,
|
|
529
|
-
id: M.katexcss
|
|
530
|
-
});
|
|
531
|
-
}), t;
|
|
532
|
-
};
|
|
533
|
-
class rt {
|
|
534
|
-
constructor(t) {
|
|
535
|
-
this.options = t;
|
|
536
|
-
}
|
|
537
|
-
cache = /* @__PURE__ */ new Map();
|
|
538
|
-
isExpired(t) {
|
|
539
|
-
return t.expiresAt <= Date.now();
|
|
540
|
-
}
|
|
541
|
-
deleteExpired(t, r) {
|
|
542
|
-
const n = r ?? this.cache.get(t);
|
|
543
|
-
return !n || !this.isExpired(n) ? !1 : (this.cache.delete(t), !0);
|
|
544
|
-
}
|
|
545
|
-
trim() {
|
|
546
|
-
for (const [t, r] of this.cache)
|
|
547
|
-
if (!this.deleteExpired(t, r))
|
|
548
|
-
break;
|
|
549
|
-
for (; this.cache.size > this.options.max; ) {
|
|
550
|
-
const t = this.cache.keys().next().value;
|
|
551
|
-
if (t === void 0)
|
|
552
|
-
break;
|
|
553
|
-
this.cache.delete(t);
|
|
554
|
-
}
|
|
555
|
-
}
|
|
556
|
-
get(t) {
|
|
557
|
-
const r = this.cache.get(t);
|
|
558
|
-
if (!(!r || this.deleteExpired(t, r)))
|
|
559
|
-
return this.cache.delete(t), this.cache.set(t, r), r.value;
|
|
560
|
-
}
|
|
561
|
-
set(t, r) {
|
|
562
|
-
this.cache.delete(t), this.cache.set(t, {
|
|
563
|
-
value: r,
|
|
564
|
-
expiresAt: Date.now() + this.options.ttl
|
|
565
|
-
}), this.trim();
|
|
566
|
-
}
|
|
567
|
-
clear() {
|
|
568
|
-
this.cache.clear();
|
|
569
|
-
}
|
|
570
|
-
}
|
|
571
|
-
const Y = new rt({
|
|
572
|
-
max: 1e3,
|
|
573
|
-
// 缓存10分钟
|
|
574
|
-
ttl: 6e5
|
|
575
|
-
}), lt = (e) => {
|
|
576
|
-
const t = C("editorId"), r = C("theme"), n = C("rootRef"), { editorExtensions: o, editorExtensionsAttrs: m, mermaidConfig: d } = P;
|
|
577
|
-
let u = o.mermaid.instance;
|
|
578
|
-
const s = ee(-1), l = () => {
|
|
579
|
-
if (!e.noMermaid && u) {
|
|
580
|
-
const a = r.value === "dark" ? {
|
|
581
|
-
startOnLoad: !1,
|
|
582
|
-
theme: "dark"
|
|
583
|
-
} : {
|
|
584
|
-
startOnLoad: !1,
|
|
585
|
-
theme: "base",
|
|
586
|
-
themeVariables: {
|
|
587
|
-
background: "#ffffff",
|
|
588
|
-
primaryColor: "#ffffff",
|
|
589
|
-
primaryTextColor: "#1f2329",
|
|
590
|
-
primaryBorderColor: "#b7c0cc",
|
|
591
|
-
secondaryColor: "#f7f8fa",
|
|
592
|
-
tertiaryColor: "#f7f8fa",
|
|
593
|
-
lineColor: "#596273",
|
|
594
|
-
edgeLabelBackground: "#ffffff",
|
|
595
|
-
clusterBkg: "#ffffff",
|
|
596
|
-
clusterBorder: "#b7c0cc"
|
|
597
|
-
}
|
|
598
|
-
};
|
|
599
|
-
u.initialize(d(a)), s.value = s.value + 1;
|
|
600
|
-
}
|
|
601
|
-
};
|
|
602
|
-
return E(
|
|
603
|
-
() => r.value,
|
|
24
|
+
},
|
|
604
25
|
() => {
|
|
605
|
-
|
|
26
|
+
e.removeEventListener("scroll", o), l.removeEventListener("scroll", o);
|
|
606
27
|
}
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
}).catch((c) => {
|
|
623
|
-
v.emit(t, Q, {
|
|
624
|
-
name: "mermaid",
|
|
625
|
-
message: `Failed to load mermaid module: ${c.message}`,
|
|
626
|
-
error: c
|
|
28
|
+
];
|
|
29
|
+
}, he = (e, l, b) => {
|
|
30
|
+
const { view: o } = b, E = oe(), m = (i) => o.lineBlockAt(o.state.doc.line(i + 1).from).top, y = (i) => o.lineBlockAt(o.state.doc.line(i + 1).from).bottom;
|
|
31
|
+
let f = [], s = [], r = [];
|
|
32
|
+
const L = () => {
|
|
33
|
+
f = [], s = Array.from(
|
|
34
|
+
l.querySelectorAll(ce)
|
|
35
|
+
), r = s.map((n) => Number(n.dataset.line));
|
|
36
|
+
const i = [...r], { lines: h } = o.state.doc;
|
|
37
|
+
i[0] !== 0 && i.unshift(0);
|
|
38
|
+
let H = i.shift() || 0, t = i.shift() || h;
|
|
39
|
+
for (let n = 0; n < h; n++)
|
|
40
|
+
n === t && (H = n, t = i.shift() || h), f.push({
|
|
41
|
+
start: H,
|
|
42
|
+
end: t - 1
|
|
627
43
|
});
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
onload() {
|
|
635
|
-
u = window.mermaid, l();
|
|
636
|
-
}
|
|
637
|
-
},
|
|
638
|
-
"mermaid"
|
|
639
|
-
);
|
|
640
|
-
}), { reRenderRef: s, replaceMermaid: async () => {
|
|
641
|
-
if (!e.noMermaid && u) {
|
|
642
|
-
const a = n.value.querySelectorAll(
|
|
643
|
-
`div.${f}-mermaid`
|
|
644
|
-
), c = document.createElement("div"), $ = document.body.offsetWidth > 1366 ? document.body.offsetWidth : 1366, p = document.body.offsetHeight > 768 ? document.body.offsetHeight : 768;
|
|
645
|
-
c.style.width = $ + "px", c.style.height = p + "px", c.style.position = "fixed", c.style.zIndex = "-10000", c.style.top = "-10000";
|
|
646
|
-
let g = a.length;
|
|
647
|
-
g > 0 && document.body.appendChild(c), await Promise.allSettled(
|
|
648
|
-
Array.from(a).map((h) => (async (y) => {
|
|
649
|
-
if (y.dataset.closed === "false")
|
|
650
|
-
return !1;
|
|
651
|
-
const b = y.innerText;
|
|
652
|
-
let S = Y.get(b);
|
|
653
|
-
if (!S) {
|
|
654
|
-
const w = le();
|
|
655
|
-
let F = { svg: "" };
|
|
656
|
-
try {
|
|
657
|
-
F = await u.render(w, b, c), S = await e.sanitizeMermaid(F.svg);
|
|
658
|
-
const x = document.createElement("p");
|
|
659
|
-
x.className = `${f}-mermaid`, x.setAttribute("data-processed", ""), x.setAttribute("data-content", b), x.innerHTML = S, x.children[0]?.removeAttribute("height"), Y.set(b, x.innerHTML), y.dataset.line !== void 0 && (x.dataset.line = y.dataset.line), y.replaceWith(x);
|
|
660
|
-
} catch (x) {
|
|
661
|
-
v.emit(t, Q, {
|
|
662
|
-
name: "mermaid",
|
|
663
|
-
message: x.message,
|
|
664
|
-
error: x
|
|
665
|
-
});
|
|
666
|
-
}
|
|
667
|
-
--g === 0 && c.remove();
|
|
668
|
-
}
|
|
669
|
-
})(h))
|
|
670
|
-
);
|
|
671
|
-
}
|
|
672
|
-
} };
|
|
673
|
-
}, it = (e, t) => {
|
|
674
|
-
t = t || {};
|
|
675
|
-
const r = 3, n = t.marker || "!", o = n.charCodeAt(0), m = n.length;
|
|
676
|
-
let d = "", u = "";
|
|
677
|
-
const s = (i, a, c, $, p) => {
|
|
678
|
-
const g = i[a];
|
|
679
|
-
return g.type === "admonition_open" ? i[a].attrPush([
|
|
680
|
-
"class",
|
|
681
|
-
`${f}-admonition ${f}-admonition-${g.info}`
|
|
682
|
-
]) : g.type === "admonition_title_open" && i[a].attrPush(["class", `${f}-admonition-title`]), p.renderToken(i, a, c);
|
|
683
|
-
}, l = (i) => {
|
|
684
|
-
const a = i.trim().split(" ", 2);
|
|
685
|
-
u = "", d = a[0], a.length > 1 && (u = i.substring(d.length + 2));
|
|
686
|
-
};
|
|
687
|
-
e.block.ruler.before(
|
|
688
|
-
"code",
|
|
689
|
-
"admonition",
|
|
690
|
-
(i, a, c, $) => {
|
|
691
|
-
let p, g, h, T = !1, y = i.bMarks[a] + i.tShift[a], b = i.eMarks[a];
|
|
692
|
-
if (o !== i.src.charCodeAt(y))
|
|
693
|
-
return !1;
|
|
694
|
-
for (p = y + 1; p <= b && n[(p - y) % m] === i.src[p]; p++)
|
|
695
|
-
;
|
|
696
|
-
const S = Math.floor((p - y) / m);
|
|
697
|
-
if (S !== r)
|
|
698
|
-
return !1;
|
|
699
|
-
p -= (p - y) % m;
|
|
700
|
-
const w = i.src.slice(y, p), F = i.src.slice(p, b);
|
|
701
|
-
if (l(F), $)
|
|
702
|
-
return !0;
|
|
703
|
-
for (g = a; g++, !(g >= c || (y = i.bMarks[g] + i.tShift[g], b = i.eMarks[g], y < b && i.sCount[g] < i.blkIndent)); )
|
|
704
|
-
if (o === i.src.charCodeAt(y) && !(i.sCount[g] - i.blkIndent >= 4)) {
|
|
705
|
-
for (p = y + 1; p <= b && n[(p - y) % m] === i.src[p]; p++)
|
|
706
|
-
;
|
|
707
|
-
if (!(Math.floor((p - y) / m) < S) && (p -= (p - y) % m, p = i.skipSpaces(p), !(p < b))) {
|
|
708
|
-
T = !0;
|
|
709
|
-
break;
|
|
710
|
-
}
|
|
711
|
-
}
|
|
712
|
-
const x = i.parentType, L = i.lineMax;
|
|
713
|
-
return i.parentType = "root", i.lineMax = g, h = i.push("admonition_open", "div", 1), h.markup = w, h.block = !0, h.info = d, h.map = [a, g], u && (h = i.push("admonition_title_open", "p", 1), h.markup = w + " " + d, h.map = [a, g], h = i.push("inline", "", 0), h.content = u, h.map = [a, i.line - 1], h.children = [], h = i.push("admonition_title_close", "p", -1), h.markup = w + " " + d), i.md.block.tokenize(i, a + 1, g), h = i.push("admonition_close", "div", -1), h.markup = i.src.slice(y, p), h.block = !0, i.parentType = x, i.lineMax = L, i.line = g + (T ? 1 : 0), !0;
|
|
714
|
-
},
|
|
715
|
-
{
|
|
716
|
-
alt: ["paragraph", "reference", "blockquote", "list"]
|
|
717
|
-
}
|
|
718
|
-
), e.renderer.rules.admonition_open = s, e.renderer.rules.admonition_title_open = s, e.renderer.rules.admonition_title_close = s, e.renderer.rules.admonition_close = s;
|
|
719
|
-
}, se = (e, t) => {
|
|
720
|
-
const r = e.attrs ? e.attrs.slice() : [];
|
|
721
|
-
return t.forEach((n) => {
|
|
722
|
-
const o = e.attrIndex(n[0]);
|
|
723
|
-
o < 0 ? r.push(n) : (r[o] = r[o].slice(), r[o][1] += ` ${n[1]}`);
|
|
724
|
-
}), r;
|
|
725
|
-
}, st = (e, t) => {
|
|
726
|
-
const r = e.renderer.rules.fence, n = e.utils.unescapeAll, o = /\[(\w*)(?::([\w ]*))?\]/, m = /::(open|close)/, d = (a) => a.info ? n(a.info).trim() : "", u = (a) => {
|
|
727
|
-
const c = d(a), [$ = null, p = ""] = (o.exec(c) || []).slice(1);
|
|
728
|
-
return [$, p];
|
|
729
|
-
}, s = (a) => {
|
|
730
|
-
const c = d(a);
|
|
731
|
-
return c ? c.split(/(\s+)/g)[0] : "";
|
|
732
|
-
}, l = (a) => {
|
|
733
|
-
const c = a.info.match(m) || [], $ = c[1] === "open" || c[1] !== "close" && t.codeFoldable && a.content.trim().split(`
|
|
734
|
-
`).length < t.autoFoldThreshold, p = c[1] || t.codeFoldable ? "details" : "div", g = c[1] || t.codeFoldable ? "summary" : "div";
|
|
735
|
-
return { open: $, tagContainer: p, tagHeader: g };
|
|
736
|
-
}, i = (a, c, $, p, g) => {
|
|
737
|
-
if (a[c].hidden)
|
|
738
|
-
return "";
|
|
739
|
-
const h = t.usedLanguageTextRef.value?.copyCode.text, T = t.customIconRef.value.copy || h, y = !!t.customIconRef.value.copy, b = `<span class="${f}-collapse-tips">${Ue("collapse-tips", t.customIconRef.value)}</span>`, [S] = u(a[c]);
|
|
740
|
-
if (S === null) {
|
|
741
|
-
const { open: k, tagContainer: R, tagHeader: J } = l(a[c]), B = [["class", `${f}-code`]];
|
|
742
|
-
k && B.push(["open", ""]);
|
|
743
|
-
const ne = {
|
|
744
|
-
attrs: se(a[c], B)
|
|
745
|
-
};
|
|
746
|
-
a[c].info = a[c].info.replace(m, "");
|
|
747
|
-
const W = r(a, c, $, p, g);
|
|
748
|
-
return `
|
|
749
|
-
<${R} ${g.renderAttrs(ne)}>
|
|
750
|
-
<${J} class="${f}-code-head">
|
|
751
|
-
<div class="${f}-code-flag"><span></span><span></span><span></span></div>
|
|
752
|
-
<div class="${f}-code-action">
|
|
753
|
-
<span class="${f}-code-lang">${e.utils.escapeHtml(a[c].info.trim())}</span>
|
|
754
|
-
<span class="${f}-copy-button" data-tips="${h}"${y ? " data-is-icon=true" : ""}>${T}</span>
|
|
755
|
-
${t.extraTools instanceof Function ? t.extraTools({ lang: a[c].info.trim() }) : t.extraTools || ""}
|
|
756
|
-
${R === "details" ? b : ""}
|
|
757
|
-
</div>
|
|
758
|
-
</${J}>
|
|
759
|
-
${W}
|
|
760
|
-
</${R}>
|
|
761
|
-
`;
|
|
762
|
-
}
|
|
763
|
-
let w, F, x, L, _ = "", N = "", D = "";
|
|
764
|
-
const { open: q, tagContainer: V, tagHeader: z } = l(a[c]), K = [["class", `${f}-code`]];
|
|
765
|
-
q && K.push(["open", ""]);
|
|
766
|
-
const Z = {
|
|
767
|
-
attrs: se(a[c], K)
|
|
768
|
-
};
|
|
769
|
-
for (let k = c; k < a.length && (w = a[k], [F, x] = u(w), F === S); k++) {
|
|
770
|
-
w.info = w.info.replace(o, "").replace(m, ""), w.hidden = !0;
|
|
771
|
-
const R = `${f}-codetab-${t.editorId}-${c}-${k - c}`;
|
|
772
|
-
L = k - c > 0 ? "" : "checked", _ += `
|
|
773
|
-
<li>
|
|
774
|
-
<input
|
|
775
|
-
type="radio"
|
|
776
|
-
id="label-${f}-codetab-label-1-${t.editorId}-${c}-${k - c}"
|
|
777
|
-
name="${f}-codetab-label-${t.editorId}-${c}"
|
|
778
|
-
class="${R}"
|
|
779
|
-
${L}
|
|
780
|
-
>
|
|
781
|
-
<label
|
|
782
|
-
for="label-${f}-codetab-label-1-${t.editorId}-${c}-${k - c}"
|
|
783
|
-
onclick="this.getRootNode().querySelectorAll('.${R}').forEach(e => e.click())"
|
|
784
|
-
>
|
|
785
|
-
${e.utils.escapeHtml(x || s(w))}
|
|
786
|
-
</label>
|
|
787
|
-
</li>`, N += `
|
|
788
|
-
<div role="tabpanel">
|
|
789
|
-
<input
|
|
790
|
-
type="radio"
|
|
791
|
-
name="${f}-codetab-pre-${t.editorId}-${c}"
|
|
792
|
-
class="${R}"
|
|
793
|
-
${L}
|
|
794
|
-
role="presentation">
|
|
795
|
-
${r(a, k, $, p, g)}
|
|
796
|
-
</div>`, D += `
|
|
797
|
-
<input
|
|
798
|
-
type="radio"
|
|
799
|
-
name="${f}-codetab-lang-${t.editorId}-${c}"
|
|
800
|
-
class="${R}"
|
|
801
|
-
${L}
|
|
802
|
-
role="presentation">
|
|
803
|
-
<span class=${f}-code-lang role="note">${e.utils.escapeHtml(s(w))}</span>`;
|
|
804
|
-
}
|
|
805
|
-
return `
|
|
806
|
-
<${V} ${g.renderAttrs(Z)}>
|
|
807
|
-
<${z} class="${f}-code-head">
|
|
808
|
-
<div class="${f}-code-flag">
|
|
809
|
-
<ul class="${f}-codetab-label" role="tablist">${_}</ul>
|
|
810
|
-
</div>
|
|
811
|
-
<div class="${f}-code-action">
|
|
812
|
-
<span class="${f}-codetab-lang">${D}</span>
|
|
813
|
-
<span class="${f}-copy-button" data-tips="${h}"${y ? " data-is-icon=true" : ""}>${T}</span>
|
|
814
|
-
${t.extraTools instanceof Function ? t.extraTools({ lang: a[c].info.trim() }) : t.extraTools || ""}
|
|
815
|
-
${V === "details" ? b : ""}
|
|
816
|
-
</div>
|
|
817
|
-
</${z}>
|
|
818
|
-
${N}
|
|
819
|
-
</${V}>
|
|
820
|
-
`;
|
|
821
|
-
};
|
|
822
|
-
e.renderer.rules.fence = i, e.renderer.rules.code_block = i;
|
|
823
|
-
}, ct = (e, t) => {
|
|
824
|
-
const r = e.renderer.rules.fence.bind(e.renderer.rules);
|
|
825
|
-
e.renderer.rules.fence = (n, o, m, d, u) => {
|
|
826
|
-
const s = n[o], l = s.content.trim();
|
|
827
|
-
if (s.info === "echarts") {
|
|
828
|
-
if (s.attrSet("class", `${f}-echarts`), s.attrSet("data-echarts-theme", t.themeRef.value), s.map && s.level === 0) {
|
|
829
|
-
const i = s.map[1] - 1, c = !!d.srcLines[i]?.trim()?.startsWith("```");
|
|
830
|
-
s.attrSet("data-closed", `${c}`), s.attrSet("data-line", String(s.map[0]));
|
|
831
|
-
}
|
|
832
|
-
return `<div ${u.renderAttrs(s)} style="width: 100%; aspect-ratio: 4 / 3;">${e.utils.escapeHtml(l)}</div>`;
|
|
833
|
-
}
|
|
834
|
-
return r(n, o, m, d, u);
|
|
835
|
-
};
|
|
836
|
-
}, dt = (e, t) => {
|
|
837
|
-
e.renderer.rules.heading_open = (r, n) => {
|
|
838
|
-
const o = r[n], m = r[n + 1].children?.reduce((u, s) => u + (["text", "code_inline", "math_inline"].includes(s.type) && s.content || ""), "") || "", d = o.markup.length;
|
|
839
|
-
return t.headsRef.value.push({
|
|
840
|
-
text: m,
|
|
841
|
-
level: d,
|
|
842
|
-
line: o.map[0],
|
|
843
|
-
currentToken: o,
|
|
844
|
-
nextToken: r[n + 1]
|
|
845
|
-
}), o.map && o.level === 0 && o.attrSet(
|
|
846
|
-
"id",
|
|
847
|
-
t.mdHeadingId({
|
|
848
|
-
text: m,
|
|
849
|
-
level: d,
|
|
850
|
-
index: t.headsRef.value.length,
|
|
851
|
-
currentToken: o,
|
|
852
|
-
nextToken: r[n + 1]
|
|
853
|
-
})
|
|
854
|
-
), e.renderer.renderToken(r, n, t);
|
|
855
|
-
}, e.renderer.rules.heading_close = (r, n, o, m, d) => d.renderToken(r, n, o);
|
|
856
|
-
}, be = {
|
|
857
|
-
block: [
|
|
858
|
-
{ open: "$$", close: "$$" },
|
|
859
|
-
{ open: "\\[", close: "\\]" }
|
|
860
|
-
],
|
|
861
|
-
inline: [
|
|
862
|
-
{ open: "$$", close: "$$" },
|
|
863
|
-
{ open: "$", close: "$" },
|
|
864
|
-
{ open: "\\[", close: "\\]" },
|
|
865
|
-
{ open: "\\(", close: "\\)" }
|
|
866
|
-
]
|
|
867
|
-
}, ut = (e) => (t, r) => {
|
|
868
|
-
const n = e.delimiters;
|
|
869
|
-
for (const o of n) {
|
|
870
|
-
if (!t.src.startsWith(o.open, t.pos))
|
|
871
|
-
continue;
|
|
872
|
-
const m = t.pos + o.open.length;
|
|
873
|
-
let d = m;
|
|
874
|
-
for (; (d = t.src.indexOf(o.close, d)) !== -1; ) {
|
|
875
|
-
let u = 0, s = d - 1;
|
|
876
|
-
for (; s >= 0 && t.src[s] === "\\"; )
|
|
877
|
-
u++, s--;
|
|
878
|
-
if (u % 2 === 0)
|
|
44
|
+
}, R = (i, h) => {
|
|
45
|
+
let H = 1;
|
|
46
|
+
for (let t = s.length - 1; t - 1 >= 0; t--) {
|
|
47
|
+
const n = s[t], a = s[t - 1];
|
|
48
|
+
if (n.offsetTop + n.offsetHeight > h && a.offsetTop < h) {
|
|
49
|
+
H = Number(a.dataset.line);
|
|
879
50
|
break;
|
|
880
|
-
d += o.close.length;
|
|
881
|
-
}
|
|
882
|
-
if (d !== -1) {
|
|
883
|
-
if (d - m === 0)
|
|
884
|
-
return r || (t.pending += o.open + o.close), t.pos = d + o.close.length, !0;
|
|
885
|
-
if (!r) {
|
|
886
|
-
const u = t.push("math_inline", "math", 0);
|
|
887
|
-
u.markup = o.open, u.content = t.src.slice(m, d);
|
|
888
51
|
}
|
|
889
|
-
return t.pos = d + o.close.length, !0;
|
|
890
52
|
}
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
t.line = i;
|
|
896
|
-
const c = t.push("math_block", "math", 0);
|
|
897
|
-
return c.block = !0, c.content = l, c.map = [r, t.line], c.markup = a, !0;
|
|
898
|
-
};
|
|
899
|
-
for (const l of m) {
|
|
900
|
-
const i = d;
|
|
901
|
-
if (t.src.slice(i, i + l.open.length) !== l.open)
|
|
902
|
-
continue;
|
|
903
|
-
const a = i + l.open.length, c = t.src.slice(a, u).trim(), $ = c === "", p = c === l.close, g = c.endsWith(l.close);
|
|
904
|
-
if (!$ && !p && !g)
|
|
905
|
-
continue;
|
|
906
|
-
if (o)
|
|
907
|
-
return !0;
|
|
908
|
-
if (p)
|
|
909
|
-
return s("", r + 1, l.open);
|
|
910
|
-
if (!$ && g) {
|
|
911
|
-
const w = c.slice(0, -l.close.length);
|
|
912
|
-
return s(w, r + 1, l.open);
|
|
913
|
-
}
|
|
914
|
-
let h = r + 1, T = !1, y = "";
|
|
915
|
-
for (; h < n; h++) {
|
|
916
|
-
const w = t.bMarks[h] + t.tShift[h], F = t.eMarks[h];
|
|
917
|
-
if (w < F && t.tShift[h] < t.blkIndent)
|
|
918
|
-
break;
|
|
919
|
-
if (t.src.slice(w, F).trim().endsWith(l.close)) {
|
|
920
|
-
const L = t.src.slice(0, F).lastIndexOf(l.close);
|
|
921
|
-
y = t.src.slice(w, L), T = !0;
|
|
53
|
+
for (let t = f.length - 1; t >= 0; t--) {
|
|
54
|
+
const n = y(f[t].end), a = m(f[t].start);
|
|
55
|
+
if (n > i && a <= i) {
|
|
56
|
+
H = H < f[t].start ? H : f[t].start;
|
|
922
57
|
break;
|
|
923
58
|
}
|
|
924
59
|
}
|
|
925
|
-
|
|
926
|
-
continue;
|
|
927
|
-
const S = t.getLines(r + 1, h, t.tShift[r], !0) + (y.trim() ? y : "");
|
|
928
|
-
return s(S, h + 1, l.open);
|
|
929
|
-
}
|
|
930
|
-
return !1;
|
|
931
|
-
}, ft = (e, { katexRef: t, inlineDelimiters: r, blockDelimiters: n }) => {
|
|
932
|
-
const o = (u, s, l, i, a = !1) => {
|
|
933
|
-
const c = {
|
|
934
|
-
attrs: se(u, [["class", s]])
|
|
935
|
-
}, $ = i.renderAttrs(c);
|
|
936
|
-
if (!t.value)
|
|
937
|
-
return `<${l} ${$}>${u.content}</${l}>`;
|
|
938
|
-
const p = t.value.renderToString(
|
|
939
|
-
u.content,
|
|
940
|
-
P.katexConfig({
|
|
941
|
-
throwOnError: !1,
|
|
942
|
-
displayMode: a
|
|
943
|
-
})
|
|
944
|
-
);
|
|
945
|
-
return `<${l} ${$} data-processed>${p}</${l}>`;
|
|
946
|
-
}, m = (u, s, l, i, a) => o(u[s], `${f}-katex-inline`, "span", a), d = (u, s, l, i, a) => o(u[s], `${f}-katex-block`, "p", a, !0);
|
|
947
|
-
e.inline.ruler.before(
|
|
948
|
-
"escape",
|
|
949
|
-
"math_inline",
|
|
950
|
-
ut({
|
|
951
|
-
delimiters: r || be.inline
|
|
952
|
-
})
|
|
953
|
-
), e.block.ruler.after(
|
|
954
|
-
"blockquote",
|
|
955
|
-
"math_block",
|
|
956
|
-
mt({
|
|
957
|
-
delimiters: n || be.block
|
|
958
|
-
}),
|
|
959
|
-
{
|
|
960
|
-
alt: ["paragraph", "reference", "blockquote", "list"]
|
|
961
|
-
}
|
|
962
|
-
), e.renderer.rules.math_inline = m, e.renderer.rules.math_block = d;
|
|
963
|
-
}, ht = (e, t) => {
|
|
964
|
-
const r = e.renderer.rules.fence.bind(e.renderer.rules);
|
|
965
|
-
e.renderer.rules.fence = (n, o, m, d, u) => {
|
|
966
|
-
const s = n[o], l = s.content.trim();
|
|
967
|
-
if (s.info === "mermaid") {
|
|
968
|
-
if (s.attrSet("class", `${f}-mermaid`), s.attrSet("data-mermaid-theme", t.themeRef.value), s.map && s.level === 0) {
|
|
969
|
-
const a = s.map[1] - 1, $ = !!d.srcLines[a]?.trim()?.startsWith("```");
|
|
970
|
-
s.attrSet("data-closed", `${$}`), s.attrSet("data-line", String(s.map[0]));
|
|
971
|
-
}
|
|
972
|
-
const i = Y.get(l);
|
|
973
|
-
return i ? (s.attrSet("data-processed", ""), s.attrSet("data-content", l), `<p ${u.renderAttrs(s)}>${i}</p>`) : `<div ${u.renderAttrs(s)}>${e.utils.escapeHtml(l)}</div>`;
|
|
974
|
-
}
|
|
975
|
-
return r(n, o, m, d, u);
|
|
976
|
-
};
|
|
977
|
-
}, $e = (e, t, r) => {
|
|
978
|
-
const n = e.attrIndex(t), o = [t, r];
|
|
979
|
-
n < 0 ? e.attrPush(o) : (e.attrs = e.attrs || [], e.attrs[n] = o);
|
|
980
|
-
}, pt = (e) => e.type === "inline", gt = (e) => e.type === "paragraph_open", vt = (e) => e.type === "list_item_open", yt = (e) => e.content.indexOf("[ ] ") === 0 || e.content.indexOf("[x] ") === 0 || e.content.indexOf("[X] ") === 0, bt = (e, t) => pt(e[t]) && gt(e[t - 1]) && vt(e[t - 2]) && yt(e[t]), $t = (e, t) => {
|
|
981
|
-
const r = e[t].level - 1;
|
|
982
|
-
for (let n = t - 1; n >= 0; n--)
|
|
983
|
-
if (e[n].level === r)
|
|
984
|
-
return n;
|
|
985
|
-
return -1;
|
|
986
|
-
}, wt = (e) => {
|
|
987
|
-
const t = new e("html_inline", "", 0);
|
|
988
|
-
return t.content = "<label>", t;
|
|
989
|
-
}, Ct = (e) => {
|
|
990
|
-
const t = new e("html_inline", "", 0);
|
|
991
|
-
return t.content = "</label>", t;
|
|
992
|
-
}, Et = (e, t, r) => {
|
|
993
|
-
const n = new r("html_inline", "", 0);
|
|
994
|
-
return n.content = '<label class="task-list-item-label" for="' + t + '">' + e + "</label>", n.attrs = [["for", t]], n;
|
|
995
|
-
}, kt = (e, t, r) => {
|
|
996
|
-
const n = new t("html_inline", "", 0), o = r.enabled ? " " : ' disabled="" ';
|
|
997
|
-
return e.content.indexOf("[ ] ") === 0 ? n.content = '<input class="task-list-item-checkbox"' + o + 'type="checkbox">' : (e.content.indexOf("[x] ") === 0 || e.content.indexOf("[X] ") === 0) && (n.content = '<input class="task-list-item-checkbox" checked=""' + o + 'type="checkbox">'), n;
|
|
998
|
-
}, Tt = (e, t, r) => {
|
|
999
|
-
if (e.children = e.children || [], e.children.unshift(kt(e, t, r)), e.children[1].content = e.children[1].content.slice(3), e.content = e.content.slice(3), r.label)
|
|
1000
|
-
if (r.labelAfter) {
|
|
1001
|
-
e.children.pop();
|
|
1002
|
-
const n = "task-item-" + Math.ceil(Math.random() * (1e4 * 1e3) - 1e3);
|
|
1003
|
-
e.children[0].content = e.children[0].content.slice(0, -1) + ' id="' + n + '">', e.children.push(Et(e.content, n, t));
|
|
1004
|
-
} else
|
|
1005
|
-
e.children.unshift(wt(t)), e.children.push(Ct(t));
|
|
1006
|
-
}, xt = (e, t = {}) => {
|
|
1007
|
-
e.core.ruler.after("inline", "github-task-lists", (r) => {
|
|
1008
|
-
const n = r.tokens;
|
|
1009
|
-
for (let o = 2; o < n.length; o++)
|
|
1010
|
-
bt(n, o) && (Tt(n[o], r.Token, t), $e(
|
|
1011
|
-
n[o - 2],
|
|
1012
|
-
"class",
|
|
1013
|
-
"task-list-item" + (t.enabled ? " enabled" : " ")
|
|
1014
|
-
), $e(n[$t(n, o - 2)], "class", "contains-task-list"));
|
|
1015
|
-
});
|
|
1016
|
-
}, It = (e) => {
|
|
1017
|
-
e.core.ruler.push("init-line-number", (t) => (t.tokens.forEach((r) => {
|
|
1018
|
-
r.map && (r.attrs || (r.attrs = []), r.attrs.push(["data-line", r.map[0].toString()]));
|
|
1019
|
-
}), !0));
|
|
1020
|
-
}, St = (e, t) => {
|
|
1021
|
-
const { editorConfig: r, markdownItConfig: n, markdownItPlugins: o, editorExtensions: m } = P, d = C("editorId"), u = C("language"), s = C(
|
|
1022
|
-
"usedLanguageText"
|
|
1023
|
-
), l = C("showCodeRowNumber"), i = C("theme"), a = C("customIcon"), c = C("rootRef"), $ = C("setting"), p = G([]), g = ot(e), h = at(e), { reRenderRef: T, replaceMermaid: y } = lt(e), { reRenderEcharts: b, replaceEcharts: S } = nt(e), w = Ke({
|
|
1024
|
-
html: !0,
|
|
1025
|
-
breaks: !0,
|
|
1026
|
-
linkify: !0
|
|
1027
|
-
});
|
|
1028
|
-
n(w, {
|
|
1029
|
-
editorId: d
|
|
1030
|
-
});
|
|
1031
|
-
const F = [
|
|
1032
|
-
{
|
|
1033
|
-
type: "image",
|
|
1034
|
-
plugin: Ze,
|
|
1035
|
-
options: { figcaption: !0, classes: "md-zoom" }
|
|
1036
|
-
},
|
|
1037
|
-
{
|
|
1038
|
-
type: "admonition",
|
|
1039
|
-
plugin: it,
|
|
1040
|
-
options: {}
|
|
1041
|
-
},
|
|
1042
|
-
{
|
|
1043
|
-
type: "taskList",
|
|
1044
|
-
plugin: xt,
|
|
1045
|
-
options: {}
|
|
1046
|
-
},
|
|
1047
|
-
{
|
|
1048
|
-
type: "heading",
|
|
1049
|
-
plugin: dt,
|
|
1050
|
-
options: { mdHeadingId: e.mdHeadingId, headsRef: p }
|
|
1051
|
-
},
|
|
1052
|
-
{
|
|
1053
|
-
type: "code",
|
|
1054
|
-
plugin: st,
|
|
1055
|
-
options: {
|
|
1056
|
-
editorId: d,
|
|
1057
|
-
usedLanguageTextRef: s,
|
|
1058
|
-
// showCodeRowNumber,
|
|
1059
|
-
codeFoldable: e.codeFoldable,
|
|
1060
|
-
autoFoldThreshold: e.autoFoldThreshold,
|
|
1061
|
-
customIconRef: a
|
|
1062
|
-
}
|
|
1063
|
-
},
|
|
1064
|
-
{
|
|
1065
|
-
type: "sub",
|
|
1066
|
-
plugin: Je,
|
|
1067
|
-
options: {}
|
|
1068
|
-
},
|
|
1069
|
-
{
|
|
1070
|
-
type: "sup",
|
|
1071
|
-
plugin: Xe,
|
|
1072
|
-
options: {}
|
|
1073
|
-
}
|
|
1074
|
-
];
|
|
1075
|
-
e.noKatex || F.push({
|
|
1076
|
-
type: "katex",
|
|
1077
|
-
plugin: ft,
|
|
1078
|
-
options: { katexRef: h }
|
|
1079
|
-
}), e.noMermaid || F.push({
|
|
1080
|
-
type: "mermaid",
|
|
1081
|
-
plugin: ht,
|
|
1082
|
-
options: { themeRef: i }
|
|
1083
|
-
}), e.noEcharts || F.push({
|
|
1084
|
-
type: "echarts",
|
|
1085
|
-
plugin: ct,
|
|
1086
|
-
options: { themeRef: i }
|
|
1087
|
-
}), o(F, {
|
|
1088
|
-
editorId: d
|
|
1089
|
-
}).forEach((k) => {
|
|
1090
|
-
w.use(k.plugin, k.options);
|
|
1091
|
-
});
|
|
1092
|
-
const x = w.options.highlight;
|
|
1093
|
-
w.set({
|
|
1094
|
-
highlight: (k, R, J) => {
|
|
1095
|
-
if (x) {
|
|
1096
|
-
const W = x(k, R, J);
|
|
1097
|
-
if (W)
|
|
1098
|
-
return W;
|
|
1099
|
-
}
|
|
1100
|
-
let B;
|
|
1101
|
-
!e.noHighlight && g.value ? g.value.getLanguage(R) ? B = g.value.highlight(k, {
|
|
1102
|
-
language: R,
|
|
1103
|
-
ignoreIllegals: !0
|
|
1104
|
-
}).value : B = g.value.highlightAuto(k).value : B = w.utils.escapeHtml(k);
|
|
1105
|
-
const ne = l ? Ye(
|
|
1106
|
-
B.replace(/^\n+|\n+$/g, ""),
|
|
1107
|
-
k.replace(/^\n+|\n+$/g, "")
|
|
1108
|
-
) : `<span class="${f}-code-block">${B.replace(/^\n+|\n+$/g, "")}</span>`;
|
|
1109
|
-
return `<pre><code class="language-${R}" language=${R}>${ne}</code></pre>`;
|
|
1110
|
-
}
|
|
1111
|
-
}), It(w);
|
|
1112
|
-
const L = G(`_article-key_${le()}`), _ = G(
|
|
1113
|
-
e.sanitize(
|
|
1114
|
-
w.render(e.modelValue, {
|
|
1115
|
-
srcLines: e.modelValue.split(`
|
|
1116
|
-
`)
|
|
1117
|
-
})
|
|
1118
|
-
)
|
|
1119
|
-
);
|
|
1120
|
-
let N = () => {
|
|
1121
|
-
}, D = () => {
|
|
60
|
+
return H;
|
|
1122
61
|
};
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
);
|
|
1127
|
-
D(), D = ze(k, {
|
|
1128
|
-
customIcon: a.value
|
|
1129
|
-
}), m.mermaid?.enableZoom && (N(), N = We(k, {
|
|
1130
|
-
customIcon: a.value
|
|
1131
|
-
}));
|
|
1132
|
-
}, V = () => {
|
|
1133
|
-
v.emit(d, X, _.value), e.onHtmlChanged(_.value), e.onGetCatalog(p.value), v.emit(d, oe, p.value), U(() => {
|
|
1134
|
-
y().then(q), S();
|
|
1135
|
-
});
|
|
1136
|
-
}, z = () => {
|
|
1137
|
-
p.value = [], _.value = e.sanitize(
|
|
1138
|
-
w.render(e.modelValue, {
|
|
1139
|
-
srcLines: e.modelValue.split(`
|
|
1140
|
-
`)
|
|
1141
|
-
})
|
|
1142
|
-
);
|
|
1143
|
-
}, K = A(() => (e.noKatex || !!h.value) && (e.noHighlight || !!g.value));
|
|
1144
|
-
let Z = -1;
|
|
1145
|
-
return E([Ae(e, "modelValue"), K, T, u], () => {
|
|
1146
|
-
Z = window.setTimeout(
|
|
1147
|
-
() => {
|
|
1148
|
-
z();
|
|
1149
|
-
},
|
|
1150
|
-
t ? 0 : r.renderDelay
|
|
1151
|
-
);
|
|
1152
|
-
}), E(
|
|
1153
|
-
() => $.value.preview,
|
|
1154
|
-
() => {
|
|
1155
|
-
$.value.preview && U(() => {
|
|
1156
|
-
y().then(q), S(), v.emit(d, oe, p.value);
|
|
1157
|
-
});
|
|
1158
|
-
}
|
|
1159
|
-
), E([_, b], () => {
|
|
1160
|
-
V();
|
|
1161
|
-
}), H(V), H(() => {
|
|
1162
|
-
v.on(d, {
|
|
1163
|
-
name: De,
|
|
1164
|
-
callback() {
|
|
1165
|
-
v.emit(d, oe, p.value);
|
|
1166
|
-
}
|
|
1167
|
-
}), v.on(d, {
|
|
1168
|
-
name: de,
|
|
1169
|
-
callback: () => {
|
|
1170
|
-
L.value = `_article-key_${le()}`, z();
|
|
1171
|
-
}
|
|
1172
|
-
});
|
|
1173
|
-
}), te(() => {
|
|
1174
|
-
N(), D(), clearTimeout(Z);
|
|
1175
|
-
}), { html: _, key: L };
|
|
1176
|
-
}, Ft = (e, t) => {
|
|
1177
|
-
const r = C("editorId"), n = C("setting"), { noImgZoomIn: o } = e, m = Le(() => {
|
|
1178
|
-
const d = document.querySelectorAll(
|
|
1179
|
-
`#${r}-preview img:not(.not-zoom):not(.medium-zoom-image)`
|
|
1180
|
-
);
|
|
1181
|
-
d.length !== 0 && Qe(d, {
|
|
1182
|
-
background: "#00000073"
|
|
1183
|
-
});
|
|
1184
|
-
});
|
|
1185
|
-
H(async () => {
|
|
1186
|
-
!o && n.value.preview && await m();
|
|
1187
|
-
}), E([t, () => n.value.preview], async () => {
|
|
1188
|
-
!o && n.value.preview && await m();
|
|
1189
|
-
});
|
|
1190
|
-
}, we = {
|
|
1191
|
-
checked: {
|
|
1192
|
-
regexp: /- \[x\]/,
|
|
1193
|
-
value: "- [ ]"
|
|
1194
|
-
},
|
|
1195
|
-
unChecked: {
|
|
1196
|
-
regexp: /- \[\s\]/,
|
|
1197
|
-
value: "- [x]"
|
|
1198
|
-
}
|
|
1199
|
-
}, At = (e, t) => {
|
|
1200
|
-
const r = C("editorId"), n = C("rootRef");
|
|
1201
|
-
let o = () => {
|
|
1202
|
-
};
|
|
1203
|
-
const m = () => {
|
|
1204
|
-
if (!n.value)
|
|
62
|
+
let x = 0, B = 0;
|
|
63
|
+
const _ = () => {
|
|
64
|
+
if (B !== 0)
|
|
1205
65
|
return !1;
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
};
|
|
1227
|
-
te(() => {
|
|
1228
|
-
o();
|
|
1229
|
-
}), E(
|
|
1230
|
-
[t],
|
|
1231
|
-
() => {
|
|
1232
|
-
o(), U(m);
|
|
1233
|
-
},
|
|
1234
|
-
{
|
|
1235
|
-
immediate: !0
|
|
1236
|
-
}
|
|
1237
|
-
);
|
|
1238
|
-
}, Rt = (e, t, r) => {
|
|
1239
|
-
const n = C("setting"), o = () => {
|
|
1240
|
-
U(() => {
|
|
1241
|
-
e.onRemount?.();
|
|
66
|
+
x++;
|
|
67
|
+
const { scrollDOM: i, contentHeight: h } = o;
|
|
68
|
+
let H = w(l, "padding-block-start");
|
|
69
|
+
const t = o.lineBlockAtHeight(i.scrollTop), { number: n } = o.state.doc.lineAt(t.from), a = f[n - 1];
|
|
70
|
+
if (!a)
|
|
71
|
+
return !1;
|
|
72
|
+
let u = 1;
|
|
73
|
+
const k = l.querySelector(`[data-line="${a.start}"]`) || l.firstElementChild?.firstElementChild, d = l.querySelector(`[data-line="${a.end + 1}"]`) || l.lastElementChild?.lastElementChild, c = i.scrollHeight - i.clientHeight, I = l.scrollHeight - l.clientHeight;
|
|
74
|
+
let g = m(a.start), v = y(a.end), C = k.offsetTop, S = d.offsetTop - C;
|
|
75
|
+
g === 0 && (C = 0, k === d ? (H = 0, v = h - i.offsetHeight, S = I) : S = d.offsetTop), u = (i.scrollTop - g) / (v - g);
|
|
76
|
+
const A = d == l.lastElementChild?.lastElementChild ? d.offsetTop + d.clientHeight : d.offsetTop;
|
|
77
|
+
if (v >= c || A > I) {
|
|
78
|
+
const p = R(c, I);
|
|
79
|
+
g = m(p), u = (i.scrollTop - g) / (c - g);
|
|
80
|
+
const F = l.querySelector(`[data-line="${p}"]`);
|
|
81
|
+
g > 0 && F && (C = F.offsetTop), S = I - C + w(l, "padding-block-start");
|
|
82
|
+
}
|
|
83
|
+
const T = C - H + S * u;
|
|
84
|
+
E(l, T, () => {
|
|
85
|
+
x--;
|
|
1242
86
|
});
|
|
1243
|
-
},
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
},
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
type: Function,
|
|
1269
|
-
default: () => ""
|
|
1270
|
-
},
|
|
1271
|
-
noMermaid: {
|
|
1272
|
-
type: Boolean,
|
|
1273
|
-
default: !1
|
|
1274
|
-
},
|
|
1275
|
-
sanitize: {
|
|
1276
|
-
type: Function,
|
|
1277
|
-
default: (e) => e
|
|
1278
|
-
},
|
|
1279
|
-
// 不使用该函数功能
|
|
1280
|
-
noKatex: {
|
|
1281
|
-
type: Boolean,
|
|
1282
|
-
default: !1
|
|
1283
|
-
},
|
|
1284
|
-
formatCopiedText: {
|
|
1285
|
-
type: Function,
|
|
1286
|
-
default: (e) => e
|
|
1287
|
-
},
|
|
1288
|
-
noHighlight: {
|
|
1289
|
-
type: Boolean,
|
|
1290
|
-
default: !1
|
|
1291
|
-
},
|
|
1292
|
-
previewOnly: {
|
|
1293
|
-
type: Boolean,
|
|
1294
|
-
default: !1
|
|
1295
|
-
},
|
|
1296
|
-
noImgZoomIn: {
|
|
1297
|
-
type: Boolean
|
|
1298
|
-
},
|
|
1299
|
-
sanitizeMermaid: {
|
|
1300
|
-
type: Function
|
|
1301
|
-
},
|
|
1302
|
-
codeFoldable: {
|
|
1303
|
-
type: Boolean
|
|
1304
|
-
},
|
|
1305
|
-
autoFoldThreshold: {
|
|
1306
|
-
type: Number
|
|
1307
|
-
},
|
|
1308
|
-
onRemount: {
|
|
1309
|
-
type: Function
|
|
1310
|
-
},
|
|
1311
|
-
noEcharts: {
|
|
1312
|
-
type: Boolean
|
|
1313
|
-
},
|
|
1314
|
-
previewComponent: {
|
|
1315
|
-
type: [Object, Function],
|
|
1316
|
-
default: void 0
|
|
1317
|
-
}
|
|
1318
|
-
}, nn = {
|
|
1319
|
-
...xe,
|
|
1320
|
-
updateModelValue: {
|
|
1321
|
-
type: Function,
|
|
1322
|
-
default: () => {
|
|
1323
|
-
}
|
|
1324
|
-
},
|
|
1325
|
-
placeholder: {
|
|
1326
|
-
type: String,
|
|
1327
|
-
default: ""
|
|
1328
|
-
},
|
|
1329
|
-
scrollAuto: {
|
|
1330
|
-
type: Boolean
|
|
1331
|
-
},
|
|
1332
|
-
autofocus: {
|
|
1333
|
-
type: Boolean
|
|
1334
|
-
},
|
|
1335
|
-
readonly: {
|
|
1336
|
-
type: Boolean
|
|
1337
|
-
},
|
|
1338
|
-
maxlength: {
|
|
1339
|
-
type: Number
|
|
1340
|
-
},
|
|
1341
|
-
autoDetectCode: {
|
|
1342
|
-
type: Boolean
|
|
1343
|
-
},
|
|
1344
|
-
/**
|
|
1345
|
-
* 输入框失去焦点时触发事件
|
|
1346
|
-
*/
|
|
1347
|
-
onBlur: {
|
|
1348
|
-
type: Function,
|
|
1349
|
-
default: () => {
|
|
1350
|
-
}
|
|
1351
|
-
},
|
|
1352
|
-
/**
|
|
1353
|
-
* 输入框获得焦点时触发事件
|
|
1354
|
-
*/
|
|
1355
|
-
onFocus: {
|
|
1356
|
-
type: Function,
|
|
1357
|
-
default: () => {
|
|
1358
|
-
}
|
|
1359
|
-
},
|
|
1360
|
-
completions: {
|
|
1361
|
-
type: Array
|
|
1362
|
-
},
|
|
1363
|
-
onInput: {
|
|
1364
|
-
type: Function
|
|
1365
|
-
},
|
|
1366
|
-
onDrop: {
|
|
1367
|
-
type: Function,
|
|
1368
|
-
default: () => {
|
|
1369
|
-
}
|
|
1370
|
-
},
|
|
1371
|
-
inputBoxWidth: {
|
|
1372
|
-
type: String
|
|
1373
|
-
},
|
|
1374
|
-
oninputBoxWidthChange: {
|
|
1375
|
-
type: Function
|
|
1376
|
-
},
|
|
1377
|
-
transformImgUrl: {
|
|
1378
|
-
type: Function,
|
|
1379
|
-
default: (e) => e
|
|
1380
|
-
},
|
|
1381
|
-
catalogLayout: {
|
|
1382
|
-
type: String
|
|
1383
|
-
},
|
|
1384
|
-
catalogMaxDepth: {
|
|
1385
|
-
type: Number
|
|
1386
|
-
}
|
|
1387
|
-
}, Ce = (e) => {
|
|
1388
|
-
const r = new DOMParser().parseFromString(e, "text/html");
|
|
1389
|
-
return Array.from(r.body.childNodes);
|
|
1390
|
-
}, Ht = (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, Mt = /* @__PURE__ */ ce({
|
|
1391
|
-
name: "UpdateOnDemand",
|
|
1392
|
-
props: {
|
|
1393
|
-
id: {
|
|
1394
|
-
type: String,
|
|
1395
|
-
required: !0
|
|
1396
|
-
},
|
|
1397
|
-
class: {
|
|
1398
|
-
type: [String, Array, Object],
|
|
1399
|
-
required: !0
|
|
1400
|
-
},
|
|
1401
|
-
html: {
|
|
1402
|
-
type: String,
|
|
1403
|
-
required: !0
|
|
1404
|
-
}
|
|
1405
|
-
},
|
|
1406
|
-
setup(e) {
|
|
1407
|
-
const t = G(), r = e.html, n = (o, m) => {
|
|
1408
|
-
if (!t.value) return;
|
|
1409
|
-
const d = t.value, u = Array.from(d.childNodes), s = Math.min(o.length, m.length);
|
|
1410
|
-
let l = -1;
|
|
1411
|
-
for (let a = 0; a < s; a++)
|
|
1412
|
-
if (!Ht(o[a], m[a])) {
|
|
1413
|
-
l = a;
|
|
87
|
+
}, P = () => {
|
|
88
|
+
if (x !== 0)
|
|
89
|
+
return;
|
|
90
|
+
B++;
|
|
91
|
+
const { scrollDOM: i } = o, h = l.scrollTop, H = l.scrollHeight, t = i.scrollHeight - i.clientHeight, n = l.scrollHeight - l.clientHeight;
|
|
92
|
+
let a = l.firstElementChild?.firstElementChild, u = l.firstElementChild?.lastElementChild;
|
|
93
|
+
if (r.length > 0) {
|
|
94
|
+
let A = Math.ceil(
|
|
95
|
+
r[r.length - 1] * (h / H)
|
|
96
|
+
), T = r.findLastIndex((p) => p <= A);
|
|
97
|
+
T = T === -1 ? 0 : T, A = r[T];
|
|
98
|
+
for (let p = T; p >= 0 && p < r.length; )
|
|
99
|
+
if (s[p].offsetTop > h) {
|
|
100
|
+
if (p - 1 >= 0) {
|
|
101
|
+
p--;
|
|
102
|
+
continue;
|
|
103
|
+
}
|
|
104
|
+
A = -1, T = -1;
|
|
105
|
+
break;
|
|
106
|
+
} else {
|
|
107
|
+
if (p + 1 < r.length && s[p + 1].offsetTop < h) {
|
|
108
|
+
p++;
|
|
109
|
+
continue;
|
|
110
|
+
}
|
|
111
|
+
A = r[p], T = p;
|
|
1414
112
|
break;
|
|
1415
113
|
}
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
l =
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
}
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
}),
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
return () => j(Re, null, [r.value.preview && (e.previewOnly ? s() : j("div", {
|
|
1463
|
-
id: `${t}-preview-wrapper`,
|
|
1464
|
-
class: `${f}-preview-wrapper`,
|
|
1465
|
-
key: "content-preview-wrapper"
|
|
1466
|
-
}, [s()])), r.value.htmlPreview && j("div", {
|
|
1467
|
-
id: `${t}-html-wrapper`,
|
|
1468
|
-
class: `${f}-preview-wrapper`,
|
|
1469
|
-
key: "html-preview-wrapper"
|
|
1470
|
-
}, [j("div", {
|
|
1471
|
-
class: `${f}-html`
|
|
1472
|
-
}, [m.value])])]);
|
|
1473
|
-
}
|
|
1474
|
-
}), Lt = ({ text: e }) => e, Ie = {
|
|
1475
|
-
/**
|
|
1476
|
-
* markdown content.
|
|
1477
|
-
*
|
|
1478
|
-
* @default ''
|
|
1479
|
-
*/
|
|
1480
|
-
modelValue: {
|
|
1481
|
-
type: String,
|
|
1482
|
-
default: ""
|
|
1483
|
-
},
|
|
1484
|
-
/**
|
|
1485
|
-
* input回调事件
|
|
1486
|
-
*/
|
|
1487
|
-
onChange: {
|
|
1488
|
-
type: Function,
|
|
1489
|
-
default: void 0
|
|
1490
|
-
},
|
|
1491
|
-
/**
|
|
1492
|
-
* 主题,支持light和dark
|
|
1493
|
-
*
|
|
1494
|
-
* @default 'light'
|
|
1495
|
-
*/
|
|
1496
|
-
theme: {
|
|
1497
|
-
type: String,
|
|
1498
|
-
default: "light"
|
|
1499
|
-
},
|
|
1500
|
-
/**
|
|
1501
|
-
* 外层类名
|
|
1502
|
-
*
|
|
1503
|
-
* @default ''
|
|
1504
|
-
*/
|
|
1505
|
-
class: {
|
|
1506
|
-
type: String,
|
|
1507
|
-
default: ""
|
|
1508
|
-
},
|
|
1509
|
-
/**
|
|
1510
|
-
* 预设语言名称
|
|
1511
|
-
*
|
|
1512
|
-
* @default 'zh-CN'
|
|
1513
|
-
*/
|
|
1514
|
-
language: {
|
|
1515
|
-
type: String,
|
|
1516
|
-
default: "zh-CN"
|
|
1517
|
-
},
|
|
1518
|
-
/**
|
|
1519
|
-
* html变化事件
|
|
1520
|
-
*/
|
|
1521
|
-
onHtmlChanged: {
|
|
1522
|
-
type: Function,
|
|
1523
|
-
default: void 0
|
|
1524
|
-
},
|
|
1525
|
-
/**
|
|
1526
|
-
* 获取目录结构
|
|
1527
|
-
*/
|
|
1528
|
-
onGetCatalog: {
|
|
1529
|
-
type: Function,
|
|
1530
|
-
default: void 0
|
|
1531
|
-
},
|
|
1532
|
-
/**
|
|
1533
|
-
* 编辑器唯一标识
|
|
1534
|
-
*
|
|
1535
|
-
* @default 'md-editor-v3'
|
|
1536
|
-
* @deprecated 5.x版本开始使用 id 替换
|
|
1537
|
-
*/
|
|
1538
|
-
editorId: {
|
|
1539
|
-
type: String,
|
|
1540
|
-
default: void 0
|
|
1541
|
-
},
|
|
1542
|
-
/**
|
|
1543
|
-
* 5.x版本开始 editorId 的替换
|
|
1544
|
-
*
|
|
1545
|
-
* @default 'md-editor-v3'
|
|
1546
|
-
*/
|
|
1547
|
-
id: {
|
|
1548
|
-
type: String,
|
|
1549
|
-
default: void 0
|
|
1550
|
-
},
|
|
1551
|
-
/**
|
|
1552
|
-
* 预览中代码是否显示行号
|
|
1553
|
-
*
|
|
1554
|
-
* @default true
|
|
1555
|
-
*/
|
|
1556
|
-
showCodeRowNumber: {
|
|
1557
|
-
type: Boolean,
|
|
1558
|
-
default: !0
|
|
1559
|
-
},
|
|
1560
|
-
/**
|
|
1561
|
-
* 预览内容样式
|
|
1562
|
-
*
|
|
1563
|
-
* @default 'default'
|
|
1564
|
-
*/
|
|
1565
|
-
previewTheme: {
|
|
1566
|
-
type: String,
|
|
1567
|
-
default: "default"
|
|
1568
|
-
},
|
|
1569
|
-
/**
|
|
1570
|
-
* 编辑器样式
|
|
1571
|
-
*/
|
|
1572
|
-
style: {
|
|
114
|
+
switch (T) {
|
|
115
|
+
case -1: {
|
|
116
|
+
a = l.firstElementChild?.firstElementChild, u = s[0];
|
|
117
|
+
break;
|
|
118
|
+
}
|
|
119
|
+
case r.length - 1: {
|
|
120
|
+
a = s[T], u = l.firstElementChild?.lastElementChild;
|
|
121
|
+
break;
|
|
122
|
+
}
|
|
123
|
+
default:
|
|
124
|
+
a = s[T], u = s[T + 1 === s.length ? T : T + 1];
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
let k = a === l.firstElementChild?.firstElementChild ? 0 : a.offsetTop - w(a, "margin-block-start"), d = u.offsetTop, c = 0;
|
|
128
|
+
const { start: I, end: g } = f[Number(a.dataset.line || 0)];
|
|
129
|
+
let v = m(I);
|
|
130
|
+
const C = m(
|
|
131
|
+
g + 1 === o.state.doc.lines ? g : g + 1
|
|
132
|
+
);
|
|
133
|
+
let S = 0;
|
|
134
|
+
if (C > t || u.offsetTop + u.offsetHeight > n) {
|
|
135
|
+
const A = R(t, n), T = l.querySelector(`[data-line="${A}"]`);
|
|
136
|
+
k = T ? T.offsetTop - w(T, "margin-block-start") : k, v = m(A), c = (h - k) / (n - k), S = t - v;
|
|
137
|
+
} else a === l.firstElementChild?.firstElementChild ? (a === u && (d = u.offsetTop + u.offsetHeight + w(u, "margin-block-end")), S = C, c = Math.max(h / d, 0)) : (c = Math.max(
|
|
138
|
+
(h - k) / (d - k),
|
|
139
|
+
0
|
|
140
|
+
), S = C - v);
|
|
141
|
+
E(e, v + S * c, () => {
|
|
142
|
+
B--;
|
|
143
|
+
});
|
|
144
|
+
}, M = (i) => {
|
|
145
|
+
const { scrollDOM: h, contentHeight: H } = o, t = h.clientHeight;
|
|
146
|
+
if (H <= t || l.firstElementChild.clientHeight <= l.clientHeight || o.state.doc.lines <= f[f.length - 1]?.end)
|
|
147
|
+
return !1;
|
|
148
|
+
i.target === e ? _() : P();
|
|
149
|
+
};
|
|
150
|
+
return [
|
|
151
|
+
() => {
|
|
152
|
+
L(), e.addEventListener("scroll", M), l.addEventListener("scroll", M), e.dispatchEvent(new Event("scroll"));
|
|
153
|
+
},
|
|
154
|
+
() => {
|
|
155
|
+
e.removeEventListener("scroll", M), l.removeEventListener("scroll", M);
|
|
156
|
+
}
|
|
157
|
+
];
|
|
158
|
+
}, se = {
|
|
159
|
+
tocItem: {
|
|
1573
160
|
type: Object,
|
|
1574
161
|
default: () => ({})
|
|
1575
162
|
},
|
|
1576
|
-
/**
|
|
1577
|
-
* 标题的id生成方式
|
|
1578
|
-
*
|
|
1579
|
-
* @default (text: string) => text
|
|
1580
|
-
*/
|
|
1581
163
|
mdHeadingId: {
|
|
1582
164
|
type: Function,
|
|
1583
|
-
default:
|
|
1584
|
-
|
|
1585
|
-
/**
|
|
1586
|
-
*
|
|
1587
|
-
* 不能保证文本正确的情况,在marked编译md文本后通过该方法处理
|
|
1588
|
-
* 推荐DOMPurify、sanitize-html
|
|
1589
|
-
*
|
|
1590
|
-
* @default (text: string) => text
|
|
1591
|
-
*/
|
|
1592
|
-
sanitize: {
|
|
1593
|
-
type: Function,
|
|
1594
|
-
default: (e) => e
|
|
1595
|
-
},
|
|
1596
|
-
/**
|
|
1597
|
-
* 不使用该mermaid
|
|
1598
|
-
*
|
|
1599
|
-
* @default false
|
|
1600
|
-
*/
|
|
1601
|
-
noMermaid: {
|
|
1602
|
-
type: Boolean,
|
|
1603
|
-
default: !1
|
|
1604
|
-
},
|
|
1605
|
-
/**
|
|
1606
|
-
* 不使用katex
|
|
1607
|
-
*
|
|
1608
|
-
* @default false
|
|
1609
|
-
*/
|
|
1610
|
-
noKatex: {
|
|
1611
|
-
type: Boolean,
|
|
1612
|
-
default: !1
|
|
1613
|
-
},
|
|
1614
|
-
/**
|
|
1615
|
-
* 代码主题
|
|
1616
|
-
*
|
|
1617
|
-
* @default 'atom'
|
|
1618
|
-
*/
|
|
1619
|
-
codeTheme: {
|
|
1620
|
-
type: String,
|
|
1621
|
-
default: "atom"
|
|
165
|
+
default: () => {
|
|
166
|
+
}
|
|
1622
167
|
},
|
|
1623
|
-
|
|
1624
|
-
* 复制代码格式化方法
|
|
1625
|
-
*
|
|
1626
|
-
* @default (text) => text
|
|
1627
|
-
*/
|
|
1628
|
-
formatCopiedText: {
|
|
168
|
+
onActive: {
|
|
1629
169
|
type: Function,
|
|
1630
|
-
default: (
|
|
1631
|
-
|
|
1632
|
-
/**
|
|
1633
|
-
* 某些预览主题的代码模块背景是暗色系
|
|
1634
|
-
* 将这个属性设置为true,会自动在该主题下的light模式下使用暗色系的代码风格
|
|
1635
|
-
*
|
|
1636
|
-
* @default true
|
|
1637
|
-
*/
|
|
1638
|
-
codeStyleReverse: {
|
|
1639
|
-
type: Boolean,
|
|
1640
|
-
default: !0
|
|
1641
|
-
},
|
|
1642
|
-
/**
|
|
1643
|
-
* 需要自动调整的预览主题
|
|
1644
|
-
*
|
|
1645
|
-
* @default ['default', 'mk-cute']
|
|
1646
|
-
*/
|
|
1647
|
-
codeStyleReverseList: {
|
|
1648
|
-
type: Array,
|
|
1649
|
-
default: ["default", "mk-cute"]
|
|
1650
|
-
},
|
|
1651
|
-
noHighlight: {
|
|
1652
|
-
type: Boolean,
|
|
1653
|
-
default: !1
|
|
1654
|
-
},
|
|
1655
|
-
/**
|
|
1656
|
-
* 是否关闭编辑器默认的放大缩小功能
|
|
1657
|
-
*/
|
|
1658
|
-
noImgZoomIn: {
|
|
1659
|
-
type: Boolean,
|
|
1660
|
-
default: !1
|
|
1661
|
-
},
|
|
1662
|
-
/**
|
|
1663
|
-
* 自定义的图标
|
|
1664
|
-
*/
|
|
1665
|
-
customIcon: {
|
|
1666
|
-
type: Object,
|
|
1667
|
-
default: {}
|
|
170
|
+
default: () => {
|
|
171
|
+
}
|
|
1668
172
|
},
|
|
1669
|
-
|
|
173
|
+
onClick: {
|
|
1670
174
|
type: Function,
|
|
1671
|
-
default: (
|
|
1672
|
-
|
|
1673
|
-
/**
|
|
1674
|
-
* 是否开启折叠代码功能
|
|
1675
|
-
* 不开启会使用div标签替代details标签
|
|
1676
|
-
*
|
|
1677
|
-
* @default true
|
|
1678
|
-
*/
|
|
1679
|
-
codeFoldable: {
|
|
1680
|
-
type: Boolean,
|
|
1681
|
-
default: !0
|
|
175
|
+
default: () => {
|
|
176
|
+
}
|
|
1682
177
|
},
|
|
1683
|
-
|
|
1684
|
-
* 触发自动折叠代码的行数阈值
|
|
1685
|
-
*
|
|
1686
|
-
* @default 30
|
|
1687
|
-
*/
|
|
1688
|
-
autoFoldThreshold: {
|
|
178
|
+
scrollElementOffsetTop: {
|
|
1689
179
|
type: Number,
|
|
1690
|
-
default:
|
|
1691
|
-
},
|
|
1692
|
-
/**
|
|
1693
|
-
* 内容重新挂载事件
|
|
1694
|
-
*
|
|
1695
|
-
* 相比起onHtmlChanged,onRemount会在重新挂载后触发
|
|
1696
|
-
*/
|
|
1697
|
-
onRemount: {
|
|
1698
|
-
type: Function,
|
|
1699
|
-
default: void 0
|
|
1700
|
-
},
|
|
1701
|
-
/**
|
|
1702
|
-
* 不使用 echarts
|
|
1703
|
-
*/
|
|
1704
|
-
noEcharts: {
|
|
1705
|
-
type: Boolean,
|
|
1706
|
-
default: !1
|
|
1707
|
-
},
|
|
1708
|
-
previewComponent: {
|
|
1709
|
-
type: [Object, Function],
|
|
1710
|
-
default: void 0
|
|
180
|
+
default: 0
|
|
1711
181
|
}
|
|
1712
|
-
},
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
182
|
+
}, Q = /* @__PURE__ */ z({
|
|
183
|
+
props: se,
|
|
184
|
+
setup(e) {
|
|
185
|
+
const l = q("scrollElementRef"), b = q("roorNodeRef"), o = D();
|
|
186
|
+
J(() => e.tocItem.active, (m) => {
|
|
187
|
+
m && e.onActive(e.tocItem, o.value);
|
|
188
|
+
}), K(() => {
|
|
189
|
+
e.tocItem.active && e.onActive(e.tocItem, o.value);
|
|
190
|
+
});
|
|
191
|
+
const E = (m) => {
|
|
192
|
+
if (m.stopPropagation(), e.onClick(m, e.tocItem), m.defaultPrevented)
|
|
193
|
+
return;
|
|
194
|
+
const y = e.mdHeadingId({
|
|
195
|
+
text: e.tocItem.text,
|
|
196
|
+
level: e.tocItem.level,
|
|
197
|
+
index: e.tocItem.index,
|
|
198
|
+
currentToken: e.tocItem.currentToken,
|
|
199
|
+
nextToken: e.tocItem.nextToken
|
|
200
|
+
}), f = b.value.getElementById(y), s = l.value;
|
|
201
|
+
if (f && s) {
|
|
202
|
+
let r = f.offsetParent, L = f.offsetTop;
|
|
203
|
+
if (s.contains(r))
|
|
204
|
+
for (; r && s != r; )
|
|
205
|
+
L += r?.offsetTop, r = r?.offsetParent;
|
|
206
|
+
const R = f.previousElementSibling;
|
|
207
|
+
let x = 0;
|
|
208
|
+
R || (x = w(f, "margin-block-start")), s?.scrollTo({
|
|
209
|
+
top: L - e.scrollElementOffsetTop - x,
|
|
210
|
+
behavior: "smooth"
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
};
|
|
214
|
+
return () => N("div", {
|
|
215
|
+
ref: o,
|
|
216
|
+
class: [`${O}-catalog-link`, e.tocItem.active && `${O}-catalog-active`],
|
|
217
|
+
onClick: E
|
|
218
|
+
}, [N("span", {
|
|
219
|
+
title: e.tocItem.text
|
|
220
|
+
}, [e.tocItem.text]), e.tocItem.children && e.tocItem.children.length > 0 && N("div", {
|
|
221
|
+
class: `${O}-catalog-wrapper`
|
|
222
|
+
}, [e.tocItem.children.map((m) => N(Q, {
|
|
223
|
+
mdHeadingId: e.mdHeadingId,
|
|
224
|
+
key: `${e.tocItem.text}-link-${m.level}-${m.text}`,
|
|
225
|
+
tocItem: m,
|
|
226
|
+
onActive: e.onActive,
|
|
227
|
+
onClick: e.onClick,
|
|
228
|
+
scrollElementOffsetTop: e.scrollElementOffsetTop
|
|
229
|
+
}, null))])]);
|
|
230
|
+
}
|
|
231
|
+
}), re = {
|
|
1721
232
|
/**
|
|
1722
|
-
*
|
|
233
|
+
* 编辑器的Id,务必与需要绑定的编辑器Id相同
|
|
1723
234
|
*/
|
|
1724
|
-
|
|
1725
|
-
type:
|
|
235
|
+
editorId: {
|
|
236
|
+
type: String,
|
|
1726
237
|
default: void 0
|
|
1727
238
|
},
|
|
1728
|
-
|
|
1729
|
-
* 是否页面内全屏
|
|
1730
|
-
*
|
|
1731
|
-
* @default false
|
|
1732
|
-
*/
|
|
1733
|
-
pageFullscreen: {
|
|
1734
|
-
type: Boolean,
|
|
1735
|
-
default: !1
|
|
1736
|
-
},
|
|
1737
|
-
/**
|
|
1738
|
-
* 是否展开预览
|
|
1739
|
-
*
|
|
1740
|
-
* @default true
|
|
1741
|
-
*/
|
|
1742
|
-
preview: {
|
|
1743
|
-
type: Boolean,
|
|
1744
|
-
default: !0
|
|
1745
|
-
},
|
|
1746
|
-
/**
|
|
1747
|
-
* 是否展开html预览
|
|
1748
|
-
*
|
|
1749
|
-
* @default false
|
|
1750
|
-
*/
|
|
1751
|
-
htmlPreview: {
|
|
1752
|
-
type: Boolean,
|
|
1753
|
-
default: !1
|
|
1754
|
-
},
|
|
1755
|
-
/**
|
|
1756
|
-
* 仅预览模式,不显示toolbar和编辑框
|
|
1757
|
-
*
|
|
1758
|
-
* @4.0.0开始移除该设置,使用组件MdPreview替换
|
|
1759
|
-
*
|
|
1760
|
-
* @default false
|
|
1761
|
-
*/
|
|
1762
|
-
// previewOnly: {
|
|
1763
|
-
// type: Boolean as PropType<boolean>,
|
|
1764
|
-
// default: false
|
|
1765
|
-
// },
|
|
1766
|
-
/**
|
|
1767
|
-
* 工具栏选择显示
|
|
1768
|
-
*
|
|
1769
|
-
* @default allToolbar
|
|
1770
|
-
*/
|
|
1771
|
-
toolbars: {
|
|
1772
|
-
type: Array,
|
|
1773
|
-
default: _e
|
|
1774
|
-
},
|
|
1775
|
-
/**
|
|
1776
|
-
* 浮动工具栏
|
|
1777
|
-
*
|
|
1778
|
-
* @version 6.0.0
|
|
1779
|
-
* @default []
|
|
1780
|
-
*/
|
|
1781
|
-
floatingToolbars: {
|
|
1782
|
-
type: Array,
|
|
1783
|
-
default: []
|
|
1784
|
-
},
|
|
1785
|
-
/**
|
|
1786
|
-
* 工具栏选择不显示
|
|
1787
|
-
*
|
|
1788
|
-
* @default []
|
|
1789
|
-
*/
|
|
1790
|
-
toolbarsExclude: {
|
|
1791
|
-
type: Array,
|
|
1792
|
-
default: []
|
|
1793
|
-
},
|
|
1794
|
-
/**
|
|
1795
|
-
* 格式化md
|
|
1796
|
-
*
|
|
1797
|
-
* @default true
|
|
1798
|
-
*/
|
|
1799
|
-
noPrettier: {
|
|
1800
|
-
type: Boolean,
|
|
1801
|
-
default: !1
|
|
1802
|
-
},
|
|
1803
|
-
/**
|
|
1804
|
-
* 一个tab等于空格数
|
|
1805
|
-
*
|
|
1806
|
-
* @default 2
|
|
1807
|
-
*/
|
|
1808
|
-
tabWidth: {
|
|
1809
|
-
type: Number,
|
|
1810
|
-
default: 2
|
|
1811
|
-
},
|
|
1812
|
-
/**
|
|
1813
|
-
* 表格预设格子数
|
|
1814
|
-
*
|
|
1815
|
-
* 也可以是[6, 4, 10, 8]
|
|
1816
|
-
*
|
|
1817
|
-
* @default [6, 4]
|
|
1818
|
-
*/
|
|
1819
|
-
tableShape: {
|
|
1820
|
-
type: Array,
|
|
1821
|
-
default: [6, 4]
|
|
1822
|
-
},
|
|
1823
|
-
/**
|
|
1824
|
-
* 空提示
|
|
1825
|
-
*
|
|
1826
|
-
* @default ''
|
|
1827
|
-
*/
|
|
1828
|
-
placeholder: {
|
|
239
|
+
class: {
|
|
1829
240
|
type: String,
|
|
1830
241
|
default: ""
|
|
1831
242
|
},
|
|
1832
|
-
|
|
1833
|
-
* 自定义的工具栏列表
|
|
1834
|
-
*/
|
|
1835
|
-
defToolbars: {
|
|
1836
|
-
type: [String, Object],
|
|
1837
|
-
default: void 0
|
|
1838
|
-
},
|
|
1839
|
-
/**
|
|
1840
|
-
* 内部错误捕获
|
|
1841
|
-
*/
|
|
1842
|
-
onError: {
|
|
243
|
+
mdHeadingId: {
|
|
1843
244
|
type: Function,
|
|
1844
|
-
default:
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
* 页脚列表显示顺序
|
|
1848
|
-
*/
|
|
1849
|
-
footers: {
|
|
1850
|
-
type: Array,
|
|
1851
|
-
default: Oe
|
|
245
|
+
default: ({
|
|
246
|
+
text: e
|
|
247
|
+
}) => e
|
|
1852
248
|
},
|
|
1853
249
|
/**
|
|
1854
|
-
*
|
|
250
|
+
* 指定滚动的容器,选择器需带上对应的符号,默认预览框
|
|
251
|
+
* 元素必须定位!!!!!!
|
|
1855
252
|
*
|
|
1856
|
-
*
|
|
1857
|
-
*/
|
|
1858
|
-
scrollAuto: {
|
|
1859
|
-
type: Boolean,
|
|
1860
|
-
default: !0
|
|
1861
|
-
},
|
|
1862
|
-
/**
|
|
1863
|
-
* 自定义的也叫工具组件列表
|
|
253
|
+
* 默认:#md-editor-preview-wrapper
|
|
1864
254
|
*/
|
|
1865
|
-
|
|
255
|
+
scrollElement: {
|
|
1866
256
|
type: [String, Object],
|
|
1867
257
|
default: void 0
|
|
1868
258
|
},
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
* @default false
|
|
1873
|
-
*/
|
|
1874
|
-
noUploadImg: {
|
|
1875
|
-
type: Boolean,
|
|
1876
|
-
default: !1
|
|
1877
|
-
},
|
|
1878
|
-
/**
|
|
1879
|
-
* 文本区域自动获得焦点
|
|
1880
|
-
*
|
|
1881
|
-
* @default false
|
|
1882
|
-
*/
|
|
1883
|
-
autoFocus: {
|
|
1884
|
-
type: Boolean,
|
|
1885
|
-
default: !1
|
|
1886
|
-
},
|
|
1887
|
-
/**
|
|
1888
|
-
* 禁用文本区域
|
|
1889
|
-
*
|
|
1890
|
-
* @default false
|
|
1891
|
-
*/
|
|
1892
|
-
disabled: {
|
|
1893
|
-
type: Boolean,
|
|
1894
|
-
default: !1
|
|
259
|
+
theme: {
|
|
260
|
+
type: String,
|
|
261
|
+
default: "light"
|
|
1895
262
|
},
|
|
1896
263
|
/**
|
|
1897
|
-
*
|
|
264
|
+
* 高亮标题相对滚动容器顶部偏移量,即距离该值时,高亮当前目录菜单项
|
|
1898
265
|
*
|
|
1899
|
-
*
|
|
1900
|
-
*/
|
|
1901
|
-
readOnly: {
|
|
1902
|
-
type: Boolean,
|
|
1903
|
-
default: !1
|
|
1904
|
-
},
|
|
1905
|
-
/**
|
|
1906
|
-
* 文本区域允许的最大字符数
|
|
266
|
+
* 默认:20px
|
|
1907
267
|
*/
|
|
1908
|
-
|
|
268
|
+
offsetTop: {
|
|
1909
269
|
type: Number,
|
|
1910
|
-
default:
|
|
270
|
+
default: 20
|
|
1911
271
|
},
|
|
1912
272
|
/**
|
|
1913
|
-
*
|
|
1914
|
-
* 目前支持 vscode 复制的代码识别
|
|
273
|
+
* 滚动区域的固定顶部高度
|
|
1915
274
|
*
|
|
1916
|
-
*
|
|
275
|
+
* 默认:0
|
|
1917
276
|
*/
|
|
1918
|
-
|
|
1919
|
-
type:
|
|
1920
|
-
default:
|
|
277
|
+
scrollElementOffsetTop: {
|
|
278
|
+
type: Number,
|
|
279
|
+
default: 0
|
|
1921
280
|
},
|
|
1922
|
-
|
|
1923
|
-
* 输入框失去焦点时触发事件
|
|
1924
|
-
*/
|
|
1925
|
-
onBlur: {
|
|
281
|
+
onClick: {
|
|
1926
282
|
type: Function,
|
|
1927
283
|
default: void 0
|
|
1928
284
|
},
|
|
1929
|
-
|
|
1930
|
-
* 输入框获得焦点时触发事件
|
|
1931
|
-
*/
|
|
1932
|
-
onFocus: {
|
|
285
|
+
onActive: {
|
|
1933
286
|
type: Function,
|
|
1934
287
|
default: void 0
|
|
1935
288
|
},
|
|
1936
289
|
/**
|
|
1937
|
-
*
|
|
1938
|
-
*
|
|
1939
|
-
* 它会被像下面这样嵌入编辑器
|
|
1940
|
-
*
|
|
1941
|
-
* import { autocompletion } from '@codemirror/autocomplete';
|
|
1942
|
-
* autocompletion({
|
|
1943
|
-
* override: [...completions]
|
|
1944
|
-
* })
|
|
1945
|
-
*/
|
|
1946
|
-
completions: {
|
|
1947
|
-
type: Array,
|
|
1948
|
-
default: void 0
|
|
1949
|
-
},
|
|
1950
|
-
/**
|
|
1951
|
-
* 是否在工具栏下面显示对应的文字名称
|
|
290
|
+
* 滚动容器是否在web component中,默认不在
|
|
1952
291
|
*
|
|
1953
|
-
*
|
|
292
|
+
* 在其中的话通过document查询不到
|
|
1954
293
|
*/
|
|
1955
|
-
|
|
294
|
+
isScrollElementInShadow: {
|
|
1956
295
|
type: Boolean,
|
|
1957
296
|
default: !1
|
|
1958
297
|
},
|
|
1959
298
|
/**
|
|
1960
|
-
*
|
|
1961
|
-
*/
|
|
1962
|
-
onInput: {
|
|
1963
|
-
type: Function,
|
|
1964
|
-
default: void 0
|
|
1965
|
-
},
|
|
1966
|
-
onDrop: {
|
|
1967
|
-
type: Function,
|
|
1968
|
-
default: void 0
|
|
1969
|
-
},
|
|
1970
|
-
/**
|
|
1971
|
-
* 输入框的默认宽度
|
|
1972
|
-
*
|
|
1973
|
-
* @example '100px'/'50%'
|
|
1974
|
-
* @default '50%
|
|
1975
|
-
*/
|
|
1976
|
-
inputBoxWidth: {
|
|
1977
|
-
type: String,
|
|
1978
|
-
default: "50%"
|
|
1979
|
-
},
|
|
1980
|
-
/**
|
|
1981
|
-
* 输入框宽度变化事件
|
|
1982
|
-
*/
|
|
1983
|
-
oninputBoxWidthChange: {
|
|
1984
|
-
type: Function,
|
|
1985
|
-
default: void 0
|
|
1986
|
-
},
|
|
1987
|
-
/**
|
|
1988
|
-
* 替换粘贴的图片链接
|
|
1989
|
-
*
|
|
1990
|
-
* @param t 图片链接
|
|
1991
|
-
* @returns
|
|
1992
|
-
*/
|
|
1993
|
-
transformImgUrl: {
|
|
1994
|
-
type: Function,
|
|
1995
|
-
default: (e) => e
|
|
1996
|
-
},
|
|
1997
|
-
/**
|
|
1998
|
-
* 内置的目录显示的状态
|
|
1999
|
-
*
|
|
2000
|
-
* 'fixed': 悬浮在内容上方
|
|
2001
|
-
* 'flat': 展示在右侧
|
|
2002
|
-
*
|
|
2003
|
-
* \>=5.3.0
|
|
299
|
+
* 设置与哪个区域同步,默认与内容区域同步
|
|
2004
300
|
*
|
|
2005
|
-
*
|
|
301
|
+
* >= v5.3.0
|
|
2006
302
|
*/
|
|
2007
|
-
|
|
303
|
+
syncWith: {
|
|
2008
304
|
type: String,
|
|
2009
|
-
default: "
|
|
305
|
+
default: "preview"
|
|
2010
306
|
},
|
|
2011
307
|
/**
|
|
2012
308
|
* 控制最大显示的目录层级
|
|
@@ -2015,97 +311,164 @@ const Y = new rt({
|
|
|
2015
311
|
type: Number,
|
|
2016
312
|
default: void 0
|
|
2017
313
|
}
|
|
2018
|
-
},
|
|
2019
|
-
"
|
|
2020
|
-
|
|
2021
|
-
"
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
],
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
314
|
+
}, W = /* @__PURE__ */ z({
|
|
315
|
+
name: "MdCatalog",
|
|
316
|
+
props: re,
|
|
317
|
+
emits: ["onClick", "onActive"],
|
|
318
|
+
setup(e, l) {
|
|
319
|
+
const b = e.editorId, o = `#${b}-preview-wrapper`, E = X({
|
|
320
|
+
list: [],
|
|
321
|
+
show: !1,
|
|
322
|
+
scrollElement: e.scrollElement || o
|
|
323
|
+
}), m = G(), y = D(), f = D(), s = D(), r = D(), L = G(), R = D({});
|
|
324
|
+
V("scrollElementRef", f), V("roorNodeRef", r);
|
|
325
|
+
const x = Y(() => {
|
|
326
|
+
const t = [];
|
|
327
|
+
return E.list.forEach((n, a) => {
|
|
328
|
+
if (e.catalogMaxDepth && n.level > e.catalogMaxDepth)
|
|
329
|
+
return;
|
|
330
|
+
const {
|
|
331
|
+
text: u,
|
|
332
|
+
level: k,
|
|
333
|
+
line: d
|
|
334
|
+
} = n, c = {
|
|
335
|
+
level: k,
|
|
336
|
+
text: u,
|
|
337
|
+
line: d,
|
|
338
|
+
index: a + 1,
|
|
339
|
+
active: m.value === n
|
|
340
|
+
};
|
|
341
|
+
if (t.length === 0)
|
|
342
|
+
t.push(c);
|
|
343
|
+
else {
|
|
344
|
+
let I = t[t.length - 1];
|
|
345
|
+
if (c.level > I.level)
|
|
346
|
+
for (let g = I.level + 1; g <= 6; g++) {
|
|
347
|
+
const {
|
|
348
|
+
children: v
|
|
349
|
+
} = I;
|
|
350
|
+
if (!v) {
|
|
351
|
+
I.children = [c];
|
|
352
|
+
break;
|
|
353
|
+
}
|
|
354
|
+
if (I = v[v.length - 1], c.level <= I.level) {
|
|
355
|
+
v.push(c);
|
|
356
|
+
break;
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
else
|
|
360
|
+
t.push(c);
|
|
361
|
+
}
|
|
362
|
+
}), t;
|
|
363
|
+
}), B = () => {
|
|
364
|
+
if (E.scrollElement instanceof HTMLElement)
|
|
365
|
+
return E.scrollElement;
|
|
366
|
+
let t = document;
|
|
367
|
+
return (E.scrollElement === o || e.isScrollElementInShadow) && (t = y.value?.getRootNode()), t.querySelector(E.scrollElement);
|
|
368
|
+
}, _ = (t) => {
|
|
369
|
+
if (t.length === 0)
|
|
370
|
+
return m.value = void 0, E.list = [], !1;
|
|
371
|
+
const {
|
|
372
|
+
activeHead: n,
|
|
373
|
+
activeIndex: a
|
|
374
|
+
} = t.reduce((d, c, I) => {
|
|
375
|
+
let g = 0;
|
|
376
|
+
if (e.syncWith === "preview") {
|
|
377
|
+
const v = r.value?.getElementById(e.mdHeadingId({
|
|
378
|
+
text: c.text,
|
|
379
|
+
level: c.level,
|
|
380
|
+
index: I + 1,
|
|
381
|
+
currentToken: c.currentToken,
|
|
382
|
+
nextToken: c.nextToken
|
|
383
|
+
}));
|
|
384
|
+
v instanceof HTMLElement && (g = ne(v, f.value));
|
|
385
|
+
} else {
|
|
386
|
+
const v = L.value;
|
|
387
|
+
if (v) {
|
|
388
|
+
const C = v.lineBlockAt(v.state.doc.line(c.line + 1).from).top, S = v.scrollDOM.scrollTop;
|
|
389
|
+
g = C - S;
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
return g < e.offsetTop && g > d.minTop ? {
|
|
393
|
+
activeHead: c,
|
|
394
|
+
activeIndex: I,
|
|
395
|
+
minTop: g
|
|
396
|
+
} : d;
|
|
397
|
+
}, {
|
|
398
|
+
activeHead: t[0],
|
|
399
|
+
activeIndex: 0,
|
|
400
|
+
minTop: Number.MIN_SAFE_INTEGER
|
|
401
|
+
});
|
|
402
|
+
let u = n;
|
|
403
|
+
const {
|
|
404
|
+
catalogMaxDepth: k
|
|
405
|
+
} = e;
|
|
406
|
+
if (k && u.level > k) {
|
|
407
|
+
for (let d = a; d >= 0; d--) {
|
|
408
|
+
const c = t[d];
|
|
409
|
+
if (c.level <= k) {
|
|
410
|
+
u = c;
|
|
411
|
+
break;
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
if (u.level > k) {
|
|
415
|
+
const d = t.find((c) => c.level <= k);
|
|
416
|
+
d && (u = d);
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
m.value = u, E.list = t;
|
|
420
|
+
}, P = (t, n) => {
|
|
421
|
+
R.value.top = n.offsetTop + w(n, "padding-block-start") + "px", e.onActive?.(t, n), l.emit("onActive", t, n);
|
|
422
|
+
}, M = () => {
|
|
423
|
+
_(E.list);
|
|
424
|
+
}, i = (t) => {
|
|
425
|
+
if (s.value?.removeEventListener("scroll", M), e.syncWith === "editor")
|
|
426
|
+
s.value = L.value?.scrollDOM;
|
|
427
|
+
else {
|
|
428
|
+
const n = B();
|
|
429
|
+
f.value = n, s.value = n === document.documentElement ? document : n;
|
|
430
|
+
}
|
|
431
|
+
_(t), s.value?.addEventListener("scroll", M);
|
|
432
|
+
}, h = (t) => {
|
|
433
|
+
L.value = t;
|
|
434
|
+
};
|
|
435
|
+
J([() => e.syncWith, L, () => e.catalogMaxDepth], () => {
|
|
436
|
+
i(E.list);
|
|
437
|
+
}), K(() => {
|
|
438
|
+
r.value = y.value.getRootNode(), $.on(b, {
|
|
439
|
+
name: j,
|
|
440
|
+
callback: i
|
|
441
|
+
}), $.on(b, {
|
|
442
|
+
name: U,
|
|
443
|
+
callback: h
|
|
444
|
+
}), $.emit(b, te), $.emit(b, le);
|
|
445
|
+
}), Z(() => {
|
|
446
|
+
$.remove(b, j, i), $.remove(b, U, h), s.value?.removeEventListener("scroll", M);
|
|
2058
447
|
});
|
|
2059
|
-
const
|
|
2060
|
-
e.
|
|
2061
|
-
}, s = (a) => {
|
|
2062
|
-
e.onHtmlChanged?.(a), t.emit("onHtmlChanged", a);
|
|
2063
|
-
}, l = (a) => {
|
|
2064
|
-
e.onGetCatalog?.(a), t.emit("onGetCatalog", a);
|
|
2065
|
-
}, i = () => {
|
|
2066
|
-
e.onRemount?.(), t.emit("onRemount");
|
|
448
|
+
const H = (t, n) => {
|
|
449
|
+
e.onClick?.(t, n), l.emit("onClick", t, n);
|
|
2067
450
|
};
|
|
2068
|
-
return () =>
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
onGetCatalog: l,
|
|
451
|
+
return () => N("div", {
|
|
452
|
+
class: [`${O}-catalog`, e.theme === "dark" && `${O}-catalog-dark`, e.class || ""],
|
|
453
|
+
ref: y
|
|
454
|
+
}, [x.value.length > 0 && N(ee, null, [N("div", {
|
|
455
|
+
class: `${O}-catalog-indicator`,
|
|
456
|
+
style: R.value
|
|
457
|
+
}, null), N("div", {
|
|
458
|
+
class: `${O}-catalog-container`
|
|
459
|
+
}, [x.value.map((t) => N(Q, {
|
|
2078
460
|
mdHeadingId: e.mdHeadingId,
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
previewOnly: !0,
|
|
2086
|
-
sanitizeMermaid: e.sanitizeMermaid,
|
|
2087
|
-
codeFoldable: e.codeFoldable,
|
|
2088
|
-
autoFoldThreshold: e.autoFoldThreshold,
|
|
2089
|
-
onRemount: i,
|
|
2090
|
-
noEcharts: e.noEcharts,
|
|
2091
|
-
previewComponent: e.previewComponent
|
|
2092
|
-
}, null)]);
|
|
461
|
+
tocItem: t,
|
|
462
|
+
key: `link-${t.level}-${t.text}`,
|
|
463
|
+
onActive: P,
|
|
464
|
+
onClick: H,
|
|
465
|
+
scrollElementOffsetTop: e.scrollElementOffsetTop
|
|
466
|
+
}, null))])])]);
|
|
2093
467
|
}
|
|
2094
468
|
});
|
|
2095
|
-
|
|
469
|
+
W.install = (e) => (e.component(W.name, W), e);
|
|
2096
470
|
export {
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
on as b,
|
|
2101
|
-
nn as c,
|
|
2102
|
-
Qt as d,
|
|
2103
|
-
an as e,
|
|
2104
|
-
en as f,
|
|
2105
|
-
Zt as g,
|
|
2106
|
-
Xt as h,
|
|
2107
|
-
Yt as i,
|
|
2108
|
-
tn as j,
|
|
2109
|
-
Jt as k,
|
|
2110
|
-
et as u
|
|
471
|
+
W as M,
|
|
472
|
+
ve as a,
|
|
473
|
+
he as s
|
|
2111
474
|
};
|