md-editor-v3 6.4.2 → 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 +27 -27
- package/lib/es/chunks/config.mjs +2 -1
- package/lib/es/chunks/index3.mjs +380 -377
- package/lib/types/index.d.ts +76 -66
- package/package.json +1 -1
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";
|
|
@@ -36,28 +36,28 @@ const M = {
|
|
|
36
36
|
o.buildFinished = !1;
|
|
37
37
|
}
|
|
38
38
|
), H(() => {
|
|
39
|
-
|
|
39
|
+
v.on(n, {
|
|
40
40
|
name: X,
|
|
41
|
-
callback(
|
|
42
|
-
o.buildFinished = !0, o.html =
|
|
41
|
+
callback(m) {
|
|
42
|
+
o.buildFinished = !0, o.html = m;
|
|
43
43
|
}
|
|
44
|
-
}),
|
|
44
|
+
}), v.on(n, {
|
|
45
45
|
name: ke,
|
|
46
46
|
callback() {
|
|
47
|
-
const
|
|
47
|
+
const m = new Promise((d) => {
|
|
48
48
|
if (o.buildFinished)
|
|
49
|
-
|
|
49
|
+
d(o.html);
|
|
50
50
|
else {
|
|
51
|
-
const
|
|
52
|
-
|
|
51
|
+
const u = (s) => {
|
|
52
|
+
d(s), v.remove(n, X, u);
|
|
53
53
|
};
|
|
54
|
-
|
|
54
|
+
v.on(n, {
|
|
55
55
|
name: X,
|
|
56
|
-
callback:
|
|
56
|
+
callback: u
|
|
57
57
|
});
|
|
58
58
|
}
|
|
59
59
|
});
|
|
60
|
-
e.onSave ? e.onSave(e.modelValue,
|
|
60
|
+
e.onSave ? e.onSave(e.modelValue, m) : t.emit("onSave", e.modelValue, m);
|
|
61
61
|
}
|
|
62
62
|
});
|
|
63
63
|
});
|
|
@@ -66,49 +66,49 @@ const M = {
|
|
|
66
66
|
rootRef: r,
|
|
67
67
|
setting: n
|
|
68
68
|
}) => {
|
|
69
|
-
const o = P.editorExtensions.highlight,
|
|
70
|
-
|
|
69
|
+
const o = P.editorExtensions.highlight, m = P.editorExtensionsAttrs.highlight;
|
|
70
|
+
I("editorId", t), I("rootRef", r), I(
|
|
71
71
|
"theme",
|
|
72
72
|
A(() => e.theme)
|
|
73
|
-
),
|
|
73
|
+
), I(
|
|
74
74
|
"language",
|
|
75
75
|
A(() => e.language)
|
|
76
|
-
),
|
|
76
|
+
), I(
|
|
77
77
|
"highlight",
|
|
78
78
|
A(() => {
|
|
79
|
-
const { js:
|
|
79
|
+
const { js: u } = o, s = {
|
|
80
80
|
...ue,
|
|
81
81
|
...o.css
|
|
82
|
-
}, { 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] : {};
|
|
83
83
|
return {
|
|
84
84
|
js: {
|
|
85
|
-
src:
|
|
85
|
+
src: u,
|
|
86
86
|
...l
|
|
87
87
|
},
|
|
88
88
|
css: {
|
|
89
|
-
href:
|
|
89
|
+
href: c,
|
|
90
90
|
...$
|
|
91
91
|
}
|
|
92
92
|
};
|
|
93
93
|
})
|
|
94
|
-
),
|
|
95
|
-
const
|
|
96
|
-
const
|
|
94
|
+
), I("showCodeRowNumber", e.showCodeRowNumber);
|
|
95
|
+
const d = A(() => {
|
|
96
|
+
const u = {
|
|
97
97
|
...me,
|
|
98
98
|
...P.editorConfig.languageUserDefined
|
|
99
99
|
};
|
|
100
100
|
return Me(
|
|
101
101
|
Pe(me["en-US"]),
|
|
102
|
-
|
|
102
|
+
u[e.language] || {}
|
|
103
103
|
);
|
|
104
104
|
});
|
|
105
|
-
return
|
|
105
|
+
return I("usedLanguageText", d), I(
|
|
106
106
|
"previewTheme",
|
|
107
107
|
A(() => e.previewTheme)
|
|
108
|
-
),
|
|
108
|
+
), I(
|
|
109
109
|
"customIcon",
|
|
110
110
|
A(() => e.customIcon)
|
|
111
|
-
),
|
|
111
|
+
), I(
|
|
112
112
|
"setting",
|
|
113
113
|
A(() => n ? {
|
|
114
114
|
// setting是reactive,不转化是可以直接赋值的
|
|
@@ -121,28 +121,28 @@ const M = {
|
|
|
121
121
|
fullscreen: !1
|
|
122
122
|
})
|
|
123
123
|
), { editorId: t };
|
|
124
|
-
}, Jt = (e, t) => (
|
|
124
|
+
}, Jt = (e, t) => (I("tabWidth", e.tabWidth), I(
|
|
125
125
|
"disabled",
|
|
126
126
|
A(() => e.disabled)
|
|
127
|
-
),
|
|
127
|
+
), I(
|
|
128
128
|
"showToolbarName",
|
|
129
129
|
A(() => e.showToolbarName)
|
|
130
|
-
),
|
|
130
|
+
), I("noUploadImg", e.noUploadImg), I(
|
|
131
131
|
"tableShape",
|
|
132
132
|
A(() => e.tableShape)
|
|
133
|
-
),
|
|
133
|
+
), I("noPrettier", e.noPrettier), I(
|
|
134
134
|
"codeTheme",
|
|
135
135
|
A(() => e.codeTheme)
|
|
136
|
-
),
|
|
136
|
+
), I("updateSetting", t.updateSetting), I(
|
|
137
137
|
"catalogVisible",
|
|
138
138
|
A(() => t.catalogVisible.value)
|
|
139
|
-
),
|
|
139
|
+
), I("defToolbars", t.defToolbars), I(
|
|
140
140
|
"floatingToolbars",
|
|
141
141
|
A(() => e.floatingToolbars)
|
|
142
142
|
), Te(e, t)), Xt = (e) => {
|
|
143
|
-
const { noPrettier: t, noUploadImg: r } = e, { editorExtensions: n, editorExtensionsAttrs: o } = P,
|
|
143
|
+
const { noPrettier: t, noUploadImg: r } = e, { editorExtensions: n, editorExtensionsAttrs: o } = P, m = t || n.prettier.prettierInstance, d = t || n.prettier.parserMarkdownInstance, u = r || n.cropper.instance;
|
|
144
144
|
H(() => {
|
|
145
|
-
if (!
|
|
145
|
+
if (!u) {
|
|
146
146
|
const { js: s = {}, css: l = {} } = o.cropper || {};
|
|
147
147
|
O("link", {
|
|
148
148
|
...l,
|
|
@@ -155,7 +155,7 @@ const M = {
|
|
|
155
155
|
id: M.cropperjs
|
|
156
156
|
});
|
|
157
157
|
}
|
|
158
|
-
if (!
|
|
158
|
+
if (!m) {
|
|
159
159
|
const { standaloneJs: s = {} } = o.prettier || {};
|
|
160
160
|
O("script", {
|
|
161
161
|
...s,
|
|
@@ -163,7 +163,7 @@ const M = {
|
|
|
163
163
|
id: M.prettier
|
|
164
164
|
});
|
|
165
165
|
}
|
|
166
|
-
if (!
|
|
166
|
+
if (!d) {
|
|
167
167
|
const { parserMarkdownJs: s = {} } = o.prettier || {};
|
|
168
168
|
O("script", {
|
|
169
169
|
...s,
|
|
@@ -175,7 +175,7 @@ const M = {
|
|
|
175
175
|
}, Yt = (e, t, r) => {
|
|
176
176
|
const { editorId: n } = r;
|
|
177
177
|
H(() => {
|
|
178
|
-
|
|
178
|
+
v.on(n, {
|
|
179
179
|
name: Q,
|
|
180
180
|
callback: (o) => {
|
|
181
181
|
e.onError?.(o), t.emit("onError", o);
|
|
@@ -189,7 +189,7 @@ const M = {
|
|
|
189
189
|
preview: e.preview,
|
|
190
190
|
htmlPreview: e.preview ? !1 : e.htmlPreview,
|
|
191
191
|
previewOnly: !1
|
|
192
|
-
}),
|
|
192
|
+
}), m = re({ ...o }), d = (l, i) => {
|
|
193
193
|
const a = i === void 0 ? !o[l] : i;
|
|
194
194
|
switch (l) {
|
|
195
195
|
case "preview": {
|
|
@@ -201,34 +201,34 @@ const M = {
|
|
|
201
201
|
break;
|
|
202
202
|
}
|
|
203
203
|
case "previewOnly": {
|
|
204
|
-
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));
|
|
205
205
|
break;
|
|
206
206
|
}
|
|
207
207
|
}
|
|
208
|
-
|
|
208
|
+
m[l] = a, o[l] = a;
|
|
209
209
|
};
|
|
210
|
-
let
|
|
210
|
+
let u = "";
|
|
211
211
|
const s = () => {
|
|
212
|
-
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;
|
|
213
213
|
};
|
|
214
214
|
return E(() => [o.pageFullscreen, o.fullscreen], s), H(() => {
|
|
215
|
-
|
|
215
|
+
v.on(n, {
|
|
216
216
|
name: Be,
|
|
217
217
|
callback(l, i) {
|
|
218
|
-
const a = (
|
|
219
|
-
|
|
218
|
+
const a = (c) => {
|
|
219
|
+
v.emit(n, ie, "image", {
|
|
220
220
|
desc: "",
|
|
221
|
-
urls:
|
|
221
|
+
urls: c
|
|
222
222
|
}), i?.();
|
|
223
223
|
};
|
|
224
224
|
e.onUploadImg ? e.onUploadImg(l, a) : t.emit("onUploadImg", l, a);
|
|
225
225
|
}
|
|
226
|
-
}),
|
|
227
|
-
}), [o,
|
|
226
|
+
}), u = document.body.style.overflow, s();
|
|
227
|
+
}), [o, d];
|
|
228
228
|
}, en = (e, t) => {
|
|
229
229
|
const { editorId: r } = t, n = G(!1);
|
|
230
230
|
return H(() => {
|
|
231
|
-
|
|
231
|
+
v.on(r, {
|
|
232
232
|
name: Ee,
|
|
233
233
|
callback: (o) => {
|
|
234
234
|
o === void 0 ? n.value = !n.value : n.value = o;
|
|
@@ -236,40 +236,40 @@ const M = {
|
|
|
236
236
|
});
|
|
237
237
|
}), n;
|
|
238
238
|
}, tn = (e, t, r) => {
|
|
239
|
-
const { editorId: n, catalogVisible: o, setting:
|
|
239
|
+
const { editorId: n, catalogVisible: o, setting: m, updateSetting: d, codeRef: u } = r;
|
|
240
240
|
E(
|
|
241
|
-
() =>
|
|
241
|
+
() => m.pageFullscreen,
|
|
242
242
|
(l) => {
|
|
243
|
-
|
|
243
|
+
v.emit(n, fe, l);
|
|
244
244
|
}
|
|
245
245
|
), E(
|
|
246
|
-
() =>
|
|
246
|
+
() => m.fullscreen,
|
|
247
247
|
(l) => {
|
|
248
|
-
|
|
248
|
+
v.emit(n, he, l);
|
|
249
249
|
}
|
|
250
250
|
), E(
|
|
251
|
-
() =>
|
|
251
|
+
() => m.preview,
|
|
252
252
|
(l) => {
|
|
253
|
-
|
|
253
|
+
v.emit(n, pe, l);
|
|
254
254
|
}
|
|
255
255
|
), E(
|
|
256
|
-
() =>
|
|
256
|
+
() => m.previewOnly,
|
|
257
257
|
(l) => {
|
|
258
|
-
|
|
258
|
+
v.emit(n, ge, l);
|
|
259
259
|
}
|
|
260
260
|
), E(
|
|
261
|
-
() =>
|
|
261
|
+
() => m.htmlPreview,
|
|
262
262
|
(l) => {
|
|
263
|
-
|
|
263
|
+
v.emit(n, ve, l);
|
|
264
264
|
}
|
|
265
265
|
), E(o, (l) => {
|
|
266
|
-
|
|
266
|
+
v.emit(n, ye, l);
|
|
267
267
|
});
|
|
268
268
|
const s = {
|
|
269
269
|
on(l, i) {
|
|
270
270
|
switch (l) {
|
|
271
271
|
case "pageFullscreen": {
|
|
272
|
-
|
|
272
|
+
v.on(n, {
|
|
273
273
|
name: fe,
|
|
274
274
|
callback(a) {
|
|
275
275
|
i(a);
|
|
@@ -278,7 +278,7 @@ const M = {
|
|
|
278
278
|
break;
|
|
279
279
|
}
|
|
280
280
|
case "fullscreen": {
|
|
281
|
-
|
|
281
|
+
v.on(n, {
|
|
282
282
|
name: he,
|
|
283
283
|
callback(a) {
|
|
284
284
|
i(a);
|
|
@@ -287,7 +287,7 @@ const M = {
|
|
|
287
287
|
break;
|
|
288
288
|
}
|
|
289
289
|
case "preview": {
|
|
290
|
-
|
|
290
|
+
v.on(n, {
|
|
291
291
|
name: pe,
|
|
292
292
|
callback(a) {
|
|
293
293
|
i(a);
|
|
@@ -296,7 +296,7 @@ const M = {
|
|
|
296
296
|
break;
|
|
297
297
|
}
|
|
298
298
|
case "previewOnly": {
|
|
299
|
-
|
|
299
|
+
v.on(n, {
|
|
300
300
|
name: ge,
|
|
301
301
|
callback(a) {
|
|
302
302
|
i(a);
|
|
@@ -305,7 +305,7 @@ const M = {
|
|
|
305
305
|
break;
|
|
306
306
|
}
|
|
307
307
|
case "htmlPreview": {
|
|
308
|
-
|
|
308
|
+
v.on(n, {
|
|
309
309
|
name: ve,
|
|
310
310
|
callback(a) {
|
|
311
311
|
i(a);
|
|
@@ -314,7 +314,7 @@ const M = {
|
|
|
314
314
|
break;
|
|
315
315
|
}
|
|
316
316
|
case "catalog": {
|
|
317
|
-
|
|
317
|
+
v.on(n, {
|
|
318
318
|
name: ye,
|
|
319
319
|
callback(a) {
|
|
320
320
|
i(a);
|
|
@@ -325,49 +325,49 @@ const M = {
|
|
|
325
325
|
}
|
|
326
326
|
},
|
|
327
327
|
togglePageFullscreen(l) {
|
|
328
|
-
|
|
328
|
+
d("pageFullscreen", l);
|
|
329
329
|
},
|
|
330
330
|
toggleFullscreen(l) {
|
|
331
|
-
|
|
331
|
+
v.emit(n, Ne, l);
|
|
332
332
|
},
|
|
333
333
|
togglePreview(l) {
|
|
334
|
-
|
|
334
|
+
d("preview", l);
|
|
335
335
|
},
|
|
336
336
|
togglePreviewOnly(l) {
|
|
337
|
-
|
|
337
|
+
d("previewOnly", l);
|
|
338
338
|
},
|
|
339
339
|
toggleHtmlPreview(l) {
|
|
340
|
-
|
|
340
|
+
d("htmlPreview", l);
|
|
341
341
|
},
|
|
342
342
|
toggleCatalog(l) {
|
|
343
|
-
|
|
343
|
+
v.emit(n, Ee, l);
|
|
344
344
|
},
|
|
345
345
|
triggerSave() {
|
|
346
|
-
|
|
346
|
+
v.emit(n, ke);
|
|
347
347
|
},
|
|
348
348
|
insert(l) {
|
|
349
|
-
|
|
349
|
+
v.emit(n, ie, "universal", { generate: l });
|
|
350
350
|
},
|
|
351
351
|
focus(l) {
|
|
352
|
-
|
|
352
|
+
u.value?.focus(l);
|
|
353
353
|
},
|
|
354
354
|
rerender() {
|
|
355
|
-
|
|
355
|
+
v.emit(n, de);
|
|
356
356
|
},
|
|
357
357
|
getSelectedText() {
|
|
358
|
-
return
|
|
358
|
+
return u.value?.getSelectedText();
|
|
359
359
|
},
|
|
360
360
|
resetHistory() {
|
|
361
|
-
|
|
361
|
+
u.value?.resetHistory();
|
|
362
362
|
},
|
|
363
363
|
domEventHandlers(l) {
|
|
364
|
-
|
|
364
|
+
v.emit(n, je, l);
|
|
365
365
|
},
|
|
366
366
|
execCommand(l) {
|
|
367
|
-
|
|
367
|
+
v.emit(n, ie, l);
|
|
368
368
|
},
|
|
369
369
|
getEditorView() {
|
|
370
|
-
return
|
|
370
|
+
return u.value?.getEditorView();
|
|
371
371
|
}
|
|
372
372
|
};
|
|
373
373
|
t.expose(s);
|
|
@@ -375,107 +375,110 @@ const M = {
|
|
|
375
375
|
const t = Fe();
|
|
376
376
|
return e.id || e.editorId || `${f}-${t}`;
|
|
377
377
|
}, tt = (e, t, r) => {
|
|
378
|
-
const n =
|
|
378
|
+
const n = C("editorId"), o = C("rootRef"), m = C("usedLanguageText"), d = C("setting"), u = () => {
|
|
379
379
|
o.value.querySelectorAll(`#${n} .${f}-preview .${f}-code`).forEach((i) => {
|
|
380
380
|
let a = -1;
|
|
381
|
-
const
|
|
381
|
+
const c = i.querySelector(
|
|
382
382
|
`.${f}-copy-button:not([data-processed])`
|
|
383
383
|
);
|
|
384
|
-
|
|
384
|
+
c && (c.onclick = ($) => {
|
|
385
385
|
$.preventDefault(), clearTimeout(a);
|
|
386
|
-
const
|
|
387
|
-
let
|
|
388
|
-
qe(e.formatCopiedText(
|
|
389
|
-
|
|
386
|
+
const g = (i.querySelector("input:checked + pre code") || i.querySelector("pre code")).textContent, { text: h, successTips: T, failTips: y } = m.value.copyCode;
|
|
387
|
+
let b = T;
|
|
388
|
+
qe(e.formatCopiedText(g || "")).catch(() => {
|
|
389
|
+
b = y;
|
|
390
390
|
}).finally(() => {
|
|
391
|
-
|
|
392
|
-
|
|
391
|
+
c.dataset.isIcon ? c.dataset.tips = b : c.innerHTML = b, a = window.setTimeout(() => {
|
|
392
|
+
c.dataset.isIcon ? c.dataset.tips = h : c.innerHTML = h;
|
|
393
393
|
}, 1500);
|
|
394
394
|
});
|
|
395
|
-
},
|
|
395
|
+
}, c.setAttribute("data-processed", "true"));
|
|
396
396
|
});
|
|
397
397
|
}, s = () => {
|
|
398
|
-
U(
|
|
398
|
+
U(u);
|
|
399
399
|
}, l = (i) => {
|
|
400
|
-
i && U(
|
|
400
|
+
i && U(u);
|
|
401
401
|
};
|
|
402
|
-
E([t, r], s), E(() =>
|
|
402
|
+
E([t, r], s), E(() => d.value.preview, l), E(() => d.value.htmlPreview, l), H(u);
|
|
403
403
|
}, nt = (e) => {
|
|
404
|
-
const t =
|
|
405
|
-
let
|
|
406
|
-
const
|
|
407
|
-
!e.noEcharts &&
|
|
404
|
+
const t = C("editorId"), r = C("theme"), n = C("rootRef"), { editorExtensions: o, editorExtensionsAttrs: m, echartsConfig: d } = P;
|
|
405
|
+
let u = o.echarts.instance;
|
|
406
|
+
const s = ee(-1), l = () => {
|
|
407
|
+
!e.noEcharts && u && (s.value = s.value + 1);
|
|
408
408
|
};
|
|
409
409
|
E(
|
|
410
410
|
() => r.value,
|
|
411
411
|
() => {
|
|
412
|
-
|
|
412
|
+
l();
|
|
413
413
|
}
|
|
414
414
|
), H(() => {
|
|
415
|
-
if (e.noEcharts ||
|
|
415
|
+
if (e.noEcharts || u)
|
|
416
416
|
return;
|
|
417
|
-
const
|
|
417
|
+
const g = o.echarts.js;
|
|
418
418
|
O(
|
|
419
419
|
"script",
|
|
420
420
|
{
|
|
421
|
-
...
|
|
422
|
-
src:
|
|
421
|
+
...m.echarts?.js,
|
|
422
|
+
src: g,
|
|
423
423
|
id: M.echarts,
|
|
424
424
|
onload() {
|
|
425
|
-
|
|
425
|
+
u = window.echarts, l();
|
|
426
426
|
}
|
|
427
427
|
},
|
|
428
428
|
"echarts"
|
|
429
429
|
);
|
|
430
430
|
});
|
|
431
|
-
let
|
|
432
|
-
const
|
|
433
|
-
if (!
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
}),
|
|
437
|
-
|
|
438
|
-
}),
|
|
431
|
+
let i = [], a = [], c = [];
|
|
432
|
+
const $ = (g = !1) => {
|
|
433
|
+
if (!i.length) {
|
|
434
|
+
g && (a.forEach((b) => {
|
|
435
|
+
b.dispose?.();
|
|
436
|
+
}), c.forEach((b) => {
|
|
437
|
+
b.disconnect?.();
|
|
438
|
+
}), a = [], c = []);
|
|
439
439
|
return;
|
|
440
440
|
}
|
|
441
|
-
const
|
|
442
|
-
|
|
443
|
-
const
|
|
444
|
-
if (
|
|
445
|
-
|
|
441
|
+
const h = [], T = [], y = [];
|
|
442
|
+
i.forEach((b, S) => {
|
|
443
|
+
const w = a[S], F = c[S];
|
|
444
|
+
if (g || !b || !b.isConnected || (n?.value ? !n.value.contains(b) : !1)) {
|
|
445
|
+
w?.dispose?.(), F?.disconnect?.();
|
|
446
446
|
return;
|
|
447
447
|
}
|
|
448
|
-
|
|
449
|
-
}),
|
|
450
|
-
},
|
|
451
|
-
|
|
448
|
+
h.push(b), w && T.push(w), F && y.push(F);
|
|
449
|
+
}), i = h, a = T, c = y;
|
|
450
|
+
}, p = () => {
|
|
451
|
+
$(), !e.noEcharts && u && Array.from(
|
|
452
452
|
n.value.querySelectorAll(
|
|
453
453
|
`#${t} div.${f}-echarts:not([data-processed])`
|
|
454
454
|
)
|
|
455
|
-
).forEach((
|
|
456
|
-
if (
|
|
455
|
+
).forEach((h) => {
|
|
456
|
+
if (h.dataset.closed === "false")
|
|
457
457
|
return !1;
|
|
458
458
|
try {
|
|
459
|
-
const
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
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();
|
|
463
466
|
});
|
|
464
|
-
|
|
465
|
-
} catch (
|
|
466
|
-
|
|
467
|
+
S.observe(h), c.push(S);
|
|
468
|
+
} catch (T) {
|
|
469
|
+
v.emit(t, Q, {
|
|
467
470
|
name: "echarts",
|
|
468
|
-
message:
|
|
469
|
-
error:
|
|
471
|
+
message: T?.message,
|
|
472
|
+
error: T
|
|
470
473
|
});
|
|
471
474
|
}
|
|
472
475
|
});
|
|
473
476
|
};
|
|
474
477
|
return te(() => {
|
|
475
|
-
|
|
476
|
-
}), { reRenderEcharts:
|
|
478
|
+
$(!0);
|
|
479
|
+
}), { reRenderEcharts: s, replaceEcharts: p };
|
|
477
480
|
}, ot = (e) => {
|
|
478
|
-
const t =
|
|
481
|
+
const t = C("highlight"), r = ee(P.editorExtensions.highlight.instance);
|
|
479
482
|
return H(() => {
|
|
480
483
|
e.noHighlight || r.value || (O("link", {
|
|
481
484
|
...t.value.css,
|
|
@@ -570,10 +573,10 @@ const Y = new rt({
|
|
|
570
573
|
// 缓存10分钟
|
|
571
574
|
ttl: 6e5
|
|
572
575
|
}), lt = (e) => {
|
|
573
|
-
const t =
|
|
574
|
-
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;
|
|
575
578
|
const s = ee(-1), l = () => {
|
|
576
|
-
if (!e.noMermaid &&
|
|
579
|
+
if (!e.noMermaid && u) {
|
|
577
580
|
const a = r.value === "dark" ? {
|
|
578
581
|
startOnLoad: !1,
|
|
579
582
|
theme: "dark"
|
|
@@ -593,7 +596,7 @@ const Y = new rt({
|
|
|
593
596
|
clusterBorder: "#b7c0cc"
|
|
594
597
|
}
|
|
595
598
|
};
|
|
596
|
-
|
|
599
|
+
u.initialize(d(a)), s.value = s.value + 1;
|
|
597
600
|
}
|
|
598
601
|
};
|
|
599
602
|
return E(
|
|
@@ -602,11 +605,11 @@ const Y = new rt({
|
|
|
602
605
|
Y.clear(), l();
|
|
603
606
|
}
|
|
604
607
|
), H(() => {
|
|
605
|
-
if (e.noMermaid ||
|
|
608
|
+
if (e.noMermaid || u)
|
|
606
609
|
return;
|
|
607
610
|
const a = o.mermaid.js;
|
|
608
611
|
/\.mjs/.test(a) ? (O("link", {
|
|
609
|
-
...
|
|
612
|
+
...m.mermaid?.js,
|
|
610
613
|
rel: "modulepreload",
|
|
611
614
|
href: a,
|
|
612
615
|
id: M.mermaidM
|
|
@@ -614,100 +617,100 @@ const Y = new rt({
|
|
|
614
617
|
/* @vite-ignore */
|
|
615
618
|
/* webpackIgnore: true */
|
|
616
619
|
a
|
|
617
|
-
).then((
|
|
618
|
-
|
|
619
|
-
}).catch((
|
|
620
|
-
|
|
620
|
+
).then((c) => {
|
|
621
|
+
u = c.default, l();
|
|
622
|
+
}).catch((c) => {
|
|
623
|
+
v.emit(t, Q, {
|
|
621
624
|
name: "mermaid",
|
|
622
|
-
message: `Failed to load mermaid module: ${
|
|
623
|
-
error:
|
|
625
|
+
message: `Failed to load mermaid module: ${c.message}`,
|
|
626
|
+
error: c
|
|
624
627
|
});
|
|
625
628
|
})) : O(
|
|
626
629
|
"script",
|
|
627
630
|
{
|
|
628
|
-
...
|
|
631
|
+
...m.mermaid?.js,
|
|
629
632
|
src: a,
|
|
630
633
|
id: M.mermaid,
|
|
631
634
|
onload() {
|
|
632
|
-
|
|
635
|
+
u = window.mermaid, l();
|
|
633
636
|
}
|
|
634
637
|
},
|
|
635
638
|
"mermaid"
|
|
636
639
|
);
|
|
637
640
|
}), { reRenderRef: s, replaceMermaid: async () => {
|
|
638
|
-
if (!e.noMermaid &&
|
|
641
|
+
if (!e.noMermaid && u) {
|
|
639
642
|
const a = n.value.querySelectorAll(
|
|
640
643
|
`div.${f}-mermaid`
|
|
641
|
-
),
|
|
642
|
-
|
|
643
|
-
let
|
|
644
|
-
|
|
645
|
-
Array.from(a).map((
|
|
646
|
-
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")
|
|
647
650
|
return !1;
|
|
648
|
-
const
|
|
649
|
-
let S = Y.get(
|
|
651
|
+
const b = y.innerText;
|
|
652
|
+
let S = Y.get(b);
|
|
650
653
|
if (!S) {
|
|
651
|
-
const
|
|
654
|
+
const w = le();
|
|
652
655
|
let F = { svg: "" };
|
|
653
656
|
try {
|
|
654
|
-
F = await
|
|
655
|
-
const
|
|
656
|
-
|
|
657
|
-
} catch (
|
|
658
|
-
|
|
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, {
|
|
659
662
|
name: "mermaid",
|
|
660
|
-
message:
|
|
661
|
-
error:
|
|
663
|
+
message: x.message,
|
|
664
|
+
error: x
|
|
662
665
|
});
|
|
663
666
|
}
|
|
664
|
-
--
|
|
667
|
+
--g === 0 && c.remove();
|
|
665
668
|
}
|
|
666
|
-
})(
|
|
669
|
+
})(h))
|
|
667
670
|
);
|
|
668
671
|
}
|
|
669
672
|
} };
|
|
670
673
|
}, it = (e, t) => {
|
|
671
674
|
t = t || {};
|
|
672
|
-
const r = 3, n = t.marker || "!", o = n.charCodeAt(0),
|
|
673
|
-
let
|
|
674
|
-
const s = (i, a,
|
|
675
|
-
const
|
|
676
|
-
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([
|
|
677
680
|
"class",
|
|
678
|
-
`${f}-admonition ${f}-admonition-${
|
|
679
|
-
]) :
|
|
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);
|
|
680
683
|
}, l = (i) => {
|
|
681
684
|
const a = i.trim().split(" ", 2);
|
|
682
|
-
|
|
685
|
+
u = "", d = a[0], a.length > 1 && (u = i.substring(d.length + 2));
|
|
683
686
|
};
|
|
684
687
|
e.block.ruler.before(
|
|
685
688
|
"code",
|
|
686
689
|
"admonition",
|
|
687
|
-
(i, a,
|
|
688
|
-
let
|
|
689
|
-
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))
|
|
690
693
|
return !1;
|
|
691
|
-
for (
|
|
694
|
+
for (p = y + 1; p <= b && n[(p - y) % m] === i.src[p]; p++)
|
|
692
695
|
;
|
|
693
|
-
const S = Math.floor((
|
|
696
|
+
const S = Math.floor((p - y) / m);
|
|
694
697
|
if (S !== r)
|
|
695
698
|
return !1;
|
|
696
|
-
|
|
697
|
-
const
|
|
699
|
+
p -= (p - y) % m;
|
|
700
|
+
const w = i.src.slice(y, p), F = i.src.slice(p, b);
|
|
698
701
|
if (l(F), $)
|
|
699
702
|
return !0;
|
|
700
|
-
for (
|
|
701
|
-
if (o === i.src.charCodeAt(
|
|
702
|
-
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++)
|
|
703
706
|
;
|
|
704
|
-
if (!(Math.floor((
|
|
705
|
-
|
|
707
|
+
if (!(Math.floor((p - y) / m) < S) && (p -= (p - y) % m, p = i.skipSpaces(p), !(p < b))) {
|
|
708
|
+
T = !0;
|
|
706
709
|
break;
|
|
707
710
|
}
|
|
708
711
|
}
|
|
709
|
-
const
|
|
710
|
-
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;
|
|
711
714
|
},
|
|
712
715
|
{
|
|
713
716
|
alt: ["paragraph", "reference", "blockquote", "list"]
|
|
@@ -720,96 +723,96 @@ const Y = new rt({
|
|
|
720
723
|
o < 0 ? r.push(n) : (r[o] = r[o].slice(), r[o][1] += ` ${n[1]}`);
|
|
721
724
|
}), r;
|
|
722
725
|
}, st = (e, t) => {
|
|
723
|
-
const r = e.renderer.rules.fence, n = e.utils.unescapeAll, o = /\[(\w*)(?::([\w ]*))?\]/,
|
|
724
|
-
const
|
|
725
|
-
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];
|
|
726
729
|
}, s = (a) => {
|
|
727
|
-
const
|
|
728
|
-
return
|
|
730
|
+
const c = d(a);
|
|
731
|
+
return c ? c.split(/(\s+)/g)[0] : "";
|
|
729
732
|
}, l = (a) => {
|
|
730
|
-
const
|
|
731
|
-
`).length < t.autoFoldThreshold,
|
|
732
|
-
return { open: $, tagContainer:
|
|
733
|
-
}, i = (a,
|
|
734
|
-
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)
|
|
735
738
|
return "";
|
|
736
|
-
const
|
|
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]);
|
|
737
740
|
if (S === null) {
|
|
738
|
-
const { open: k, tagContainer: R, tagHeader: J } = l(a[
|
|
741
|
+
const { open: k, tagContainer: R, tagHeader: J } = l(a[c]), B = [["class", `${f}-code`]];
|
|
739
742
|
k && B.push(["open", ""]);
|
|
740
743
|
const ne = {
|
|
741
|
-
attrs: se(a[
|
|
744
|
+
attrs: se(a[c], B)
|
|
742
745
|
};
|
|
743
|
-
a[
|
|
744
|
-
const W = r(a,
|
|
746
|
+
a[c].info = a[c].info.replace(m, "");
|
|
747
|
+
const W = r(a, c, $, p, g);
|
|
745
748
|
return `
|
|
746
|
-
<${R} ${
|
|
749
|
+
<${R} ${g.renderAttrs(ne)}>
|
|
747
750
|
<${J} class="${f}-code-head">
|
|
748
751
|
<div class="${f}-code-flag"><span></span><span></span><span></span></div>
|
|
749
752
|
<div class="${f}-code-action">
|
|
750
|
-
<span class="${f}-code-lang">${e.utils.escapeHtml(a[
|
|
751
|
-
<span class="${f}-copy-button" data-tips="${
|
|
752
|
-
${t.extraTools instanceof Function ? t.extraTools({ lang: a[
|
|
753
|
-
${R === "details" ?
|
|
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 : ""}
|
|
754
757
|
</div>
|
|
755
758
|
</${J}>
|
|
756
759
|
${W}
|
|
757
760
|
</${R}>
|
|
758
761
|
`;
|
|
759
762
|
}
|
|
760
|
-
let
|
|
761
|
-
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`]];
|
|
762
765
|
q && K.push(["open", ""]);
|
|
763
766
|
const Z = {
|
|
764
|
-
attrs: se(a[
|
|
767
|
+
attrs: se(a[c], K)
|
|
765
768
|
};
|
|
766
|
-
for (let k =
|
|
767
|
-
|
|
768
|
-
const R = `${f}-codetab-${t.editorId}-${
|
|
769
|
-
L = k -
|
|
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", _ += `
|
|
770
773
|
<li>
|
|
771
774
|
<input
|
|
772
775
|
type="radio"
|
|
773
|
-
id="label-${f}-codetab-label-1-${t.editorId}-${
|
|
774
|
-
name="${f}-codetab-label-${t.editorId}-${
|
|
776
|
+
id="label-${f}-codetab-label-1-${t.editorId}-${c}-${k - c}"
|
|
777
|
+
name="${f}-codetab-label-${t.editorId}-${c}"
|
|
775
778
|
class="${R}"
|
|
776
779
|
${L}
|
|
777
780
|
>
|
|
778
781
|
<label
|
|
779
|
-
for="label-${f}-codetab-label-1-${t.editorId}-${
|
|
782
|
+
for="label-${f}-codetab-label-1-${t.editorId}-${c}-${k - c}"
|
|
780
783
|
onclick="this.getRootNode().querySelectorAll('.${R}').forEach(e => e.click())"
|
|
781
784
|
>
|
|
782
|
-
${e.utils.escapeHtml(
|
|
785
|
+
${e.utils.escapeHtml(x || s(w))}
|
|
783
786
|
</label>
|
|
784
787
|
</li>`, N += `
|
|
785
788
|
<div role="tabpanel">
|
|
786
789
|
<input
|
|
787
790
|
type="radio"
|
|
788
|
-
name="${f}-codetab-pre-${t.editorId}-${
|
|
791
|
+
name="${f}-codetab-pre-${t.editorId}-${c}"
|
|
789
792
|
class="${R}"
|
|
790
793
|
${L}
|
|
791
794
|
role="presentation">
|
|
792
|
-
${r(a, k, $,
|
|
795
|
+
${r(a, k, $, p, g)}
|
|
793
796
|
</div>`, D += `
|
|
794
797
|
<input
|
|
795
798
|
type="radio"
|
|
796
|
-
name="${f}-codetab-lang-${t.editorId}-${
|
|
799
|
+
name="${f}-codetab-lang-${t.editorId}-${c}"
|
|
797
800
|
class="${R}"
|
|
798
801
|
${L}
|
|
799
802
|
role="presentation">
|
|
800
|
-
<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>`;
|
|
801
804
|
}
|
|
802
805
|
return `
|
|
803
|
-
<${V} ${
|
|
806
|
+
<${V} ${g.renderAttrs(Z)}>
|
|
804
807
|
<${z} class="${f}-code-head">
|
|
805
808
|
<div class="${f}-code-flag">
|
|
806
809
|
<ul class="${f}-codetab-label" role="tablist">${_}</ul>
|
|
807
810
|
</div>
|
|
808
811
|
<div class="${f}-code-action">
|
|
809
812
|
<span class="${f}-codetab-lang">${D}</span>
|
|
810
|
-
<span class="${f}-copy-button" data-tips="${
|
|
811
|
-
${t.extraTools instanceof Function ? t.extraTools({ lang: a[
|
|
812
|
-
${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 : ""}
|
|
813
816
|
</div>
|
|
814
817
|
</${z}>
|
|
815
818
|
${N}
|
|
@@ -819,37 +822,37 @@ const Y = new rt({
|
|
|
819
822
|
e.renderer.rules.fence = i, e.renderer.rules.code_block = i;
|
|
820
823
|
}, ct = (e, t) => {
|
|
821
824
|
const r = e.renderer.rules.fence.bind(e.renderer.rules);
|
|
822
|
-
e.renderer.rules.fence = (n, o,
|
|
825
|
+
e.renderer.rules.fence = (n, o, m, d, u) => {
|
|
823
826
|
const s = n[o], l = s.content.trim();
|
|
824
827
|
if (s.info === "echarts") {
|
|
825
828
|
if (s.attrSet("class", `${f}-echarts`), s.attrSet("data-echarts-theme", t.themeRef.value), s.map && s.level === 0) {
|
|
826
|
-
const i = s.map[1] - 1,
|
|
827
|
-
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]));
|
|
828
831
|
}
|
|
829
|
-
return `<div ${
|
|
832
|
+
return `<div ${u.renderAttrs(s)} style="width: 100%; aspect-ratio: 4 / 3;">${e.utils.escapeHtml(l)}</div>`;
|
|
830
833
|
}
|
|
831
|
-
return r(n, o,
|
|
834
|
+
return r(n, o, m, d, u);
|
|
832
835
|
};
|
|
833
836
|
}, dt = (e, t) => {
|
|
834
837
|
e.renderer.rules.heading_open = (r, n) => {
|
|
835
|
-
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;
|
|
836
839
|
return t.headsRef.value.push({
|
|
837
|
-
text:
|
|
838
|
-
level:
|
|
840
|
+
text: m,
|
|
841
|
+
level: d,
|
|
839
842
|
line: o.map[0],
|
|
840
843
|
currentToken: o,
|
|
841
844
|
nextToken: r[n + 1]
|
|
842
845
|
}), o.map && o.level === 0 && o.attrSet(
|
|
843
846
|
"id",
|
|
844
847
|
t.mdHeadingId({
|
|
845
|
-
text:
|
|
846
|
-
level:
|
|
848
|
+
text: m,
|
|
849
|
+
level: d,
|
|
847
850
|
index: t.headsRef.value.length,
|
|
848
851
|
currentToken: o,
|
|
849
852
|
nextToken: r[n + 1]
|
|
850
853
|
})
|
|
851
854
|
), e.renderer.renderToken(r, n, t);
|
|
852
|
-
}, e.renderer.rules.heading_close = (r, n, o,
|
|
855
|
+
}, e.renderer.rules.heading_close = (r, n, o, m, d) => d.renderToken(r, n, o);
|
|
853
856
|
}, be = {
|
|
854
857
|
block: [
|
|
855
858
|
{ open: "$$", close: "$$" },
|
|
@@ -866,81 +869,81 @@ const Y = new rt({
|
|
|
866
869
|
for (const o of n) {
|
|
867
870
|
if (!t.src.startsWith(o.open, t.pos))
|
|
868
871
|
continue;
|
|
869
|
-
const
|
|
870
|
-
let
|
|
871
|
-
for (; (
|
|
872
|
-
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;
|
|
873
876
|
for (; s >= 0 && t.src[s] === "\\"; )
|
|
874
|
-
|
|
875
|
-
if (
|
|
877
|
+
u++, s--;
|
|
878
|
+
if (u % 2 === 0)
|
|
876
879
|
break;
|
|
877
|
-
|
|
880
|
+
d += o.close.length;
|
|
878
881
|
}
|
|
879
|
-
if (
|
|
880
|
-
if (
|
|
881
|
-
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;
|
|
882
885
|
if (!r) {
|
|
883
|
-
const
|
|
884
|
-
|
|
886
|
+
const u = t.push("math_inline", "math", 0);
|
|
887
|
+
u.markup = o.open, u.content = t.src.slice(m, d);
|
|
885
888
|
}
|
|
886
|
-
return t.pos =
|
|
889
|
+
return t.pos = d + o.close.length, !0;
|
|
887
890
|
}
|
|
888
891
|
}
|
|
889
892
|
return !1;
|
|
890
893
|
}, mt = (e) => (t, r, n, o) => {
|
|
891
|
-
const
|
|
894
|
+
const m = e.delimiters, d = t.bMarks[r] + t.tShift[r], u = t.eMarks[r], s = (l, i, a) => {
|
|
892
895
|
t.line = i;
|
|
893
|
-
const
|
|
894
|
-
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;
|
|
895
898
|
};
|
|
896
|
-
for (const l of
|
|
897
|
-
const i =
|
|
899
|
+
for (const l of m) {
|
|
900
|
+
const i = d;
|
|
898
901
|
if (t.src.slice(i, i + l.open.length) !== l.open)
|
|
899
902
|
continue;
|
|
900
|
-
const a = i + l.open.length,
|
|
901
|
-
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)
|
|
902
905
|
continue;
|
|
903
906
|
if (o)
|
|
904
907
|
return !0;
|
|
905
|
-
if (
|
|
908
|
+
if (p)
|
|
906
909
|
return s("", r + 1, l.open);
|
|
907
|
-
if (!$ &&
|
|
908
|
-
const
|
|
909
|
-
return s(
|
|
910
|
+
if (!$ && g) {
|
|
911
|
+
const w = c.slice(0, -l.close.length);
|
|
912
|
+
return s(w, r + 1, l.open);
|
|
910
913
|
}
|
|
911
|
-
let
|
|
912
|
-
for (;
|
|
913
|
-
const
|
|
914
|
-
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)
|
|
915
918
|
break;
|
|
916
|
-
if (t.src.slice(
|
|
919
|
+
if (t.src.slice(w, F).trim().endsWith(l.close)) {
|
|
917
920
|
const L = t.src.slice(0, F).lastIndexOf(l.close);
|
|
918
|
-
|
|
921
|
+
y = t.src.slice(w, L), T = !0;
|
|
919
922
|
break;
|
|
920
923
|
}
|
|
921
924
|
}
|
|
922
|
-
if (!
|
|
925
|
+
if (!T)
|
|
923
926
|
continue;
|
|
924
|
-
const S = t.getLines(r + 1,
|
|
925
|
-
return s(S,
|
|
927
|
+
const S = t.getLines(r + 1, h, t.tShift[r], !0) + (y.trim() ? y : "");
|
|
928
|
+
return s(S, h + 1, l.open);
|
|
926
929
|
}
|
|
927
930
|
return !1;
|
|
928
931
|
}, ft = (e, { katexRef: t, inlineDelimiters: r, blockDelimiters: n }) => {
|
|
929
|
-
const o = (
|
|
930
|
-
const
|
|
931
|
-
attrs: se(
|
|
932
|
-
}, $ = i.renderAttrs(
|
|
932
|
+
const o = (u, s, l, i, a = !1) => {
|
|
933
|
+
const c = {
|
|
934
|
+
attrs: se(u, [["class", s]])
|
|
935
|
+
}, $ = i.renderAttrs(c);
|
|
933
936
|
if (!t.value)
|
|
934
|
-
return `<${l} ${$}>${
|
|
935
|
-
const
|
|
936
|
-
|
|
937
|
+
return `<${l} ${$}>${u.content}</${l}>`;
|
|
938
|
+
const p = t.value.renderToString(
|
|
939
|
+
u.content,
|
|
937
940
|
P.katexConfig({
|
|
938
941
|
throwOnError: !1,
|
|
939
942
|
displayMode: a
|
|
940
943
|
})
|
|
941
944
|
);
|
|
942
|
-
return `<${l} ${$} data-processed>${
|
|
943
|
-
},
|
|
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);
|
|
944
947
|
e.inline.ruler.before(
|
|
945
948
|
"escape",
|
|
946
949
|
"math_inline",
|
|
@@ -956,20 +959,20 @@ const Y = new rt({
|
|
|
956
959
|
{
|
|
957
960
|
alt: ["paragraph", "reference", "blockquote", "list"]
|
|
958
961
|
}
|
|
959
|
-
), e.renderer.rules.math_inline =
|
|
962
|
+
), e.renderer.rules.math_inline = m, e.renderer.rules.math_block = d;
|
|
960
963
|
}, ht = (e, t) => {
|
|
961
964
|
const r = e.renderer.rules.fence.bind(e.renderer.rules);
|
|
962
|
-
e.renderer.rules.fence = (n, o,
|
|
965
|
+
e.renderer.rules.fence = (n, o, m, d, u) => {
|
|
963
966
|
const s = n[o], l = s.content.trim();
|
|
964
967
|
if (s.info === "mermaid") {
|
|
965
968
|
if (s.attrSet("class", `${f}-mermaid`), s.attrSet("data-mermaid-theme", t.themeRef.value), s.map && s.level === 0) {
|
|
966
|
-
const a = s.map[1] - 1, $ = !!
|
|
969
|
+
const a = s.map[1] - 1, $ = !!d.srcLines[a]?.trim()?.startsWith("```");
|
|
967
970
|
s.attrSet("data-closed", `${$}`), s.attrSet("data-line", String(s.map[0]));
|
|
968
971
|
}
|
|
969
972
|
const i = Y.get(l);
|
|
970
|
-
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>`;
|
|
971
974
|
}
|
|
972
|
-
return r(n, o,
|
|
975
|
+
return r(n, o, m, d, u);
|
|
973
976
|
};
|
|
974
977
|
}, $e = (e, t, r) => {
|
|
975
978
|
const n = e.attrIndex(t), o = [t, r];
|
|
@@ -1015,15 +1018,15 @@ const Y = new rt({
|
|
|
1015
1018
|
r.map && (r.attrs || (r.attrs = []), r.attrs.push(["data-line", r.map[0].toString()]));
|
|
1016
1019
|
}), !0));
|
|
1017
1020
|
}, St = (e, t) => {
|
|
1018
|
-
const { editorConfig: r, markdownItConfig: n, markdownItPlugins: o, editorExtensions:
|
|
1021
|
+
const { editorConfig: r, markdownItConfig: n, markdownItPlugins: o, editorExtensions: m } = P, d = C("editorId"), u = C("language"), s = C(
|
|
1019
1022
|
"usedLanguageText"
|
|
1020
|
-
), 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({
|
|
1021
1024
|
html: !0,
|
|
1022
1025
|
breaks: !0,
|
|
1023
1026
|
linkify: !0
|
|
1024
1027
|
});
|
|
1025
|
-
n(
|
|
1026
|
-
editorId:
|
|
1028
|
+
n(w, {
|
|
1029
|
+
editorId: d
|
|
1027
1030
|
});
|
|
1028
1031
|
const F = [
|
|
1029
1032
|
{
|
|
@@ -1044,13 +1047,13 @@ const Y = new rt({
|
|
|
1044
1047
|
{
|
|
1045
1048
|
type: "heading",
|
|
1046
1049
|
plugin: dt,
|
|
1047
|
-
options: { mdHeadingId: e.mdHeadingId, headsRef:
|
|
1050
|
+
options: { mdHeadingId: e.mdHeadingId, headsRef: p }
|
|
1048
1051
|
},
|
|
1049
1052
|
{
|
|
1050
1053
|
type: "code",
|
|
1051
1054
|
plugin: st,
|
|
1052
1055
|
options: {
|
|
1053
|
-
editorId:
|
|
1056
|
+
editorId: d,
|
|
1054
1057
|
usedLanguageTextRef: s,
|
|
1055
1058
|
// showCodeRowNumber,
|
|
1056
1059
|
codeFoldable: e.codeFoldable,
|
|
@@ -1072,7 +1075,7 @@ const Y = new rt({
|
|
|
1072
1075
|
e.noKatex || F.push({
|
|
1073
1076
|
type: "katex",
|
|
1074
1077
|
plugin: ft,
|
|
1075
|
-
options: { katexRef:
|
|
1078
|
+
options: { katexRef: h }
|
|
1076
1079
|
}), e.noMermaid || F.push({
|
|
1077
1080
|
type: "mermaid",
|
|
1078
1081
|
plugin: ht,
|
|
@@ -1082,33 +1085,33 @@ const Y = new rt({
|
|
|
1082
1085
|
plugin: ct,
|
|
1083
1086
|
options: { themeRef: i }
|
|
1084
1087
|
}), o(F, {
|
|
1085
|
-
editorId:
|
|
1088
|
+
editorId: d
|
|
1086
1089
|
}).forEach((k) => {
|
|
1087
|
-
|
|
1090
|
+
w.use(k.plugin, k.options);
|
|
1088
1091
|
});
|
|
1089
|
-
const
|
|
1090
|
-
|
|
1092
|
+
const x = w.options.highlight;
|
|
1093
|
+
w.set({
|
|
1091
1094
|
highlight: (k, R, J) => {
|
|
1092
|
-
if (
|
|
1093
|
-
const W =
|
|
1095
|
+
if (x) {
|
|
1096
|
+
const W = x(k, R, J);
|
|
1094
1097
|
if (W)
|
|
1095
1098
|
return W;
|
|
1096
1099
|
}
|
|
1097
1100
|
let B;
|
|
1098
|
-
!e.noHighlight &&
|
|
1101
|
+
!e.noHighlight && g.value ? g.value.getLanguage(R) ? B = g.value.highlight(k, {
|
|
1099
1102
|
language: R,
|
|
1100
1103
|
ignoreIllegals: !0
|
|
1101
|
-
}).value : B =
|
|
1104
|
+
}).value : B = g.value.highlightAuto(k).value : B = w.utils.escapeHtml(k);
|
|
1102
1105
|
const ne = l ? Ye(
|
|
1103
1106
|
B.replace(/^\n+|\n+$/g, ""),
|
|
1104
1107
|
k.replace(/^\n+|\n+$/g, "")
|
|
1105
1108
|
) : `<span class="${f}-code-block">${B.replace(/^\n+|\n+$/g, "")}</span>`;
|
|
1106
1109
|
return `<pre><code class="language-${R}" language=${R}>${ne}</code></pre>`;
|
|
1107
1110
|
}
|
|
1108
|
-
}), It(
|
|
1111
|
+
}), It(w);
|
|
1109
1112
|
const L = G(`_article-key_${le()}`), _ = G(
|
|
1110
1113
|
e.sanitize(
|
|
1111
|
-
|
|
1114
|
+
w.render(e.modelValue, {
|
|
1112
1115
|
srcLines: e.modelValue.split(`
|
|
1113
1116
|
`)
|
|
1114
1117
|
})
|
|
@@ -1118,28 +1121,28 @@ const Y = new rt({
|
|
|
1118
1121
|
}, D = () => {
|
|
1119
1122
|
};
|
|
1120
1123
|
const q = () => {
|
|
1121
|
-
const k =
|
|
1122
|
-
`#${
|
|
1124
|
+
const k = c.value?.querySelectorAll(
|
|
1125
|
+
`#${d} p.${f}-mermaid:not([data-closed=false])`
|
|
1123
1126
|
);
|
|
1124
1127
|
D(), D = ze(k, {
|
|
1125
1128
|
customIcon: a.value
|
|
1126
|
-
}),
|
|
1129
|
+
}), m.mermaid?.enableZoom && (N(), N = We(k, {
|
|
1127
1130
|
customIcon: a.value
|
|
1128
1131
|
}));
|
|
1129
1132
|
}, V = () => {
|
|
1130
|
-
|
|
1131
|
-
|
|
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();
|
|
1132
1135
|
});
|
|
1133
1136
|
}, z = () => {
|
|
1134
|
-
|
|
1135
|
-
|
|
1137
|
+
p.value = [], _.value = e.sanitize(
|
|
1138
|
+
w.render(e.modelValue, {
|
|
1136
1139
|
srcLines: e.modelValue.split(`
|
|
1137
1140
|
`)
|
|
1138
1141
|
})
|
|
1139
1142
|
);
|
|
1140
|
-
}, K = A(() => (e.noKatex || !!
|
|
1143
|
+
}, K = A(() => (e.noKatex || !!h.value) && (e.noHighlight || !!g.value));
|
|
1141
1144
|
let Z = -1;
|
|
1142
|
-
return E([Ae(e, "modelValue"), K,
|
|
1145
|
+
return E([Ae(e, "modelValue"), K, T, u], () => {
|
|
1143
1146
|
Z = window.setTimeout(
|
|
1144
1147
|
() => {
|
|
1145
1148
|
z();
|
|
@@ -1150,18 +1153,18 @@ const Y = new rt({
|
|
|
1150
1153
|
() => $.value.preview,
|
|
1151
1154
|
() => {
|
|
1152
1155
|
$.value.preview && U(() => {
|
|
1153
|
-
|
|
1156
|
+
y().then(q), S(), v.emit(d, oe, p.value);
|
|
1154
1157
|
});
|
|
1155
1158
|
}
|
|
1156
|
-
), E([_,
|
|
1159
|
+
), E([_, b], () => {
|
|
1157
1160
|
V();
|
|
1158
1161
|
}), H(V), H(() => {
|
|
1159
|
-
|
|
1162
|
+
v.on(d, {
|
|
1160
1163
|
name: De,
|
|
1161
1164
|
callback() {
|
|
1162
|
-
|
|
1165
|
+
v.emit(d, oe, p.value);
|
|
1163
1166
|
}
|
|
1164
|
-
}),
|
|
1167
|
+
}), v.on(d, {
|
|
1165
1168
|
name: de,
|
|
1166
1169
|
callback: () => {
|
|
1167
1170
|
L.value = `_article-key_${le()}`, z();
|
|
@@ -1171,18 +1174,18 @@ const Y = new rt({
|
|
|
1171
1174
|
N(), D(), clearTimeout(Z);
|
|
1172
1175
|
}), { html: _, key: L };
|
|
1173
1176
|
}, Ft = (e, t) => {
|
|
1174
|
-
const r =
|
|
1175
|
-
const
|
|
1177
|
+
const r = C("editorId"), n = C("setting"), { noImgZoomIn: o } = e, m = Le(() => {
|
|
1178
|
+
const d = document.querySelectorAll(
|
|
1176
1179
|
`#${r}-preview img:not(.not-zoom):not(.medium-zoom-image)`
|
|
1177
1180
|
);
|
|
1178
|
-
|
|
1181
|
+
d.length !== 0 && Qe(d, {
|
|
1179
1182
|
background: "#00000073"
|
|
1180
1183
|
});
|
|
1181
1184
|
});
|
|
1182
1185
|
H(async () => {
|
|
1183
|
-
!o && n.value.preview && await
|
|
1186
|
+
!o && n.value.preview && await m();
|
|
1184
1187
|
}), E([t, () => n.value.preview], async () => {
|
|
1185
|
-
!o && n.value.preview && await
|
|
1188
|
+
!o && n.value.preview && await m();
|
|
1186
1189
|
});
|
|
1187
1190
|
}, we = {
|
|
1188
1191
|
checked: {
|
|
@@ -1194,30 +1197,30 @@ const Y = new rt({
|
|
|
1194
1197
|
value: "- [x]"
|
|
1195
1198
|
}
|
|
1196
1199
|
}, At = (e, t) => {
|
|
1197
|
-
const r =
|
|
1200
|
+
const r = C("editorId"), n = C("rootRef");
|
|
1198
1201
|
let o = () => {
|
|
1199
1202
|
};
|
|
1200
|
-
const
|
|
1203
|
+
const m = () => {
|
|
1201
1204
|
if (!n.value)
|
|
1202
1205
|
return !1;
|
|
1203
|
-
const
|
|
1206
|
+
const d = n.value.querySelectorAll(".task-list-item.enabled"), u = (s) => {
|
|
1204
1207
|
s.preventDefault();
|
|
1205
1208
|
const l = s.target.checked ? "unChecked" : "checked", i = s.target.parentElement?.dataset.line;
|
|
1206
1209
|
if (!i)
|
|
1207
1210
|
return;
|
|
1208
|
-
const a = Number(i),
|
|
1209
|
-
`), $ =
|
|
1211
|
+
const a = Number(i), c = e.modelValue.split(`
|
|
1212
|
+
`), $ = c[Number(a)].replace(
|
|
1210
1213
|
we[l].regexp,
|
|
1211
1214
|
we[l].value
|
|
1212
1215
|
);
|
|
1213
|
-
e.previewOnly ? (
|
|
1214
|
-
`))) :
|
|
1216
|
+
e.previewOnly ? (c[Number(a)] = $, e.onChange(c.join(`
|
|
1217
|
+
`))) : v.emit(r, Ve, a + 1, $);
|
|
1215
1218
|
};
|
|
1216
|
-
|
|
1217
|
-
s.addEventListener("click",
|
|
1219
|
+
d.forEach((s) => {
|
|
1220
|
+
s.addEventListener("click", u);
|
|
1218
1221
|
}), o = () => {
|
|
1219
|
-
|
|
1220
|
-
s.removeEventListener("click",
|
|
1222
|
+
d.forEach((s) => {
|
|
1223
|
+
s.removeEventListener("click", u);
|
|
1221
1224
|
});
|
|
1222
1225
|
};
|
|
1223
1226
|
};
|
|
@@ -1226,21 +1229,21 @@ const Y = new rt({
|
|
|
1226
1229
|
}), E(
|
|
1227
1230
|
[t],
|
|
1228
1231
|
() => {
|
|
1229
|
-
o(), U(
|
|
1232
|
+
o(), U(m);
|
|
1230
1233
|
},
|
|
1231
1234
|
{
|
|
1232
1235
|
immediate: !0
|
|
1233
1236
|
}
|
|
1234
1237
|
);
|
|
1235
1238
|
}, Rt = (e, t, r) => {
|
|
1236
|
-
const n =
|
|
1239
|
+
const n = C("setting"), o = () => {
|
|
1237
1240
|
U(() => {
|
|
1238
1241
|
e.onRemount?.();
|
|
1239
1242
|
});
|
|
1240
|
-
},
|
|
1241
|
-
|
|
1243
|
+
}, m = (d) => {
|
|
1244
|
+
d && o();
|
|
1242
1245
|
};
|
|
1243
|
-
E([t, r], o), E(() => n.value.preview,
|
|
1246
|
+
E([t, r], o), E(() => n.value.preview, m), E(() => n.value.htmlPreview, m), H(o);
|
|
1244
1247
|
}, xe = {
|
|
1245
1248
|
modelValue: {
|
|
1246
1249
|
type: String,
|
|
@@ -1401,31 +1404,31 @@ const Y = new rt({
|
|
|
1401
1404
|
}
|
|
1402
1405
|
},
|
|
1403
1406
|
setup(e) {
|
|
1404
|
-
const t = G(), r = e.html, n = (o,
|
|
1407
|
+
const t = G(), r = e.html, n = (o, m) => {
|
|
1405
1408
|
if (!t.value) return;
|
|
1406
|
-
const
|
|
1409
|
+
const d = t.value, u = Array.from(d.childNodes), s = Math.min(o.length, m.length);
|
|
1407
1410
|
let l = -1;
|
|
1408
1411
|
for (let a = 0; a < s; a++)
|
|
1409
|
-
if (!Ht(o[a],
|
|
1412
|
+
if (!Ht(o[a], m[a])) {
|
|
1410
1413
|
l = a;
|
|
1411
1414
|
break;
|
|
1412
1415
|
}
|
|
1413
1416
|
if (l === -1)
|
|
1414
|
-
if (
|
|
1417
|
+
if (m.length > o.length)
|
|
1415
1418
|
l = o.length;
|
|
1416
|
-
else if (o.length >
|
|
1417
|
-
l =
|
|
1419
|
+
else if (o.length > m.length)
|
|
1420
|
+
l = m.length;
|
|
1418
1421
|
else
|
|
1419
1422
|
return;
|
|
1420
|
-
const i = Math.min(l,
|
|
1421
|
-
for (let a =
|
|
1422
|
-
|
|
1423
|
+
const i = Math.min(l, u.length);
|
|
1424
|
+
for (let a = u.length - 1; a >= i; a--)
|
|
1425
|
+
u[a].remove();
|
|
1423
1426
|
for (let a = l; a < o.length; a++)
|
|
1424
|
-
|
|
1427
|
+
d.appendChild(o[a].cloneNode(!0));
|
|
1425
1428
|
};
|
|
1426
|
-
return E(() => e.html, (o,
|
|
1427
|
-
const
|
|
1428
|
-
n(
|
|
1429
|
+
return E(() => e.html, (o, m) => {
|
|
1430
|
+
const d = Ce(o), u = Ce(m || "");
|
|
1431
|
+
n(d, u);
|
|
1429
1432
|
}), () => j("div", {
|
|
1430
1433
|
id: e.id,
|
|
1431
1434
|
class: e.class,
|
|
@@ -1437,23 +1440,23 @@ const Y = new rt({
|
|
|
1437
1440
|
name: "ContentPreview",
|
|
1438
1441
|
props: xe,
|
|
1439
1442
|
setup(e) {
|
|
1440
|
-
const t =
|
|
1441
|
-
html:
|
|
1442
|
-
key:
|
|
1443
|
+
const t = C("editorId"), r = C("setting"), n = C("previewTheme"), o = C("showCodeRowNumber"), {
|
|
1444
|
+
html: m,
|
|
1445
|
+
key: d
|
|
1443
1446
|
} = St(e, e.previewOnly);
|
|
1444
|
-
tt(e,
|
|
1445
|
-
const
|
|
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 = () => {
|
|
1446
1449
|
const l = `${t}-preview`;
|
|
1447
1450
|
return e.previewComponent ? He(e.previewComponent, {
|
|
1448
|
-
key:
|
|
1449
|
-
html:
|
|
1451
|
+
key: d.value,
|
|
1452
|
+
html: m.value,
|
|
1450
1453
|
id: l,
|
|
1451
|
-
class:
|
|
1454
|
+
class: u.value
|
|
1452
1455
|
}) : j(Mt, {
|
|
1453
|
-
key:
|
|
1454
|
-
html:
|
|
1456
|
+
key: d.value,
|
|
1457
|
+
html: m.value,
|
|
1455
1458
|
id: l,
|
|
1456
|
-
class:
|
|
1459
|
+
class: u.value
|
|
1457
1460
|
}, null);
|
|
1458
1461
|
};
|
|
1459
1462
|
return () => j(Re, null, [r.value.preview && (e.previewOnly ? s() : j("div", {
|
|
@@ -1466,7 +1469,7 @@ const Y = new rt({
|
|
|
1466
1469
|
key: "html-preview-wrapper"
|
|
1467
1470
|
}, [j("div", {
|
|
1468
1471
|
class: `${f}-html`
|
|
1469
|
-
}, [
|
|
1472
|
+
}, [m.value])])]);
|
|
1470
1473
|
}
|
|
1471
1474
|
}), Lt = ({ text: e }) => e, Ie = {
|
|
1472
1475
|
/**
|
|
@@ -2031,7 +2034,7 @@ const Y = new rt({
|
|
|
2031
2034
|
], Ot = (e, t, r) => {
|
|
2032
2035
|
const { editorId: n } = r, o = {
|
|
2033
2036
|
rerender() {
|
|
2034
|
-
|
|
2037
|
+
v.emit(n, de);
|
|
2035
2038
|
}
|
|
2036
2039
|
};
|
|
2037
2040
|
t.expose(o);
|
|
@@ -2044,16 +2047,16 @@ const Y = new rt({
|
|
|
2044
2047
|
noKatex: r,
|
|
2045
2048
|
noMermaid: n,
|
|
2046
2049
|
noHighlight: o
|
|
2047
|
-
} = e,
|
|
2050
|
+
} = e, m = G(), d = et(e);
|
|
2048
2051
|
Te(e, {
|
|
2049
|
-
rootRef:
|
|
2050
|
-
editorId:
|
|
2052
|
+
rootRef: m,
|
|
2053
|
+
editorId: d
|
|
2051
2054
|
}), Ot(e, t, {
|
|
2052
|
-
editorId:
|
|
2055
|
+
editorId: d
|
|
2053
2056
|
}), te(() => {
|
|
2054
|
-
|
|
2057
|
+
v.clear(d);
|
|
2055
2058
|
});
|
|
2056
|
-
const
|
|
2059
|
+
const u = (a) => {
|
|
2057
2060
|
e.onChange?.(a), t.emit("onChange", a), t.emit("update:modelValue", a);
|
|
2058
2061
|
}, s = (a) => {
|
|
2059
2062
|
e.onHtmlChanged?.(a), t.emit("onHtmlChanged", a);
|
|
@@ -2063,13 +2066,13 @@ const Y = new rt({
|
|
|
2063
2066
|
e.onRemount?.(), t.emit("onRemount");
|
|
2064
2067
|
};
|
|
2065
2068
|
return () => j("div", {
|
|
2066
|
-
id:
|
|
2069
|
+
id: d,
|
|
2067
2070
|
class: [f, e.class, e.theme === "dark" && `${f}-dark`, `${f}-previewOnly`],
|
|
2068
2071
|
style: e.style,
|
|
2069
|
-
ref:
|
|
2072
|
+
ref: m
|
|
2070
2073
|
}, [j(Pt, {
|
|
2071
2074
|
modelValue: e.modelValue,
|
|
2072
|
-
onChange:
|
|
2075
|
+
onChange: u,
|
|
2073
2076
|
onHtmlChanged: s,
|
|
2074
2077
|
onGetCatalog: l,
|
|
2075
2078
|
mdHeadingId: e.mdHeadingId,
|