md-editor-v3 6.4.1 → 6.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/lib/cjs/chunks/config.cjs +1 -1
- package/lib/cjs/chunks/index3.cjs +28 -28
- package/lib/es/chunks/config.mjs +2 -1
- package/lib/es/chunks/index3.mjs +510 -469
- package/lib/types/index.d.ts +78 -68
- package/package.json +1 -2
package/lib/es/chunks/index3.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { useId as Fe, provide as
|
|
1
|
+
import { useId as Fe, provide as I, computed as A, reactive as re, watch as E, onMounted as H, ref as G, inject as C, nextTick as U, shallowRef as ee, onBeforeUnmount as te, toRef as Ae, defineComponent as ce, createVNode as j, Fragment as Re, h as He } from "vue";
|
|
2
2
|
import { deepMerge as Me, deepClone as Pe, randomId as le, debounce as Le } from "@vavt/util";
|
|
3
3
|
import { p as f, g as P, f as ue, s as me, b as Oe, a as _e } from "./config.mjs";
|
|
4
|
-
import { b as
|
|
4
|
+
import { b as v, U as Be, C as Ee, B as X, O as ke, E as Q, P as fe, F as he, f as pe, g as ge, H as ve, h as ye, R as ie, e as je, i as de, d as Ne, j as oe, k as De, T as Ve } from "./event-bus.mjs";
|
|
5
5
|
import { a as O, u as Ge, S as Ue, c as ze, z as We } from "./dom.mjs";
|
|
6
6
|
import qe from "@vavt/copy2clipboard";
|
|
7
7
|
import Ke from "markdown-it";
|
|
@@ -9,8 +9,7 @@ import Ze from "markdown-it-image-figures";
|
|
|
9
9
|
import Je from "markdown-it-sub";
|
|
10
10
|
import Xe from "markdown-it-sup";
|
|
11
11
|
import { g as Ye } from "./index5.mjs";
|
|
12
|
-
import
|
|
13
|
-
import et from "medium-zoom";
|
|
12
|
+
import Qe from "medium-zoom";
|
|
14
13
|
const M = {
|
|
15
14
|
hljs: `${f}-hljs`,
|
|
16
15
|
hlcss: `${f}-hlCss`,
|
|
@@ -24,41 +23,41 @@ const M = {
|
|
|
24
23
|
katexjs: `${f}-katex`,
|
|
25
24
|
katexcss: `${f}-katexCss`,
|
|
26
25
|
echarts: `${f}-echarts`
|
|
27
|
-
},
|
|
26
|
+
}, Zt = (e, t, r) => {
|
|
28
27
|
const { editorId: n } = r, o = re({
|
|
29
28
|
// 是否已编译成html
|
|
30
29
|
buildFinished: !1,
|
|
31
30
|
// 存储当前最新的html
|
|
32
31
|
html: ""
|
|
33
32
|
});
|
|
34
|
-
|
|
33
|
+
E(
|
|
35
34
|
() => e.modelValue,
|
|
36
35
|
() => {
|
|
37
36
|
o.buildFinished = !1;
|
|
38
37
|
}
|
|
39
38
|
), H(() => {
|
|
40
|
-
|
|
39
|
+
v.on(n, {
|
|
41
40
|
name: X,
|
|
42
|
-
callback(
|
|
43
|
-
o.buildFinished = !0, o.html =
|
|
41
|
+
callback(m) {
|
|
42
|
+
o.buildFinished = !0, o.html = m;
|
|
44
43
|
}
|
|
45
|
-
}),
|
|
46
|
-
name:
|
|
44
|
+
}), v.on(n, {
|
|
45
|
+
name: ke,
|
|
47
46
|
callback() {
|
|
48
|
-
const
|
|
47
|
+
const m = new Promise((d) => {
|
|
49
48
|
if (o.buildFinished)
|
|
50
|
-
|
|
49
|
+
d(o.html);
|
|
51
50
|
else {
|
|
52
|
-
const
|
|
53
|
-
|
|
51
|
+
const u = (s) => {
|
|
52
|
+
d(s), v.remove(n, X, u);
|
|
54
53
|
};
|
|
55
|
-
|
|
54
|
+
v.on(n, {
|
|
56
55
|
name: X,
|
|
57
|
-
callback:
|
|
56
|
+
callback: u
|
|
58
57
|
});
|
|
59
58
|
}
|
|
60
59
|
});
|
|
61
|
-
e.onSave ? e.onSave(e.modelValue,
|
|
60
|
+
e.onSave ? e.onSave(e.modelValue, m) : t.emit("onSave", e.modelValue, m);
|
|
62
61
|
}
|
|
63
62
|
});
|
|
64
63
|
});
|
|
@@ -67,51 +66,51 @@ const M = {
|
|
|
67
66
|
rootRef: r,
|
|
68
67
|
setting: n
|
|
69
68
|
}) => {
|
|
70
|
-
const o = P.editorExtensions.highlight,
|
|
71
|
-
|
|
69
|
+
const o = P.editorExtensions.highlight, m = P.editorExtensionsAttrs.highlight;
|
|
70
|
+
I("editorId", t), I("rootRef", r), I(
|
|
72
71
|
"theme",
|
|
73
|
-
|
|
74
|
-
),
|
|
72
|
+
A(() => e.theme)
|
|
73
|
+
), I(
|
|
75
74
|
"language",
|
|
76
|
-
|
|
77
|
-
),
|
|
75
|
+
A(() => e.language)
|
|
76
|
+
), I(
|
|
78
77
|
"highlight",
|
|
79
|
-
|
|
80
|
-
const { js:
|
|
78
|
+
A(() => {
|
|
79
|
+
const { js: u } = o, s = {
|
|
81
80
|
...ue,
|
|
82
81
|
...o.css
|
|
83
|
-
}, { js: l, css: i = {} } =
|
|
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] : {};
|
|
84
83
|
return {
|
|
85
84
|
js: {
|
|
86
|
-
src:
|
|
85
|
+
src: u,
|
|
87
86
|
...l
|
|
88
87
|
},
|
|
89
88
|
css: {
|
|
90
|
-
href:
|
|
89
|
+
href: c,
|
|
91
90
|
...$
|
|
92
91
|
}
|
|
93
92
|
};
|
|
94
93
|
})
|
|
95
|
-
),
|
|
96
|
-
const
|
|
97
|
-
const
|
|
94
|
+
), I("showCodeRowNumber", e.showCodeRowNumber);
|
|
95
|
+
const d = A(() => {
|
|
96
|
+
const u = {
|
|
98
97
|
...me,
|
|
99
98
|
...P.editorConfig.languageUserDefined
|
|
100
99
|
};
|
|
101
100
|
return Me(
|
|
102
101
|
Pe(me["en-US"]),
|
|
103
|
-
|
|
102
|
+
u[e.language] || {}
|
|
104
103
|
);
|
|
105
104
|
});
|
|
106
|
-
return
|
|
105
|
+
return I("usedLanguageText", d), I(
|
|
107
106
|
"previewTheme",
|
|
108
|
-
|
|
109
|
-
),
|
|
107
|
+
A(() => e.previewTheme)
|
|
108
|
+
), I(
|
|
110
109
|
"customIcon",
|
|
111
|
-
|
|
112
|
-
),
|
|
110
|
+
A(() => e.customIcon)
|
|
111
|
+
), I(
|
|
113
112
|
"setting",
|
|
114
|
-
|
|
113
|
+
A(() => n ? {
|
|
115
114
|
// setting是reactive,不转化是可以直接赋值的
|
|
116
115
|
...n
|
|
117
116
|
} : {
|
|
@@ -122,28 +121,28 @@ const M = {
|
|
|
122
121
|
fullscreen: !1
|
|
123
122
|
})
|
|
124
123
|
), { editorId: t };
|
|
125
|
-
},
|
|
124
|
+
}, Jt = (e, t) => (I("tabWidth", e.tabWidth), I(
|
|
126
125
|
"disabled",
|
|
127
|
-
|
|
128
|
-
),
|
|
126
|
+
A(() => e.disabled)
|
|
127
|
+
), I(
|
|
129
128
|
"showToolbarName",
|
|
130
|
-
|
|
131
|
-
),
|
|
129
|
+
A(() => e.showToolbarName)
|
|
130
|
+
), I("noUploadImg", e.noUploadImg), I(
|
|
132
131
|
"tableShape",
|
|
133
|
-
|
|
134
|
-
),
|
|
132
|
+
A(() => e.tableShape)
|
|
133
|
+
), I("noPrettier", e.noPrettier), I(
|
|
135
134
|
"codeTheme",
|
|
136
|
-
|
|
137
|
-
),
|
|
135
|
+
A(() => e.codeTheme)
|
|
136
|
+
), I("updateSetting", t.updateSetting), I(
|
|
138
137
|
"catalogVisible",
|
|
139
|
-
|
|
140
|
-
),
|
|
138
|
+
A(() => t.catalogVisible.value)
|
|
139
|
+
), I("defToolbars", t.defToolbars), I(
|
|
141
140
|
"floatingToolbars",
|
|
142
|
-
|
|
143
|
-
), Te(e, t)),
|
|
144
|
-
const { noPrettier: t, noUploadImg: r } = e, { editorExtensions: n, editorExtensionsAttrs: o } = P,
|
|
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;
|
|
145
144
|
H(() => {
|
|
146
|
-
if (!
|
|
145
|
+
if (!u) {
|
|
147
146
|
const { js: s = {}, css: l = {} } = o.cropper || {};
|
|
148
147
|
O("link", {
|
|
149
148
|
...l,
|
|
@@ -156,7 +155,7 @@ const M = {
|
|
|
156
155
|
id: M.cropperjs
|
|
157
156
|
});
|
|
158
157
|
}
|
|
159
|
-
if (!
|
|
158
|
+
if (!m) {
|
|
160
159
|
const { standaloneJs: s = {} } = o.prettier || {};
|
|
161
160
|
O("script", {
|
|
162
161
|
...s,
|
|
@@ -164,7 +163,7 @@ const M = {
|
|
|
164
163
|
id: M.prettier
|
|
165
164
|
});
|
|
166
165
|
}
|
|
167
|
-
if (!
|
|
166
|
+
if (!d) {
|
|
168
167
|
const { parserMarkdownJs: s = {} } = o.prettier || {};
|
|
169
168
|
O("script", {
|
|
170
169
|
...s,
|
|
@@ -173,24 +172,24 @@ const M = {
|
|
|
173
172
|
});
|
|
174
173
|
}
|
|
175
174
|
});
|
|
176
|
-
},
|
|
175
|
+
}, Yt = (e, t, r) => {
|
|
177
176
|
const { editorId: n } = r;
|
|
178
177
|
H(() => {
|
|
179
|
-
|
|
178
|
+
v.on(n, {
|
|
180
179
|
name: Q,
|
|
181
180
|
callback: (o) => {
|
|
182
181
|
e.onError?.(o), t.emit("onError", o);
|
|
183
182
|
}
|
|
184
183
|
});
|
|
185
184
|
});
|
|
186
|
-
},
|
|
185
|
+
}, Qt = (e, t, r) => {
|
|
187
186
|
const { editorId: n } = r, o = re({
|
|
188
187
|
pageFullscreen: e.pageFullscreen,
|
|
189
188
|
fullscreen: !1,
|
|
190
189
|
preview: e.preview,
|
|
191
190
|
htmlPreview: e.preview ? !1 : e.htmlPreview,
|
|
192
191
|
previewOnly: !1
|
|
193
|
-
}),
|
|
192
|
+
}), m = re({ ...o }), d = (l, i) => {
|
|
194
193
|
const a = i === void 0 ? !o[l] : i;
|
|
195
194
|
switch (l) {
|
|
196
195
|
case "preview": {
|
|
@@ -202,75 +201,75 @@ const M = {
|
|
|
202
201
|
break;
|
|
203
202
|
}
|
|
204
203
|
case "previewOnly": {
|
|
205
|
-
a ? !o.preview && !o.htmlPreview && (o.preview = !0) : (
|
|
204
|
+
a ? !o.preview && !o.htmlPreview && (o.preview = !0) : (m.preview || (o.preview = !1), m.htmlPreview || (o.htmlPreview = !1));
|
|
206
205
|
break;
|
|
207
206
|
}
|
|
208
207
|
}
|
|
209
|
-
|
|
208
|
+
m[l] = a, o[l] = a;
|
|
210
209
|
};
|
|
211
|
-
let
|
|
210
|
+
let u = "";
|
|
212
211
|
const s = () => {
|
|
213
|
-
o.pageFullscreen || o.fullscreen ? document.body.style.overflow = "hidden" : document.body.style.overflow =
|
|
212
|
+
o.pageFullscreen || o.fullscreen ? document.body.style.overflow = "hidden" : document.body.style.overflow = u;
|
|
214
213
|
};
|
|
215
|
-
return
|
|
216
|
-
|
|
214
|
+
return E(() => [o.pageFullscreen, o.fullscreen], s), H(() => {
|
|
215
|
+
v.on(n, {
|
|
217
216
|
name: Be,
|
|
218
217
|
callback(l, i) {
|
|
219
|
-
const a = (
|
|
220
|
-
|
|
218
|
+
const a = (c) => {
|
|
219
|
+
v.emit(n, ie, "image", {
|
|
221
220
|
desc: "",
|
|
222
|
-
urls:
|
|
221
|
+
urls: c
|
|
223
222
|
}), i?.();
|
|
224
223
|
};
|
|
225
224
|
e.onUploadImg ? e.onUploadImg(l, a) : t.emit("onUploadImg", l, a);
|
|
226
225
|
}
|
|
227
|
-
}),
|
|
228
|
-
}), [o,
|
|
229
|
-
},
|
|
226
|
+
}), u = document.body.style.overflow, s();
|
|
227
|
+
}), [o, d];
|
|
228
|
+
}, en = (e, t) => {
|
|
230
229
|
const { editorId: r } = t, n = G(!1);
|
|
231
230
|
return H(() => {
|
|
232
|
-
|
|
233
|
-
name:
|
|
231
|
+
v.on(r, {
|
|
232
|
+
name: Ee,
|
|
234
233
|
callback: (o) => {
|
|
235
234
|
o === void 0 ? n.value = !n.value : n.value = o;
|
|
236
235
|
}
|
|
237
236
|
});
|
|
238
237
|
}), n;
|
|
239
|
-
},
|
|
240
|
-
const { editorId: n, catalogVisible: o, setting:
|
|
241
|
-
|
|
242
|
-
() =>
|
|
238
|
+
}, tn = (e, t, r) => {
|
|
239
|
+
const { editorId: n, catalogVisible: o, setting: m, updateSetting: d, codeRef: u } = r;
|
|
240
|
+
E(
|
|
241
|
+
() => m.pageFullscreen,
|
|
243
242
|
(l) => {
|
|
244
|
-
|
|
243
|
+
v.emit(n, fe, l);
|
|
245
244
|
}
|
|
246
|
-
),
|
|
247
|
-
() =>
|
|
245
|
+
), E(
|
|
246
|
+
() => m.fullscreen,
|
|
248
247
|
(l) => {
|
|
249
|
-
|
|
248
|
+
v.emit(n, he, l);
|
|
250
249
|
}
|
|
251
|
-
),
|
|
252
|
-
() =>
|
|
250
|
+
), E(
|
|
251
|
+
() => m.preview,
|
|
253
252
|
(l) => {
|
|
254
|
-
|
|
253
|
+
v.emit(n, pe, l);
|
|
255
254
|
}
|
|
256
|
-
),
|
|
257
|
-
() =>
|
|
255
|
+
), E(
|
|
256
|
+
() => m.previewOnly,
|
|
258
257
|
(l) => {
|
|
259
|
-
|
|
258
|
+
v.emit(n, ge, l);
|
|
260
259
|
}
|
|
261
|
-
),
|
|
262
|
-
() =>
|
|
260
|
+
), E(
|
|
261
|
+
() => m.htmlPreview,
|
|
263
262
|
(l) => {
|
|
264
|
-
|
|
263
|
+
v.emit(n, ve, l);
|
|
265
264
|
}
|
|
266
|
-
),
|
|
267
|
-
|
|
265
|
+
), E(o, (l) => {
|
|
266
|
+
v.emit(n, ye, l);
|
|
268
267
|
});
|
|
269
268
|
const s = {
|
|
270
269
|
on(l, i) {
|
|
271
270
|
switch (l) {
|
|
272
271
|
case "pageFullscreen": {
|
|
273
|
-
|
|
272
|
+
v.on(n, {
|
|
274
273
|
name: fe,
|
|
275
274
|
callback(a) {
|
|
276
275
|
i(a);
|
|
@@ -279,7 +278,7 @@ const M = {
|
|
|
279
278
|
break;
|
|
280
279
|
}
|
|
281
280
|
case "fullscreen": {
|
|
282
|
-
|
|
281
|
+
v.on(n, {
|
|
283
282
|
name: he,
|
|
284
283
|
callback(a) {
|
|
285
284
|
i(a);
|
|
@@ -288,7 +287,7 @@ const M = {
|
|
|
288
287
|
break;
|
|
289
288
|
}
|
|
290
289
|
case "preview": {
|
|
291
|
-
|
|
290
|
+
v.on(n, {
|
|
292
291
|
name: pe,
|
|
293
292
|
callback(a) {
|
|
294
293
|
i(a);
|
|
@@ -297,7 +296,7 @@ const M = {
|
|
|
297
296
|
break;
|
|
298
297
|
}
|
|
299
298
|
case "previewOnly": {
|
|
300
|
-
|
|
299
|
+
v.on(n, {
|
|
301
300
|
name: ge,
|
|
302
301
|
callback(a) {
|
|
303
302
|
i(a);
|
|
@@ -306,7 +305,7 @@ const M = {
|
|
|
306
305
|
break;
|
|
307
306
|
}
|
|
308
307
|
case "htmlPreview": {
|
|
309
|
-
|
|
308
|
+
v.on(n, {
|
|
310
309
|
name: ve,
|
|
311
310
|
callback(a) {
|
|
312
311
|
i(a);
|
|
@@ -315,7 +314,7 @@ const M = {
|
|
|
315
314
|
break;
|
|
316
315
|
}
|
|
317
316
|
case "catalog": {
|
|
318
|
-
|
|
317
|
+
v.on(n, {
|
|
319
318
|
name: ye,
|
|
320
319
|
callback(a) {
|
|
321
320
|
i(a);
|
|
@@ -326,157 +325,160 @@ const M = {
|
|
|
326
325
|
}
|
|
327
326
|
},
|
|
328
327
|
togglePageFullscreen(l) {
|
|
329
|
-
|
|
328
|
+
d("pageFullscreen", l);
|
|
330
329
|
},
|
|
331
330
|
toggleFullscreen(l) {
|
|
332
|
-
|
|
331
|
+
v.emit(n, Ne, l);
|
|
333
332
|
},
|
|
334
333
|
togglePreview(l) {
|
|
335
|
-
|
|
334
|
+
d("preview", l);
|
|
336
335
|
},
|
|
337
336
|
togglePreviewOnly(l) {
|
|
338
|
-
|
|
337
|
+
d("previewOnly", l);
|
|
339
338
|
},
|
|
340
339
|
toggleHtmlPreview(l) {
|
|
341
|
-
|
|
340
|
+
d("htmlPreview", l);
|
|
342
341
|
},
|
|
343
342
|
toggleCatalog(l) {
|
|
344
|
-
|
|
343
|
+
v.emit(n, Ee, l);
|
|
345
344
|
},
|
|
346
345
|
triggerSave() {
|
|
347
|
-
|
|
346
|
+
v.emit(n, ke);
|
|
348
347
|
},
|
|
349
348
|
insert(l) {
|
|
350
|
-
|
|
349
|
+
v.emit(n, ie, "universal", { generate: l });
|
|
351
350
|
},
|
|
352
351
|
focus(l) {
|
|
353
|
-
|
|
352
|
+
u.value?.focus(l);
|
|
354
353
|
},
|
|
355
354
|
rerender() {
|
|
356
|
-
|
|
355
|
+
v.emit(n, de);
|
|
357
356
|
},
|
|
358
357
|
getSelectedText() {
|
|
359
|
-
return
|
|
358
|
+
return u.value?.getSelectedText();
|
|
360
359
|
},
|
|
361
360
|
resetHistory() {
|
|
362
|
-
|
|
361
|
+
u.value?.resetHistory();
|
|
363
362
|
},
|
|
364
363
|
domEventHandlers(l) {
|
|
365
|
-
|
|
364
|
+
v.emit(n, je, l);
|
|
366
365
|
},
|
|
367
366
|
execCommand(l) {
|
|
368
|
-
|
|
367
|
+
v.emit(n, ie, l);
|
|
369
368
|
},
|
|
370
369
|
getEditorView() {
|
|
371
|
-
return
|
|
370
|
+
return u.value?.getEditorView();
|
|
372
371
|
}
|
|
373
372
|
};
|
|
374
373
|
t.expose(s);
|
|
375
|
-
},
|
|
374
|
+
}, et = (e) => {
|
|
376
375
|
const t = Fe();
|
|
377
376
|
return e.id || e.editorId || `${f}-${t}`;
|
|
378
|
-
},
|
|
379
|
-
const n =
|
|
377
|
+
}, tt = (e, t, r) => {
|
|
378
|
+
const n = C("editorId"), o = C("rootRef"), m = C("usedLanguageText"), d = C("setting"), u = () => {
|
|
380
379
|
o.value.querySelectorAll(`#${n} .${f}-preview .${f}-code`).forEach((i) => {
|
|
381
380
|
let a = -1;
|
|
382
|
-
const
|
|
381
|
+
const c = i.querySelector(
|
|
383
382
|
`.${f}-copy-button:not([data-processed])`
|
|
384
383
|
);
|
|
385
|
-
|
|
384
|
+
c && (c.onclick = ($) => {
|
|
386
385
|
$.preventDefault(), clearTimeout(a);
|
|
387
|
-
const
|
|
388
|
-
let
|
|
389
|
-
qe(e.formatCopiedText(
|
|
390
|
-
|
|
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;
|
|
391
390
|
}).finally(() => {
|
|
392
|
-
|
|
393
|
-
|
|
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;
|
|
394
393
|
}, 1500);
|
|
395
394
|
});
|
|
396
|
-
},
|
|
395
|
+
}, c.setAttribute("data-processed", "true"));
|
|
397
396
|
});
|
|
398
397
|
}, s = () => {
|
|
399
|
-
U(
|
|
398
|
+
U(u);
|
|
400
399
|
}, l = (i) => {
|
|
401
|
-
i && U(
|
|
400
|
+
i && U(u);
|
|
402
401
|
};
|
|
403
|
-
|
|
404
|
-
},
|
|
405
|
-
const t =
|
|
406
|
-
let
|
|
407
|
-
const
|
|
408
|
-
!e.noEcharts &&
|
|
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);
|
|
409
408
|
};
|
|
410
|
-
|
|
409
|
+
E(
|
|
411
410
|
() => r.value,
|
|
412
411
|
() => {
|
|
413
|
-
|
|
412
|
+
l();
|
|
414
413
|
}
|
|
415
414
|
), H(() => {
|
|
416
|
-
if (e.noEcharts ||
|
|
415
|
+
if (e.noEcharts || u)
|
|
417
416
|
return;
|
|
418
|
-
const
|
|
417
|
+
const g = o.echarts.js;
|
|
419
418
|
O(
|
|
420
419
|
"script",
|
|
421
420
|
{
|
|
422
|
-
...
|
|
423
|
-
src:
|
|
421
|
+
...m.echarts?.js,
|
|
422
|
+
src: g,
|
|
424
423
|
id: M.echarts,
|
|
425
424
|
onload() {
|
|
426
|
-
|
|
425
|
+
u = window.echarts, l();
|
|
427
426
|
}
|
|
428
427
|
},
|
|
429
428
|
"echarts"
|
|
430
429
|
);
|
|
431
430
|
});
|
|
432
|
-
let
|
|
433
|
-
const
|
|
434
|
-
if (!
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
}),
|
|
438
|
-
|
|
439
|
-
}),
|
|
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 = []);
|
|
440
439
|
return;
|
|
441
440
|
}
|
|
442
|
-
const
|
|
443
|
-
|
|
444
|
-
const
|
|
445
|
-
if (
|
|
446
|
-
|
|
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?.();
|
|
447
446
|
return;
|
|
448
447
|
}
|
|
449
|
-
|
|
450
|
-
}),
|
|
451
|
-
},
|
|
452
|
-
|
|
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(
|
|
453
452
|
n.value.querySelectorAll(
|
|
454
453
|
`#${t} div.${f}-echarts:not([data-processed])`
|
|
455
454
|
)
|
|
456
|
-
).forEach((
|
|
457
|
-
if (
|
|
455
|
+
).forEach((h) => {
|
|
456
|
+
if (h.dataset.closed === "false")
|
|
458
457
|
return !1;
|
|
459
458
|
try {
|
|
460
|
-
const
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
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();
|
|
464
466
|
});
|
|
465
|
-
|
|
466
|
-
} catch (
|
|
467
|
-
|
|
467
|
+
S.observe(h), c.push(S);
|
|
468
|
+
} catch (T) {
|
|
469
|
+
v.emit(t, Q, {
|
|
468
470
|
name: "echarts",
|
|
469
|
-
message:
|
|
470
|
-
error:
|
|
471
|
+
message: T?.message,
|
|
472
|
+
error: T
|
|
471
473
|
});
|
|
472
474
|
}
|
|
473
475
|
});
|
|
474
476
|
};
|
|
475
477
|
return te(() => {
|
|
476
|
-
|
|
477
|
-
}), { reRenderEcharts:
|
|
478
|
-
},
|
|
479
|
-
const t =
|
|
478
|
+
$(!0);
|
|
479
|
+
}), { reRenderEcharts: s, replaceEcharts: p };
|
|
480
|
+
}, ot = (e) => {
|
|
481
|
+
const t = C("highlight"), r = ee(P.editorExtensions.highlight.instance);
|
|
480
482
|
return H(() => {
|
|
481
483
|
e.noHighlight || r.value || (O("link", {
|
|
482
484
|
...t.value.css,
|
|
@@ -493,7 +495,7 @@ const M = {
|
|
|
493
495
|
},
|
|
494
496
|
"hljs"
|
|
495
497
|
));
|
|
496
|
-
}),
|
|
498
|
+
}), E(
|
|
497
499
|
() => t.value.css,
|
|
498
500
|
() => {
|
|
499
501
|
e.noHighlight || P.editorExtensions.highlight.instance || Ge("link", {
|
|
@@ -503,7 +505,7 @@ const M = {
|
|
|
503
505
|
});
|
|
504
506
|
}
|
|
505
507
|
), r;
|
|
506
|
-
},
|
|
508
|
+
}, at = (e) => {
|
|
507
509
|
const t = ee(P.editorExtensions.katex.instance);
|
|
508
510
|
return H(() => {
|
|
509
511
|
if (e.noKatex || t.value)
|
|
@@ -527,15 +529,54 @@ const M = {
|
|
|
527
529
|
id: M.katexcss
|
|
528
530
|
});
|
|
529
531
|
}), t;
|
|
530
|
-
}
|
|
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({
|
|
531
572
|
max: 1e3,
|
|
532
573
|
// 缓存10分钟
|
|
533
574
|
ttl: 6e5
|
|
534
575
|
}), lt = (e) => {
|
|
535
|
-
const t =
|
|
536
|
-
let
|
|
576
|
+
const t = C("editorId"), r = C("theme"), n = C("rootRef"), { editorExtensions: o, editorExtensionsAttrs: m, mermaidConfig: d } = P;
|
|
577
|
+
let u = o.mermaid.instance;
|
|
537
578
|
const s = ee(-1), l = () => {
|
|
538
|
-
if (!e.noMermaid &&
|
|
579
|
+
if (!e.noMermaid && u) {
|
|
539
580
|
const a = r.value === "dark" ? {
|
|
540
581
|
startOnLoad: !1,
|
|
541
582
|
theme: "dark"
|
|
@@ -555,20 +596,20 @@ const M = {
|
|
|
555
596
|
clusterBorder: "#b7c0cc"
|
|
556
597
|
}
|
|
557
598
|
};
|
|
558
|
-
|
|
599
|
+
u.initialize(d(a)), s.value = s.value + 1;
|
|
559
600
|
}
|
|
560
601
|
};
|
|
561
|
-
return
|
|
602
|
+
return E(
|
|
562
603
|
() => r.value,
|
|
563
604
|
() => {
|
|
564
605
|
Y.clear(), l();
|
|
565
606
|
}
|
|
566
607
|
), H(() => {
|
|
567
|
-
if (e.noMermaid ||
|
|
608
|
+
if (e.noMermaid || u)
|
|
568
609
|
return;
|
|
569
610
|
const a = o.mermaid.js;
|
|
570
611
|
/\.mjs/.test(a) ? (O("link", {
|
|
571
|
-
...
|
|
612
|
+
...m.mermaid?.js,
|
|
572
613
|
rel: "modulepreload",
|
|
573
614
|
href: a,
|
|
574
615
|
id: M.mermaidM
|
|
@@ -576,100 +617,100 @@ const M = {
|
|
|
576
617
|
/* @vite-ignore */
|
|
577
618
|
/* webpackIgnore: true */
|
|
578
619
|
a
|
|
579
|
-
).then((
|
|
580
|
-
|
|
581
|
-
}).catch((
|
|
582
|
-
|
|
620
|
+
).then((c) => {
|
|
621
|
+
u = c.default, l();
|
|
622
|
+
}).catch((c) => {
|
|
623
|
+
v.emit(t, Q, {
|
|
583
624
|
name: "mermaid",
|
|
584
|
-
message: `Failed to load mermaid module: ${
|
|
585
|
-
error:
|
|
625
|
+
message: `Failed to load mermaid module: ${c.message}`,
|
|
626
|
+
error: c
|
|
586
627
|
});
|
|
587
628
|
})) : O(
|
|
588
629
|
"script",
|
|
589
630
|
{
|
|
590
|
-
...
|
|
631
|
+
...m.mermaid?.js,
|
|
591
632
|
src: a,
|
|
592
633
|
id: M.mermaid,
|
|
593
634
|
onload() {
|
|
594
|
-
|
|
635
|
+
u = window.mermaid, l();
|
|
595
636
|
}
|
|
596
637
|
},
|
|
597
638
|
"mermaid"
|
|
598
639
|
);
|
|
599
640
|
}), { reRenderRef: s, replaceMermaid: async () => {
|
|
600
|
-
if (!e.noMermaid &&
|
|
641
|
+
if (!e.noMermaid && u) {
|
|
601
642
|
const a = n.value.querySelectorAll(
|
|
602
643
|
`div.${f}-mermaid`
|
|
603
|
-
),
|
|
604
|
-
|
|
605
|
-
let
|
|
606
|
-
|
|
607
|
-
Array.from(a).map((
|
|
608
|
-
if (
|
|
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")
|
|
609
650
|
return !1;
|
|
610
|
-
const
|
|
611
|
-
let
|
|
612
|
-
if (!
|
|
613
|
-
const
|
|
651
|
+
const b = y.innerText;
|
|
652
|
+
let S = Y.get(b);
|
|
653
|
+
if (!S) {
|
|
654
|
+
const w = le();
|
|
614
655
|
let F = { svg: "" };
|
|
615
656
|
try {
|
|
616
|
-
F = await
|
|
617
|
-
const
|
|
618
|
-
|
|
619
|
-
} catch (
|
|
620
|
-
|
|
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, {
|
|
621
662
|
name: "mermaid",
|
|
622
|
-
message:
|
|
623
|
-
error:
|
|
663
|
+
message: x.message,
|
|
664
|
+
error: x
|
|
624
665
|
});
|
|
625
666
|
}
|
|
626
|
-
--
|
|
667
|
+
--g === 0 && c.remove();
|
|
627
668
|
}
|
|
628
|
-
})(
|
|
669
|
+
})(h))
|
|
629
670
|
);
|
|
630
671
|
}
|
|
631
672
|
} };
|
|
632
673
|
}, it = (e, t) => {
|
|
633
674
|
t = t || {};
|
|
634
|
-
const r = 3, n = t.marker || "!", o = n.charCodeAt(0),
|
|
635
|
-
let
|
|
636
|
-
const s = (i, a,
|
|
637
|
-
const
|
|
638
|
-
return
|
|
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([
|
|
639
680
|
"class",
|
|
640
|
-
`${f}-admonition ${f}-admonition-${
|
|
641
|
-
]) :
|
|
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);
|
|
642
683
|
}, l = (i) => {
|
|
643
684
|
const a = i.trim().split(" ", 2);
|
|
644
|
-
|
|
685
|
+
u = "", d = a[0], a.length > 1 && (u = i.substring(d.length + 2));
|
|
645
686
|
};
|
|
646
687
|
e.block.ruler.before(
|
|
647
688
|
"code",
|
|
648
689
|
"admonition",
|
|
649
|
-
(i, a,
|
|
650
|
-
let
|
|
651
|
-
if (o !== i.src.charCodeAt(
|
|
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))
|
|
652
693
|
return !1;
|
|
653
|
-
for (
|
|
694
|
+
for (p = y + 1; p <= b && n[(p - y) % m] === i.src[p]; p++)
|
|
654
695
|
;
|
|
655
|
-
const
|
|
656
|
-
if (
|
|
696
|
+
const S = Math.floor((p - y) / m);
|
|
697
|
+
if (S !== r)
|
|
657
698
|
return !1;
|
|
658
|
-
|
|
659
|
-
const
|
|
699
|
+
p -= (p - y) % m;
|
|
700
|
+
const w = i.src.slice(y, p), F = i.src.slice(p, b);
|
|
660
701
|
if (l(F), $)
|
|
661
702
|
return !0;
|
|
662
|
-
for (
|
|
663
|
-
if (o === i.src.charCodeAt(
|
|
664
|
-
for (
|
|
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++)
|
|
665
706
|
;
|
|
666
|
-
if (!(Math.floor((
|
|
667
|
-
|
|
707
|
+
if (!(Math.floor((p - y) / m) < S) && (p -= (p - y) % m, p = i.skipSpaces(p), !(p < b))) {
|
|
708
|
+
T = !0;
|
|
668
709
|
break;
|
|
669
710
|
}
|
|
670
711
|
}
|
|
671
|
-
const
|
|
672
|
-
return i.parentType = "root", i.lineMax =
|
|
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;
|
|
673
714
|
},
|
|
674
715
|
{
|
|
675
716
|
alt: ["paragraph", "reference", "blockquote", "list"]
|
|
@@ -682,96 +723,96 @@ const M = {
|
|
|
682
723
|
o < 0 ? r.push(n) : (r[o] = r[o].slice(), r[o][1] += ` ${n[1]}`);
|
|
683
724
|
}), r;
|
|
684
725
|
}, st = (e, t) => {
|
|
685
|
-
const r = e.renderer.rules.fence, n = e.utils.unescapeAll, o = /\[(\w*)(?::([\w ]*))?\]/,
|
|
686
|
-
const
|
|
687
|
-
return [$,
|
|
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];
|
|
688
729
|
}, s = (a) => {
|
|
689
|
-
const
|
|
690
|
-
return
|
|
730
|
+
const c = d(a);
|
|
731
|
+
return c ? c.split(/(\s+)/g)[0] : "";
|
|
691
732
|
}, l = (a) => {
|
|
692
|
-
const
|
|
693
|
-
`).length < t.autoFoldThreshold,
|
|
694
|
-
return { open: $, tagContainer:
|
|
695
|
-
}, i = (a,
|
|
696
|
-
if (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)
|
|
697
738
|
return "";
|
|
698
|
-
const
|
|
699
|
-
if (
|
|
700
|
-
const { open:
|
|
701
|
-
|
|
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", ""]);
|
|
702
743
|
const ne = {
|
|
703
|
-
attrs: se(a[
|
|
744
|
+
attrs: se(a[c], B)
|
|
704
745
|
};
|
|
705
|
-
a[
|
|
706
|
-
const W = r(a,
|
|
746
|
+
a[c].info = a[c].info.replace(m, "");
|
|
747
|
+
const W = r(a, c, $, p, g);
|
|
707
748
|
return `
|
|
708
|
-
<${
|
|
749
|
+
<${R} ${g.renderAttrs(ne)}>
|
|
709
750
|
<${J} class="${f}-code-head">
|
|
710
751
|
<div class="${f}-code-flag"><span></span><span></span><span></span></div>
|
|
711
752
|
<div class="${f}-code-action">
|
|
712
|
-
<span class="${f}-code-lang">${e.utils.escapeHtml(a[
|
|
713
|
-
<span class="${f}-copy-button" data-tips="${
|
|
714
|
-
${t.extraTools instanceof Function ? t.extraTools({ lang: a[
|
|
715
|
-
${
|
|
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 : ""}
|
|
716
757
|
</div>
|
|
717
758
|
</${J}>
|
|
718
759
|
${W}
|
|
719
|
-
</${
|
|
760
|
+
</${R}>
|
|
720
761
|
`;
|
|
721
762
|
}
|
|
722
|
-
let
|
|
723
|
-
const { open: q, tagContainer: V, tagHeader: z } = l(a[
|
|
763
|
+
let w, F, x, L, _ = "", N = "", D = "";
|
|
764
|
+
const { open: q, tagContainer: V, tagHeader: z } = l(a[c]), K = [["class", `${f}-code`]];
|
|
724
765
|
q && K.push(["open", ""]);
|
|
725
766
|
const Z = {
|
|
726
|
-
attrs: se(a[
|
|
767
|
+
attrs: se(a[c], K)
|
|
727
768
|
};
|
|
728
|
-
for (let
|
|
729
|
-
|
|
730
|
-
const
|
|
731
|
-
L =
|
|
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", _ += `
|
|
732
773
|
<li>
|
|
733
774
|
<input
|
|
734
775
|
type="radio"
|
|
735
|
-
id="label-${f}-codetab-label-1-${t.editorId}-${
|
|
736
|
-
name="${f}-codetab-label-${t.editorId}-${
|
|
737
|
-
class="${
|
|
776
|
+
id="label-${f}-codetab-label-1-${t.editorId}-${c}-${k - c}"
|
|
777
|
+
name="${f}-codetab-label-${t.editorId}-${c}"
|
|
778
|
+
class="${R}"
|
|
738
779
|
${L}
|
|
739
780
|
>
|
|
740
781
|
<label
|
|
741
|
-
for="label-${f}-codetab-label-1-${t.editorId}-${
|
|
742
|
-
onclick="this.getRootNode().querySelectorAll('.${
|
|
782
|
+
for="label-${f}-codetab-label-1-${t.editorId}-${c}-${k - c}"
|
|
783
|
+
onclick="this.getRootNode().querySelectorAll('.${R}').forEach(e => e.click())"
|
|
743
784
|
>
|
|
744
|
-
${e.utils.escapeHtml(
|
|
785
|
+
${e.utils.escapeHtml(x || s(w))}
|
|
745
786
|
</label>
|
|
746
787
|
</li>`, N += `
|
|
747
788
|
<div role="tabpanel">
|
|
748
789
|
<input
|
|
749
790
|
type="radio"
|
|
750
|
-
name="${f}-codetab-pre-${t.editorId}-${
|
|
751
|
-
class="${
|
|
791
|
+
name="${f}-codetab-pre-${t.editorId}-${c}"
|
|
792
|
+
class="${R}"
|
|
752
793
|
${L}
|
|
753
794
|
role="presentation">
|
|
754
|
-
${r(a,
|
|
795
|
+
${r(a, k, $, p, g)}
|
|
755
796
|
</div>`, D += `
|
|
756
797
|
<input
|
|
757
798
|
type="radio"
|
|
758
|
-
name="${f}-codetab-lang-${t.editorId}-${
|
|
759
|
-
class="${
|
|
799
|
+
name="${f}-codetab-lang-${t.editorId}-${c}"
|
|
800
|
+
class="${R}"
|
|
760
801
|
${L}
|
|
761
802
|
role="presentation">
|
|
762
|
-
<span class=${f}-code-lang role="note">${e.utils.escapeHtml(s(
|
|
803
|
+
<span class=${f}-code-lang role="note">${e.utils.escapeHtml(s(w))}</span>`;
|
|
763
804
|
}
|
|
764
805
|
return `
|
|
765
|
-
<${V} ${
|
|
806
|
+
<${V} ${g.renderAttrs(Z)}>
|
|
766
807
|
<${z} class="${f}-code-head">
|
|
767
808
|
<div class="${f}-code-flag">
|
|
768
809
|
<ul class="${f}-codetab-label" role="tablist">${_}</ul>
|
|
769
810
|
</div>
|
|
770
811
|
<div class="${f}-code-action">
|
|
771
812
|
<span class="${f}-codetab-lang">${D}</span>
|
|
772
|
-
<span class="${f}-copy-button" data-tips="${
|
|
773
|
-
${t.extraTools instanceof Function ? t.extraTools({ lang: a[
|
|
774
|
-
${V === "details" ?
|
|
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 : ""}
|
|
775
816
|
</div>
|
|
776
817
|
</${z}>
|
|
777
818
|
${N}
|
|
@@ -781,37 +822,37 @@ const M = {
|
|
|
781
822
|
e.renderer.rules.fence = i, e.renderer.rules.code_block = i;
|
|
782
823
|
}, ct = (e, t) => {
|
|
783
824
|
const r = e.renderer.rules.fence.bind(e.renderer.rules);
|
|
784
|
-
e.renderer.rules.fence = (n, o,
|
|
825
|
+
e.renderer.rules.fence = (n, o, m, d, u) => {
|
|
785
826
|
const s = n[o], l = s.content.trim();
|
|
786
827
|
if (s.info === "echarts") {
|
|
787
828
|
if (s.attrSet("class", `${f}-echarts`), s.attrSet("data-echarts-theme", t.themeRef.value), s.map && s.level === 0) {
|
|
788
|
-
const i = s.map[1] - 1,
|
|
789
|
-
s.attrSet("data-closed", `${
|
|
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]));
|
|
790
831
|
}
|
|
791
|
-
return `<div ${
|
|
832
|
+
return `<div ${u.renderAttrs(s)} style="width: 100%; aspect-ratio: 4 / 3;">${e.utils.escapeHtml(l)}</div>`;
|
|
792
833
|
}
|
|
793
|
-
return r(n, o,
|
|
834
|
+
return r(n, o, m, d, u);
|
|
794
835
|
};
|
|
795
836
|
}, dt = (e, t) => {
|
|
796
837
|
e.renderer.rules.heading_open = (r, n) => {
|
|
797
|
-
const o = 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;
|
|
798
839
|
return t.headsRef.value.push({
|
|
799
|
-
text:
|
|
800
|
-
level:
|
|
840
|
+
text: m,
|
|
841
|
+
level: d,
|
|
801
842
|
line: o.map[0],
|
|
802
843
|
currentToken: o,
|
|
803
844
|
nextToken: r[n + 1]
|
|
804
845
|
}), o.map && o.level === 0 && o.attrSet(
|
|
805
846
|
"id",
|
|
806
847
|
t.mdHeadingId({
|
|
807
|
-
text:
|
|
808
|
-
level:
|
|
848
|
+
text: m,
|
|
849
|
+
level: d,
|
|
809
850
|
index: t.headsRef.value.length,
|
|
810
851
|
currentToken: o,
|
|
811
852
|
nextToken: r[n + 1]
|
|
812
853
|
})
|
|
813
854
|
), e.renderer.renderToken(r, n, t);
|
|
814
|
-
}, e.renderer.rules.heading_close = (r, n, o,
|
|
855
|
+
}, e.renderer.rules.heading_close = (r, n, o, m, d) => d.renderToken(r, n, o);
|
|
815
856
|
}, be = {
|
|
816
857
|
block: [
|
|
817
858
|
{ open: "$$", close: "$$" },
|
|
@@ -828,81 +869,81 @@ const M = {
|
|
|
828
869
|
for (const o of n) {
|
|
829
870
|
if (!t.src.startsWith(o.open, t.pos))
|
|
830
871
|
continue;
|
|
831
|
-
const
|
|
832
|
-
let
|
|
833
|
-
for (; (
|
|
834
|
-
let
|
|
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;
|
|
835
876
|
for (; s >= 0 && t.src[s] === "\\"; )
|
|
836
|
-
|
|
837
|
-
if (
|
|
877
|
+
u++, s--;
|
|
878
|
+
if (u % 2 === 0)
|
|
838
879
|
break;
|
|
839
|
-
|
|
880
|
+
d += o.close.length;
|
|
840
881
|
}
|
|
841
|
-
if (
|
|
842
|
-
if (
|
|
843
|
-
return r || (t.pending += o.open + o.close), t.pos =
|
|
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;
|
|
844
885
|
if (!r) {
|
|
845
|
-
const
|
|
846
|
-
|
|
886
|
+
const u = t.push("math_inline", "math", 0);
|
|
887
|
+
u.markup = o.open, u.content = t.src.slice(m, d);
|
|
847
888
|
}
|
|
848
|
-
return t.pos =
|
|
889
|
+
return t.pos = d + o.close.length, !0;
|
|
849
890
|
}
|
|
850
891
|
}
|
|
851
892
|
return !1;
|
|
852
893
|
}, mt = (e) => (t, r, n, o) => {
|
|
853
|
-
const
|
|
894
|
+
const m = e.delimiters, d = t.bMarks[r] + t.tShift[r], u = t.eMarks[r], s = (l, i, a) => {
|
|
854
895
|
t.line = i;
|
|
855
|
-
const
|
|
856
|
-
return
|
|
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;
|
|
857
898
|
};
|
|
858
|
-
for (const l of
|
|
859
|
-
const i =
|
|
899
|
+
for (const l of m) {
|
|
900
|
+
const i = d;
|
|
860
901
|
if (t.src.slice(i, i + l.open.length) !== l.open)
|
|
861
902
|
continue;
|
|
862
|
-
const a = i + l.open.length,
|
|
863
|
-
if (!$ && !
|
|
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)
|
|
864
905
|
continue;
|
|
865
906
|
if (o)
|
|
866
907
|
return !0;
|
|
867
|
-
if (
|
|
908
|
+
if (p)
|
|
868
909
|
return s("", r + 1, l.open);
|
|
869
|
-
if (!$ &&
|
|
870
|
-
const
|
|
871
|
-
return s(
|
|
910
|
+
if (!$ && g) {
|
|
911
|
+
const w = c.slice(0, -l.close.length);
|
|
912
|
+
return s(w, r + 1, l.open);
|
|
872
913
|
}
|
|
873
|
-
let
|
|
874
|
-
for (;
|
|
875
|
-
const
|
|
876
|
-
if (
|
|
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)
|
|
877
918
|
break;
|
|
878
|
-
if (t.src.slice(
|
|
919
|
+
if (t.src.slice(w, F).trim().endsWith(l.close)) {
|
|
879
920
|
const L = t.src.slice(0, F).lastIndexOf(l.close);
|
|
880
|
-
|
|
921
|
+
y = t.src.slice(w, L), T = !0;
|
|
881
922
|
break;
|
|
882
923
|
}
|
|
883
924
|
}
|
|
884
|
-
if (!
|
|
925
|
+
if (!T)
|
|
885
926
|
continue;
|
|
886
|
-
const
|
|
887
|
-
return s(
|
|
927
|
+
const S = t.getLines(r + 1, h, t.tShift[r], !0) + (y.trim() ? y : "");
|
|
928
|
+
return s(S, h + 1, l.open);
|
|
888
929
|
}
|
|
889
930
|
return !1;
|
|
890
931
|
}, ft = (e, { katexRef: t, inlineDelimiters: r, blockDelimiters: n }) => {
|
|
891
|
-
const o = (
|
|
892
|
-
const
|
|
893
|
-
attrs: se(
|
|
894
|
-
}, $ = i.renderAttrs(
|
|
932
|
+
const o = (u, s, l, i, a = !1) => {
|
|
933
|
+
const c = {
|
|
934
|
+
attrs: se(u, [["class", s]])
|
|
935
|
+
}, $ = i.renderAttrs(c);
|
|
895
936
|
if (!t.value)
|
|
896
|
-
return `<${l} ${$}>${
|
|
897
|
-
const
|
|
898
|
-
|
|
937
|
+
return `<${l} ${$}>${u.content}</${l}>`;
|
|
938
|
+
const p = t.value.renderToString(
|
|
939
|
+
u.content,
|
|
899
940
|
P.katexConfig({
|
|
900
941
|
throwOnError: !1,
|
|
901
942
|
displayMode: a
|
|
902
943
|
})
|
|
903
944
|
);
|
|
904
|
-
return `<${l} ${$} data-processed>${
|
|
905
|
-
},
|
|
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);
|
|
906
947
|
e.inline.ruler.before(
|
|
907
948
|
"escape",
|
|
908
949
|
"math_inline",
|
|
@@ -918,20 +959,20 @@ const M = {
|
|
|
918
959
|
{
|
|
919
960
|
alt: ["paragraph", "reference", "blockquote", "list"]
|
|
920
961
|
}
|
|
921
|
-
), e.renderer.rules.math_inline =
|
|
962
|
+
), e.renderer.rules.math_inline = m, e.renderer.rules.math_block = d;
|
|
922
963
|
}, ht = (e, t) => {
|
|
923
964
|
const r = e.renderer.rules.fence.bind(e.renderer.rules);
|
|
924
|
-
e.renderer.rules.fence = (n, o,
|
|
965
|
+
e.renderer.rules.fence = (n, o, m, d, u) => {
|
|
925
966
|
const s = n[o], l = s.content.trim();
|
|
926
967
|
if (s.info === "mermaid") {
|
|
927
968
|
if (s.attrSet("class", `${f}-mermaid`), s.attrSet("data-mermaid-theme", t.themeRef.value), s.map && s.level === 0) {
|
|
928
|
-
const a = s.map[1] - 1, $ = !!
|
|
969
|
+
const a = s.map[1] - 1, $ = !!d.srcLines[a]?.trim()?.startsWith("```");
|
|
929
970
|
s.attrSet("data-closed", `${$}`), s.attrSet("data-line", String(s.map[0]));
|
|
930
971
|
}
|
|
931
972
|
const i = Y.get(l);
|
|
932
|
-
return i ? (s.attrSet("data-processed", ""), s.attrSet("data-content", l), `<p ${
|
|
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>`;
|
|
933
974
|
}
|
|
934
|
-
return r(n, o,
|
|
975
|
+
return r(n, o, m, d, u);
|
|
935
976
|
};
|
|
936
977
|
}, $e = (e, t, r) => {
|
|
937
978
|
const n = e.attrIndex(t), o = [t, r];
|
|
@@ -948,21 +989,21 @@ const M = {
|
|
|
948
989
|
}, Ct = (e) => {
|
|
949
990
|
const t = new e("html_inline", "", 0);
|
|
950
991
|
return t.content = "</label>", t;
|
|
951
|
-
},
|
|
992
|
+
}, Et = (e, t, r) => {
|
|
952
993
|
const n = new r("html_inline", "", 0);
|
|
953
994
|
return n.content = '<label class="task-list-item-label" for="' + t + '">' + e + "</label>", n.attrs = [["for", t]], n;
|
|
954
|
-
},
|
|
995
|
+
}, kt = (e, t, r) => {
|
|
955
996
|
const n = new t("html_inline", "", 0), o = r.enabled ? " " : ' disabled="" ';
|
|
956
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;
|
|
957
998
|
}, Tt = (e, t, r) => {
|
|
958
|
-
if (e.children = e.children || [], e.children.unshift(
|
|
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)
|
|
959
1000
|
if (r.labelAfter) {
|
|
960
1001
|
e.children.pop();
|
|
961
1002
|
const n = "task-item-" + Math.ceil(Math.random() * (1e4 * 1e3) - 1e3);
|
|
962
|
-
e.children[0].content = e.children[0].content.slice(0, -1) + ' id="' + n + '">', e.children.push(
|
|
1003
|
+
e.children[0].content = e.children[0].content.slice(0, -1) + ' id="' + n + '">', e.children.push(Et(e.content, n, t));
|
|
963
1004
|
} else
|
|
964
1005
|
e.children.unshift(wt(t)), e.children.push(Ct(t));
|
|
965
|
-
},
|
|
1006
|
+
}, xt = (e, t = {}) => {
|
|
966
1007
|
e.core.ruler.after("inline", "github-task-lists", (r) => {
|
|
967
1008
|
const n = r.tokens;
|
|
968
1009
|
for (let o = 2; o < n.length; o++)
|
|
@@ -972,20 +1013,20 @@ const M = {
|
|
|
972
1013
|
"task-list-item" + (t.enabled ? " enabled" : " ")
|
|
973
1014
|
), $e(n[$t(n, o - 2)], "class", "contains-task-list"));
|
|
974
1015
|
});
|
|
975
|
-
},
|
|
1016
|
+
}, It = (e) => {
|
|
976
1017
|
e.core.ruler.push("init-line-number", (t) => (t.tokens.forEach((r) => {
|
|
977
1018
|
r.map && (r.attrs || (r.attrs = []), r.attrs.push(["data-line", r.map[0].toString()]));
|
|
978
1019
|
}), !0));
|
|
979
|
-
},
|
|
980
|
-
const { editorConfig: r, markdownItConfig: n, markdownItPlugins: o, editorExtensions:
|
|
1020
|
+
}, St = (e, t) => {
|
|
1021
|
+
const { editorConfig: r, markdownItConfig: n, markdownItPlugins: o, editorExtensions: m } = P, d = C("editorId"), u = C("language"), s = C(
|
|
981
1022
|
"usedLanguageText"
|
|
982
|
-
), l =
|
|
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({
|
|
983
1024
|
html: !0,
|
|
984
1025
|
breaks: !0,
|
|
985
1026
|
linkify: !0
|
|
986
1027
|
});
|
|
987
|
-
n(
|
|
988
|
-
editorId:
|
|
1028
|
+
n(w, {
|
|
1029
|
+
editorId: d
|
|
989
1030
|
});
|
|
990
1031
|
const F = [
|
|
991
1032
|
{
|
|
@@ -1000,19 +1041,19 @@ const M = {
|
|
|
1000
1041
|
},
|
|
1001
1042
|
{
|
|
1002
1043
|
type: "taskList",
|
|
1003
|
-
plugin:
|
|
1044
|
+
plugin: xt,
|
|
1004
1045
|
options: {}
|
|
1005
1046
|
},
|
|
1006
1047
|
{
|
|
1007
1048
|
type: "heading",
|
|
1008
1049
|
plugin: dt,
|
|
1009
|
-
options: { mdHeadingId: e.mdHeadingId, headsRef:
|
|
1050
|
+
options: { mdHeadingId: e.mdHeadingId, headsRef: p }
|
|
1010
1051
|
},
|
|
1011
1052
|
{
|
|
1012
1053
|
type: "code",
|
|
1013
1054
|
plugin: st,
|
|
1014
1055
|
options: {
|
|
1015
|
-
editorId:
|
|
1056
|
+
editorId: d,
|
|
1016
1057
|
usedLanguageTextRef: s,
|
|
1017
1058
|
// showCodeRowNumber,
|
|
1018
1059
|
codeFoldable: e.codeFoldable,
|
|
@@ -1034,7 +1075,7 @@ const M = {
|
|
|
1034
1075
|
e.noKatex || F.push({
|
|
1035
1076
|
type: "katex",
|
|
1036
1077
|
plugin: ft,
|
|
1037
|
-
options: { katexRef:
|
|
1078
|
+
options: { katexRef: h }
|
|
1038
1079
|
}), e.noMermaid || F.push({
|
|
1039
1080
|
type: "mermaid",
|
|
1040
1081
|
plugin: ht,
|
|
@@ -1044,33 +1085,33 @@ const M = {
|
|
|
1044
1085
|
plugin: ct,
|
|
1045
1086
|
options: { themeRef: i }
|
|
1046
1087
|
}), o(F, {
|
|
1047
|
-
editorId:
|
|
1048
|
-
}).forEach((
|
|
1049
|
-
|
|
1088
|
+
editorId: d
|
|
1089
|
+
}).forEach((k) => {
|
|
1090
|
+
w.use(k.plugin, k.options);
|
|
1050
1091
|
});
|
|
1051
|
-
const
|
|
1052
|
-
|
|
1053
|
-
highlight: (
|
|
1054
|
-
if (
|
|
1055
|
-
const W =
|
|
1092
|
+
const x = w.options.highlight;
|
|
1093
|
+
w.set({
|
|
1094
|
+
highlight: (k, R, J) => {
|
|
1095
|
+
if (x) {
|
|
1096
|
+
const W = x(k, R, J);
|
|
1056
1097
|
if (W)
|
|
1057
1098
|
return W;
|
|
1058
1099
|
}
|
|
1059
1100
|
let B;
|
|
1060
|
-
!e.noHighlight &&
|
|
1061
|
-
language:
|
|
1101
|
+
!e.noHighlight && g.value ? g.value.getLanguage(R) ? B = g.value.highlight(k, {
|
|
1102
|
+
language: R,
|
|
1062
1103
|
ignoreIllegals: !0
|
|
1063
|
-
}).value : B =
|
|
1104
|
+
}).value : B = g.value.highlightAuto(k).value : B = w.utils.escapeHtml(k);
|
|
1064
1105
|
const ne = l ? Ye(
|
|
1065
1106
|
B.replace(/^\n+|\n+$/g, ""),
|
|
1066
|
-
|
|
1107
|
+
k.replace(/^\n+|\n+$/g, "")
|
|
1067
1108
|
) : `<span class="${f}-code-block">${B.replace(/^\n+|\n+$/g, "")}</span>`;
|
|
1068
|
-
return `<pre><code class="language-${
|
|
1109
|
+
return `<pre><code class="language-${R}" language=${R}>${ne}</code></pre>`;
|
|
1069
1110
|
}
|
|
1070
|
-
}),
|
|
1111
|
+
}), It(w);
|
|
1071
1112
|
const L = G(`_article-key_${le()}`), _ = G(
|
|
1072
1113
|
e.sanitize(
|
|
1073
|
-
|
|
1114
|
+
w.render(e.modelValue, {
|
|
1074
1115
|
srcLines: e.modelValue.split(`
|
|
1075
1116
|
`)
|
|
1076
1117
|
})
|
|
@@ -1080,50 +1121,50 @@ const M = {
|
|
|
1080
1121
|
}, D = () => {
|
|
1081
1122
|
};
|
|
1082
1123
|
const q = () => {
|
|
1083
|
-
const
|
|
1084
|
-
`#${
|
|
1124
|
+
const k = c.value?.querySelectorAll(
|
|
1125
|
+
`#${d} p.${f}-mermaid:not([data-closed=false])`
|
|
1085
1126
|
);
|
|
1086
|
-
D(), D = ze(
|
|
1127
|
+
D(), D = ze(k, {
|
|
1087
1128
|
customIcon: a.value
|
|
1088
|
-
}),
|
|
1129
|
+
}), m.mermaid?.enableZoom && (N(), N = We(k, {
|
|
1089
1130
|
customIcon: a.value
|
|
1090
1131
|
}));
|
|
1091
1132
|
}, V = () => {
|
|
1092
|
-
|
|
1093
|
-
|
|
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();
|
|
1094
1135
|
});
|
|
1095
1136
|
}, z = () => {
|
|
1096
|
-
|
|
1097
|
-
|
|
1137
|
+
p.value = [], _.value = e.sanitize(
|
|
1138
|
+
w.render(e.modelValue, {
|
|
1098
1139
|
srcLines: e.modelValue.split(`
|
|
1099
1140
|
`)
|
|
1100
1141
|
})
|
|
1101
1142
|
);
|
|
1102
|
-
}, K =
|
|
1143
|
+
}, K = A(() => (e.noKatex || !!h.value) && (e.noHighlight || !!g.value));
|
|
1103
1144
|
let Z = -1;
|
|
1104
|
-
return
|
|
1145
|
+
return E([Ae(e, "modelValue"), K, T, u], () => {
|
|
1105
1146
|
Z = window.setTimeout(
|
|
1106
1147
|
() => {
|
|
1107
1148
|
z();
|
|
1108
1149
|
},
|
|
1109
1150
|
t ? 0 : r.renderDelay
|
|
1110
1151
|
);
|
|
1111
|
-
}),
|
|
1152
|
+
}), E(
|
|
1112
1153
|
() => $.value.preview,
|
|
1113
1154
|
() => {
|
|
1114
1155
|
$.value.preview && U(() => {
|
|
1115
|
-
|
|
1156
|
+
y().then(q), S(), v.emit(d, oe, p.value);
|
|
1116
1157
|
});
|
|
1117
1158
|
}
|
|
1118
|
-
),
|
|
1159
|
+
), E([_, b], () => {
|
|
1119
1160
|
V();
|
|
1120
1161
|
}), H(V), H(() => {
|
|
1121
|
-
|
|
1162
|
+
v.on(d, {
|
|
1122
1163
|
name: De,
|
|
1123
1164
|
callback() {
|
|
1124
|
-
|
|
1165
|
+
v.emit(d, oe, p.value);
|
|
1125
1166
|
}
|
|
1126
|
-
}),
|
|
1167
|
+
}), v.on(d, {
|
|
1127
1168
|
name: de,
|
|
1128
1169
|
callback: () => {
|
|
1129
1170
|
L.value = `_article-key_${le()}`, z();
|
|
@@ -1133,18 +1174,18 @@ const M = {
|
|
|
1133
1174
|
N(), D(), clearTimeout(Z);
|
|
1134
1175
|
}), { html: _, key: L };
|
|
1135
1176
|
}, Ft = (e, t) => {
|
|
1136
|
-
const r =
|
|
1137
|
-
const
|
|
1177
|
+
const r = C("editorId"), n = C("setting"), { noImgZoomIn: o } = e, m = Le(() => {
|
|
1178
|
+
const d = document.querySelectorAll(
|
|
1138
1179
|
`#${r}-preview img:not(.not-zoom):not(.medium-zoom-image)`
|
|
1139
1180
|
);
|
|
1140
|
-
|
|
1181
|
+
d.length !== 0 && Qe(d, {
|
|
1141
1182
|
background: "#00000073"
|
|
1142
1183
|
});
|
|
1143
1184
|
});
|
|
1144
1185
|
H(async () => {
|
|
1145
|
-
!o && n.value.preview && await
|
|
1146
|
-
}),
|
|
1147
|
-
!o && n.value.preview && await
|
|
1186
|
+
!o && n.value.preview && await m();
|
|
1187
|
+
}), E([t, () => n.value.preview], async () => {
|
|
1188
|
+
!o && n.value.preview && await m();
|
|
1148
1189
|
});
|
|
1149
1190
|
}, we = {
|
|
1150
1191
|
checked: {
|
|
@@ -1155,55 +1196,55 @@ const M = {
|
|
|
1155
1196
|
regexp: /- \[\s\]/,
|
|
1156
1197
|
value: "- [x]"
|
|
1157
1198
|
}
|
|
1158
|
-
},
|
|
1159
|
-
const r =
|
|
1199
|
+
}, At = (e, t) => {
|
|
1200
|
+
const r = C("editorId"), n = C("rootRef");
|
|
1160
1201
|
let o = () => {
|
|
1161
1202
|
};
|
|
1162
|
-
const
|
|
1203
|
+
const m = () => {
|
|
1163
1204
|
if (!n.value)
|
|
1164
1205
|
return !1;
|
|
1165
|
-
const
|
|
1206
|
+
const d = n.value.querySelectorAll(".task-list-item.enabled"), u = (s) => {
|
|
1166
1207
|
s.preventDefault();
|
|
1167
1208
|
const l = s.target.checked ? "unChecked" : "checked", i = s.target.parentElement?.dataset.line;
|
|
1168
1209
|
if (!i)
|
|
1169
1210
|
return;
|
|
1170
|
-
const a = Number(i),
|
|
1171
|
-
`), $ =
|
|
1211
|
+
const a = Number(i), c = e.modelValue.split(`
|
|
1212
|
+
`), $ = c[Number(a)].replace(
|
|
1172
1213
|
we[l].regexp,
|
|
1173
1214
|
we[l].value
|
|
1174
1215
|
);
|
|
1175
|
-
e.previewOnly ? (
|
|
1176
|
-
`))) :
|
|
1216
|
+
e.previewOnly ? (c[Number(a)] = $, e.onChange(c.join(`
|
|
1217
|
+
`))) : v.emit(r, Ve, a + 1, $);
|
|
1177
1218
|
};
|
|
1178
|
-
|
|
1179
|
-
s.addEventListener("click",
|
|
1219
|
+
d.forEach((s) => {
|
|
1220
|
+
s.addEventListener("click", u);
|
|
1180
1221
|
}), o = () => {
|
|
1181
|
-
|
|
1182
|
-
s.removeEventListener("click",
|
|
1222
|
+
d.forEach((s) => {
|
|
1223
|
+
s.removeEventListener("click", u);
|
|
1183
1224
|
});
|
|
1184
1225
|
};
|
|
1185
1226
|
};
|
|
1186
1227
|
te(() => {
|
|
1187
1228
|
o();
|
|
1188
|
-
}),
|
|
1229
|
+
}), E(
|
|
1189
1230
|
[t],
|
|
1190
1231
|
() => {
|
|
1191
|
-
o(), U(
|
|
1232
|
+
o(), U(m);
|
|
1192
1233
|
},
|
|
1193
1234
|
{
|
|
1194
1235
|
immediate: !0
|
|
1195
1236
|
}
|
|
1196
1237
|
);
|
|
1197
|
-
},
|
|
1198
|
-
const n =
|
|
1238
|
+
}, Rt = (e, t, r) => {
|
|
1239
|
+
const n = C("setting"), o = () => {
|
|
1199
1240
|
U(() => {
|
|
1200
1241
|
e.onRemount?.();
|
|
1201
1242
|
});
|
|
1202
|
-
},
|
|
1203
|
-
|
|
1243
|
+
}, m = (d) => {
|
|
1244
|
+
d && o();
|
|
1204
1245
|
};
|
|
1205
|
-
|
|
1206
|
-
},
|
|
1246
|
+
E([t, r], o), E(() => n.value.preview, m), E(() => n.value.htmlPreview, m), H(o);
|
|
1247
|
+
}, xe = {
|
|
1207
1248
|
modelValue: {
|
|
1208
1249
|
type: String,
|
|
1209
1250
|
default: ""
|
|
@@ -1274,8 +1315,8 @@ const M = {
|
|
|
1274
1315
|
type: [Object, Function],
|
|
1275
1316
|
default: void 0
|
|
1276
1317
|
}
|
|
1277
|
-
},
|
|
1278
|
-
...
|
|
1318
|
+
}, nn = {
|
|
1319
|
+
...xe,
|
|
1279
1320
|
updateModelValue: {
|
|
1280
1321
|
type: Function,
|
|
1281
1322
|
default: () => {
|
|
@@ -1363,31 +1404,31 @@ const M = {
|
|
|
1363
1404
|
}
|
|
1364
1405
|
},
|
|
1365
1406
|
setup(e) {
|
|
1366
|
-
const t = G(), r = e.html, n = (o,
|
|
1407
|
+
const t = G(), r = e.html, n = (o, m) => {
|
|
1367
1408
|
if (!t.value) return;
|
|
1368
|
-
const
|
|
1409
|
+
const d = t.value, u = Array.from(d.childNodes), s = Math.min(o.length, m.length);
|
|
1369
1410
|
let l = -1;
|
|
1370
1411
|
for (let a = 0; a < s; a++)
|
|
1371
|
-
if (!Ht(o[a],
|
|
1412
|
+
if (!Ht(o[a], m[a])) {
|
|
1372
1413
|
l = a;
|
|
1373
1414
|
break;
|
|
1374
1415
|
}
|
|
1375
1416
|
if (l === -1)
|
|
1376
|
-
if (
|
|
1417
|
+
if (m.length > o.length)
|
|
1377
1418
|
l = o.length;
|
|
1378
|
-
else if (o.length >
|
|
1379
|
-
l =
|
|
1419
|
+
else if (o.length > m.length)
|
|
1420
|
+
l = m.length;
|
|
1380
1421
|
else
|
|
1381
1422
|
return;
|
|
1382
|
-
const i = Math.min(l,
|
|
1383
|
-
for (let a =
|
|
1384
|
-
|
|
1423
|
+
const i = Math.min(l, u.length);
|
|
1424
|
+
for (let a = u.length - 1; a >= i; a--)
|
|
1425
|
+
u[a].remove();
|
|
1385
1426
|
for (let a = l; a < o.length; a++)
|
|
1386
|
-
|
|
1427
|
+
d.appendChild(o[a].cloneNode(!0));
|
|
1387
1428
|
};
|
|
1388
|
-
return
|
|
1389
|
-
const
|
|
1390
|
-
n(
|
|
1429
|
+
return E(() => e.html, (o, m) => {
|
|
1430
|
+
const d = Ce(o), u = Ce(m || "");
|
|
1431
|
+
n(d, u);
|
|
1391
1432
|
}), () => j("div", {
|
|
1392
1433
|
id: e.id,
|
|
1393
1434
|
class: e.class,
|
|
@@ -1397,28 +1438,28 @@ const M = {
|
|
|
1397
1438
|
}
|
|
1398
1439
|
}), Pt = /* @__PURE__ */ ce({
|
|
1399
1440
|
name: "ContentPreview",
|
|
1400
|
-
props:
|
|
1441
|
+
props: xe,
|
|
1401
1442
|
setup(e) {
|
|
1402
|
-
const t =
|
|
1403
|
-
html:
|
|
1404
|
-
key:
|
|
1405
|
-
} =
|
|
1406
|
-
|
|
1407
|
-
const
|
|
1443
|
+
const t = C("editorId"), r = C("setting"), n = C("previewTheme"), o = C("showCodeRowNumber"), {
|
|
1444
|
+
html: m,
|
|
1445
|
+
key: d
|
|
1446
|
+
} = St(e, e.previewOnly);
|
|
1447
|
+
tt(e, m, d), Ft(e, m), At(e, m), Rt(e, m, d);
|
|
1448
|
+
const u = A(() => [`${f}-preview`, `${n?.value}-theme`, o && `${f}-scrn`].filter(Boolean)), s = () => {
|
|
1408
1449
|
const l = `${t}-preview`;
|
|
1409
1450
|
return e.previewComponent ? He(e.previewComponent, {
|
|
1410
|
-
key:
|
|
1411
|
-
html:
|
|
1451
|
+
key: d.value,
|
|
1452
|
+
html: m.value,
|
|
1412
1453
|
id: l,
|
|
1413
|
-
class:
|
|
1454
|
+
class: u.value
|
|
1414
1455
|
}) : j(Mt, {
|
|
1415
|
-
key:
|
|
1416
|
-
html:
|
|
1456
|
+
key: d.value,
|
|
1457
|
+
html: m.value,
|
|
1417
1458
|
id: l,
|
|
1418
|
-
class:
|
|
1459
|
+
class: u.value
|
|
1419
1460
|
}, null);
|
|
1420
1461
|
};
|
|
1421
|
-
return () => j(
|
|
1462
|
+
return () => j(Re, null, [r.value.preview && (e.previewOnly ? s() : j("div", {
|
|
1422
1463
|
id: `${t}-preview-wrapper`,
|
|
1423
1464
|
class: `${f}-preview-wrapper`,
|
|
1424
1465
|
key: "content-preview-wrapper"
|
|
@@ -1428,9 +1469,9 @@ const M = {
|
|
|
1428
1469
|
key: "html-preview-wrapper"
|
|
1429
1470
|
}, [j("div", {
|
|
1430
1471
|
class: `${f}-html`
|
|
1431
|
-
}, [
|
|
1472
|
+
}, [m.value])])]);
|
|
1432
1473
|
}
|
|
1433
|
-
}), Lt = ({ text: e }) => e,
|
|
1474
|
+
}), Lt = ({ text: e }) => e, Ie = {
|
|
1434
1475
|
/**
|
|
1435
1476
|
* markdown content.
|
|
1436
1477
|
*
|
|
@@ -1668,8 +1709,8 @@ const M = {
|
|
|
1668
1709
|
type: [Object, Function],
|
|
1669
1710
|
default: void 0
|
|
1670
1711
|
}
|
|
1671
|
-
},
|
|
1672
|
-
...
|
|
1712
|
+
}, on = {
|
|
1713
|
+
...Ie,
|
|
1673
1714
|
/**
|
|
1674
1715
|
* input回调事件
|
|
1675
1716
|
*/
|
|
@@ -1974,14 +2015,14 @@ const M = {
|
|
|
1974
2015
|
type: Number,
|
|
1975
2016
|
default: void 0
|
|
1976
2017
|
}
|
|
1977
|
-
},
|
|
2018
|
+
}, Se = [
|
|
1978
2019
|
"onHtmlChanged",
|
|
1979
2020
|
"onGetCatalog",
|
|
1980
2021
|
"onChange",
|
|
1981
2022
|
"onRemount",
|
|
1982
2023
|
"update:modelValue"
|
|
1983
|
-
],
|
|
1984
|
-
...
|
|
2024
|
+
], an = [
|
|
2025
|
+
...Se,
|
|
1985
2026
|
"onSave",
|
|
1986
2027
|
"onUploadImg",
|
|
1987
2028
|
"onError",
|
|
@@ -1993,29 +2034,29 @@ const M = {
|
|
|
1993
2034
|
], Ot = (e, t, r) => {
|
|
1994
2035
|
const { editorId: n } = r, o = {
|
|
1995
2036
|
rerender() {
|
|
1996
|
-
|
|
2037
|
+
v.emit(n, de);
|
|
1997
2038
|
}
|
|
1998
2039
|
};
|
|
1999
2040
|
t.expose(o);
|
|
2000
2041
|
}, ae = /* @__PURE__ */ ce({
|
|
2001
2042
|
name: "MdPreview",
|
|
2002
|
-
props:
|
|
2003
|
-
emits:
|
|
2043
|
+
props: Ie,
|
|
2044
|
+
emits: Se,
|
|
2004
2045
|
setup(e, t) {
|
|
2005
2046
|
const {
|
|
2006
2047
|
noKatex: r,
|
|
2007
2048
|
noMermaid: n,
|
|
2008
2049
|
noHighlight: o
|
|
2009
|
-
} = e,
|
|
2050
|
+
} = e, m = G(), d = et(e);
|
|
2010
2051
|
Te(e, {
|
|
2011
|
-
rootRef:
|
|
2012
|
-
editorId:
|
|
2052
|
+
rootRef: m,
|
|
2053
|
+
editorId: d
|
|
2013
2054
|
}), Ot(e, t, {
|
|
2014
|
-
editorId:
|
|
2055
|
+
editorId: d
|
|
2015
2056
|
}), te(() => {
|
|
2016
|
-
|
|
2057
|
+
v.clear(d);
|
|
2017
2058
|
});
|
|
2018
|
-
const
|
|
2059
|
+
const u = (a) => {
|
|
2019
2060
|
e.onChange?.(a), t.emit("onChange", a), t.emit("update:modelValue", a);
|
|
2020
2061
|
}, s = (a) => {
|
|
2021
2062
|
e.onHtmlChanged?.(a), t.emit("onHtmlChanged", a);
|
|
@@ -2025,13 +2066,13 @@ const M = {
|
|
|
2025
2066
|
e.onRemount?.(), t.emit("onRemount");
|
|
2026
2067
|
};
|
|
2027
2068
|
return () => j("div", {
|
|
2028
|
-
id:
|
|
2069
|
+
id: d,
|
|
2029
2070
|
class: [f, e.class, e.theme === "dark" && `${f}-dark`, `${f}-previewOnly`],
|
|
2030
2071
|
style: e.style,
|
|
2031
|
-
ref:
|
|
2072
|
+
ref: m
|
|
2032
2073
|
}, [j(Pt, {
|
|
2033
2074
|
modelValue: e.modelValue,
|
|
2034
|
-
onChange:
|
|
2075
|
+
onChange: u,
|
|
2035
2076
|
onHtmlChanged: s,
|
|
2036
2077
|
onGetCatalog: l,
|
|
2037
2078
|
mdHeadingId: e.mdHeadingId,
|
|
@@ -2056,15 +2097,15 @@ export {
|
|
|
2056
2097
|
M as C,
|
|
2057
2098
|
ae as M,
|
|
2058
2099
|
Pt as a,
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
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
|
|
2070
2111
|
};
|