md-editor-v3 6.5.4 → 6.5.5
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/MdEditor.cjs +15 -15
- package/lib/cjs/chunks/index4.cjs +36 -36
- package/lib/es/MdEditor.mjs +942 -890
- package/lib/es/chunks/index4.mjs +453 -430
- package/lib/types/index.d.ts +5 -5
- package/package.json +1 -1
package/lib/es/chunks/index4.mjs
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { useId as He, provide as x, computed as F, reactive as le, watch as
|
|
1
|
+
import { useId as He, provide as x, computed as F, reactive as le, watch as k, onMounted as M, ref as z, inject as C, nextTick as W, shallowRef as ee, onBeforeUnmount as te, toRef as Me, defineComponent as de, createVNode as N, Fragment as Pe, h as Le } from "vue";
|
|
2
2
|
import { deepMerge as _e, deepClone as Oe, randomId as ie, debounce as Be } from "@vavt/util";
|
|
3
3
|
import { p as h, g as L, f as me, s as fe, a as je, b as Ne } from "./config.mjs";
|
|
4
|
-
import { b as
|
|
5
|
-
import { a as O, u as
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import { a as
|
|
12
|
-
import
|
|
4
|
+
import { b, R as De, U as Ve, C as ke, B as X, O as xe, E as Q, g as he, F as pe, h as ge, i as ve, H as ye, j as be, e as Ge, k as ue, d as Ue, f as ae, P as ze, T as We } from "./event-bus.mjs";
|
|
5
|
+
import { a as O, u as qe, S as Ke, c as Ze, z as Je } from "./dom.mjs";
|
|
6
|
+
import Xe from "@vavt/copy2clipboard";
|
|
7
|
+
import Ye from "markdown-it";
|
|
8
|
+
import Qe from "markdown-it-image-figures";
|
|
9
|
+
import et from "markdown-it-sub";
|
|
10
|
+
import tt from "markdown-it-sup";
|
|
11
|
+
import { a as nt } from "./index5.mjs";
|
|
12
|
+
import ot from "medium-zoom";
|
|
13
13
|
const P = {
|
|
14
14
|
hljs: `${h}-hljs`,
|
|
15
15
|
hlcss: `${h}-hlCss`,
|
|
@@ -23,41 +23,43 @@ const P = {
|
|
|
23
23
|
katexjs: `${h}-katex`,
|
|
24
24
|
katexcss: `${h}-katexCss`,
|
|
25
25
|
echarts: `${h}-echarts`
|
|
26
|
-
},
|
|
26
|
+
}, se = (e, t) => {
|
|
27
|
+
b.emit(e, De, t);
|
|
28
|
+
}, en = (e, t, a) => {
|
|
27
29
|
const { editorId: n } = a, o = le({
|
|
28
30
|
// 是否已编译成html
|
|
29
31
|
buildFinished: !1,
|
|
30
32
|
// 存储当前最新的html
|
|
31
33
|
html: ""
|
|
32
34
|
});
|
|
33
|
-
|
|
35
|
+
k(
|
|
34
36
|
() => e.modelValue,
|
|
35
37
|
() => {
|
|
36
38
|
o.buildFinished = !1;
|
|
37
39
|
}
|
|
38
40
|
), M(() => {
|
|
39
|
-
|
|
41
|
+
b.on(n, {
|
|
40
42
|
name: X,
|
|
41
|
-
callback(
|
|
42
|
-
o.buildFinished = !0, o.html =
|
|
43
|
+
callback(u) {
|
|
44
|
+
o.buildFinished = !0, o.html = u;
|
|
43
45
|
}
|
|
44
|
-
}),
|
|
46
|
+
}), b.on(n, {
|
|
45
47
|
name: xe,
|
|
46
48
|
callback() {
|
|
47
|
-
const
|
|
49
|
+
const u = new Promise((c) => {
|
|
48
50
|
if (o.buildFinished)
|
|
49
51
|
c(o.html);
|
|
50
52
|
else {
|
|
51
|
-
const
|
|
52
|
-
c(s),
|
|
53
|
+
const d = (s) => {
|
|
54
|
+
c(s), b.remove(n, X, d);
|
|
53
55
|
};
|
|
54
|
-
|
|
56
|
+
b.on(n, {
|
|
55
57
|
name: X,
|
|
56
|
-
callback:
|
|
58
|
+
callback: d
|
|
57
59
|
});
|
|
58
60
|
}
|
|
59
61
|
});
|
|
60
|
-
e.onSave ? e.onSave(e.modelValue,
|
|
62
|
+
e.onSave ? e.onSave(e.modelValue, u) : t.emit("onSave", e.modelValue, u);
|
|
61
63
|
}
|
|
62
64
|
});
|
|
63
65
|
});
|
|
@@ -66,7 +68,7 @@ const P = {
|
|
|
66
68
|
rootRef: a,
|
|
67
69
|
setting: n
|
|
68
70
|
}) => {
|
|
69
|
-
const o = L.editorExtensions.highlight,
|
|
71
|
+
const o = L.editorExtensions.highlight, u = L.editorExtensionsAttrs.highlight;
|
|
70
72
|
x("editorId", t), x("rootRef", a), x(
|
|
71
73
|
"theme",
|
|
72
74
|
F(() => e.theme)
|
|
@@ -76,30 +78,30 @@ const P = {
|
|
|
76
78
|
), x(
|
|
77
79
|
"highlight",
|
|
78
80
|
F(() => {
|
|
79
|
-
const { js:
|
|
81
|
+
const { js: d } = o, s = {
|
|
80
82
|
...me,
|
|
81
83
|
...o.css
|
|
82
|
-
}, { js: l, css: i = {} } =
|
|
84
|
+
}, { js: l, css: i = {} } = u || {}, r = e.codeStyleReverse && e.codeStyleReverseList.includes(e.previewTheme) ? "dark" : e.theme, m = s[e.codeTheme] ? s[e.codeTheme][r] : me.atom[r], f = s[e.codeTheme] && i[e.codeTheme] ? i[e.codeTheme][r] : i.atom ? i.atom[r] : {};
|
|
83
85
|
return {
|
|
84
86
|
js: {
|
|
85
|
-
src:
|
|
87
|
+
src: d,
|
|
86
88
|
...l
|
|
87
89
|
},
|
|
88
90
|
css: {
|
|
89
|
-
href:
|
|
91
|
+
href: m,
|
|
90
92
|
...f
|
|
91
93
|
}
|
|
92
94
|
};
|
|
93
95
|
})
|
|
94
96
|
), x("showCodeRowNumber", e.showCodeRowNumber);
|
|
95
97
|
const c = F(() => {
|
|
96
|
-
const
|
|
98
|
+
const d = {
|
|
97
99
|
...fe,
|
|
98
100
|
...L.editorConfig.languageUserDefined
|
|
99
101
|
};
|
|
100
102
|
return _e(
|
|
101
103
|
Oe(fe["en-US"]),
|
|
102
|
-
|
|
104
|
+
d[e.language] || {}
|
|
103
105
|
);
|
|
104
106
|
});
|
|
105
107
|
return x("usedLanguageText", c), x(
|
|
@@ -121,9 +123,12 @@ const P = {
|
|
|
121
123
|
fullscreen: !1
|
|
122
124
|
})
|
|
123
125
|
), { editorId: t };
|
|
124
|
-
},
|
|
126
|
+
}, tn = (e, t) => (x("tabWidth", e.tabWidth), x(
|
|
125
127
|
"disabled",
|
|
126
128
|
F(() => e.disabled)
|
|
129
|
+
), x(
|
|
130
|
+
"contentDisabled",
|
|
131
|
+
F(() => e.disabled || e.readOnly)
|
|
127
132
|
), x(
|
|
128
133
|
"showToolbarName",
|
|
129
134
|
F(() => e.showToolbarName)
|
|
@@ -139,10 +144,10 @@ const P = {
|
|
|
139
144
|
), x("defToolbars", t.defToolbars), x(
|
|
140
145
|
"floatingToolbars",
|
|
141
146
|
F(() => e.floatingToolbars)
|
|
142
|
-
), Te(e, t)),
|
|
143
|
-
const { noPrettier: t, noUploadImg: a } = e, { editorExtensions: n, editorExtensionsAttrs: o } = L,
|
|
147
|
+
), Te(e, t)), nn = (e) => {
|
|
148
|
+
const { noPrettier: t, noUploadImg: a } = e, { editorExtensions: n, editorExtensionsAttrs: o } = L, u = t || n.prettier.prettierInstance, c = t || n.prettier.parserMarkdownInstance, d = a || n.cropper.instance;
|
|
144
149
|
M(() => {
|
|
145
|
-
if (!
|
|
150
|
+
if (!d) {
|
|
146
151
|
const { js: s = {}, css: l = {} } = o.cropper || {};
|
|
147
152
|
O("link", {
|
|
148
153
|
...l,
|
|
@@ -155,7 +160,7 @@ const P = {
|
|
|
155
160
|
id: P.cropperjs
|
|
156
161
|
});
|
|
157
162
|
}
|
|
158
|
-
if (!
|
|
163
|
+
if (!u) {
|
|
159
164
|
const { standaloneJs: s = {} } = o.prettier || {};
|
|
160
165
|
O("script", {
|
|
161
166
|
...s,
|
|
@@ -172,24 +177,24 @@ const P = {
|
|
|
172
177
|
});
|
|
173
178
|
}
|
|
174
179
|
});
|
|
175
|
-
},
|
|
180
|
+
}, on = (e, t, a) => {
|
|
176
181
|
const { editorId: n } = a;
|
|
177
182
|
M(() => {
|
|
178
|
-
|
|
183
|
+
b.on(n, {
|
|
179
184
|
name: Q,
|
|
180
185
|
callback: (o) => {
|
|
181
186
|
e.onError?.(o), t.emit("onError", o);
|
|
182
187
|
}
|
|
183
188
|
});
|
|
184
189
|
});
|
|
185
|
-
},
|
|
190
|
+
}, an = (e, t, a) => {
|
|
186
191
|
const { editorId: n } = a, o = le({
|
|
187
192
|
pageFullscreen: e.pageFullscreen,
|
|
188
193
|
fullscreen: !1,
|
|
189
194
|
preview: e.preview,
|
|
190
195
|
htmlPreview: e.preview ? !1 : e.htmlPreview,
|
|
191
196
|
previewOnly: !1
|
|
192
|
-
}),
|
|
197
|
+
}), u = le({ ...o }), c = (l, i) => {
|
|
193
198
|
const r = i === void 0 ? !o[l] : i;
|
|
194
199
|
switch (l) {
|
|
195
200
|
case "preview": {
|
|
@@ -201,75 +206,78 @@ const P = {
|
|
|
201
206
|
break;
|
|
202
207
|
}
|
|
203
208
|
case "previewOnly": {
|
|
204
|
-
r ? !o.preview && !o.htmlPreview && (o.preview = !0) : (
|
|
209
|
+
r ? !o.preview && !o.htmlPreview && (o.preview = !0) : (u.preview || (o.preview = !1), u.htmlPreview || (o.htmlPreview = !1));
|
|
205
210
|
break;
|
|
206
211
|
}
|
|
207
212
|
}
|
|
208
|
-
|
|
213
|
+
u[l] = r, o[l] = r;
|
|
209
214
|
};
|
|
210
|
-
let
|
|
215
|
+
let d = "";
|
|
211
216
|
const s = () => {
|
|
212
|
-
o.pageFullscreen || o.fullscreen ? document.body.style.overflow = "hidden" : document.body.style.overflow =
|
|
217
|
+
o.pageFullscreen || o.fullscreen ? document.body.style.overflow = "hidden" : document.body.style.overflow = d;
|
|
213
218
|
};
|
|
214
|
-
return
|
|
215
|
-
|
|
216
|
-
name:
|
|
219
|
+
return k(() => [o.pageFullscreen, o.fullscreen], s), M(() => {
|
|
220
|
+
b.on(n, {
|
|
221
|
+
name: Ve,
|
|
217
222
|
callback(l, i) {
|
|
218
|
-
const r = (
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
223
|
+
const r = (m) => {
|
|
224
|
+
se(n, {
|
|
225
|
+
direct: "image",
|
|
226
|
+
params: {
|
|
227
|
+
desc: "",
|
|
228
|
+
urls: m
|
|
229
|
+
}
|
|
222
230
|
}), i?.();
|
|
223
231
|
};
|
|
224
232
|
e.onUploadImg ? e.onUploadImg(l, r) : t.emit("onUploadImg", l, r);
|
|
225
233
|
}
|
|
226
|
-
}),
|
|
234
|
+
}), d = document.body.style.overflow, s();
|
|
227
235
|
}), [o, c];
|
|
228
|
-
},
|
|
236
|
+
}, rn = (e, t) => {
|
|
229
237
|
const { editorId: a } = t, n = z(!1);
|
|
230
238
|
return M(() => {
|
|
231
|
-
|
|
239
|
+
b.on(a, {
|
|
232
240
|
name: ke,
|
|
233
241
|
callback: (o) => {
|
|
234
242
|
o === void 0 ? n.value = !n.value : n.value = o;
|
|
235
243
|
}
|
|
236
244
|
});
|
|
237
245
|
}), n;
|
|
238
|
-
},
|
|
239
|
-
const { editorId: n, catalogVisible: o, setting:
|
|
240
|
-
|
|
241
|
-
() =>
|
|
246
|
+
}, ln = (e, t, a) => {
|
|
247
|
+
const { editorId: n, catalogVisible: o, setting: u, updateSetting: c, codeRef: d } = a;
|
|
248
|
+
k(
|
|
249
|
+
() => u.pageFullscreen,
|
|
242
250
|
(l) => {
|
|
243
|
-
|
|
251
|
+
b.emit(n, he, l);
|
|
244
252
|
}
|
|
245
|
-
),
|
|
246
|
-
() =>
|
|
253
|
+
), k(
|
|
254
|
+
() => u.fullscreen,
|
|
247
255
|
(l) => {
|
|
248
|
-
|
|
256
|
+
b.emit(n, pe, l);
|
|
249
257
|
}
|
|
250
|
-
),
|
|
251
|
-
() =>
|
|
258
|
+
), k(
|
|
259
|
+
() => u.preview,
|
|
252
260
|
(l) => {
|
|
253
|
-
|
|
261
|
+
b.emit(n, ge, l);
|
|
254
262
|
}
|
|
255
|
-
),
|
|
256
|
-
() =>
|
|
263
|
+
), k(
|
|
264
|
+
() => u.previewOnly,
|
|
257
265
|
(l) => {
|
|
258
|
-
|
|
266
|
+
b.emit(n, ve, l);
|
|
259
267
|
}
|
|
260
|
-
),
|
|
261
|
-
() =>
|
|
268
|
+
), k(
|
|
269
|
+
() => u.htmlPreview,
|
|
262
270
|
(l) => {
|
|
263
|
-
|
|
271
|
+
b.emit(n, ye, l);
|
|
264
272
|
}
|
|
265
|
-
),
|
|
266
|
-
|
|
273
|
+
), k(o, (l) => {
|
|
274
|
+
b.emit(n, be, l);
|
|
267
275
|
});
|
|
268
276
|
const s = {
|
|
269
277
|
on(l, i) {
|
|
270
278
|
switch (l) {
|
|
271
279
|
case "pageFullscreen": {
|
|
272
|
-
|
|
280
|
+
b.on(n, {
|
|
273
281
|
name: he,
|
|
274
282
|
callback(r) {
|
|
275
283
|
i(r);
|
|
@@ -278,7 +286,7 @@ const P = {
|
|
|
278
286
|
break;
|
|
279
287
|
}
|
|
280
288
|
case "fullscreen": {
|
|
281
|
-
|
|
289
|
+
b.on(n, {
|
|
282
290
|
name: pe,
|
|
283
291
|
callback(r) {
|
|
284
292
|
i(r);
|
|
@@ -287,7 +295,7 @@ const P = {
|
|
|
287
295
|
break;
|
|
288
296
|
}
|
|
289
297
|
case "preview": {
|
|
290
|
-
|
|
298
|
+
b.on(n, {
|
|
291
299
|
name: ge,
|
|
292
300
|
callback(r) {
|
|
293
301
|
i(r);
|
|
@@ -296,7 +304,7 @@ const P = {
|
|
|
296
304
|
break;
|
|
297
305
|
}
|
|
298
306
|
case "previewOnly": {
|
|
299
|
-
|
|
307
|
+
b.on(n, {
|
|
300
308
|
name: ve,
|
|
301
309
|
callback(r) {
|
|
302
310
|
i(r);
|
|
@@ -305,7 +313,7 @@ const P = {
|
|
|
305
313
|
break;
|
|
306
314
|
}
|
|
307
315
|
case "htmlPreview": {
|
|
308
|
-
|
|
316
|
+
b.on(n, {
|
|
309
317
|
name: ye,
|
|
310
318
|
callback(r) {
|
|
311
319
|
i(r);
|
|
@@ -314,7 +322,7 @@ const P = {
|
|
|
314
322
|
break;
|
|
315
323
|
}
|
|
316
324
|
case "catalog": {
|
|
317
|
-
|
|
325
|
+
b.on(n, {
|
|
318
326
|
name: be,
|
|
319
327
|
callback(r) {
|
|
320
328
|
i(r);
|
|
@@ -328,7 +336,7 @@ const P = {
|
|
|
328
336
|
c("pageFullscreen", l);
|
|
329
337
|
},
|
|
330
338
|
toggleFullscreen(l) {
|
|
331
|
-
|
|
339
|
+
b.emit(n, Ue, l);
|
|
332
340
|
},
|
|
333
341
|
togglePreview(l) {
|
|
334
342
|
c("preview", l);
|
|
@@ -340,144 +348,152 @@ const P = {
|
|
|
340
348
|
c("htmlPreview", l);
|
|
341
349
|
},
|
|
342
350
|
toggleCatalog(l) {
|
|
343
|
-
|
|
351
|
+
b.emit(n, ke, l);
|
|
344
352
|
},
|
|
345
353
|
triggerSave() {
|
|
346
|
-
|
|
354
|
+
b.emit(n, xe);
|
|
347
355
|
},
|
|
348
356
|
insert(l) {
|
|
349
|
-
|
|
357
|
+
se(n, {
|
|
358
|
+
direct: "universal",
|
|
359
|
+
params: { generate: l },
|
|
360
|
+
source: "programmatic"
|
|
361
|
+
});
|
|
350
362
|
},
|
|
351
363
|
focus(l) {
|
|
352
|
-
|
|
364
|
+
d.value?.focus(l);
|
|
353
365
|
},
|
|
354
366
|
rerender() {
|
|
355
|
-
|
|
367
|
+
b.emit(n, ue);
|
|
356
368
|
},
|
|
357
369
|
getSelectedText() {
|
|
358
|
-
return
|
|
370
|
+
return d.value?.getSelectedText();
|
|
359
371
|
},
|
|
360
372
|
resetHistory() {
|
|
361
|
-
|
|
373
|
+
d.value?.resetHistory();
|
|
362
374
|
},
|
|
363
375
|
domEventHandlers(l) {
|
|
364
|
-
|
|
376
|
+
b.emit(n, Ge, l);
|
|
365
377
|
},
|
|
366
378
|
execCommand(l) {
|
|
367
|
-
|
|
379
|
+
se(n, { direct: l, source: "programmatic" });
|
|
368
380
|
},
|
|
369
381
|
getEditorView() {
|
|
370
|
-
return
|
|
382
|
+
return d.value?.getEditorView();
|
|
371
383
|
}
|
|
372
384
|
};
|
|
373
385
|
t.expose(s);
|
|
374
|
-
},
|
|
386
|
+
}, at = (e) => {
|
|
375
387
|
const t = He();
|
|
376
388
|
return e.id || e.editorId || `${h}-${t}`;
|
|
377
|
-
},
|
|
378
|
-
const n = C("editorId"), o = C("rootRef"),
|
|
389
|
+
}, rt = (e, t, a) => {
|
|
390
|
+
const n = C("editorId"), o = C("rootRef"), u = C("usedLanguageText"), c = C("setting"), d = () => {
|
|
379
391
|
o.value.querySelectorAll(`#${n} .${h}-preview .${h}-code`).forEach((i) => {
|
|
380
392
|
let r = -1;
|
|
381
|
-
const
|
|
393
|
+
const m = i.querySelector(
|
|
382
394
|
`.${h}-copy-button:not([data-processed])`
|
|
383
395
|
);
|
|
384
|
-
|
|
396
|
+
m && (m.onclick = (f) => {
|
|
385
397
|
f.preventDefault(), clearTimeout(r);
|
|
386
|
-
const
|
|
387
|
-
let $ =
|
|
388
|
-
|
|
389
|
-
$ =
|
|
398
|
+
const g = (i.querySelector("input:checked + pre code") || i.querySelector("pre code")).textContent, { text: v, successTips: E, failTips: y } = u.value.copyCode;
|
|
399
|
+
let $ = E;
|
|
400
|
+
Xe(e.formatCopiedText(g || "")).catch(() => {
|
|
401
|
+
$ = y;
|
|
390
402
|
}).finally(() => {
|
|
391
|
-
|
|
392
|
-
|
|
403
|
+
m.dataset.isIcon ? m.dataset.tips = $ : m.textContent = $, r = window.setTimeout(() => {
|
|
404
|
+
m.dataset.isIcon ? m.dataset.tips = v : m.textContent = v;
|
|
393
405
|
}, 1500);
|
|
394
406
|
});
|
|
395
|
-
},
|
|
407
|
+
}, m.setAttribute("data-processed", "true"));
|
|
396
408
|
});
|
|
397
409
|
}, s = () => {
|
|
398
|
-
W(
|
|
410
|
+
W(d);
|
|
399
411
|
}, l = (i) => {
|
|
400
|
-
i && W(
|
|
412
|
+
i && W(d);
|
|
401
413
|
};
|
|
402
|
-
|
|
403
|
-
},
|
|
404
|
-
const t = C("editorId"), a = C("theme"), n = C("rootRef"), { editorExtensions: o, editorExtensionsAttrs:
|
|
405
|
-
let
|
|
414
|
+
k([t, a], s), k(() => c.value.preview, l), k(() => c.value.htmlPreview, l), M(d);
|
|
415
|
+
}, lt = (e) => {
|
|
416
|
+
const t = C("editorId"), a = C("theme"), n = C("rootRef"), { editorExtensions: o, editorExtensionsAttrs: u, echartsConfig: c } = L;
|
|
417
|
+
let d = o.echarts.instance;
|
|
406
418
|
const s = ee(-1), l = () => {
|
|
407
|
-
!e.noEcharts &&
|
|
419
|
+
!e.noEcharts && d && (s.value = s.value + 1);
|
|
408
420
|
};
|
|
409
|
-
|
|
421
|
+
k(
|
|
410
422
|
() => a.value,
|
|
411
423
|
() => {
|
|
412
424
|
l();
|
|
413
425
|
}
|
|
414
426
|
), M(() => {
|
|
415
|
-
if (e.noEcharts ||
|
|
427
|
+
if (e.noEcharts || d)
|
|
416
428
|
return;
|
|
417
|
-
const
|
|
429
|
+
const g = o.echarts.js;
|
|
418
430
|
O(
|
|
419
431
|
"script",
|
|
420
432
|
{
|
|
421
|
-
...
|
|
422
|
-
src:
|
|
433
|
+
...u.echarts?.js,
|
|
434
|
+
src: g,
|
|
423
435
|
id: P.echarts,
|
|
424
436
|
onload() {
|
|
425
|
-
|
|
437
|
+
d = window.echarts, l();
|
|
426
438
|
}
|
|
427
439
|
},
|
|
428
440
|
"echarts"
|
|
429
441
|
);
|
|
430
442
|
});
|
|
431
|
-
let i = [], r = [],
|
|
432
|
-
const f = (
|
|
443
|
+
let i = [], r = [], m = [];
|
|
444
|
+
const f = (g = !1) => {
|
|
433
445
|
if (!i.length) {
|
|
434
|
-
|
|
446
|
+
g && (r.forEach(($) => {
|
|
435
447
|
$.dispose?.();
|
|
436
|
-
}),
|
|
448
|
+
}), m.forEach(($) => {
|
|
437
449
|
$.disconnect?.();
|
|
438
|
-
}), r = [],
|
|
450
|
+
}), r = [], m = []);
|
|
439
451
|
return;
|
|
440
452
|
}
|
|
441
|
-
const
|
|
442
|
-
i.forEach(($,
|
|
443
|
-
const w = r[
|
|
444
|
-
if (
|
|
453
|
+
const v = [], E = [], y = [];
|
|
454
|
+
i.forEach(($, T) => {
|
|
455
|
+
const w = r[T], I = m[T];
|
|
456
|
+
if (g || !$ || !$.isConnected || (n?.value ? !n.value.contains($) : !1)) {
|
|
445
457
|
w?.dispose?.(), I?.disconnect?.();
|
|
446
458
|
return;
|
|
447
459
|
}
|
|
448
|
-
|
|
449
|
-
}), i =
|
|
450
|
-
},
|
|
451
|
-
f(), !e.noEcharts &&
|
|
452
|
-
n.value
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
460
|
+
v.push($), w && E.push(w), I && y.push(I);
|
|
461
|
+
}), i = v, r = E, m = y;
|
|
462
|
+
}, p = () => {
|
|
463
|
+
if (f(), !e.noEcharts && d) {
|
|
464
|
+
const g = n.value;
|
|
465
|
+
if (!g) return;
|
|
466
|
+
Array.from(
|
|
467
|
+
g.querySelectorAll(
|
|
468
|
+
`#${t} div.${h}-echarts:not([data-processed])`
|
|
469
|
+
)
|
|
470
|
+
).forEach((E) => {
|
|
471
|
+
if (E.dataset.closed === "false")
|
|
472
|
+
return !1;
|
|
473
|
+
try {
|
|
474
|
+
const y = o.echarts.parseOption(E.innerText, {
|
|
475
|
+
editorId: t,
|
|
476
|
+
element: E
|
|
477
|
+
}), $ = c(y), T = d.init(E, a.value);
|
|
478
|
+
T.setOption($), E.setAttribute("data-processed", ""), i.push(E), r.push(T);
|
|
479
|
+
const w = new ResizeObserver(() => {
|
|
480
|
+
T.resize();
|
|
481
|
+
});
|
|
482
|
+
w.observe(E), m.push(w);
|
|
483
|
+
} catch (y) {
|
|
484
|
+
b.emit(t, Q, {
|
|
485
|
+
name: "echarts",
|
|
486
|
+
message: y?.message,
|
|
487
|
+
error: y
|
|
488
|
+
});
|
|
489
|
+
}
|
|
490
|
+
});
|
|
491
|
+
}
|
|
476
492
|
};
|
|
477
493
|
return te(() => {
|
|
478
494
|
f(!0);
|
|
479
|
-
}), { reRenderEcharts: s, replaceEcharts:
|
|
480
|
-
},
|
|
495
|
+
}), { reRenderEcharts: s, replaceEcharts: p };
|
|
496
|
+
}, it = (e) => {
|
|
481
497
|
const t = C("highlight"), a = ee(L.editorExtensions.highlight.instance);
|
|
482
498
|
return M(() => {
|
|
483
499
|
e.noHighlight || a.value || (O("link", {
|
|
@@ -495,17 +511,17 @@ const P = {
|
|
|
495
511
|
},
|
|
496
512
|
"hljs"
|
|
497
513
|
));
|
|
498
|
-
}),
|
|
514
|
+
}), k(
|
|
499
515
|
() => t.value.css,
|
|
500
516
|
() => {
|
|
501
|
-
e.noHighlight || L.editorExtensions.highlight.instance ||
|
|
517
|
+
e.noHighlight || L.editorExtensions.highlight.instance || qe("link", {
|
|
502
518
|
...t.value.css,
|
|
503
519
|
rel: "stylesheet",
|
|
504
520
|
id: P.hlcss
|
|
505
521
|
});
|
|
506
522
|
}
|
|
507
523
|
), a;
|
|
508
|
-
},
|
|
524
|
+
}, st = (e) => {
|
|
509
525
|
const t = ee(L.editorExtensions.katex.instance);
|
|
510
526
|
return M(() => {
|
|
511
527
|
if (e.noKatex || t.value)
|
|
@@ -530,7 +546,7 @@ const P = {
|
|
|
530
546
|
});
|
|
531
547
|
}), t;
|
|
532
548
|
};
|
|
533
|
-
class
|
|
549
|
+
class ct {
|
|
534
550
|
constructor(t) {
|
|
535
551
|
this.options = t;
|
|
536
552
|
}
|
|
@@ -569,15 +585,15 @@ class st {
|
|
|
569
585
|
this.cache.clear();
|
|
570
586
|
}
|
|
571
587
|
}
|
|
572
|
-
const Y = new
|
|
588
|
+
const Y = new ct({
|
|
573
589
|
max: 1e3,
|
|
574
590
|
// 缓存10分钟
|
|
575
591
|
ttl: 6e5
|
|
576
|
-
}),
|
|
577
|
-
const t = C("editorId"), a = C("theme"), n = C("rootRef"), { editorExtensions: o, editorExtensionsAttrs:
|
|
578
|
-
let
|
|
592
|
+
}), dt = (e) => {
|
|
593
|
+
const t = C("editorId"), a = C("theme"), n = C("rootRef"), { editorExtensions: o, editorExtensionsAttrs: u, mermaidConfig: c } = L;
|
|
594
|
+
let d = o.mermaid.instance;
|
|
579
595
|
const s = ee(-1), l = () => {
|
|
580
|
-
if (!e.noMermaid &&
|
|
596
|
+
if (!e.noMermaid && d) {
|
|
581
597
|
const r = a.value === "dark" ? {
|
|
582
598
|
startOnLoad: !1,
|
|
583
599
|
theme: "dark"
|
|
@@ -597,20 +613,20 @@ const Y = new st({
|
|
|
597
613
|
clusterBorder: "#b7c0cc"
|
|
598
614
|
}
|
|
599
615
|
};
|
|
600
|
-
|
|
616
|
+
d.initialize(c(r)), s.value = s.value + 1;
|
|
601
617
|
}
|
|
602
618
|
};
|
|
603
|
-
return
|
|
619
|
+
return k(
|
|
604
620
|
() => a.value,
|
|
605
621
|
() => {
|
|
606
622
|
Y.clear(), l();
|
|
607
623
|
}
|
|
608
624
|
), M(() => {
|
|
609
|
-
if (e.noMermaid ||
|
|
625
|
+
if (e.noMermaid || d)
|
|
610
626
|
return;
|
|
611
627
|
const r = o.mermaid.js;
|
|
612
628
|
/\.mjs/.test(r) ? (O("link", {
|
|
613
|
-
...
|
|
629
|
+
...u.mermaid?.js,
|
|
614
630
|
rel: "modulepreload",
|
|
615
631
|
href: r,
|
|
616
632
|
id: P.mermaidM
|
|
@@ -618,100 +634,106 @@ const Y = new st({
|
|
|
618
634
|
/* @vite-ignore */
|
|
619
635
|
/* webpackIgnore: true */
|
|
620
636
|
r
|
|
621
|
-
).then((
|
|
622
|
-
|
|
623
|
-
}).catch((
|
|
624
|
-
|
|
637
|
+
).then((m) => {
|
|
638
|
+
d = m.default, l();
|
|
639
|
+
}).catch((m) => {
|
|
640
|
+
b.emit(t, Q, {
|
|
625
641
|
name: "mermaid",
|
|
626
|
-
message: `Failed to load mermaid module: ${
|
|
627
|
-
error:
|
|
642
|
+
message: `Failed to load mermaid module: ${m.message}`,
|
|
643
|
+
error: m
|
|
628
644
|
});
|
|
629
645
|
})) : O(
|
|
630
646
|
"script",
|
|
631
647
|
{
|
|
632
|
-
...
|
|
648
|
+
...u.mermaid?.js,
|
|
633
649
|
src: r,
|
|
634
650
|
id: P.mermaid,
|
|
635
651
|
onload() {
|
|
636
|
-
|
|
652
|
+
d = window.mermaid, l();
|
|
637
653
|
}
|
|
638
654
|
},
|
|
639
655
|
"mermaid"
|
|
640
656
|
);
|
|
641
657
|
}), { reRenderRef: s, replaceMermaid: async () => {
|
|
642
|
-
if (!e.noMermaid &&
|
|
643
|
-
const r = n.value
|
|
658
|
+
if (!e.noMermaid && d) {
|
|
659
|
+
const r = n.value;
|
|
660
|
+
if (!r) return;
|
|
661
|
+
const m = r.querySelectorAll(
|
|
644
662
|
`div.${h}-mermaid`
|
|
645
|
-
), d = document.createElement("div"), f = document.body.offsetWidth > 1366 ? document.body.offsetWidth : 1366, g = document.body.offsetHeight > 768 ? document.body.offsetHeight : 768;
|
|
646
|
-
d.style.width = f + "px", d.style.height = g + "px", d.style.position = "fixed", d.style.zIndex = "-10000", d.style.top = "-10000";
|
|
647
|
-
let v = r.length;
|
|
648
|
-
v > 0 && document.body.appendChild(d), await Promise.allSettled(
|
|
649
|
-
Array.from(r).map((p) => (async (b) => {
|
|
650
|
-
if (b.dataset.closed === "false")
|
|
651
|
-
return !1;
|
|
652
|
-
const $ = b.innerText;
|
|
653
|
-
let S = Y.get($);
|
|
654
|
-
if (!S) {
|
|
655
|
-
const w = ie();
|
|
656
|
-
let I = { svg: "" };
|
|
657
|
-
try {
|
|
658
|
-
I = await u.render(w, $, d), S = await e.sanitizeMermaid(I.svg);
|
|
659
|
-
const k = document.createElement("p");
|
|
660
|
-
k.className = `${h}-mermaid`, k.setAttribute("data-processed", ""), k.setAttribute("data-content", $), k.innerHTML = S, k.children[0]?.removeAttribute("height"), Y.set($, k.innerHTML), b.dataset.line !== void 0 && (k.dataset.line = b.dataset.line), b.replaceWith(k);
|
|
661
|
-
} catch (k) {
|
|
662
|
-
y.emit(t, Q, {
|
|
663
|
-
name: "mermaid",
|
|
664
|
-
message: k.message,
|
|
665
|
-
error: k
|
|
666
|
-
});
|
|
667
|
-
}
|
|
668
|
-
--v === 0 && d.remove();
|
|
669
|
-
}
|
|
670
|
-
})(p))
|
|
671
663
|
);
|
|
664
|
+
if (m.length === 0) return;
|
|
665
|
+
const f = document.createElement("div"), p = document.body.offsetWidth > 1366 ? document.body.offsetWidth : 1366, g = document.body.offsetHeight > 768 ? document.body.offsetHeight : 768;
|
|
666
|
+
f.style.width = p + "px", f.style.height = g + "px", f.style.position = "fixed", f.style.zIndex = "-10000", f.style.top = "-10000px", f.style.left = "-10000px", document.body.appendChild(f);
|
|
667
|
+
try {
|
|
668
|
+
await Promise.allSettled(
|
|
669
|
+
Array.from(m).map((v) => (async (y) => {
|
|
670
|
+
if (y.dataset.closed === "false")
|
|
671
|
+
return !1;
|
|
672
|
+
const $ = y.innerText;
|
|
673
|
+
let T = Y.get($);
|
|
674
|
+
if (!T) {
|
|
675
|
+
const w = ie();
|
|
676
|
+
let I = { svg: "" };
|
|
677
|
+
try {
|
|
678
|
+
I = await d.render(w, $, f), T = await e.sanitizeMermaid(I.svg);
|
|
679
|
+
const S = document.createElement("p");
|
|
680
|
+
S.className = `${h}-mermaid`, S.setAttribute("data-processed", ""), S.setAttribute("data-content", $), S.innerHTML = T, S.children[0]?.removeAttribute("height"), Y.set($, S.innerHTML), y.dataset.line !== void 0 && (S.dataset.line = y.dataset.line), y.replaceWith(S);
|
|
681
|
+
} catch (S) {
|
|
682
|
+
b.emit(t, Q, {
|
|
683
|
+
name: "mermaid",
|
|
684
|
+
message: S.message,
|
|
685
|
+
error: S
|
|
686
|
+
});
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
})(v))
|
|
690
|
+
);
|
|
691
|
+
} finally {
|
|
692
|
+
f.remove();
|
|
693
|
+
}
|
|
672
694
|
}
|
|
673
695
|
} };
|
|
674
|
-
},
|
|
696
|
+
}, ut = (e, t) => {
|
|
675
697
|
t = t || {};
|
|
676
|
-
const a = 3, n = t.marker || "!", o = n.charCodeAt(0),
|
|
677
|
-
let c = "",
|
|
678
|
-
const s = (i, r,
|
|
679
|
-
const
|
|
680
|
-
return
|
|
698
|
+
const a = 3, n = t.marker || "!", o = n.charCodeAt(0), u = n.length;
|
|
699
|
+
let c = "", d = "";
|
|
700
|
+
const s = (i, r, m, f, p) => {
|
|
701
|
+
const g = i[r];
|
|
702
|
+
return g.type === "admonition_open" ? i[r].attrPush([
|
|
681
703
|
"class",
|
|
682
|
-
`${h}-admonition ${h}-admonition-${
|
|
683
|
-
]) :
|
|
704
|
+
`${h}-admonition ${h}-admonition-${g.info}`
|
|
705
|
+
]) : g.type === "admonition_title_open" && i[r].attrPush(["class", `${h}-admonition-title`]), p.renderToken(i, r, m);
|
|
684
706
|
}, l = (i) => {
|
|
685
707
|
const r = i.trim().split(" ", 2);
|
|
686
|
-
|
|
708
|
+
d = "", c = r[0], r.length > 1 && (d = i.substring(c.length + 2));
|
|
687
709
|
};
|
|
688
710
|
e.block.ruler.before(
|
|
689
711
|
"code",
|
|
690
712
|
"admonition",
|
|
691
|
-
(i, r,
|
|
692
|
-
let g, v,
|
|
693
|
-
if (o !== i.src.charCodeAt(
|
|
713
|
+
(i, r, m, f) => {
|
|
714
|
+
let p, g, v, E = !1, y = i.bMarks[r] + i.tShift[r], $ = i.eMarks[r];
|
|
715
|
+
if (o !== i.src.charCodeAt(y))
|
|
694
716
|
return !1;
|
|
695
|
-
for (
|
|
717
|
+
for (p = y + 1; p <= $ && n[(p - y) % u] === i.src[p]; p++)
|
|
696
718
|
;
|
|
697
|
-
const
|
|
698
|
-
if (
|
|
719
|
+
const T = Math.floor((p - y) / u);
|
|
720
|
+
if (T !== a)
|
|
699
721
|
return !1;
|
|
700
|
-
|
|
701
|
-
const w = i.src.slice(
|
|
722
|
+
p -= (p - y) % u;
|
|
723
|
+
const w = i.src.slice(y, p), I = i.src.slice(p, $);
|
|
702
724
|
if (l(I), f)
|
|
703
725
|
return !0;
|
|
704
|
-
for (
|
|
705
|
-
if (o === i.src.charCodeAt(
|
|
706
|
-
for (
|
|
726
|
+
for (g = r; g++, !(g >= m || (y = i.bMarks[g] + i.tShift[g], $ = i.eMarks[g], y < $ && i.sCount[g] < i.blkIndent)); )
|
|
727
|
+
if (o === i.src.charCodeAt(y) && !(i.sCount[g] - i.blkIndent >= 4)) {
|
|
728
|
+
for (p = y + 1; p <= $ && n[(p - y) % u] === i.src[p]; p++)
|
|
707
729
|
;
|
|
708
|
-
if (!(Math.floor((
|
|
709
|
-
|
|
730
|
+
if (!(Math.floor((p - y) / u) < T) && (p -= (p - y) % u, p = i.skipSpaces(p), !(p < $))) {
|
|
731
|
+
E = !0;
|
|
710
732
|
break;
|
|
711
733
|
}
|
|
712
734
|
}
|
|
713
|
-
const
|
|
714
|
-
return i.parentType = "root", i.lineMax =
|
|
735
|
+
const S = i.parentType, R = i.lineMax;
|
|
736
|
+
return i.parentType = "root", i.lineMax = g, v = i.push("admonition_open", "div", 1), v.markup = w, v.block = !0, v.info = c, v.map = [r, g], d && (v = i.push("admonition_title_open", "p", 1), v.markup = w + " " + c, v.map = [r, g], v = i.push("inline", "", 0), v.content = d, v.map = [r, i.line - 1], v.children = [], v = i.push("admonition_title_close", "p", -1), v.markup = w + " " + c), i.md.block.tokenize(i, r + 1, g), v = i.push("admonition_close", "div", -1), v.markup = i.src.slice(y, p), v.block = !0, i.parentType = S, i.lineMax = R, i.line = g + (E ? 1 : 0), !0;
|
|
715
737
|
},
|
|
716
738
|
{
|
|
717
739
|
alt: ["paragraph", "reference", "blockquote", "list"]
|
|
@@ -723,39 +745,39 @@ const Y = new st({
|
|
|
723
745
|
const o = e.attrIndex(n[0]);
|
|
724
746
|
o < 0 ? a.push(n) : (a[o] = a[o].slice(), a[o][1] += ` ${n[1]}`);
|
|
725
747
|
}), a;
|
|
726
|
-
},
|
|
748
|
+
}, mt = (e) => Array.from(e).map(
|
|
727
749
|
(t) => /[A-Za-z0-9_-]/.test(t) ? t : `_${t.codePointAt(0).toString(16)}_`
|
|
728
|
-
).join(""),
|
|
729
|
-
const a = e.renderer.rules.fence, n = e.utils.unescapeAll, o = /\[(\w*)(?::([\w ]*))?\]/,
|
|
730
|
-
const f =
|
|
731
|
-
return [
|
|
732
|
-
}, l = (
|
|
733
|
-
const f =
|
|
750
|
+
).join(""), ft = (e, t) => {
|
|
751
|
+
const a = e.renderer.rules.fence, n = e.utils.unescapeAll, o = /\[(\w*)(?::([\w ]*))?\]/, u = /::(open|close)/, c = mt(t.editorId), d = (m) => m.info ? n(m.info).trim() : "", s = (m) => {
|
|
752
|
+
const f = d(m), [p = null, g = ""] = (o.exec(f) || []).slice(1);
|
|
753
|
+
return [p, g];
|
|
754
|
+
}, l = (m) => {
|
|
755
|
+
const f = d(m);
|
|
734
756
|
return f ? f.split(/(\s+)/g)[0] : "";
|
|
735
|
-
}, i = (
|
|
736
|
-
const f =
|
|
737
|
-
`).length < t.autoFoldThreshold,
|
|
738
|
-
return { open:
|
|
739
|
-
}, r = (
|
|
740
|
-
if (
|
|
757
|
+
}, i = (m) => {
|
|
758
|
+
const f = m.info.match(u) || [], p = f[1] === "open" || f[1] !== "close" && t.codeFoldable && m.content.trim().split(`
|
|
759
|
+
`).length < t.autoFoldThreshold, g = f[1] || t.codeFoldable ? "details" : "div", v = f[1] || t.codeFoldable ? "summary" : "div";
|
|
760
|
+
return { open: p, tagContainer: g, tagHeader: v };
|
|
761
|
+
}, r = (m, f, p, g, v) => {
|
|
762
|
+
if (m[f].hidden)
|
|
741
763
|
return "";
|
|
742
|
-
const
|
|
743
|
-
if (
|
|
744
|
-
const { open: A, tagContainer: _, tagHeader: J } = i(
|
|
764
|
+
const E = t.usedLanguageTextRef.value?.copyCode.text || "", y = t.customIconRef.value.copy, $ = e.utils.escapeHtml(E), T = y || $, w = !!y, I = `<span class="${h}-collapse-tips">${Ke("collapse-tips", t.customIconRef.value)}</span>`, [S] = s(m[f]);
|
|
765
|
+
if (S === null) {
|
|
766
|
+
const { open: A, tagContainer: _, tagHeader: J } = i(m[f]), U = [["class", `${h}-code`]];
|
|
745
767
|
A && U.push(["open", ""]);
|
|
746
768
|
const Fe = {
|
|
747
|
-
attrs: ce(
|
|
769
|
+
attrs: ce(m[f], U)
|
|
748
770
|
};
|
|
749
|
-
|
|
750
|
-
const Re = a(
|
|
771
|
+
m[f].info = m[f].info.replace(u, "");
|
|
772
|
+
const Re = a(m, f, p, g, v);
|
|
751
773
|
return `
|
|
752
|
-
<${_} ${
|
|
774
|
+
<${_} ${v.renderAttrs(Fe)}>
|
|
753
775
|
<${J} class="${h}-code-head">
|
|
754
776
|
<div class="${h}-code-flag"><span></span><span></span><span></span></div>
|
|
755
777
|
<div class="${h}-code-action">
|
|
756
|
-
<span class="${h}-code-lang">${e.utils.escapeHtml(
|
|
757
|
-
<span class="${h}-copy-button" data-tips="${$}"${w ? " data-is-icon=true" : ""}>${
|
|
758
|
-
${t.extraTools instanceof Function ? t.extraTools({ lang:
|
|
778
|
+
<span class="${h}-code-lang">${e.utils.escapeHtml(m[f].info.trim())}</span>
|
|
779
|
+
<span class="${h}-copy-button" data-tips="${$}"${w ? " data-is-icon=true" : ""}>${T}</span>
|
|
780
|
+
${t.extraTools instanceof Function ? t.extraTools({ lang: m[f].info.trim() }) : t.extraTools || ""}
|
|
759
781
|
${_ === "details" ? I : ""}
|
|
760
782
|
</div>
|
|
761
783
|
</${J}>
|
|
@@ -764,13 +786,13 @@ const Y = new st({
|
|
|
764
786
|
`;
|
|
765
787
|
}
|
|
766
788
|
let R, B, V, j, q = "", K = "", Z = "";
|
|
767
|
-
const { open: ne, tagContainer: G, tagHeader: H } = i(
|
|
789
|
+
const { open: ne, tagContainer: G, tagHeader: H } = i(m[f]), D = [["class", `${h}-code`]];
|
|
768
790
|
ne && D.push(["open", ""]);
|
|
769
791
|
const oe = {
|
|
770
|
-
attrs: ce(
|
|
792
|
+
attrs: ce(m[f], D)
|
|
771
793
|
};
|
|
772
|
-
for (let A = f; A <
|
|
773
|
-
R.info = R.info.replace(o, "").replace(
|
|
794
|
+
for (let A = f; A < m.length && (R = m[A], [B, V] = s(R), B === S); A++) {
|
|
795
|
+
R.info = R.info.replace(o, "").replace(u, ""), R.hidden = !0;
|
|
774
796
|
const _ = `${h}-codetab-${c}-${f}-${A - f}`;
|
|
775
797
|
j = A - f > 0 ? "" : "checked", q += `
|
|
776
798
|
<li>
|
|
@@ -795,7 +817,7 @@ const Y = new st({
|
|
|
795
817
|
class="${_}"
|
|
796
818
|
${j}
|
|
797
819
|
role="presentation">
|
|
798
|
-
${a(
|
|
820
|
+
${a(m, A, p, g, v)}
|
|
799
821
|
</div>`, Z += `
|
|
800
822
|
<input
|
|
801
823
|
type="radio"
|
|
@@ -806,15 +828,15 @@ const Y = new st({
|
|
|
806
828
|
<span class=${h}-code-lang role="note">${e.utils.escapeHtml(l(R))}</span>`;
|
|
807
829
|
}
|
|
808
830
|
return `
|
|
809
|
-
<${G} ${
|
|
831
|
+
<${G} ${v.renderAttrs(oe)}>
|
|
810
832
|
<${H} class="${h}-code-head">
|
|
811
833
|
<div class="${h}-code-flag">
|
|
812
834
|
<ul class="${h}-codetab-label" role="tablist">${q}</ul>
|
|
813
835
|
</div>
|
|
814
836
|
<div class="${h}-code-action">
|
|
815
837
|
<span class="${h}-codetab-lang">${Z}</span>
|
|
816
|
-
<span class="${h}-copy-button" data-tips="${$}"${w ? " data-is-icon=true" : ""}>${
|
|
817
|
-
${t.extraTools instanceof Function ? t.extraTools({ lang:
|
|
838
|
+
<span class="${h}-copy-button" data-tips="${$}"${w ? " data-is-icon=true" : ""}>${T}</span>
|
|
839
|
+
${t.extraTools instanceof Function ? t.extraTools({ lang: m[f].info.trim() }) : t.extraTools || ""}
|
|
818
840
|
${G === "details" ? I : ""}
|
|
819
841
|
</div>
|
|
820
842
|
</${H}>
|
|
@@ -823,24 +845,24 @@ const Y = new st({
|
|
|
823
845
|
`;
|
|
824
846
|
};
|
|
825
847
|
e.renderer.rules.fence = r, e.renderer.rules.code_block = r;
|
|
826
|
-
},
|
|
848
|
+
}, ht = (e, t) => {
|
|
827
849
|
const a = e.renderer.rules.fence.bind(e.renderer.rules);
|
|
828
|
-
e.renderer.rules.fence = (n, o,
|
|
850
|
+
e.renderer.rules.fence = (n, o, u, c, d) => {
|
|
829
851
|
const s = n[o], l = s.content.trim();
|
|
830
852
|
if (s.info === "echarts") {
|
|
831
853
|
if (s.attrSet("class", `${h}-echarts`), s.attrSet("data-echarts-theme", t.themeRef.value), s.map && s.level === 0) {
|
|
832
|
-
const i = s.map[1] - 1,
|
|
833
|
-
s.attrSet("data-closed", `${
|
|
854
|
+
const i = s.map[1] - 1, m = !!c.srcLines[i]?.trim()?.startsWith("```");
|
|
855
|
+
s.attrSet("data-closed", `${m}`), s.attrSet("data-line", String(s.map[0]));
|
|
834
856
|
}
|
|
835
|
-
return `<div ${
|
|
857
|
+
return `<div ${d.renderAttrs(s)} style="width: 100%; aspect-ratio: 4 / 3;">${e.utils.escapeHtml(l)}</div>`;
|
|
836
858
|
}
|
|
837
|
-
return a(n, o,
|
|
859
|
+
return a(n, o, u, c, d);
|
|
838
860
|
};
|
|
839
|
-
},
|
|
861
|
+
}, pt = (e, t) => {
|
|
840
862
|
e.renderer.rules.heading_open = (a, n) => {
|
|
841
|
-
const o = a[n],
|
|
863
|
+
const o = a[n], u = a[n + 1].children?.reduce((d, s) => d + (["text", "code_inline", "math_inline"].includes(s.type) && s.content || ""), "") || "", c = o.markup.length;
|
|
842
864
|
return t.headsRef.value.push({
|
|
843
|
-
text:
|
|
865
|
+
text: u,
|
|
844
866
|
level: c,
|
|
845
867
|
line: o.map[0],
|
|
846
868
|
currentToken: o,
|
|
@@ -848,14 +870,14 @@ const Y = new st({
|
|
|
848
870
|
}), o.map && o.level === 0 && o.attrSet(
|
|
849
871
|
"id",
|
|
850
872
|
t.mdHeadingId({
|
|
851
|
-
text:
|
|
873
|
+
text: u,
|
|
852
874
|
level: c,
|
|
853
875
|
index: t.headsRef.value.length,
|
|
854
876
|
currentToken: o,
|
|
855
877
|
nextToken: a[n + 1]
|
|
856
878
|
})
|
|
857
879
|
), e.renderer.renderToken(a, n, t);
|
|
858
|
-
}, e.renderer.rules.heading_close = (a, n, o,
|
|
880
|
+
}, e.renderer.rules.heading_close = (a, n, o, u, c) => c.renderToken(a, n, o);
|
|
859
881
|
}, $e = {
|
|
860
882
|
block: [
|
|
861
883
|
{ open: "$$", close: "$$" },
|
|
@@ -867,105 +889,105 @@ const Y = new st({
|
|
|
867
889
|
{ open: "\\[", close: "\\]" },
|
|
868
890
|
{ open: "\\(", close: "\\)" }
|
|
869
891
|
]
|
|
870
|
-
},
|
|
892
|
+
}, gt = (e) => (t, a) => {
|
|
871
893
|
const n = e.delimiters;
|
|
872
894
|
for (const o of n) {
|
|
873
895
|
if (!t.src.startsWith(o.open, t.pos))
|
|
874
896
|
continue;
|
|
875
|
-
const
|
|
876
|
-
let c =
|
|
897
|
+
const u = t.pos + o.open.length;
|
|
898
|
+
let c = u;
|
|
877
899
|
for (; (c = t.src.indexOf(o.close, c)) !== -1; ) {
|
|
878
|
-
let
|
|
900
|
+
let d = 0, s = c - 1;
|
|
879
901
|
for (; s >= 0 && t.src[s] === "\\"; )
|
|
880
|
-
|
|
881
|
-
if (
|
|
902
|
+
d++, s--;
|
|
903
|
+
if (d % 2 === 0)
|
|
882
904
|
break;
|
|
883
905
|
c += o.close.length;
|
|
884
906
|
}
|
|
885
907
|
if (c !== -1) {
|
|
886
|
-
if (c -
|
|
908
|
+
if (c - u === 0)
|
|
887
909
|
return a || (t.pending += o.open + o.close), t.pos = c + o.close.length, !0;
|
|
888
910
|
if (!a) {
|
|
889
|
-
const
|
|
890
|
-
|
|
911
|
+
const d = t.push("math_inline", "math", 0);
|
|
912
|
+
d.markup = o.open, d.content = t.src.slice(u, c);
|
|
891
913
|
}
|
|
892
914
|
return t.pos = c + o.close.length, !0;
|
|
893
915
|
}
|
|
894
916
|
}
|
|
895
917
|
return !1;
|
|
896
|
-
},
|
|
897
|
-
const
|
|
918
|
+
}, vt = (e) => (t, a, n, o) => {
|
|
919
|
+
const u = e.delimiters, c = t.bMarks[a] + t.tShift[a], d = t.eMarks[a], s = (l, i, r) => {
|
|
898
920
|
t.line = i;
|
|
899
|
-
const
|
|
900
|
-
return
|
|
921
|
+
const m = t.push("math_block", "math", 0);
|
|
922
|
+
return m.block = !0, m.content = l, m.map = [a, t.line], m.markup = r, !0;
|
|
901
923
|
};
|
|
902
|
-
for (const l of
|
|
924
|
+
for (const l of u) {
|
|
903
925
|
const i = c;
|
|
904
926
|
if (t.src.slice(i, i + l.open.length) !== l.open)
|
|
905
927
|
continue;
|
|
906
|
-
const r = i + l.open.length,
|
|
907
|
-
if (!f && !
|
|
928
|
+
const r = i + l.open.length, m = t.src.slice(r, d).trim(), f = m === "", p = m === l.close, g = m.endsWith(l.close);
|
|
929
|
+
if (!f && !p && !g)
|
|
908
930
|
continue;
|
|
909
931
|
if (o)
|
|
910
932
|
return !0;
|
|
911
|
-
if (
|
|
933
|
+
if (p)
|
|
912
934
|
return s("", a + 1, l.open);
|
|
913
|
-
if (!f &&
|
|
914
|
-
const w =
|
|
935
|
+
if (!f && g) {
|
|
936
|
+
const w = m.slice(0, -l.close.length);
|
|
915
937
|
return s(w, a + 1, l.open);
|
|
916
938
|
}
|
|
917
|
-
let
|
|
918
|
-
for (;
|
|
919
|
-
const w = t.bMarks[
|
|
920
|
-
if (w < I && t.tShift[
|
|
939
|
+
let v = a + 1, E = !1, y = "";
|
|
940
|
+
for (; v < n; v++) {
|
|
941
|
+
const w = t.bMarks[v] + t.tShift[v], I = t.eMarks[v];
|
|
942
|
+
if (w < I && t.tShift[v] < t.blkIndent)
|
|
921
943
|
break;
|
|
922
944
|
if (t.src.slice(w, I).trim().endsWith(l.close)) {
|
|
923
945
|
const R = t.src.slice(0, I).lastIndexOf(l.close);
|
|
924
|
-
|
|
946
|
+
y = t.src.slice(w, R), E = !0;
|
|
925
947
|
break;
|
|
926
948
|
}
|
|
927
949
|
}
|
|
928
|
-
if (!
|
|
950
|
+
if (!E)
|
|
929
951
|
continue;
|
|
930
|
-
const
|
|
931
|
-
return s(
|
|
952
|
+
const T = t.getLines(a + 1, v, t.tShift[a], !0) + (y.trim() ? y : "");
|
|
953
|
+
return s(T, v + 1, l.open);
|
|
932
954
|
}
|
|
933
955
|
return !1;
|
|
934
|
-
},
|
|
935
|
-
const o = (
|
|
936
|
-
const
|
|
937
|
-
attrs: ce(
|
|
938
|
-
}, f = i.renderAttrs(
|
|
956
|
+
}, yt = (e, { katexRef: t, inlineDelimiters: a, blockDelimiters: n }) => {
|
|
957
|
+
const o = (d, s, l, i, r = !1) => {
|
|
958
|
+
const m = {
|
|
959
|
+
attrs: ce(d, [["class", s]])
|
|
960
|
+
}, f = i.renderAttrs(m);
|
|
939
961
|
if (!t.value)
|
|
940
|
-
return `<${l} ${f}>${
|
|
941
|
-
const
|
|
942
|
-
|
|
962
|
+
return `<${l} ${f}>${d.content}</${l}>`;
|
|
963
|
+
const p = t.value.renderToString(
|
|
964
|
+
d.content,
|
|
943
965
|
L.katexConfig({
|
|
944
966
|
throwOnError: !1,
|
|
945
967
|
displayMode: r
|
|
946
968
|
})
|
|
947
969
|
);
|
|
948
|
-
return `<${l} ${f} data-processed>${
|
|
949
|
-
},
|
|
970
|
+
return `<${l} ${f} data-processed>${p}</${l}>`;
|
|
971
|
+
}, u = (d, s, l, i, r) => o(d[s], `${h}-katex-inline`, "span", r), c = (d, s, l, i, r) => o(d[s], `${h}-katex-block`, "p", r, !0);
|
|
950
972
|
e.inline.ruler.before(
|
|
951
973
|
"escape",
|
|
952
974
|
"math_inline",
|
|
953
|
-
|
|
975
|
+
gt({
|
|
954
976
|
delimiters: a || $e.inline
|
|
955
977
|
})
|
|
956
978
|
), e.block.ruler.after(
|
|
957
979
|
"blockquote",
|
|
958
980
|
"math_block",
|
|
959
|
-
|
|
981
|
+
vt({
|
|
960
982
|
delimiters: n || $e.block
|
|
961
983
|
}),
|
|
962
984
|
{
|
|
963
985
|
alt: ["paragraph", "reference", "blockquote", "list"]
|
|
964
986
|
}
|
|
965
|
-
), e.renderer.rules.math_inline =
|
|
966
|
-
},
|
|
987
|
+
), e.renderer.rules.math_inline = u, e.renderer.rules.math_block = c;
|
|
988
|
+
}, bt = (e, t) => {
|
|
967
989
|
const a = e.renderer.rules.fence.bind(e.renderer.rules);
|
|
968
|
-
e.renderer.rules.fence = (n, o,
|
|
990
|
+
e.renderer.rules.fence = (n, o, u, c, d) => {
|
|
969
991
|
const s = n[o], l = s.content.trim();
|
|
970
992
|
if (s.info === "mermaid") {
|
|
971
993
|
if (s.attrSet("class", `${h}-mermaid`), s.attrSet("data-mermaid-theme", t.themeRef.value), s.map && s.level === 0) {
|
|
@@ -973,57 +995,57 @@ const Y = new st({
|
|
|
973
995
|
s.attrSet("data-closed", `${f}`), s.attrSet("data-line", String(s.map[0]));
|
|
974
996
|
}
|
|
975
997
|
const i = Y.get(l);
|
|
976
|
-
return i ? (s.attrSet("data-processed", ""), s.attrSet("data-content", l), `<p ${
|
|
998
|
+
return i ? (s.attrSet("data-processed", ""), s.attrSet("data-content", l), `<p ${d.renderAttrs(s)}>${i}</p>`) : `<div ${d.renderAttrs(s)}>${e.utils.escapeHtml(l)}</div>`;
|
|
977
999
|
}
|
|
978
|
-
return a(n, o,
|
|
1000
|
+
return a(n, o, u, c, d);
|
|
979
1001
|
};
|
|
980
1002
|
}, we = (e, t, a) => {
|
|
981
1003
|
const n = e.attrIndex(t), o = [t, a];
|
|
982
1004
|
n < 0 ? e.attrPush(o) : (e.attrs = e.attrs || [], e.attrs[n] = o);
|
|
983
|
-
},
|
|
1005
|
+
}, $t = (e) => e.type === "inline", wt = (e) => e.type === "paragraph_open", Ct = (e) => e.type === "list_item_open", Et = (e) => e.content.indexOf("[ ] ") === 0 || e.content.indexOf("[x] ") === 0 || e.content.indexOf("[X] ") === 0, kt = (e, t) => $t(e[t]) && wt(e[t - 1]) && Ct(e[t - 2]) && Et(e[t]), xt = (e, t) => {
|
|
984
1006
|
const a = e[t].level - 1;
|
|
985
1007
|
for (let n = t - 1; n >= 0; n--)
|
|
986
1008
|
if (e[n].level === a)
|
|
987
1009
|
return n;
|
|
988
1010
|
return -1;
|
|
989
|
-
},
|
|
1011
|
+
}, Tt = (e) => {
|
|
990
1012
|
const t = new e("html_inline", "", 0);
|
|
991
1013
|
return t.content = "<label>", t;
|
|
992
|
-
},
|
|
1014
|
+
}, St = (e) => {
|
|
993
1015
|
const t = new e("html_inline", "", 0);
|
|
994
1016
|
return t.content = "</label>", t;
|
|
995
|
-
},
|
|
1017
|
+
}, It = (e, t, a) => {
|
|
996
1018
|
const n = new a("html_inline", "", 0);
|
|
997
1019
|
return n.content = '<label class="task-list-item-label" for="' + t + '">' + e + "</label>", n.attrs = [["for", t]], n;
|
|
998
|
-
},
|
|
1020
|
+
}, At = (e, t, a) => {
|
|
999
1021
|
const n = new t("html_inline", "", 0), o = a.enabled ? " " : ' disabled="" ';
|
|
1000
1022
|
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;
|
|
1001
|
-
},
|
|
1002
|
-
if (e.children = e.children || [], e.children.unshift(
|
|
1023
|
+
}, Ft = (e, t, a) => {
|
|
1024
|
+
if (e.children = e.children || [], e.children.unshift(At(e, t, a)), e.children[1].content = e.children[1].content.slice(3), e.content = e.content.slice(3), a.label)
|
|
1003
1025
|
if (a.labelAfter) {
|
|
1004
1026
|
e.children.pop();
|
|
1005
1027
|
const n = "task-item-" + Math.ceil(Math.random() * (1e4 * 1e3) - 1e3);
|
|
1006
|
-
e.children[0].content = e.children[0].content.slice(0, -1) + ' id="' + n + '">', e.children.push(
|
|
1028
|
+
e.children[0].content = e.children[0].content.slice(0, -1) + ' id="' + n + '">', e.children.push(It(e.content, n, t));
|
|
1007
1029
|
} else
|
|
1008
|
-
e.children.unshift(
|
|
1009
|
-
},
|
|
1030
|
+
e.children.unshift(Tt(t)), e.children.push(St(t));
|
|
1031
|
+
}, Rt = (e, t = {}) => {
|
|
1010
1032
|
e.core.ruler.after("inline", "github-task-lists", (a) => {
|
|
1011
1033
|
const n = a.tokens;
|
|
1012
1034
|
for (let o = 2; o < n.length; o++)
|
|
1013
|
-
|
|
1035
|
+
kt(n, o) && (Ft(n[o], a.Token, t), we(
|
|
1014
1036
|
n[o - 2],
|
|
1015
1037
|
"class",
|
|
1016
1038
|
"task-list-item" + (t.enabled ? " enabled" : " ")
|
|
1017
|
-
), we(n[
|
|
1039
|
+
), we(n[xt(n, o - 2)], "class", "contains-task-list"));
|
|
1018
1040
|
});
|
|
1019
|
-
},
|
|
1041
|
+
}, Ht = (e) => {
|
|
1020
1042
|
e.core.ruler.push("init-line-number", (t) => (t.tokens.forEach((a) => {
|
|
1021
1043
|
a.map && (a.attrs || (a.attrs = []), a.attrs.push(["data-line", a.map[0].toString()]));
|
|
1022
1044
|
}), !0));
|
|
1023
|
-
},
|
|
1024
|
-
const { editorConfig: a, markdownItConfig: n, markdownItPlugins: o, editorExtensions:
|
|
1045
|
+
}, Mt = (e, t) => {
|
|
1046
|
+
const { editorConfig: a, markdownItConfig: n, markdownItPlugins: o, editorExtensions: u } = L, c = C("editorId"), d = C("language"), s = C(
|
|
1025
1047
|
"usedLanguageText"
|
|
1026
|
-
), l = C("showCodeRowNumber"), i = C("theme"), r = C("customIcon"),
|
|
1048
|
+
), l = C("showCodeRowNumber"), i = C("theme"), r = C("customIcon"), m = C("rootRef"), f = C("setting"), p = z([]), g = it(e), v = st(e), { reRenderRef: E, replaceMermaid: y } = dt(e), { reRenderEcharts: $, replaceEcharts: T } = lt(e), w = Ye({
|
|
1027
1049
|
html: !0,
|
|
1028
1050
|
breaks: !0,
|
|
1029
1051
|
linkify: !0
|
|
@@ -1034,27 +1056,27 @@ const Y = new st({
|
|
|
1034
1056
|
const I = [
|
|
1035
1057
|
{
|
|
1036
1058
|
type: "image",
|
|
1037
|
-
plugin:
|
|
1059
|
+
plugin: Qe,
|
|
1038
1060
|
options: { figcaption: !0, classes: "md-zoom" }
|
|
1039
1061
|
},
|
|
1040
1062
|
{
|
|
1041
1063
|
type: "admonition",
|
|
1042
|
-
plugin:
|
|
1064
|
+
plugin: ut,
|
|
1043
1065
|
options: {}
|
|
1044
1066
|
},
|
|
1045
1067
|
{
|
|
1046
1068
|
type: "taskList",
|
|
1047
|
-
plugin:
|
|
1069
|
+
plugin: Rt,
|
|
1048
1070
|
options: {}
|
|
1049
1071
|
},
|
|
1050
1072
|
{
|
|
1051
1073
|
type: "heading",
|
|
1052
|
-
plugin:
|
|
1053
|
-
options: { mdHeadingId: e.mdHeadingId, headsRef:
|
|
1074
|
+
plugin: pt,
|
|
1075
|
+
options: { mdHeadingId: e.mdHeadingId, headsRef: p }
|
|
1054
1076
|
},
|
|
1055
1077
|
{
|
|
1056
1078
|
type: "code",
|
|
1057
|
-
plugin:
|
|
1079
|
+
plugin: ft,
|
|
1058
1080
|
options: {
|
|
1059
1081
|
editorId: c,
|
|
1060
1082
|
usedLanguageTextRef: s,
|
|
@@ -1066,52 +1088,52 @@ const Y = new st({
|
|
|
1066
1088
|
},
|
|
1067
1089
|
{
|
|
1068
1090
|
type: "sub",
|
|
1069
|
-
plugin:
|
|
1091
|
+
plugin: et,
|
|
1070
1092
|
options: {}
|
|
1071
1093
|
},
|
|
1072
1094
|
{
|
|
1073
1095
|
type: "sup",
|
|
1074
|
-
plugin:
|
|
1096
|
+
plugin: tt,
|
|
1075
1097
|
options: {}
|
|
1076
1098
|
}
|
|
1077
1099
|
];
|
|
1078
1100
|
e.noKatex || I.push({
|
|
1079
1101
|
type: "katex",
|
|
1080
|
-
plugin:
|
|
1081
|
-
options: { katexRef:
|
|
1102
|
+
plugin: yt,
|
|
1103
|
+
options: { katexRef: v }
|
|
1082
1104
|
}), e.noMermaid || I.push({
|
|
1083
1105
|
type: "mermaid",
|
|
1084
|
-
plugin:
|
|
1106
|
+
plugin: bt,
|
|
1085
1107
|
options: { themeRef: i }
|
|
1086
1108
|
}), e.noEcharts || I.push({
|
|
1087
1109
|
type: "echarts",
|
|
1088
|
-
plugin:
|
|
1110
|
+
plugin: ht,
|
|
1089
1111
|
options: { themeRef: i }
|
|
1090
1112
|
}), o(I, {
|
|
1091
1113
|
editorId: c
|
|
1092
1114
|
}).forEach((H) => {
|
|
1093
1115
|
w.use(H.plugin, H.options);
|
|
1094
1116
|
});
|
|
1095
|
-
const
|
|
1117
|
+
const S = w.options.highlight;
|
|
1096
1118
|
w.set({
|
|
1097
1119
|
highlight: (H, D, oe) => {
|
|
1098
|
-
if (
|
|
1099
|
-
const U =
|
|
1120
|
+
if (S) {
|
|
1121
|
+
const U = S(H, D, oe);
|
|
1100
1122
|
if (U)
|
|
1101
1123
|
return U;
|
|
1102
1124
|
}
|
|
1103
1125
|
let A;
|
|
1104
|
-
!e.noHighlight &&
|
|
1126
|
+
!e.noHighlight && g.value ? g.value.getLanguage(D) ? A = g.value.highlight(H, {
|
|
1105
1127
|
language: D,
|
|
1106
1128
|
ignoreIllegals: !0
|
|
1107
|
-
}).value : A =
|
|
1108
|
-
const _ = w.utils.escapeHtml(D), J = l ?
|
|
1129
|
+
}).value : A = g.value.highlightAuto(H).value : A = w.utils.escapeHtml(H);
|
|
1130
|
+
const _ = w.utils.escapeHtml(D), J = l ? nt(
|
|
1109
1131
|
A.replace(/^\n+|\n+$/g, ""),
|
|
1110
1132
|
H.replace(/^\n+|\n+$/g, "")
|
|
1111
1133
|
) : `<span class="${h}-code-block">${A.replace(/^\n+|\n+$/g, "")}</span>`;
|
|
1112
1134
|
return `<pre><code class="language-${_}" language="${_}">${J}</code></pre>`;
|
|
1113
1135
|
}
|
|
1114
|
-
}),
|
|
1136
|
+
}), Ht(w);
|
|
1115
1137
|
const R = z(`_article-key_${ie()}`), B = z(
|
|
1116
1138
|
e.sanitize(
|
|
1117
1139
|
w.render(e.modelValue, {
|
|
@@ -1124,50 +1146,50 @@ const Y = new st({
|
|
|
1124
1146
|
}, j = () => {
|
|
1125
1147
|
};
|
|
1126
1148
|
const q = () => {
|
|
1127
|
-
const H =
|
|
1149
|
+
const H = m.value?.querySelectorAll(
|
|
1128
1150
|
`#${c} p.${h}-mermaid:not([data-closed=false])`
|
|
1129
1151
|
);
|
|
1130
|
-
j(), j =
|
|
1152
|
+
j(), j = Ze(H, {
|
|
1131
1153
|
customIcon: r.value
|
|
1132
|
-
}),
|
|
1154
|
+
}), u.mermaid?.enableZoom && (V(), V = Je(H, {
|
|
1133
1155
|
customIcon: r.value
|
|
1134
1156
|
}));
|
|
1135
1157
|
}, K = () => {
|
|
1136
|
-
|
|
1137
|
-
|
|
1158
|
+
b.emit(c, X, B.value), e.onHtmlChanged(B.value), e.onGetCatalog(p.value), b.emit(c, ae, p.value), W(() => {
|
|
1159
|
+
y().then(q), T();
|
|
1138
1160
|
});
|
|
1139
1161
|
}, Z = () => {
|
|
1140
|
-
|
|
1162
|
+
p.value = [], B.value = e.sanitize(
|
|
1141
1163
|
w.render(e.modelValue, {
|
|
1142
1164
|
srcLines: e.modelValue.split(`
|
|
1143
1165
|
`)
|
|
1144
1166
|
})
|
|
1145
1167
|
);
|
|
1146
|
-
}, ne = F(() => (e.noKatex || !!
|
|
1168
|
+
}, ne = F(() => (e.noKatex || !!v.value) && (e.noHighlight || !!g.value));
|
|
1147
1169
|
let G = -1;
|
|
1148
|
-
return
|
|
1170
|
+
return k([Me(e, "modelValue"), ne, E, d], () => {
|
|
1149
1171
|
G = window.setTimeout(
|
|
1150
1172
|
() => {
|
|
1151
1173
|
Z();
|
|
1152
1174
|
},
|
|
1153
1175
|
t ? 0 : a.renderDelay
|
|
1154
1176
|
);
|
|
1155
|
-
}),
|
|
1177
|
+
}), k(
|
|
1156
1178
|
() => f.value.preview,
|
|
1157
1179
|
() => {
|
|
1158
1180
|
f.value.preview && W(() => {
|
|
1159
|
-
|
|
1181
|
+
y().then(q), T(), b.emit(c, ae, p.value);
|
|
1160
1182
|
});
|
|
1161
1183
|
}
|
|
1162
|
-
),
|
|
1184
|
+
), k([B, $], () => {
|
|
1163
1185
|
K();
|
|
1164
1186
|
}), M(K), M(() => {
|
|
1165
|
-
|
|
1166
|
-
name:
|
|
1187
|
+
b.on(c, {
|
|
1188
|
+
name: ze,
|
|
1167
1189
|
callback() {
|
|
1168
|
-
|
|
1190
|
+
b.emit(c, ae, p.value);
|
|
1169
1191
|
}
|
|
1170
|
-
}),
|
|
1192
|
+
}), b.on(c, {
|
|
1171
1193
|
name: ue,
|
|
1172
1194
|
callback: () => {
|
|
1173
1195
|
R.value = `_article-key_${ie()}`, Z();
|
|
@@ -1176,19 +1198,19 @@ const Y = new st({
|
|
|
1176
1198
|
}), te(() => {
|
|
1177
1199
|
V(), j(), clearTimeout(G);
|
|
1178
1200
|
}), { html: B, key: R };
|
|
1179
|
-
},
|
|
1180
|
-
const a = C("editorId"), n = C("setting"), { noImgZoomIn: o } = e,
|
|
1201
|
+
}, Pt = (e, t) => {
|
|
1202
|
+
const a = C("editorId"), n = C("setting"), { noImgZoomIn: o } = e, u = Be(() => {
|
|
1181
1203
|
const c = document.querySelectorAll(
|
|
1182
1204
|
`#${a}-preview img:not(.not-zoom):not(.medium-zoom-image)`
|
|
1183
1205
|
);
|
|
1184
|
-
c.length !== 0 &&
|
|
1206
|
+
c.length !== 0 && ot(c, {
|
|
1185
1207
|
background: "#00000073"
|
|
1186
1208
|
});
|
|
1187
1209
|
});
|
|
1188
1210
|
M(async () => {
|
|
1189
|
-
!o && n.value.preview && await
|
|
1190
|
-
}),
|
|
1191
|
-
!o && n.value.preview && await
|
|
1211
|
+
!o && n.value.preview && await u();
|
|
1212
|
+
}), k([t, () => n.value.preview], async () => {
|
|
1213
|
+
!o && n.value.preview && await u();
|
|
1192
1214
|
});
|
|
1193
1215
|
}, Ce = {
|
|
1194
1216
|
checked: {
|
|
@@ -1199,54 +1221,54 @@ const Y = new st({
|
|
|
1199
1221
|
regexp: /- \[\s\]/,
|
|
1200
1222
|
value: "- [x]"
|
|
1201
1223
|
}
|
|
1202
|
-
},
|
|
1224
|
+
}, Lt = (e, t) => {
|
|
1203
1225
|
const a = C("editorId"), n = C("rootRef");
|
|
1204
1226
|
let o = () => {
|
|
1205
1227
|
};
|
|
1206
|
-
const
|
|
1228
|
+
const u = () => {
|
|
1207
1229
|
if (!n.value)
|
|
1208
1230
|
return !1;
|
|
1209
|
-
const c = n.value.querySelectorAll(".task-list-item.enabled"),
|
|
1231
|
+
const c = n.value.querySelectorAll(".task-list-item.enabled"), d = (s) => {
|
|
1210
1232
|
s.preventDefault();
|
|
1211
1233
|
const l = s.target.checked ? "unChecked" : "checked", i = s.target.parentElement?.dataset.line;
|
|
1212
1234
|
if (!i)
|
|
1213
1235
|
return;
|
|
1214
|
-
const r = Number(i),
|
|
1215
|
-
`), f =
|
|
1236
|
+
const r = Number(i), m = e.modelValue.split(`
|
|
1237
|
+
`), f = m[Number(r)].replace(
|
|
1216
1238
|
Ce[l].regexp,
|
|
1217
1239
|
Ce[l].value
|
|
1218
1240
|
);
|
|
1219
|
-
e.previewOnly ? (
|
|
1220
|
-
`))) :
|
|
1241
|
+
e.previewOnly ? (m[Number(r)] = f, e.onChange(m.join(`
|
|
1242
|
+
`))) : b.emit(a, We, r + 1, f);
|
|
1221
1243
|
};
|
|
1222
1244
|
c.forEach((s) => {
|
|
1223
|
-
s.addEventListener("click",
|
|
1245
|
+
s.addEventListener("click", d);
|
|
1224
1246
|
}), o = () => {
|
|
1225
1247
|
c.forEach((s) => {
|
|
1226
|
-
s.removeEventListener("click",
|
|
1248
|
+
s.removeEventListener("click", d);
|
|
1227
1249
|
});
|
|
1228
1250
|
};
|
|
1229
1251
|
};
|
|
1230
1252
|
te(() => {
|
|
1231
1253
|
o();
|
|
1232
|
-
}),
|
|
1254
|
+
}), k(
|
|
1233
1255
|
[t],
|
|
1234
1256
|
() => {
|
|
1235
|
-
o(), W(
|
|
1257
|
+
o(), W(u);
|
|
1236
1258
|
},
|
|
1237
1259
|
{
|
|
1238
1260
|
immediate: !0
|
|
1239
1261
|
}
|
|
1240
1262
|
);
|
|
1241
|
-
},
|
|
1263
|
+
}, _t = (e, t, a) => {
|
|
1242
1264
|
const n = C("setting"), o = () => {
|
|
1243
1265
|
W(() => {
|
|
1244
1266
|
e.onRemount?.();
|
|
1245
1267
|
});
|
|
1246
|
-
},
|
|
1268
|
+
}, u = (c) => {
|
|
1247
1269
|
c && o();
|
|
1248
1270
|
};
|
|
1249
|
-
|
|
1271
|
+
k([t, a], o), k(() => n.value.preview, u), k(() => n.value.htmlPreview, u), M(o);
|
|
1250
1272
|
}, Se = {
|
|
1251
1273
|
modelValue: {
|
|
1252
1274
|
type: String,
|
|
@@ -1318,7 +1340,7 @@ const Y = new st({
|
|
|
1318
1340
|
type: [Object, Function],
|
|
1319
1341
|
default: void 0
|
|
1320
1342
|
}
|
|
1321
|
-
},
|
|
1343
|
+
}, sn = {
|
|
1322
1344
|
...Se,
|
|
1323
1345
|
updateModelValue: {
|
|
1324
1346
|
type: Function,
|
|
@@ -1390,7 +1412,7 @@ const Y = new st({
|
|
|
1390
1412
|
}, Ee = (e) => {
|
|
1391
1413
|
const a = new DOMParser().parseFromString(e, "text/html");
|
|
1392
1414
|
return Array.from(a.body.childNodes);
|
|
1393
|
-
},
|
|
1415
|
+
}, Ot = (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, Bt = /* @__PURE__ */ de({
|
|
1394
1416
|
name: "UpdateOnDemand",
|
|
1395
1417
|
props: {
|
|
1396
1418
|
id: {
|
|
@@ -1407,31 +1429,31 @@ const Y = new st({
|
|
|
1407
1429
|
}
|
|
1408
1430
|
},
|
|
1409
1431
|
setup(e) {
|
|
1410
|
-
const t = z(), a = e.html, n = (o,
|
|
1432
|
+
const t = z(), a = e.html, n = (o, u) => {
|
|
1411
1433
|
if (!t.value) return;
|
|
1412
|
-
const c = t.value,
|
|
1434
|
+
const c = t.value, d = Array.from(c.childNodes), s = Math.min(o.length, u.length);
|
|
1413
1435
|
let l = -1;
|
|
1414
1436
|
for (let r = 0; r < s; r++)
|
|
1415
|
-
if (!
|
|
1437
|
+
if (!Ot(o[r], u[r])) {
|
|
1416
1438
|
l = r;
|
|
1417
1439
|
break;
|
|
1418
1440
|
}
|
|
1419
1441
|
if (l === -1)
|
|
1420
|
-
if (
|
|
1442
|
+
if (u.length > o.length)
|
|
1421
1443
|
l = o.length;
|
|
1422
|
-
else if (o.length >
|
|
1423
|
-
l =
|
|
1444
|
+
else if (o.length > u.length)
|
|
1445
|
+
l = u.length;
|
|
1424
1446
|
else
|
|
1425
1447
|
return;
|
|
1426
|
-
const i = Math.min(l,
|
|
1427
|
-
for (let r =
|
|
1428
|
-
|
|
1448
|
+
const i = Math.min(l, d.length);
|
|
1449
|
+
for (let r = d.length - 1; r >= i; r--)
|
|
1450
|
+
d[r].remove();
|
|
1429
1451
|
for (let r = l; r < o.length; r++)
|
|
1430
1452
|
c.appendChild(o[r].cloneNode(!0));
|
|
1431
1453
|
};
|
|
1432
|
-
return
|
|
1433
|
-
const c = Ee(o),
|
|
1434
|
-
n(c,
|
|
1454
|
+
return k(() => e.html, (o, u) => {
|
|
1455
|
+
const c = Ee(o), d = Ee(u || "");
|
|
1456
|
+
n(c, d);
|
|
1435
1457
|
}), () => N("div", {
|
|
1436
1458
|
id: e.id,
|
|
1437
1459
|
class: e.class,
|
|
@@ -1439,27 +1461,27 @@ const Y = new st({
|
|
|
1439
1461
|
ref: t
|
|
1440
1462
|
}, null);
|
|
1441
1463
|
}
|
|
1442
|
-
}),
|
|
1464
|
+
}), jt = /* @__PURE__ */ de({
|
|
1443
1465
|
name: "ContentPreview",
|
|
1444
1466
|
props: Se,
|
|
1445
1467
|
setup(e) {
|
|
1446
1468
|
const t = C("editorId"), a = C("setting"), n = C("previewTheme"), o = C("showCodeRowNumber"), {
|
|
1447
|
-
html:
|
|
1469
|
+
html: u,
|
|
1448
1470
|
key: c
|
|
1449
|
-
} =
|
|
1450
|
-
|
|
1451
|
-
const
|
|
1471
|
+
} = Mt(e, e.previewOnly);
|
|
1472
|
+
rt(e, u, c), Pt(e, u), Lt(e, u), _t(e, u, c);
|
|
1473
|
+
const d = F(() => [`${h}-preview`, `${n?.value}-theme`, o && `${h}-scrn`].filter(Boolean)), s = () => {
|
|
1452
1474
|
const l = `${t}-preview`;
|
|
1453
1475
|
return e.previewComponent ? Le(e.previewComponent, {
|
|
1454
1476
|
key: c.value,
|
|
1455
|
-
html:
|
|
1477
|
+
html: u.value,
|
|
1456
1478
|
id: l,
|
|
1457
|
-
class:
|
|
1458
|
-
}) : N(
|
|
1479
|
+
class: d.value
|
|
1480
|
+
}) : N(Bt, {
|
|
1459
1481
|
key: c.value,
|
|
1460
|
-
html:
|
|
1482
|
+
html: u.value,
|
|
1461
1483
|
id: l,
|
|
1462
|
-
class:
|
|
1484
|
+
class: d.value
|
|
1463
1485
|
}, null);
|
|
1464
1486
|
};
|
|
1465
1487
|
return () => N(Pe, null, [a.value.preview && (e.previewOnly ? s() : N("div", {
|
|
@@ -1472,9 +1494,9 @@ const Y = new st({
|
|
|
1472
1494
|
key: "html-preview-wrapper"
|
|
1473
1495
|
}, [N("div", {
|
|
1474
1496
|
class: `${h}-html`
|
|
1475
|
-
}, [
|
|
1497
|
+
}, [u.value])])]);
|
|
1476
1498
|
}
|
|
1477
|
-
}),
|
|
1499
|
+
}), Nt = ({ text: e }) => e, Ie = {
|
|
1478
1500
|
/**
|
|
1479
1501
|
* markdown content.
|
|
1480
1502
|
*
|
|
@@ -1583,7 +1605,7 @@ const Y = new st({
|
|
|
1583
1605
|
*/
|
|
1584
1606
|
mdHeadingId: {
|
|
1585
1607
|
type: Function,
|
|
1586
|
-
default:
|
|
1608
|
+
default: Nt
|
|
1587
1609
|
},
|
|
1588
1610
|
/**
|
|
1589
1611
|
*
|
|
@@ -1712,7 +1734,7 @@ const Y = new st({
|
|
|
1712
1734
|
type: [Object, Function],
|
|
1713
1735
|
default: void 0
|
|
1714
1736
|
}
|
|
1715
|
-
},
|
|
1737
|
+
}, cn = {
|
|
1716
1738
|
...Ie,
|
|
1717
1739
|
/**
|
|
1718
1740
|
* input回调事件
|
|
@@ -2024,7 +2046,7 @@ const Y = new st({
|
|
|
2024
2046
|
"onChange",
|
|
2025
2047
|
"onRemount",
|
|
2026
2048
|
"update:modelValue"
|
|
2027
|
-
],
|
|
2049
|
+
], dn = [
|
|
2028
2050
|
...Ae,
|
|
2029
2051
|
"onSave",
|
|
2030
2052
|
"onUploadImg",
|
|
@@ -2034,10 +2056,10 @@ const Y = new st({
|
|
|
2034
2056
|
"onInput",
|
|
2035
2057
|
"onDrop",
|
|
2036
2058
|
"oninputBoxWidthChange"
|
|
2037
|
-
],
|
|
2059
|
+
], Dt = (e, t, a) => {
|
|
2038
2060
|
const { editorId: n } = a, o = {
|
|
2039
2061
|
rerender() {
|
|
2040
|
-
|
|
2062
|
+
b.emit(n, ue);
|
|
2041
2063
|
}
|
|
2042
2064
|
};
|
|
2043
2065
|
t.expose(o);
|
|
@@ -2050,16 +2072,16 @@ const Y = new st({
|
|
|
2050
2072
|
noKatex: a,
|
|
2051
2073
|
noMermaid: n,
|
|
2052
2074
|
noHighlight: o
|
|
2053
|
-
} = e,
|
|
2075
|
+
} = e, u = z(), c = at(e);
|
|
2054
2076
|
Te(e, {
|
|
2055
|
-
rootRef:
|
|
2077
|
+
rootRef: u,
|
|
2056
2078
|
editorId: c
|
|
2057
|
-
}),
|
|
2079
|
+
}), Dt(e, t, {
|
|
2058
2080
|
editorId: c
|
|
2059
2081
|
}), te(() => {
|
|
2060
|
-
|
|
2082
|
+
b.clear(c);
|
|
2061
2083
|
});
|
|
2062
|
-
const
|
|
2084
|
+
const d = (r) => {
|
|
2063
2085
|
e.onChange?.(r), t.emit("onChange", r), t.emit("update:modelValue", r);
|
|
2064
2086
|
}, s = (r) => {
|
|
2065
2087
|
e.onHtmlChanged?.(r), t.emit("onHtmlChanged", r);
|
|
@@ -2072,10 +2094,10 @@ const Y = new st({
|
|
|
2072
2094
|
id: c,
|
|
2073
2095
|
class: [h, e.class, e.theme === "dark" && `${h}-dark`, `${h}-previewOnly`],
|
|
2074
2096
|
style: e.style,
|
|
2075
|
-
ref:
|
|
2076
|
-
}, [N(
|
|
2097
|
+
ref: u
|
|
2098
|
+
}, [N(jt, {
|
|
2077
2099
|
modelValue: e.modelValue,
|
|
2078
|
-
onChange:
|
|
2100
|
+
onChange: d,
|
|
2079
2101
|
onHtmlChanged: s,
|
|
2080
2102
|
onGetCatalog: l,
|
|
2081
2103
|
mdHeadingId: e.mdHeadingId,
|
|
@@ -2099,16 +2121,17 @@ re.install = (e) => (e.component(re.name, re), e);
|
|
|
2099
2121
|
export {
|
|
2100
2122
|
P as C,
|
|
2101
2123
|
re as M,
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2124
|
+
jt as a,
|
|
2125
|
+
dn as b,
|
|
2126
|
+
sn as c,
|
|
2127
|
+
cn as d,
|
|
2128
|
+
se as e,
|
|
2107
2129
|
an as f,
|
|
2108
|
-
|
|
2109
|
-
|
|
2130
|
+
rn as g,
|
|
2131
|
+
en as h,
|
|
2110
2132
|
nn as i,
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2133
|
+
on as j,
|
|
2134
|
+
ln as k,
|
|
2135
|
+
tn as l,
|
|
2136
|
+
at as u
|
|
2114
2137
|
};
|