md-editor-v3 6.0.0 → 6.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/MdEditor.cjs +4 -4
- package/lib/cjs/ModalToolbar.cjs +1 -1
- package/lib/cjs/NormalToolbar.cjs +1 -1
- package/lib/cjs/chunks/index.cjs +1 -1
- package/lib/cjs/chunks/index3.cjs +45 -45
- package/lib/es/MdEditor.mjs +446 -426
- package/lib/es/ModalToolbar.mjs +6 -5
- package/lib/es/NormalToolbar.mjs +2 -1
- package/lib/es/chunks/index.mjs +10 -9
- package/lib/es/chunks/index3.mjs +520 -514
- package/lib/types/MdEditor/composition.d.ts +3 -3
- package/lib/types/MdEditor/layouts/Content/ContentPreview.d.ts +0 -13
- package/lib/types/MdEditor/layouts/Content/index.d.ts +0 -3
- package/lib/types/MdEditor/layouts/Content/props.d.ts +1 -13
- package/package.json +1 -1
package/lib/es/chunks/index3.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { useId as
|
|
2
|
-
import { deepMerge as Pe, deepClone as Me, randomId as
|
|
3
|
-
import { p as h, g as
|
|
4
|
-
import { b as v, U as Oe, C as
|
|
5
|
-
import { a as
|
|
1
|
+
import { useId as Ae, provide as k, computed as F, reactive as ae, watch as w, onMounted as A, ref as V, inject as b, nextTick as U, shallowRef as ee, onBeforeUnmount as te, toRef as Re, defineComponent as ie, createVNode as O, Fragment as He } from "vue";
|
|
2
|
+
import { deepMerge as Pe, deepClone as Me, randomId as re, debounce as Le } from "@vavt/util";
|
|
3
|
+
import { p as h, g as R, f as ce, s as de, b as _e, a as Ne } from "./config.mjs";
|
|
4
|
+
import { b as v, U as Oe, C as ke, B as J, O as Ce, E as Y, P as ue, F as me, f as fe, g as he, H as pe, h as ge, R as le, e as je, i as se, d as Be, j as ne, k as De, T as Ve } from "./event-bus.mjs";
|
|
5
|
+
import { a as _, u as Ue, S as Ge, z as ve } from "./dom.mjs";
|
|
6
6
|
import ze from "@vavt/copy2clipboard";
|
|
7
7
|
import We from "markdown-it";
|
|
8
8
|
import qe from "markdown-it-image-figures";
|
|
@@ -25,7 +25,7 @@ const P = {
|
|
|
25
25
|
katexcss: `${h}-katexCss`,
|
|
26
26
|
echarts: `${h}-echarts`
|
|
27
27
|
}, Kt = (e, t, r) => {
|
|
28
|
-
const { editorId:
|
|
28
|
+
const { editorId: o } = r, n = ae({
|
|
29
29
|
// 是否已编译成html
|
|
30
30
|
buildFinished: !1,
|
|
31
31
|
// 存储当前最新的html
|
|
@@ -34,26 +34,26 @@ const P = {
|
|
|
34
34
|
w(
|
|
35
35
|
() => e.modelValue,
|
|
36
36
|
() => {
|
|
37
|
-
|
|
37
|
+
n.buildFinished = !1;
|
|
38
38
|
}
|
|
39
|
-
),
|
|
40
|
-
v.on(
|
|
41
|
-
name:
|
|
39
|
+
), A(() => {
|
|
40
|
+
v.on(o, {
|
|
41
|
+
name: J,
|
|
42
42
|
callback(m) {
|
|
43
|
-
|
|
43
|
+
n.buildFinished = !0, n.html = m;
|
|
44
44
|
}
|
|
45
|
-
}), v.on(
|
|
46
|
-
name:
|
|
45
|
+
}), v.on(o, {
|
|
46
|
+
name: Ce,
|
|
47
47
|
callback() {
|
|
48
48
|
const m = new Promise((s) => {
|
|
49
|
-
if (
|
|
50
|
-
s(
|
|
49
|
+
if (n.buildFinished)
|
|
50
|
+
s(n.html);
|
|
51
51
|
else {
|
|
52
52
|
const d = (i) => {
|
|
53
|
-
s(i), v.remove(
|
|
53
|
+
s(i), v.remove(o, J, d);
|
|
54
54
|
};
|
|
55
|
-
v.on(
|
|
56
|
-
name:
|
|
55
|
+
v.on(o, {
|
|
56
|
+
name: J,
|
|
57
57
|
callback: d
|
|
58
58
|
});
|
|
59
59
|
}
|
|
@@ -62,205 +62,215 @@ const P = {
|
|
|
62
62
|
}
|
|
63
63
|
});
|
|
64
64
|
});
|
|
65
|
-
},
|
|
66
|
-
|
|
67
|
-
|
|
65
|
+
}, Ie = (e, {
|
|
66
|
+
editorId: t,
|
|
67
|
+
rootRef: r,
|
|
68
|
+
setting: o
|
|
69
|
+
}) => {
|
|
70
|
+
const n = R.editorExtensions.highlight, m = R.editorExtensionsAttrs.highlight;
|
|
71
|
+
k("editorId", t), k("rootRef", r), k(
|
|
68
72
|
"theme",
|
|
69
|
-
|
|
70
|
-
),
|
|
73
|
+
F(() => e.theme)
|
|
74
|
+
), k(
|
|
71
75
|
"language",
|
|
72
|
-
|
|
73
|
-
),
|
|
76
|
+
F(() => e.language)
|
|
77
|
+
), k(
|
|
74
78
|
"highlight",
|
|
75
|
-
|
|
76
|
-
const { js:
|
|
79
|
+
F(() => {
|
|
80
|
+
const { js: d } = n, i = {
|
|
77
81
|
...ce,
|
|
78
82
|
...n.css
|
|
79
|
-
}, { js:
|
|
83
|
+
}, { js: u, css: l = {} } = m || {}, a = e.codeStyleReverse && e.codeStyleReverseList.includes(e.previewTheme) ? "dark" : e.theme, c = i[e.codeTheme] ? i[e.codeTheme][a] : ce.atom[a], p = i[e.codeTheme] && l[e.codeTheme] ? l[e.codeTheme][a] : l.atom ? l.atom[a] : {};
|
|
80
84
|
return {
|
|
81
85
|
js: {
|
|
82
|
-
src:
|
|
83
|
-
...
|
|
86
|
+
src: d,
|
|
87
|
+
...u
|
|
84
88
|
},
|
|
85
89
|
css: {
|
|
86
|
-
href:
|
|
87
|
-
...
|
|
90
|
+
href: c,
|
|
91
|
+
...p
|
|
88
92
|
}
|
|
89
93
|
};
|
|
90
94
|
})
|
|
91
|
-
),
|
|
92
|
-
const
|
|
93
|
-
const
|
|
95
|
+
), k("showCodeRowNumber", e.showCodeRowNumber);
|
|
96
|
+
const s = F(() => {
|
|
97
|
+
const d = {
|
|
94
98
|
...de,
|
|
95
|
-
...
|
|
99
|
+
...R.editorConfig.languageUserDefined
|
|
96
100
|
};
|
|
97
101
|
return Pe(
|
|
98
102
|
Me(de["en-US"]),
|
|
99
|
-
|
|
103
|
+
d[e.language] || {}
|
|
100
104
|
);
|
|
101
105
|
});
|
|
102
|
-
return
|
|
106
|
+
return k("usedLanguageText", s), k(
|
|
103
107
|
"previewTheme",
|
|
104
|
-
|
|
105
|
-
),
|
|
108
|
+
F(() => e.previewTheme)
|
|
109
|
+
), k(
|
|
106
110
|
"customIcon",
|
|
107
|
-
|
|
111
|
+
F(() => e.customIcon)
|
|
112
|
+
), k(
|
|
113
|
+
"setting",
|
|
114
|
+
F(() => o ? {
|
|
115
|
+
// setting是reactive,不转化是可以直接赋值的
|
|
116
|
+
...o
|
|
117
|
+
} : {
|
|
118
|
+
preview: !0,
|
|
119
|
+
htmlPreview: !1,
|
|
120
|
+
previewOnly: !1,
|
|
121
|
+
pageFullscreen: !1,
|
|
122
|
+
fullscreen: !1
|
|
123
|
+
})
|
|
108
124
|
), { editorId: t };
|
|
109
|
-
}, Zt = (e, t) => (
|
|
125
|
+
}, Zt = (e, t) => (k("tabWidth", e.tabWidth), k(
|
|
110
126
|
"disabled",
|
|
111
|
-
|
|
112
|
-
),
|
|
127
|
+
F(() => e.disabled)
|
|
128
|
+
), k(
|
|
113
129
|
"showToolbarName",
|
|
114
|
-
|
|
115
|
-
),
|
|
130
|
+
F(() => e.showToolbarName)
|
|
131
|
+
), k("noUploadImg", e.noUploadImg), k(
|
|
116
132
|
"tableShape",
|
|
117
|
-
|
|
118
|
-
),
|
|
133
|
+
F(() => e.tableShape)
|
|
134
|
+
), k("noPrettier", e.noPrettier), k(
|
|
119
135
|
"codeTheme",
|
|
120
|
-
|
|
121
|
-
),
|
|
122
|
-
"setting",
|
|
123
|
-
S(() => ({
|
|
124
|
-
// setting是reactive,不转化是可以直接赋值的
|
|
125
|
-
...t.setting
|
|
126
|
-
}))
|
|
127
|
-
), C("updateSetting", t.updateSetting), C(
|
|
136
|
+
F(() => e.codeTheme)
|
|
137
|
+
), k("updateSetting", t.updateSetting), k(
|
|
128
138
|
"catalogVisible",
|
|
129
|
-
|
|
130
|
-
),
|
|
139
|
+
F(() => t.catalogVisible.value)
|
|
140
|
+
), k("defToolbars", t.defToolbars), k(
|
|
131
141
|
"floatingToolbars",
|
|
132
|
-
|
|
133
|
-
),
|
|
134
|
-
const { noPrettier: t, noUploadImg: r } = e, { editorExtensions:
|
|
135
|
-
|
|
142
|
+
F(() => e.floatingToolbars)
|
|
143
|
+
), Ie(e, t)), Jt = (e) => {
|
|
144
|
+
const { noPrettier: t, noUploadImg: r } = e, { editorExtensions: o, editorExtensionsAttrs: n } = R, m = t || o.prettier.prettierInstance, s = t || o.prettier.parserMarkdownInstance, d = r || o.cropper.instance;
|
|
145
|
+
A(() => {
|
|
136
146
|
if (!d) {
|
|
137
|
-
const { js: i = {}, css:
|
|
138
|
-
|
|
139
|
-
...
|
|
147
|
+
const { js: i = {}, css: u = {} } = n.cropper || {};
|
|
148
|
+
_("link", {
|
|
149
|
+
...u,
|
|
140
150
|
rel: "stylesheet",
|
|
141
|
-
href:
|
|
151
|
+
href: o.cropper.css,
|
|
142
152
|
id: P.croppercss
|
|
143
|
-
}),
|
|
153
|
+
}), _("script", {
|
|
144
154
|
...i,
|
|
145
|
-
src:
|
|
155
|
+
src: o.cropper.js,
|
|
146
156
|
id: P.cropperjs
|
|
147
157
|
});
|
|
148
158
|
}
|
|
149
159
|
if (!m) {
|
|
150
|
-
const { standaloneJs: i = {} } =
|
|
151
|
-
|
|
160
|
+
const { standaloneJs: i = {} } = n.prettier || {};
|
|
161
|
+
_("script", {
|
|
152
162
|
...i,
|
|
153
|
-
src:
|
|
163
|
+
src: o.prettier.standaloneJs,
|
|
154
164
|
id: P.prettier
|
|
155
165
|
});
|
|
156
166
|
}
|
|
157
167
|
if (!s) {
|
|
158
|
-
const { parserMarkdownJs: i = {} } =
|
|
159
|
-
|
|
168
|
+
const { parserMarkdownJs: i = {} } = n.prettier || {};
|
|
169
|
+
_("script", {
|
|
160
170
|
...i,
|
|
161
|
-
src:
|
|
171
|
+
src: o.prettier.parserMarkdownJs,
|
|
162
172
|
id: P.prettierMD
|
|
163
173
|
});
|
|
164
174
|
}
|
|
165
175
|
});
|
|
166
176
|
}, Xt = (e, t, r) => {
|
|
167
|
-
const { editorId:
|
|
168
|
-
|
|
169
|
-
v.on(
|
|
170
|
-
name:
|
|
171
|
-
callback: (
|
|
172
|
-
e.onError?.(
|
|
177
|
+
const { editorId: o } = r;
|
|
178
|
+
A(() => {
|
|
179
|
+
v.on(o, {
|
|
180
|
+
name: Y,
|
|
181
|
+
callback: (n) => {
|
|
182
|
+
e.onError?.(n), t.emit("onError", n);
|
|
173
183
|
}
|
|
174
184
|
});
|
|
175
185
|
});
|
|
176
186
|
}, Yt = (e, t, r) => {
|
|
177
|
-
const { editorId:
|
|
187
|
+
const { editorId: o } = r, n = ae({
|
|
178
188
|
pageFullscreen: e.pageFullscreen,
|
|
179
189
|
fullscreen: !1,
|
|
180
190
|
preview: e.preview,
|
|
181
191
|
htmlPreview: e.preview ? !1 : e.htmlPreview,
|
|
182
192
|
previewOnly: !1
|
|
183
|
-
}), m =
|
|
184
|
-
const a = l === void 0 ? !
|
|
185
|
-
switch (
|
|
193
|
+
}), m = ae({ ...n }), s = (u, l) => {
|
|
194
|
+
const a = l === void 0 ? !n[u] : l;
|
|
195
|
+
switch (u) {
|
|
186
196
|
case "preview": {
|
|
187
|
-
|
|
197
|
+
n.htmlPreview = !1, n.previewOnly = !1;
|
|
188
198
|
break;
|
|
189
199
|
}
|
|
190
200
|
case "htmlPreview": {
|
|
191
|
-
|
|
201
|
+
n.preview = !1, n.previewOnly = !1;
|
|
192
202
|
break;
|
|
193
203
|
}
|
|
194
204
|
case "previewOnly": {
|
|
195
|
-
a ? !
|
|
205
|
+
a ? !n.preview && !n.htmlPreview && (n.preview = !0) : (m.preview || (n.preview = !1), m.htmlPreview || (n.htmlPreview = !1));
|
|
196
206
|
break;
|
|
197
207
|
}
|
|
198
208
|
}
|
|
199
|
-
m[
|
|
209
|
+
m[u] = a, n[u] = a;
|
|
200
210
|
};
|
|
201
211
|
let d = "";
|
|
202
212
|
const i = () => {
|
|
203
|
-
|
|
213
|
+
n.pageFullscreen || n.fullscreen ? document.body.style.overflow = "hidden" : document.body.style.overflow = d;
|
|
204
214
|
};
|
|
205
|
-
return w(() => [
|
|
206
|
-
v.on(
|
|
215
|
+
return w(() => [n.pageFullscreen, n.fullscreen], i), A(() => {
|
|
216
|
+
v.on(o, {
|
|
207
217
|
name: Oe,
|
|
208
|
-
callback(
|
|
209
|
-
const a = (
|
|
210
|
-
v.emit(
|
|
218
|
+
callback(u, l) {
|
|
219
|
+
const a = (c) => {
|
|
220
|
+
v.emit(o, le, "image", {
|
|
211
221
|
desc: "",
|
|
212
|
-
urls:
|
|
222
|
+
urls: c
|
|
213
223
|
}), l?.();
|
|
214
224
|
};
|
|
215
|
-
e.onUploadImg ? e.onUploadImg(
|
|
225
|
+
e.onUploadImg ? e.onUploadImg(u, a) : t.emit("onUploadImg", u, a);
|
|
216
226
|
}
|
|
217
227
|
}), d = document.body.style.overflow, i();
|
|
218
|
-
}), [
|
|
228
|
+
}), [n, s];
|
|
219
229
|
}, Qt = (e, t) => {
|
|
220
|
-
const { editorId: r } = t,
|
|
221
|
-
return
|
|
230
|
+
const { editorId: r } = t, o = V(!1);
|
|
231
|
+
return A(() => {
|
|
222
232
|
v.on(r, {
|
|
223
|
-
name:
|
|
224
|
-
callback: (
|
|
225
|
-
|
|
233
|
+
name: ke,
|
|
234
|
+
callback: (n) => {
|
|
235
|
+
n === void 0 ? o.value = !o.value : o.value = n;
|
|
226
236
|
}
|
|
227
237
|
});
|
|
228
|
-
}),
|
|
238
|
+
}), o;
|
|
229
239
|
}, en = (e, t, r) => {
|
|
230
|
-
const { editorId:
|
|
240
|
+
const { editorId: o, catalogVisible: n, setting: m, updateSetting: s, codeRef: d } = r;
|
|
231
241
|
w(
|
|
232
242
|
() => m.pageFullscreen,
|
|
233
|
-
(
|
|
234
|
-
v.emit(
|
|
243
|
+
(u) => {
|
|
244
|
+
v.emit(o, ue, u);
|
|
235
245
|
}
|
|
236
246
|
), w(
|
|
237
247
|
() => m.fullscreen,
|
|
238
|
-
(
|
|
239
|
-
v.emit(
|
|
248
|
+
(u) => {
|
|
249
|
+
v.emit(o, me, u);
|
|
240
250
|
}
|
|
241
251
|
), w(
|
|
242
252
|
() => m.preview,
|
|
243
|
-
(
|
|
244
|
-
v.emit(
|
|
253
|
+
(u) => {
|
|
254
|
+
v.emit(o, fe, u);
|
|
245
255
|
}
|
|
246
256
|
), w(
|
|
247
257
|
() => m.previewOnly,
|
|
248
|
-
(
|
|
249
|
-
v.emit(
|
|
258
|
+
(u) => {
|
|
259
|
+
v.emit(o, he, u);
|
|
250
260
|
}
|
|
251
261
|
), w(
|
|
252
262
|
() => m.htmlPreview,
|
|
253
|
-
(
|
|
254
|
-
v.emit(
|
|
263
|
+
(u) => {
|
|
264
|
+
v.emit(o, pe, u);
|
|
255
265
|
}
|
|
256
|
-
), w(
|
|
257
|
-
v.emit(
|
|
266
|
+
), w(n, (u) => {
|
|
267
|
+
v.emit(o, ge, u);
|
|
258
268
|
});
|
|
259
269
|
const i = {
|
|
260
|
-
on(
|
|
261
|
-
switch (
|
|
270
|
+
on(u, l) {
|
|
271
|
+
switch (u) {
|
|
262
272
|
case "pageFullscreen": {
|
|
263
|
-
v.on(
|
|
273
|
+
v.on(o, {
|
|
264
274
|
name: ue,
|
|
265
275
|
callback(a) {
|
|
266
276
|
l(a);
|
|
@@ -269,7 +279,7 @@ const P = {
|
|
|
269
279
|
break;
|
|
270
280
|
}
|
|
271
281
|
case "fullscreen": {
|
|
272
|
-
v.on(
|
|
282
|
+
v.on(o, {
|
|
273
283
|
name: me,
|
|
274
284
|
callback(a) {
|
|
275
285
|
l(a);
|
|
@@ -278,7 +288,7 @@ const P = {
|
|
|
278
288
|
break;
|
|
279
289
|
}
|
|
280
290
|
case "preview": {
|
|
281
|
-
v.on(
|
|
291
|
+
v.on(o, {
|
|
282
292
|
name: fe,
|
|
283
293
|
callback(a) {
|
|
284
294
|
l(a);
|
|
@@ -287,7 +297,7 @@ const P = {
|
|
|
287
297
|
break;
|
|
288
298
|
}
|
|
289
299
|
case "previewOnly": {
|
|
290
|
-
v.on(
|
|
300
|
+
v.on(o, {
|
|
291
301
|
name: he,
|
|
292
302
|
callback(a) {
|
|
293
303
|
l(a);
|
|
@@ -296,7 +306,7 @@ const P = {
|
|
|
296
306
|
break;
|
|
297
307
|
}
|
|
298
308
|
case "htmlPreview": {
|
|
299
|
-
v.on(
|
|
309
|
+
v.on(o, {
|
|
300
310
|
name: pe,
|
|
301
311
|
callback(a) {
|
|
302
312
|
l(a);
|
|
@@ -305,7 +315,7 @@ const P = {
|
|
|
305
315
|
break;
|
|
306
316
|
}
|
|
307
317
|
case "catalog": {
|
|
308
|
-
v.on(
|
|
318
|
+
v.on(o, {
|
|
309
319
|
name: ge,
|
|
310
320
|
callback(a) {
|
|
311
321
|
l(a);
|
|
@@ -315,35 +325,35 @@ const P = {
|
|
|
315
325
|
}
|
|
316
326
|
}
|
|
317
327
|
},
|
|
318
|
-
togglePageFullscreen(
|
|
319
|
-
s("pageFullscreen",
|
|
328
|
+
togglePageFullscreen(u) {
|
|
329
|
+
s("pageFullscreen", u);
|
|
320
330
|
},
|
|
321
|
-
toggleFullscreen(
|
|
322
|
-
v.emit(
|
|
331
|
+
toggleFullscreen(u) {
|
|
332
|
+
v.emit(o, Be, u);
|
|
323
333
|
},
|
|
324
|
-
togglePreview(
|
|
325
|
-
s("preview",
|
|
334
|
+
togglePreview(u) {
|
|
335
|
+
s("preview", u);
|
|
326
336
|
},
|
|
327
|
-
togglePreviewOnly(
|
|
328
|
-
s("previewOnly",
|
|
337
|
+
togglePreviewOnly(u) {
|
|
338
|
+
s("previewOnly", u);
|
|
329
339
|
},
|
|
330
|
-
toggleHtmlPreview(
|
|
331
|
-
s("htmlPreview",
|
|
340
|
+
toggleHtmlPreview(u) {
|
|
341
|
+
s("htmlPreview", u);
|
|
332
342
|
},
|
|
333
|
-
toggleCatalog(
|
|
334
|
-
v.emit(
|
|
343
|
+
toggleCatalog(u) {
|
|
344
|
+
v.emit(o, ke, u);
|
|
335
345
|
},
|
|
336
346
|
triggerSave() {
|
|
337
|
-
v.emit(
|
|
347
|
+
v.emit(o, Ce);
|
|
338
348
|
},
|
|
339
|
-
insert(
|
|
340
|
-
v.emit(
|
|
349
|
+
insert(u) {
|
|
350
|
+
v.emit(o, le, "universal", { generate: u });
|
|
341
351
|
},
|
|
342
|
-
focus(
|
|
343
|
-
d.value?.focus(
|
|
352
|
+
focus(u) {
|
|
353
|
+
d.value?.focus(u);
|
|
344
354
|
},
|
|
345
355
|
rerender() {
|
|
346
|
-
v.emit(
|
|
356
|
+
v.emit(o, se);
|
|
347
357
|
},
|
|
348
358
|
getSelectedText() {
|
|
349
359
|
return d.value?.getSelectedText();
|
|
@@ -351,11 +361,11 @@ const P = {
|
|
|
351
361
|
resetHistory() {
|
|
352
362
|
d.value?.resetHistory();
|
|
353
363
|
},
|
|
354
|
-
domEventHandlers(
|
|
355
|
-
v.emit(
|
|
364
|
+
domEventHandlers(u) {
|
|
365
|
+
v.emit(o, je, u);
|
|
356
366
|
},
|
|
357
|
-
execCommand(
|
|
358
|
-
v.emit(
|
|
367
|
+
execCommand(u) {
|
|
368
|
+
v.emit(o, le, u);
|
|
359
369
|
},
|
|
360
370
|
getEditorView() {
|
|
361
371
|
return d.value?.getEditorView();
|
|
@@ -363,38 +373,38 @@ const P = {
|
|
|
363
373
|
};
|
|
364
374
|
t.expose(i);
|
|
365
375
|
}, Qe = (e) => {
|
|
366
|
-
const t =
|
|
376
|
+
const t = Ae();
|
|
367
377
|
return e.id || e.editorId || `${h}-${t}`;
|
|
368
378
|
}, et = (e, t, r) => {
|
|
369
|
-
const
|
|
370
|
-
|
|
371
|
-
let
|
|
372
|
-
const
|
|
379
|
+
const o = b("editorId"), n = b("rootRef"), m = b("usedLanguageText"), s = b("setting"), d = () => {
|
|
380
|
+
n.value.querySelectorAll(`#${o} .${h}-preview .${h}-code`).forEach((l) => {
|
|
381
|
+
let a = -1;
|
|
382
|
+
const c = l.querySelector(
|
|
373
383
|
`.${h}-copy-button`
|
|
374
384
|
);
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
const
|
|
378
|
-
let
|
|
379
|
-
ze(e.formatCopiedText(
|
|
380
|
-
|
|
385
|
+
c && (c.onclick = (p) => {
|
|
386
|
+
p.preventDefault(), clearTimeout(a);
|
|
387
|
+
const g = (l.querySelector("input:checked + pre code") || l.querySelector("pre code")).textContent, { text: y, successTips: S, failTips: $ } = m.value.copyCode;
|
|
388
|
+
let C = S;
|
|
389
|
+
ze(e.formatCopiedText(g || "")).catch(() => {
|
|
390
|
+
C = $;
|
|
381
391
|
}).finally(() => {
|
|
382
|
-
|
|
383
|
-
|
|
392
|
+
c.dataset.isIcon ? c.dataset.tips = C : c.innerHTML = C, a = window.setTimeout(() => {
|
|
393
|
+
c.dataset.isIcon ? c.dataset.tips = y : c.innerHTML = y;
|
|
384
394
|
}, 1500);
|
|
385
395
|
});
|
|
386
396
|
});
|
|
387
397
|
});
|
|
388
|
-
},
|
|
389
|
-
|
|
390
|
-
},
|
|
391
|
-
|
|
398
|
+
}, i = () => {
|
|
399
|
+
U(d);
|
|
400
|
+
}, u = (l) => {
|
|
401
|
+
l && U(d);
|
|
392
402
|
};
|
|
393
|
-
w([t, r],
|
|
403
|
+
w([t, r], i), w(() => s.value.preview, u), w(() => s.value.htmlPreview, u), A(d);
|
|
394
404
|
}, tt = (e) => {
|
|
395
|
-
const t =
|
|
396
|
-
let s =
|
|
397
|
-
const d =
|
|
405
|
+
const t = b("editorId"), r = b("theme"), o = b("rootRef"), { editorExtensions: n, editorExtensionsAttrs: m } = R;
|
|
406
|
+
let s = n.echarts.instance;
|
|
407
|
+
const d = ee(-1), i = () => {
|
|
398
408
|
!e.noEcharts && s && (d.value = d.value + 1);
|
|
399
409
|
};
|
|
400
410
|
w(
|
|
@@ -402,11 +412,11 @@ const P = {
|
|
|
402
412
|
() => {
|
|
403
413
|
i();
|
|
404
414
|
}
|
|
405
|
-
),
|
|
415
|
+
), A(() => {
|
|
406
416
|
if (e.noEcharts || s)
|
|
407
417
|
return;
|
|
408
|
-
const f =
|
|
409
|
-
|
|
418
|
+
const f = n.echarts.js;
|
|
419
|
+
_(
|
|
410
420
|
"script",
|
|
411
421
|
{
|
|
412
422
|
...m.echarts?.js,
|
|
@@ -419,30 +429,30 @@ const P = {
|
|
|
419
429
|
"echarts"
|
|
420
430
|
);
|
|
421
431
|
});
|
|
422
|
-
let
|
|
423
|
-
const
|
|
432
|
+
let u, l = [], a = [];
|
|
433
|
+
const c = () => {
|
|
424
434
|
l.forEach((f) => {
|
|
425
435
|
f.dispose();
|
|
426
436
|
}), a.forEach((f) => {
|
|
427
437
|
f.disconnect();
|
|
428
|
-
}), l = [],
|
|
438
|
+
}), l = [], u = [], a = [];
|
|
429
439
|
}, p = () => {
|
|
430
|
-
|
|
431
|
-
|
|
440
|
+
c(), !e.noEcharts && s && (u = Array.from(
|
|
441
|
+
o.value.querySelectorAll(
|
|
432
442
|
`#${t} div.${h}-echarts:not([data-processed])`
|
|
433
443
|
)
|
|
434
|
-
),
|
|
444
|
+
), u.forEach((f) => {
|
|
435
445
|
if (f.dataset.closed === "false")
|
|
436
446
|
return !1;
|
|
437
447
|
try {
|
|
438
448
|
const g = new Function(`return ${f.innerText}`)(), y = s.init(f, r.value);
|
|
439
449
|
y.setOption(g), f.setAttribute("data-processed", ""), l.push(y);
|
|
440
|
-
const
|
|
450
|
+
const S = new ResizeObserver(() => {
|
|
441
451
|
y.resize();
|
|
442
452
|
});
|
|
443
|
-
|
|
453
|
+
S.observe(f), a.push(S);
|
|
444
454
|
} catch (g) {
|
|
445
|
-
v.emit(t,
|
|
455
|
+
v.emit(t, Y, {
|
|
446
456
|
name: "echarts",
|
|
447
457
|
message: g?.message,
|
|
448
458
|
error: g
|
|
@@ -450,17 +460,17 @@ const P = {
|
|
|
450
460
|
}
|
|
451
461
|
}));
|
|
452
462
|
};
|
|
453
|
-
return
|
|
454
|
-
|
|
463
|
+
return te(() => {
|
|
464
|
+
c();
|
|
455
465
|
}), { reRenderEcharts: d, replaceEcharts: p };
|
|
456
466
|
}, nt = (e) => {
|
|
457
|
-
const t =
|
|
458
|
-
return
|
|
459
|
-
e.noHighlight || r.value || (
|
|
467
|
+
const t = b("highlight"), r = ee(R.editorExtensions.highlight.instance);
|
|
468
|
+
return A(() => {
|
|
469
|
+
e.noHighlight || r.value || (_("link", {
|
|
460
470
|
...t.value.css,
|
|
461
471
|
rel: "stylesheet",
|
|
462
472
|
id: P.hlcss
|
|
463
|
-
}),
|
|
473
|
+
}), _(
|
|
464
474
|
"script",
|
|
465
475
|
{
|
|
466
476
|
...t.value.js,
|
|
@@ -474,7 +484,7 @@ const P = {
|
|
|
474
484
|
}), w(
|
|
475
485
|
() => t.value.css,
|
|
476
486
|
() => {
|
|
477
|
-
e.noHighlight ||
|
|
487
|
+
e.noHighlight || R.editorExtensions.highlight.instance || Ue("link", {
|
|
478
488
|
...t.value.css,
|
|
479
489
|
rel: "stylesheet",
|
|
480
490
|
id: P.hlcss
|
|
@@ -482,15 +492,15 @@ const P = {
|
|
|
482
492
|
}
|
|
483
493
|
), r;
|
|
484
494
|
}, ot = (e) => {
|
|
485
|
-
const t =
|
|
486
|
-
return
|
|
495
|
+
const t = ee(R.editorExtensions.katex.instance);
|
|
496
|
+
return A(() => {
|
|
487
497
|
if (e.noKatex || t.value)
|
|
488
498
|
return;
|
|
489
|
-
const { editorExtensions: r, editorExtensionsAttrs:
|
|
490
|
-
|
|
499
|
+
const { editorExtensions: r, editorExtensionsAttrs: o } = R;
|
|
500
|
+
_(
|
|
491
501
|
"script",
|
|
492
502
|
{
|
|
493
|
-
...
|
|
503
|
+
...o.katex?.js,
|
|
494
504
|
src: r.katex.js,
|
|
495
505
|
id: P.katexjs,
|
|
496
506
|
onload() {
|
|
@@ -498,21 +508,21 @@ const P = {
|
|
|
498
508
|
}
|
|
499
509
|
},
|
|
500
510
|
"katex"
|
|
501
|
-
),
|
|
502
|
-
...
|
|
511
|
+
), _("link", {
|
|
512
|
+
...o.katex?.css,
|
|
503
513
|
rel: "stylesheet",
|
|
504
514
|
href: r.katex.css,
|
|
505
515
|
id: P.katexcss
|
|
506
516
|
});
|
|
507
517
|
}), t;
|
|
508
|
-
},
|
|
518
|
+
}, X = new Xe({
|
|
509
519
|
max: 1e3,
|
|
510
520
|
// 缓存10分钟
|
|
511
521
|
ttl: 6e5
|
|
512
522
|
}), at = (e) => {
|
|
513
|
-
const t =
|
|
514
|
-
let d =
|
|
515
|
-
const i =
|
|
523
|
+
const t = b("editorId"), r = b("theme"), o = b("rootRef"), { editorExtensions: n, editorExtensionsAttrs: m, mermaidConfig: s } = R;
|
|
524
|
+
let d = n.mermaid.instance;
|
|
525
|
+
const i = ee(-1), u = () => {
|
|
516
526
|
!e.noMermaid && d && (d.initialize(
|
|
517
527
|
s({
|
|
518
528
|
startOnLoad: !1,
|
|
@@ -523,13 +533,13 @@ const P = {
|
|
|
523
533
|
return w(
|
|
524
534
|
() => r.value,
|
|
525
535
|
() => {
|
|
526
|
-
|
|
536
|
+
X.clear(), u();
|
|
527
537
|
}
|
|
528
|
-
),
|
|
538
|
+
), A(() => {
|
|
529
539
|
if (e.noMermaid || d)
|
|
530
540
|
return;
|
|
531
|
-
const a =
|
|
532
|
-
/\.mjs/.test(a) ? (
|
|
541
|
+
const a = n.mermaid.js;
|
|
542
|
+
/\.mjs/.test(a) ? (_("link", {
|
|
533
543
|
...m.mermaid?.js,
|
|
534
544
|
rel: "modulepreload",
|
|
535
545
|
href: a,
|
|
@@ -538,54 +548,54 @@ const P = {
|
|
|
538
548
|
/* @vite-ignore */
|
|
539
549
|
/* webpackIgnore: true */
|
|
540
550
|
a
|
|
541
|
-
).then((
|
|
542
|
-
d =
|
|
543
|
-
}).catch((
|
|
544
|
-
v.emit(t,
|
|
551
|
+
).then((c) => {
|
|
552
|
+
d = c.default, u();
|
|
553
|
+
}).catch((c) => {
|
|
554
|
+
v.emit(t, Y, {
|
|
545
555
|
name: "mermaid",
|
|
546
|
-
message: `Failed to load mermaid module: ${
|
|
547
|
-
error:
|
|
556
|
+
message: `Failed to load mermaid module: ${c.message}`,
|
|
557
|
+
error: c
|
|
548
558
|
});
|
|
549
|
-
})) :
|
|
559
|
+
})) : _(
|
|
550
560
|
"script",
|
|
551
561
|
{
|
|
552
562
|
...m.mermaid?.js,
|
|
553
563
|
src: a,
|
|
554
564
|
id: P.mermaid,
|
|
555
565
|
onload() {
|
|
556
|
-
d = window.mermaid,
|
|
566
|
+
d = window.mermaid, u();
|
|
557
567
|
}
|
|
558
568
|
},
|
|
559
569
|
"mermaid"
|
|
560
570
|
);
|
|
561
571
|
}), { reRenderRef: i, replaceMermaid: async () => {
|
|
562
572
|
if (!e.noMermaid && d) {
|
|
563
|
-
const a =
|
|
573
|
+
const a = o.value.querySelectorAll(
|
|
564
574
|
`div.${h}-mermaid`
|
|
565
|
-
),
|
|
566
|
-
|
|
575
|
+
), c = document.createElement("div"), p = document.body.offsetWidth > 1366 ? document.body.offsetWidth : 1366, f = document.body.offsetHeight > 768 ? document.body.offsetHeight : 768;
|
|
576
|
+
c.style.width = p + "px", c.style.height = f + "px", c.style.position = "fixed", c.style.zIndex = "-10000", c.style.top = "-10000";
|
|
567
577
|
let g = a.length;
|
|
568
|
-
g > 0 && document.body.appendChild(
|
|
569
|
-
Array.from(a).map((y) => (async (
|
|
570
|
-
if (
|
|
578
|
+
g > 0 && document.body.appendChild(c), await Promise.allSettled(
|
|
579
|
+
Array.from(a).map((y) => (async ($) => {
|
|
580
|
+
if ($.dataset.closed === "false")
|
|
571
581
|
return !1;
|
|
572
|
-
const
|
|
573
|
-
let
|
|
574
|
-
if (!
|
|
575
|
-
const
|
|
576
|
-
let
|
|
582
|
+
const C = $.innerText;
|
|
583
|
+
let M = X.get(C);
|
|
584
|
+
if (!M) {
|
|
585
|
+
const T = re();
|
|
586
|
+
let E = { svg: "" };
|
|
577
587
|
try {
|
|
578
|
-
|
|
588
|
+
E = await d.render(T, C, c), M = await e.sanitizeMermaid(E.svg);
|
|
579
589
|
const I = document.createElement("p");
|
|
580
|
-
I.className = `${h}-mermaid`, I.setAttribute("data-processed", ""), I.innerHTML =
|
|
590
|
+
I.className = `${h}-mermaid`, I.setAttribute("data-processed", ""), I.innerHTML = M, I.children[0]?.removeAttribute("height"), X.set(C, I.innerHTML), $.dataset.line !== void 0 && (I.dataset.line = $.dataset.line), $.replaceWith(I);
|
|
581
591
|
} catch (I) {
|
|
582
|
-
v.emit(t,
|
|
592
|
+
v.emit(t, Y, {
|
|
583
593
|
name: "mermaid",
|
|
584
594
|
message: I.message,
|
|
585
595
|
error: I
|
|
586
596
|
});
|
|
587
597
|
}
|
|
588
|
-
--g === 0 &&
|
|
598
|
+
--g === 0 && c.remove();
|
|
589
599
|
}
|
|
590
600
|
})(y))
|
|
591
601
|
);
|
|
@@ -593,187 +603,187 @@ const P = {
|
|
|
593
603
|
} };
|
|
594
604
|
}, rt = (e, t) => {
|
|
595
605
|
t = t || {};
|
|
596
|
-
const r = 3,
|
|
606
|
+
const r = 3, o = t.marker || "!", n = o.charCodeAt(0), m = o.length;
|
|
597
607
|
let s = "", d = "";
|
|
598
|
-
const i = (l, a,
|
|
608
|
+
const i = (l, a, c, p, f) => {
|
|
599
609
|
const g = l[a];
|
|
600
610
|
return g.type === "admonition_open" ? l[a].attrPush([
|
|
601
611
|
"class",
|
|
602
612
|
`${h}-admonition ${h}-admonition-${g.info}`
|
|
603
|
-
]) : g.type === "admonition_title_open" && l[a].attrPush(["class", `${h}-admonition-title`]), f.renderToken(l, a,
|
|
604
|
-
},
|
|
613
|
+
]) : g.type === "admonition_title_open" && l[a].attrPush(["class", `${h}-admonition-title`]), f.renderToken(l, a, c);
|
|
614
|
+
}, u = (l) => {
|
|
605
615
|
const a = l.trim().split(" ", 2);
|
|
606
616
|
d = "", s = a[0], a.length > 1 && (d = l.substring(s.length + 2));
|
|
607
617
|
};
|
|
608
618
|
e.block.ruler.before(
|
|
609
619
|
"code",
|
|
610
620
|
"admonition",
|
|
611
|
-
(l, a,
|
|
612
|
-
let f, g, y,
|
|
613
|
-
if (
|
|
621
|
+
(l, a, c, p) => {
|
|
622
|
+
let f, g, y, S = !1, $ = l.bMarks[a] + l.tShift[a], C = l.eMarks[a];
|
|
623
|
+
if (n !== l.src.charCodeAt($))
|
|
614
624
|
return !1;
|
|
615
|
-
for (f =
|
|
625
|
+
for (f = $ + 1; f <= C && o[(f - $) % m] === l.src[f]; f++)
|
|
616
626
|
;
|
|
617
|
-
const
|
|
618
|
-
if (
|
|
627
|
+
const M = Math.floor((f - $) / m);
|
|
628
|
+
if (M !== r)
|
|
619
629
|
return !1;
|
|
620
|
-
f -= (f -
|
|
621
|
-
const
|
|
622
|
-
if (
|
|
630
|
+
f -= (f - $) % m;
|
|
631
|
+
const T = l.src.slice($, f), E = l.src.slice(f, C);
|
|
632
|
+
if (u(E), p)
|
|
623
633
|
return !0;
|
|
624
|
-
for (g = a; g++, !(g >=
|
|
625
|
-
if (
|
|
626
|
-
for (f =
|
|
634
|
+
for (g = a; g++, !(g >= c || ($ = l.bMarks[g] + l.tShift[g], C = l.eMarks[g], $ < C && l.sCount[g] < l.blkIndent)); )
|
|
635
|
+
if (n === l.src.charCodeAt($) && !(l.sCount[g] - l.blkIndent >= 4)) {
|
|
636
|
+
for (f = $ + 1; f <= C && o[(f - $) % m] === l.src[f]; f++)
|
|
627
637
|
;
|
|
628
|
-
if (!(Math.floor((f -
|
|
629
|
-
|
|
638
|
+
if (!(Math.floor((f - $) / m) < M) && (f -= (f - $) % m, f = l.skipSpaces(f), !(f < C))) {
|
|
639
|
+
S = !0;
|
|
630
640
|
break;
|
|
631
641
|
}
|
|
632
642
|
}
|
|
633
643
|
const I = l.parentType, N = l.lineMax;
|
|
634
|
-
return l.parentType = "root", l.lineMax = g, y = l.push("admonition_open", "div", 1), y.markup =
|
|
644
|
+
return l.parentType = "root", l.lineMax = g, y = l.push("admonition_open", "div", 1), y.markup = T, y.block = !0, y.info = s, y.map = [a, g], d && (y = l.push("admonition_title_open", "p", 1), y.markup = T + " " + s, y.map = [a, g], y = l.push("inline", "", 0), y.content = d, y.map = [a, l.line - 1], y.children = [], y = l.push("admonition_title_close", "p", -1), y.markup = T + " " + s), l.md.block.tokenize(l, a + 1, g), y = l.push("admonition_close", "div", -1), y.markup = l.src.slice($, f), y.block = !0, l.parentType = I, l.lineMax = N, l.line = g + (S ? 1 : 0), !0;
|
|
635
645
|
},
|
|
636
646
|
{
|
|
637
647
|
alt: ["paragraph", "reference", "blockquote", "list"]
|
|
638
648
|
}
|
|
639
649
|
), e.renderer.rules.admonition_open = i, e.renderer.rules.admonition_title_open = i, e.renderer.rules.admonition_title_close = i, e.renderer.rules.admonition_close = i;
|
|
640
|
-
},
|
|
650
|
+
}, Q = (e, t) => {
|
|
641
651
|
const r = e.attrs ? e.attrs.slice() : [];
|
|
642
|
-
return t.forEach((
|
|
643
|
-
const
|
|
644
|
-
|
|
652
|
+
return t.forEach((o) => {
|
|
653
|
+
const n = e.attrIndex(o[0]);
|
|
654
|
+
n < 0 ? r.push(o) : (r[n] = r[n].slice(), r[n][1] += ` ${o[1]}`);
|
|
645
655
|
}), r;
|
|
646
656
|
}, lt = (e, t) => {
|
|
647
|
-
const r = e.renderer.rules.fence,
|
|
648
|
-
const
|
|
657
|
+
const r = e.renderer.rules.fence, o = e.utils.unescapeAll, n = /\[(\w*)(?::([\w ]*))?\]/, m = /::(open|close)/, s = (a) => a.info ? o(a.info).trim() : "", d = (a) => {
|
|
658
|
+
const c = s(a), [p = null, f = ""] = (n.exec(c) || []).slice(1);
|
|
649
659
|
return [p, f];
|
|
650
660
|
}, i = (a) => {
|
|
651
|
-
const
|
|
652
|
-
return
|
|
653
|
-
},
|
|
654
|
-
const
|
|
655
|
-
`).length < t.autoFoldThreshold, f =
|
|
661
|
+
const c = s(a);
|
|
662
|
+
return c ? c.split(/(\s+)/g)[0] : "";
|
|
663
|
+
}, u = (a) => {
|
|
664
|
+
const c = a.info.match(m) || [], p = c[1] === "open" || c[1] !== "close" && t.codeFoldable && a.content.trim().split(`
|
|
665
|
+
`).length < t.autoFoldThreshold, f = c[1] || t.codeFoldable ? "details" : "div", g = c[1] || t.codeFoldable ? "summary" : "div";
|
|
656
666
|
return { open: p, tagContainer: f, tagHeader: g };
|
|
657
|
-
}, l = (a,
|
|
658
|
-
if (a[
|
|
667
|
+
}, l = (a, c, p, f, g) => {
|
|
668
|
+
if (a[c].hidden)
|
|
659
669
|
return "";
|
|
660
|
-
const y = t.usedLanguageTextRef.value?.copyCode.text,
|
|
661
|
-
if (
|
|
662
|
-
const { open:
|
|
663
|
-
|
|
664
|
-
const
|
|
665
|
-
attrs:
|
|
670
|
+
const y = t.usedLanguageTextRef.value?.copyCode.text, S = t.customIconRef.value.copy || y, $ = !!t.customIconRef.value.copy, C = `<span class="${h}-collapse-tips">${Ge("collapse-tips", t.customIconRef.value)}</span>`, [M] = d(a[c]);
|
|
671
|
+
if (M === null) {
|
|
672
|
+
const { open: H, tagContainer: x, tagHeader: Z } = u(a[c]), D = [["class", `${h}-code`]];
|
|
673
|
+
H && D.push(["open", ""]);
|
|
674
|
+
const xe = {
|
|
675
|
+
attrs: Q(a[c], D)
|
|
666
676
|
};
|
|
667
|
-
a[
|
|
668
|
-
const
|
|
677
|
+
a[c].info = a[c].info.replace(m, "");
|
|
678
|
+
const Fe = r(a, c, p, f, g);
|
|
669
679
|
return `
|
|
670
|
-
<${
|
|
671
|
-
<${
|
|
680
|
+
<${x} ${g.renderAttrs(xe)}>
|
|
681
|
+
<${Z} class="${h}-code-head">
|
|
672
682
|
<div class="${h}-code-flag"><span></span><span></span><span></span></div>
|
|
673
683
|
<div class="${h}-code-action">
|
|
674
|
-
<span class="${h}-code-lang">${e.utils.escapeHtml(a[
|
|
675
|
-
<span class="${h}-copy-button" data-tips="${y}"${
|
|
676
|
-
${t.extraTools instanceof Function ? t.extraTools({ lang: a[
|
|
677
|
-
${
|
|
684
|
+
<span class="${h}-code-lang">${e.utils.escapeHtml(a[c].info.trim())}</span>
|
|
685
|
+
<span class="${h}-copy-button" data-tips="${y}"${$ ? " data-is-icon=true" : ""}>${S}</span>
|
|
686
|
+
${t.extraTools instanceof Function ? t.extraTools({ lang: a[c].info.trim() }) : t.extraTools || ""}
|
|
687
|
+
${x === "details" ? C : ""}
|
|
678
688
|
</div>
|
|
679
|
-
</${
|
|
680
|
-
${
|
|
681
|
-
</${
|
|
689
|
+
</${Z}>
|
|
690
|
+
${Fe}
|
|
691
|
+
</${x}>
|
|
682
692
|
`;
|
|
683
693
|
}
|
|
684
|
-
let
|
|
685
|
-
const { open:
|
|
686
|
-
|
|
687
|
-
const
|
|
688
|
-
attrs:
|
|
694
|
+
let T, E, I, N, G = "", j = "", z = "";
|
|
695
|
+
const { open: K, tagContainer: W, tagHeader: q } = u(a[c]), L = [["class", `${h}-code`]];
|
|
696
|
+
K && L.push(["open", ""]);
|
|
697
|
+
const B = {
|
|
698
|
+
attrs: Q(a[c], L)
|
|
689
699
|
};
|
|
690
|
-
for (let
|
|
691
|
-
|
|
692
|
-
const
|
|
693
|
-
N =
|
|
700
|
+
for (let H = c; H < a.length && (T = a[H], [E, I] = d(T), E === M); H++) {
|
|
701
|
+
T.info = T.info.replace(n, "").replace(m, ""), T.hidden = !0;
|
|
702
|
+
const x = `${h}-codetab-${t.editorId}-${c}-${H - c}`;
|
|
703
|
+
N = H - c > 0 ? "" : "checked", G += `
|
|
694
704
|
<li>
|
|
695
705
|
<input
|
|
696
706
|
type="radio"
|
|
697
|
-
id="label-${h}-codetab-label-1-${t.editorId}-${
|
|
698
|
-
name="${h}-codetab-label-${t.editorId}-${
|
|
699
|
-
class="${
|
|
707
|
+
id="label-${h}-codetab-label-1-${t.editorId}-${c}-${H - c}"
|
|
708
|
+
name="${h}-codetab-label-${t.editorId}-${c}"
|
|
709
|
+
class="${x}"
|
|
700
710
|
${N}
|
|
701
711
|
>
|
|
702
712
|
<label
|
|
703
|
-
for="label-${h}-codetab-label-1-${t.editorId}-${
|
|
704
|
-
onclick="this.getRootNode().querySelectorAll('.${
|
|
713
|
+
for="label-${h}-codetab-label-1-${t.editorId}-${c}-${H - c}"
|
|
714
|
+
onclick="this.getRootNode().querySelectorAll('.${x}').forEach(e => e.click())"
|
|
705
715
|
>
|
|
706
|
-
${e.utils.escapeHtml(I || i(
|
|
716
|
+
${e.utils.escapeHtml(I || i(T))}
|
|
707
717
|
</label>
|
|
708
|
-
</li>`,
|
|
718
|
+
</li>`, j += `
|
|
709
719
|
<div role="tabpanel">
|
|
710
720
|
<input
|
|
711
721
|
type="radio"
|
|
712
|
-
name="${h}-codetab-pre-${t.editorId}-${
|
|
713
|
-
class="${
|
|
722
|
+
name="${h}-codetab-pre-${t.editorId}-${c}"
|
|
723
|
+
class="${x}"
|
|
714
724
|
${N}
|
|
715
725
|
role="presentation">
|
|
716
|
-
${r(a,
|
|
717
|
-
</div>`,
|
|
726
|
+
${r(a, H, p, f, g)}
|
|
727
|
+
</div>`, z += `
|
|
718
728
|
<input
|
|
719
729
|
type="radio"
|
|
720
|
-
name="${h}-codetab-lang-${t.editorId}-${
|
|
721
|
-
class="${
|
|
730
|
+
name="${h}-codetab-lang-${t.editorId}-${c}"
|
|
731
|
+
class="${x}"
|
|
722
732
|
${N}
|
|
723
733
|
role="presentation">
|
|
724
|
-
<span class=${h}-code-lang role="note">${e.utils.escapeHtml(i(
|
|
734
|
+
<span class=${h}-code-lang role="note">${e.utils.escapeHtml(i(T))}</span>`;
|
|
725
735
|
}
|
|
726
736
|
return `
|
|
727
|
-
<${
|
|
728
|
-
<${
|
|
737
|
+
<${W} ${g.renderAttrs(B)}>
|
|
738
|
+
<${q} class="${h}-code-head">
|
|
729
739
|
<div class="${h}-code-flag">
|
|
730
|
-
<ul class="${h}-codetab-label" role="tablist">${
|
|
740
|
+
<ul class="${h}-codetab-label" role="tablist">${G}</ul>
|
|
731
741
|
</div>
|
|
732
742
|
<div class="${h}-code-action">
|
|
733
|
-
<span class="${h}-codetab-lang">${
|
|
734
|
-
<span class="${h}-copy-button" data-tips="${y}"${
|
|
735
|
-
${t.extraTools instanceof Function ? t.extraTools({ lang: a[
|
|
736
|
-
${
|
|
743
|
+
<span class="${h}-codetab-lang">${z}</span>
|
|
744
|
+
<span class="${h}-copy-button" data-tips="${y}"${$ ? " data-is-icon=true" : ""}>${S}</span>
|
|
745
|
+
${t.extraTools instanceof Function ? t.extraTools({ lang: a[c].info.trim() }) : t.extraTools || ""}
|
|
746
|
+
${W === "details" ? C : ""}
|
|
737
747
|
</div>
|
|
738
|
-
</${
|
|
739
|
-
${
|
|
740
|
-
</${
|
|
748
|
+
</${q}>
|
|
749
|
+
${j}
|
|
750
|
+
</${W}>
|
|
741
751
|
`;
|
|
742
752
|
};
|
|
743
753
|
e.renderer.rules.fence = l, e.renderer.rules.code_block = l;
|
|
744
754
|
}, it = (e, t) => {
|
|
745
755
|
const r = e.renderer.rules.fence.bind(e.renderer.rules);
|
|
746
|
-
e.renderer.rules.fence = (
|
|
747
|
-
const i = n
|
|
756
|
+
e.renderer.rules.fence = (o, n, m, s, d) => {
|
|
757
|
+
const i = o[n], u = i.content.trim();
|
|
748
758
|
if (i.info === "echarts") {
|
|
749
759
|
if (i.attrSet("class", `${h}-echarts`), i.attrSet("data-echarts-theme", t.themeRef.value), i.map && i.level === 0) {
|
|
750
|
-
const l = i.map[1] - 1,
|
|
751
|
-
i.attrSet("data-closed", `${
|
|
760
|
+
const l = i.map[1] - 1, c = !!s.srcLines[l]?.trim()?.startsWith("```");
|
|
761
|
+
i.attrSet("data-closed", `${c}`), i.attrSet("data-line", String(i.map[0]));
|
|
752
762
|
}
|
|
753
|
-
return `<div ${d.renderAttrs(i)} style="width: 100%; aspect-ratio: 4 / 3;">${e.utils.escapeHtml(
|
|
763
|
+
return `<div ${d.renderAttrs(i)} style="width: 100%; aspect-ratio: 4 / 3;">${e.utils.escapeHtml(u)}</div>`;
|
|
754
764
|
}
|
|
755
|
-
return r(
|
|
765
|
+
return r(o, n, m, s, d);
|
|
756
766
|
};
|
|
757
767
|
}, st = (e, t) => {
|
|
758
|
-
e.renderer.rules.heading_open = (r,
|
|
759
|
-
const
|
|
768
|
+
e.renderer.rules.heading_open = (r, o) => {
|
|
769
|
+
const n = r[o], m = r[o + 1].children?.reduce((d, i) => d + (["text", "code_inline", "math_inline"].includes(i.type) && i.content || ""), "") || "", s = n.markup.length;
|
|
760
770
|
return t.headsRef.value.push({
|
|
761
771
|
text: m,
|
|
762
772
|
level: s,
|
|
763
|
-
line:
|
|
764
|
-
currentToken:
|
|
765
|
-
nextToken: r[
|
|
766
|
-
}),
|
|
773
|
+
line: n.map[0],
|
|
774
|
+
currentToken: n,
|
|
775
|
+
nextToken: r[o + 1]
|
|
776
|
+
}), n.map && n.level === 0 && n.attrSet(
|
|
767
777
|
"id",
|
|
768
778
|
t.mdHeadingId({
|
|
769
779
|
text: m,
|
|
770
780
|
level: s,
|
|
771
781
|
index: t.headsRef.value.length,
|
|
772
|
-
currentToken:
|
|
773
|
-
nextToken: r[
|
|
782
|
+
currentToken: n,
|
|
783
|
+
nextToken: r[o + 1]
|
|
774
784
|
})
|
|
775
|
-
), e.renderer.renderToken(r,
|
|
776
|
-
}, e.renderer.rules.heading_close = (r,
|
|
785
|
+
), e.renderer.renderToken(r, o, t);
|
|
786
|
+
}, e.renderer.rules.heading_close = (r, o, n, m, s) => s.renderToken(r, o, n);
|
|
777
787
|
}, ye = {
|
|
778
788
|
block: [
|
|
779
789
|
{ open: "$$", close: "$$" },
|
|
@@ -786,74 +796,74 @@ const P = {
|
|
|
786
796
|
{ open: "\\(", close: "\\)" }
|
|
787
797
|
]
|
|
788
798
|
}, ct = (e) => (t, r) => {
|
|
789
|
-
const
|
|
790
|
-
let
|
|
791
|
-
for (const d of
|
|
799
|
+
const o = e.delimiters;
|
|
800
|
+
let n, m, s;
|
|
801
|
+
for (const d of o)
|
|
792
802
|
if (t.src.startsWith(d.open, t.pos)) {
|
|
793
803
|
const i = t.pos + d.open.length;
|
|
794
|
-
for (
|
|
795
|
-
for (s =
|
|
804
|
+
for (n = i; (n = t.src.indexOf(d.close, n)) !== -1; ) {
|
|
805
|
+
for (s = n - 1; t.src[s] === "\\"; )
|
|
796
806
|
s -= 1;
|
|
797
|
-
if ((
|
|
807
|
+
if ((n - s) % 2 === 1)
|
|
798
808
|
break;
|
|
799
|
-
|
|
809
|
+
n += d.close.length;
|
|
800
810
|
}
|
|
801
|
-
if (
|
|
811
|
+
if (n === -1)
|
|
802
812
|
return r || (t.pending += d.open), t.pos = i, !0;
|
|
803
|
-
if (
|
|
813
|
+
if (n - i === 0)
|
|
804
814
|
return r || (t.pending += d.open + d.close), t.pos = i + d.close.length, !0;
|
|
805
815
|
if (!r) {
|
|
806
|
-
const
|
|
807
|
-
m = t.push("math_inline", "math", 0), m.markup = d.open, m.content =
|
|
816
|
+
const u = t.src.slice(i, n);
|
|
817
|
+
m = t.push("math_inline", "math", 0), m.markup = d.open, m.content = u;
|
|
808
818
|
}
|
|
809
|
-
return t.pos =
|
|
819
|
+
return t.pos = n + d.close.length, !0;
|
|
810
820
|
}
|
|
811
821
|
return !1;
|
|
812
|
-
}, dt = (e) => (t, r,
|
|
822
|
+
}, dt = (e) => (t, r, o, n) => {
|
|
813
823
|
const m = e.delimiters;
|
|
814
|
-
let s, d, i,
|
|
824
|
+
let s, d, i, u, l = !1, a = t.bMarks[r] + t.tShift[r], c = t.eMarks[r];
|
|
815
825
|
for (const p of m)
|
|
816
|
-
if (t.src.slice(a, a + p.open.length) === p.open && t.src.slice(
|
|
817
|
-
if (a += p.open.length, s = t.src.slice(a,
|
|
826
|
+
if (t.src.slice(a, a + p.open.length) === p.open && t.src.slice(c - p.close.length, c) === p.close) {
|
|
827
|
+
if (a += p.open.length, s = t.src.slice(a, c), n)
|
|
818
828
|
return !0;
|
|
819
|
-
for (s.trim().slice(-p.close.length) === p.close && (s = s.trim().slice(0, -p.close.length), l = !0), i = r; !l && (i++, !(i >=
|
|
820
|
-
t.src.slice(a,
|
|
829
|
+
for (s.trim().slice(-p.close.length) === p.close && (s = s.trim().slice(0, -p.close.length), l = !0), i = r; !l && (i++, !(i >= o || (a = t.bMarks[i] + t.tShift[i], c = t.eMarks[i], a < c && t.tShift[i] < t.blkIndent))); )
|
|
830
|
+
t.src.slice(a, c).trim().slice(-p.close.length) === p.close && (u = t.src.slice(0, c).lastIndexOf(p.close), d = t.src.slice(a, u), l = !0);
|
|
821
831
|
t.line = i + 1;
|
|
822
832
|
const f = t.push("math_block", "math", 0);
|
|
823
833
|
return f.block = !0, f.content = (s && s.trim() ? s + `
|
|
824
834
|
` : "") + t.getLines(r + 1, i, t.tShift[r], !0) + (d && d.trim() ? d : ""), f.map = [r, t.line], f.markup = p.open, !0;
|
|
825
835
|
}
|
|
826
836
|
return !1;
|
|
827
|
-
}, ut = (e, { katexRef: t, inlineDelimiters: r, blockDelimiters:
|
|
828
|
-
const
|
|
829
|
-
const a = s[d],
|
|
830
|
-
attrs:
|
|
837
|
+
}, ut = (e, { katexRef: t, inlineDelimiters: r, blockDelimiters: o }) => {
|
|
838
|
+
const n = (s, d, i, u, l) => {
|
|
839
|
+
const a = s[d], c = {
|
|
840
|
+
attrs: Q(a, [["class", `${h}-katex-inline`]])
|
|
831
841
|
};
|
|
832
842
|
if (t.value) {
|
|
833
843
|
const p = t.value.renderToString(
|
|
834
844
|
a.content,
|
|
835
|
-
|
|
845
|
+
R.katexConfig({
|
|
836
846
|
throwOnError: !1
|
|
837
847
|
})
|
|
838
848
|
);
|
|
839
|
-
return `<span ${l.renderAttrs(
|
|
849
|
+
return `<span ${l.renderAttrs(c)} data-processed>${p}</span>`;
|
|
840
850
|
} else
|
|
841
|
-
return `<span ${l.renderAttrs(
|
|
842
|
-
}, m = (s, d, i,
|
|
843
|
-
const a = s[d],
|
|
844
|
-
attrs:
|
|
851
|
+
return `<span ${l.renderAttrs(c)}>${a.content}</span>`;
|
|
852
|
+
}, m = (s, d, i, u, l) => {
|
|
853
|
+
const a = s[d], c = {
|
|
854
|
+
attrs: Q(a, [["class", `${h}-katex-block`]])
|
|
845
855
|
};
|
|
846
856
|
if (t.value) {
|
|
847
857
|
const p = t.value.renderToString(
|
|
848
858
|
a.content,
|
|
849
|
-
|
|
859
|
+
R.katexConfig({
|
|
850
860
|
throwOnError: !1,
|
|
851
861
|
displayMode: !0
|
|
852
862
|
})
|
|
853
863
|
);
|
|
854
|
-
return `<p ${l.renderAttrs(
|
|
864
|
+
return `<p ${l.renderAttrs(c)} data-processed>${p}</p>`;
|
|
855
865
|
} else
|
|
856
|
-
return `<p ${l.renderAttrs(
|
|
866
|
+
return `<p ${l.renderAttrs(c)}>${a.content}</p>`;
|
|
857
867
|
};
|
|
858
868
|
e.inline.ruler.before(
|
|
859
869
|
"escape",
|
|
@@ -865,34 +875,34 @@ const P = {
|
|
|
865
875
|
"blockquote",
|
|
866
876
|
"math_block",
|
|
867
877
|
dt({
|
|
868
|
-
delimiters:
|
|
878
|
+
delimiters: o || ye.block
|
|
869
879
|
}),
|
|
870
880
|
{
|
|
871
881
|
alt: ["paragraph", "reference", "blockquote", "list"]
|
|
872
882
|
}
|
|
873
|
-
), e.renderer.rules.math_inline =
|
|
883
|
+
), e.renderer.rules.math_inline = n, e.renderer.rules.math_block = m;
|
|
874
884
|
}, mt = (e, t) => {
|
|
875
885
|
const r = e.renderer.rules.fence.bind(e.renderer.rules);
|
|
876
|
-
e.renderer.rules.fence = (
|
|
877
|
-
const i = n
|
|
886
|
+
e.renderer.rules.fence = (o, n, m, s, d) => {
|
|
887
|
+
const i = o[n], u = i.content.trim();
|
|
878
888
|
if (i.info === "mermaid") {
|
|
879
889
|
if (i.attrSet("class", `${h}-mermaid`), i.attrSet("data-mermaid-theme", t.themeRef.value), i.map && i.level === 0) {
|
|
880
890
|
const a = i.map[1] - 1, p = !!s.srcLines[a]?.trim()?.startsWith("```");
|
|
881
891
|
i.attrSet("data-closed", `${p}`), i.attrSet("data-line", String(i.map[0]));
|
|
882
892
|
}
|
|
883
|
-
const l =
|
|
884
|
-
return l ? (i.attrSet("data-processed", ""), `<p ${d.renderAttrs(i)}>${l}</p>`) : `<div ${d.renderAttrs(i)}>${e.utils.escapeHtml(
|
|
893
|
+
const l = X.get(u);
|
|
894
|
+
return l ? (i.attrSet("data-processed", ""), `<p ${d.renderAttrs(i)}>${l}</p>`) : `<div ${d.renderAttrs(i)}>${e.utils.escapeHtml(u)}</div>`;
|
|
885
895
|
}
|
|
886
|
-
return r(
|
|
896
|
+
return r(o, n, m, s, d);
|
|
887
897
|
};
|
|
888
898
|
}, be = (e, t, r) => {
|
|
889
|
-
const
|
|
890
|
-
|
|
899
|
+
const o = e.attrIndex(t), n = [t, r];
|
|
900
|
+
o < 0 ? e.attrPush(n) : (e.attrs = e.attrs || [], e.attrs[o] = n);
|
|
891
901
|
}, ft = (e) => e.type === "inline", ht = (e) => e.type === "paragraph_open", pt = (e) => e.type === "list_item_open", gt = (e) => e.content.indexOf("[ ] ") === 0 || e.content.indexOf("[x] ") === 0 || e.content.indexOf("[X] ") === 0, vt = (e, t) => ft(e[t]) && ht(e[t - 1]) && pt(e[t - 2]) && gt(e[t]), yt = (e, t) => {
|
|
892
902
|
const r = e[t].level - 1;
|
|
893
|
-
for (let
|
|
894
|
-
if (e[
|
|
895
|
-
return
|
|
903
|
+
for (let o = t - 1; o >= 0; o--)
|
|
904
|
+
if (e[o].level === r)
|
|
905
|
+
return o;
|
|
896
906
|
return -1;
|
|
897
907
|
}, bt = (e) => {
|
|
898
908
|
const t = new e("html_inline", "", 0);
|
|
@@ -901,48 +911,48 @@ const P = {
|
|
|
901
911
|
const t = new e("html_inline", "", 0);
|
|
902
912
|
return t.content = "</label>", t;
|
|
903
913
|
}, wt = (e, t, r) => {
|
|
904
|
-
const
|
|
905
|
-
return
|
|
914
|
+
const o = new r("html_inline", "", 0);
|
|
915
|
+
return o.content = '<label class="task-list-item-label" for="' + t + '">' + e + "</label>", o.attrs = [["for", t]], o;
|
|
906
916
|
}, kt = (e, t, r) => {
|
|
907
|
-
const
|
|
908
|
-
return e.content.indexOf("[ ] ") === 0 ?
|
|
917
|
+
const o = new t("html_inline", "", 0), n = r.enabled ? " " : ' disabled="" ';
|
|
918
|
+
return e.content.indexOf("[ ] ") === 0 ? o.content = '<input class="task-list-item-checkbox"' + n + 'type="checkbox">' : (e.content.indexOf("[x] ") === 0 || e.content.indexOf("[X] ") === 0) && (o.content = '<input class="task-list-item-checkbox" checked=""' + n + 'type="checkbox">'), o;
|
|
909
919
|
}, Ct = (e, t, r) => {
|
|
910
920
|
if (e.children = e.children || [], e.children.unshift(kt(e, t, r)), e.children[1].content = e.children[1].content.slice(3), e.content = e.content.slice(3), r.label)
|
|
911
921
|
if (r.labelAfter) {
|
|
912
922
|
e.children.pop();
|
|
913
|
-
const
|
|
914
|
-
e.children[0].content = e.children[0].content.slice(0, -1) + ' id="' +
|
|
923
|
+
const o = "task-item-" + Math.ceil(Math.random() * (1e4 * 1e3) - 1e3);
|
|
924
|
+
e.children[0].content = e.children[0].content.slice(0, -1) + ' id="' + o + '">', e.children.push(wt(e.content, o, t));
|
|
915
925
|
} else
|
|
916
926
|
e.children.unshift(bt(t)), e.children.push($t(t));
|
|
917
927
|
}, It = (e, t = {}) => {
|
|
918
928
|
e.core.ruler.after("inline", "github-task-lists", (r) => {
|
|
919
|
-
const
|
|
920
|
-
for (let
|
|
921
|
-
vt(
|
|
922
|
-
n
|
|
929
|
+
const o = r.tokens;
|
|
930
|
+
for (let n = 2; n < o.length; n++)
|
|
931
|
+
vt(o, n) && (Ct(o[n], r.Token, t), be(
|
|
932
|
+
o[n - 2],
|
|
923
933
|
"class",
|
|
924
934
|
"task-list-item" + (t.enabled ? " enabled" : " ")
|
|
925
|
-
), be(
|
|
935
|
+
), be(o[yt(o, n - 2)], "class", "contains-task-list"));
|
|
926
936
|
});
|
|
927
937
|
}, Tt = (e) => {
|
|
928
938
|
e.core.ruler.push("init-line-number", (t) => (t.tokens.forEach((r) => {
|
|
929
939
|
r.map && (r.attrs || (r.attrs = []), r.attrs.push(["data-line", r.map[0].toString()]));
|
|
930
940
|
}), !0));
|
|
931
941
|
}, Et = (e, t) => {
|
|
932
|
-
const { editorConfig: r, markdownItConfig:
|
|
942
|
+
const { editorConfig: r, markdownItConfig: o, markdownItPlugins: n, editorExtensions: m } = R, s = b("editorId"), d = b("language"), i = b(
|
|
933
943
|
"usedLanguageText"
|
|
934
|
-
),
|
|
935
|
-
let
|
|
944
|
+
), u = b("showCodeRowNumber"), l = b("theme"), a = b("customIcon"), c = b("rootRef"), p = b("setting"), f = V([]);
|
|
945
|
+
let g = () => {
|
|
936
946
|
};
|
|
937
|
-
const
|
|
947
|
+
const y = nt(e), S = ot(e), { reRenderRef: $, replaceMermaid: C } = at(e), { reRenderEcharts: M, replaceEcharts: T } = tt(e), E = We({
|
|
938
948
|
html: !0,
|
|
939
949
|
breaks: !0,
|
|
940
950
|
linkify: !0
|
|
941
951
|
});
|
|
942
|
-
|
|
952
|
+
o(E, {
|
|
943
953
|
editorId: s
|
|
944
954
|
});
|
|
945
|
-
const
|
|
955
|
+
const I = [
|
|
946
956
|
{
|
|
947
957
|
type: "image",
|
|
948
958
|
plugin: qe,
|
|
@@ -961,7 +971,7 @@ const P = {
|
|
|
961
971
|
{
|
|
962
972
|
type: "heading",
|
|
963
973
|
plugin: st,
|
|
964
|
-
options: { mdHeadingId: e.mdHeadingId, headsRef:
|
|
974
|
+
options: { mdHeadingId: e.mdHeadingId, headsRef: f }
|
|
965
975
|
},
|
|
966
976
|
{
|
|
967
977
|
type: "code",
|
|
@@ -986,125 +996,125 @@ const P = {
|
|
|
986
996
|
options: {}
|
|
987
997
|
}
|
|
988
998
|
];
|
|
989
|
-
e.noKatex ||
|
|
999
|
+
e.noKatex || I.push({
|
|
990
1000
|
type: "katex",
|
|
991
1001
|
plugin: ut,
|
|
992
|
-
options: { katexRef:
|
|
993
|
-
}), e.noMermaid ||
|
|
1002
|
+
options: { katexRef: S }
|
|
1003
|
+
}), e.noMermaid || I.push({
|
|
994
1004
|
type: "mermaid",
|
|
995
1005
|
plugin: mt,
|
|
996
1006
|
options: { themeRef: l }
|
|
997
|
-
}), e.noEcharts ||
|
|
1007
|
+
}), e.noEcharts || I.push({
|
|
998
1008
|
type: "echarts",
|
|
999
1009
|
plugin: it,
|
|
1000
1010
|
options: { themeRef: l }
|
|
1001
|
-
}),
|
|
1011
|
+
}), n(I, {
|
|
1002
1012
|
editorId: s
|
|
1003
|
-
}).forEach((
|
|
1004
|
-
|
|
1013
|
+
}).forEach((L) => {
|
|
1014
|
+
E.use(L.plugin, L.options);
|
|
1005
1015
|
});
|
|
1006
|
-
const
|
|
1007
|
-
|
|
1008
|
-
highlight: (
|
|
1009
|
-
if (
|
|
1010
|
-
const
|
|
1011
|
-
if (
|
|
1012
|
-
return
|
|
1016
|
+
const N = E.options.highlight;
|
|
1017
|
+
E.set({
|
|
1018
|
+
highlight: (L, B, H) => {
|
|
1019
|
+
if (N) {
|
|
1020
|
+
const D = N(L, B, H);
|
|
1021
|
+
if (D)
|
|
1022
|
+
return D;
|
|
1013
1023
|
}
|
|
1014
|
-
let
|
|
1015
|
-
!e.noHighlight &&
|
|
1024
|
+
let x;
|
|
1025
|
+
!e.noHighlight && y.value ? y.value.getLanguage(B) ? x = y.value.highlight(L, {
|
|
1016
1026
|
language: B,
|
|
1017
1027
|
ignoreIllegals: !0
|
|
1018
|
-
}).value :
|
|
1019
|
-
const
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
) : `<span class="${h}-code-block">${
|
|
1023
|
-
return `<pre><code class="language-${B}" language=${B}>${
|
|
1028
|
+
}).value : x = y.value.highlightAuto(L).value : x = E.utils.escapeHtml(L);
|
|
1029
|
+
const Z = u ? Je(
|
|
1030
|
+
x.replace(/^\n+|\n+$/g, ""),
|
|
1031
|
+
L.replace(/^\n+|\n+$/g, "")
|
|
1032
|
+
) : `<span class="${h}-code-block">${x.replace(/^\n+|\n+$/g, "")}</span>`;
|
|
1033
|
+
return `<pre><code class="language-${B}" language=${B}>${Z}</code></pre>`;
|
|
1024
1034
|
}
|
|
1025
|
-
}), Tt(
|
|
1026
|
-
const
|
|
1035
|
+
}), Tt(E);
|
|
1036
|
+
const G = V(`_article-key_${re()}`), j = V(
|
|
1027
1037
|
e.sanitize(
|
|
1028
|
-
|
|
1038
|
+
E.render(e.modelValue, {
|
|
1029
1039
|
srcLines: e.modelValue.split(`
|
|
1030
1040
|
`)
|
|
1031
1041
|
})
|
|
1032
1042
|
)
|
|
1033
1043
|
), z = () => {
|
|
1034
|
-
v.emit(s,
|
|
1035
|
-
|
|
1036
|
-
m.mermaid?.enableZoom && (
|
|
1037
|
-
|
|
1044
|
+
v.emit(s, J, j.value), e.onHtmlChanged(j.value), e.onGetCatalog(f.value), v.emit(s, ne, f.value), U(() => {
|
|
1045
|
+
C().then(() => {
|
|
1046
|
+
m.mermaid?.enableZoom && (g(), g = ve(
|
|
1047
|
+
c.value?.querySelectorAll(
|
|
1038
1048
|
`#${s} p.${h}-mermaid:not([data-closed=false])`
|
|
1039
1049
|
),
|
|
1040
1050
|
{
|
|
1041
1051
|
customIcon: a.value
|
|
1042
1052
|
}
|
|
1043
1053
|
));
|
|
1044
|
-
}),
|
|
1054
|
+
}), T();
|
|
1045
1055
|
});
|
|
1046
|
-
},
|
|
1047
|
-
|
|
1048
|
-
|
|
1056
|
+
}, K = () => {
|
|
1057
|
+
f.value = [], j.value = e.sanitize(
|
|
1058
|
+
E.render(e.modelValue, {
|
|
1049
1059
|
srcLines: e.modelValue.split(`
|
|
1050
1060
|
`)
|
|
1051
1061
|
})
|
|
1052
1062
|
);
|
|
1053
|
-
},
|
|
1054
|
-
let
|
|
1055
|
-
return w([
|
|
1056
|
-
|
|
1063
|
+
}, W = F(() => (e.noKatex || !!S.value) && (e.noHighlight || !!y.value));
|
|
1064
|
+
let q = -1;
|
|
1065
|
+
return w([Re(e, "modelValue"), W, $, d], () => {
|
|
1066
|
+
q = window.setTimeout(
|
|
1057
1067
|
() => {
|
|
1058
|
-
|
|
1068
|
+
K();
|
|
1059
1069
|
},
|
|
1060
1070
|
t ? 0 : r.renderDelay
|
|
1061
1071
|
);
|
|
1062
1072
|
}), w(
|
|
1063
|
-
() =>
|
|
1073
|
+
() => p.value.preview,
|
|
1064
1074
|
() => {
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
m.mermaid?.enableZoom && (
|
|
1068
|
-
|
|
1075
|
+
p.value.preview && U(() => {
|
|
1076
|
+
C().then(() => {
|
|
1077
|
+
m.mermaid?.enableZoom && (g(), g = ve(
|
|
1078
|
+
c.value?.querySelectorAll(
|
|
1069
1079
|
`#${s} p.${h}-mermaid:not([data-closed=false])`
|
|
1070
1080
|
),
|
|
1071
1081
|
{
|
|
1072
1082
|
customIcon: a.value
|
|
1073
1083
|
}
|
|
1074
1084
|
));
|
|
1075
|
-
}),
|
|
1085
|
+
}), T(), v.emit(s, ne, f.value);
|
|
1076
1086
|
});
|
|
1077
1087
|
}
|
|
1078
|
-
), w([j,
|
|
1088
|
+
), w([j, M], () => {
|
|
1079
1089
|
z();
|
|
1080
|
-
}),
|
|
1090
|
+
}), A(z), A(() => {
|
|
1081
1091
|
v.on(s, {
|
|
1082
1092
|
name: De,
|
|
1083
1093
|
callback() {
|
|
1084
|
-
v.emit(s,
|
|
1094
|
+
v.emit(s, ne, f.value);
|
|
1085
1095
|
}
|
|
1086
1096
|
}), v.on(s, {
|
|
1087
|
-
name:
|
|
1097
|
+
name: se,
|
|
1088
1098
|
callback: () => {
|
|
1089
|
-
|
|
1099
|
+
G.value = `_article-key_${re()}`, K();
|
|
1090
1100
|
}
|
|
1091
1101
|
});
|
|
1092
|
-
}),
|
|
1093
|
-
|
|
1094
|
-
}), { html: j, key:
|
|
1102
|
+
}), te(() => {
|
|
1103
|
+
g(), clearTimeout(q);
|
|
1104
|
+
}), { html: j, key: G };
|
|
1095
1105
|
}, St = (e, t) => {
|
|
1096
|
-
const r =
|
|
1097
|
-
const
|
|
1106
|
+
const r = b("editorId"), o = b("setting"), { noImgZoomIn: n } = e, m = Le(() => {
|
|
1107
|
+
const s = document.querySelectorAll(
|
|
1098
1108
|
`#${r}-preview img:not(.not-zoom):not(.medium-zoom-image)`
|
|
1099
1109
|
);
|
|
1100
|
-
|
|
1110
|
+
s.length !== 0 && Ye(s, {
|
|
1101
1111
|
background: "#00000073"
|
|
1102
1112
|
});
|
|
1103
1113
|
});
|
|
1104
|
-
|
|
1105
|
-
!n &&
|
|
1106
|
-
}), w([t,
|
|
1107
|
-
!n &&
|
|
1114
|
+
A(async () => {
|
|
1115
|
+
!n && o.value.preview && await m();
|
|
1116
|
+
}), w([t, () => o.value.preview], async () => {
|
|
1117
|
+
!n && o.value.preview && await m();
|
|
1108
1118
|
});
|
|
1109
1119
|
}, $e = {
|
|
1110
1120
|
checked: {
|
|
@@ -1116,54 +1126,54 @@ const P = {
|
|
|
1116
1126
|
value: "- [x]"
|
|
1117
1127
|
}
|
|
1118
1128
|
}, xt = (e, t) => {
|
|
1119
|
-
const r =
|
|
1120
|
-
let
|
|
1129
|
+
const r = b("editorId"), o = b("rootRef");
|
|
1130
|
+
let n = () => {
|
|
1121
1131
|
};
|
|
1122
1132
|
const m = () => {
|
|
1123
|
-
if (!
|
|
1133
|
+
if (!o.value)
|
|
1124
1134
|
return !1;
|
|
1125
|
-
const s =
|
|
1135
|
+
const s = o.value.querySelectorAll(".task-list-item.enabled"), d = (i) => {
|
|
1126
1136
|
i.preventDefault();
|
|
1127
|
-
const
|
|
1137
|
+
const u = i.target.checked ? "unChecked" : "checked", l = i.target.parentElement?.dataset.line;
|
|
1128
1138
|
if (!l)
|
|
1129
1139
|
return;
|
|
1130
|
-
const a = Number(l),
|
|
1131
|
-
`), p =
|
|
1132
|
-
$e[
|
|
1133
|
-
$e[
|
|
1140
|
+
const a = Number(l), c = e.modelValue.split(`
|
|
1141
|
+
`), p = c[Number(a)].replace(
|
|
1142
|
+
$e[u].regexp,
|
|
1143
|
+
$e[u].value
|
|
1134
1144
|
);
|
|
1135
|
-
e.previewOnly ? (
|
|
1145
|
+
e.previewOnly ? (c[Number(a)] = p, e.onChange(c.join(`
|
|
1136
1146
|
`))) : v.emit(r, Ve, a + 1, p);
|
|
1137
1147
|
};
|
|
1138
1148
|
s.forEach((i) => {
|
|
1139
1149
|
i.addEventListener("click", d);
|
|
1140
|
-
}),
|
|
1150
|
+
}), n = () => {
|
|
1141
1151
|
s.forEach((i) => {
|
|
1142
1152
|
i.removeEventListener("click", d);
|
|
1143
1153
|
});
|
|
1144
1154
|
};
|
|
1145
1155
|
};
|
|
1146
|
-
|
|
1147
|
-
|
|
1156
|
+
te(() => {
|
|
1157
|
+
n();
|
|
1148
1158
|
}), w(
|
|
1149
1159
|
[t],
|
|
1150
1160
|
() => {
|
|
1151
|
-
|
|
1161
|
+
n(), U(m);
|
|
1152
1162
|
},
|
|
1153
1163
|
{
|
|
1154
1164
|
immediate: !0
|
|
1155
1165
|
}
|
|
1156
1166
|
);
|
|
1157
1167
|
}, Ft = (e, t, r) => {
|
|
1158
|
-
const n = () => {
|
|
1159
|
-
|
|
1168
|
+
const o = b("setting"), n = () => {
|
|
1169
|
+
U(() => {
|
|
1160
1170
|
e.onRemount?.();
|
|
1161
1171
|
});
|
|
1162
|
-
},
|
|
1163
|
-
|
|
1172
|
+
}, m = (s) => {
|
|
1173
|
+
s && n();
|
|
1164
1174
|
};
|
|
1165
|
-
w([t, r], n), w(() =>
|
|
1166
|
-
},
|
|
1175
|
+
w([t, r], n), w(() => o.value.preview, m), w(() => o.value.htmlPreview, m), A(n);
|
|
1176
|
+
}, Te = {
|
|
1167
1177
|
modelValue: {
|
|
1168
1178
|
type: String,
|
|
1169
1179
|
default: ""
|
|
@@ -1173,10 +1183,6 @@ const P = {
|
|
|
1173
1183
|
default: () => {
|
|
1174
1184
|
}
|
|
1175
1185
|
},
|
|
1176
|
-
setting: {
|
|
1177
|
-
type: Object,
|
|
1178
|
-
default: () => ({ preview: !0 })
|
|
1179
|
-
},
|
|
1180
1186
|
onHtmlChanged: {
|
|
1181
1187
|
type: Function,
|
|
1182
1188
|
default: () => {
|
|
@@ -1235,7 +1241,7 @@ const P = {
|
|
|
1235
1241
|
type: Boolean
|
|
1236
1242
|
}
|
|
1237
1243
|
}, tn = {
|
|
1238
|
-
...
|
|
1244
|
+
...Te,
|
|
1239
1245
|
updateModelValue: {
|
|
1240
1246
|
type: Function,
|
|
1241
1247
|
default: () => {
|
|
@@ -1307,28 +1313,28 @@ const P = {
|
|
|
1307
1313
|
const r = new DOMParser().parseFromString(e, "text/html");
|
|
1308
1314
|
return Array.from(r.body.childNodes);
|
|
1309
1315
|
}, Rt = (e, t) => {
|
|
1310
|
-
const r = [],
|
|
1311
|
-
if (e.forEach((
|
|
1316
|
+
const r = [], o = [];
|
|
1317
|
+
if (e.forEach((n, m) => {
|
|
1312
1318
|
const s = t[m];
|
|
1313
1319
|
if (!s) {
|
|
1314
1320
|
r.push({
|
|
1315
1321
|
index: m,
|
|
1316
|
-
newNode:
|
|
1322
|
+
newNode: n
|
|
1317
1323
|
});
|
|
1318
1324
|
return;
|
|
1319
1325
|
}
|
|
1320
|
-
(
|
|
1326
|
+
(n.nodeType !== s.nodeType || n.textContent !== s.textContent || n.nodeType === 1 && n.outerHTML !== s.outerHTML) && r.push({
|
|
1321
1327
|
index: m,
|
|
1322
|
-
newNode:
|
|
1328
|
+
newNode: n
|
|
1323
1329
|
});
|
|
1324
1330
|
}), t.length > e.length)
|
|
1325
|
-
for (let
|
|
1326
|
-
|
|
1331
|
+
for (let n = e.length; n < t.length; n++)
|
|
1332
|
+
o.push(t[n]);
|
|
1327
1333
|
return {
|
|
1328
1334
|
updates: r,
|
|
1329
|
-
deletes:
|
|
1335
|
+
deletes: o
|
|
1330
1336
|
};
|
|
1331
|
-
}, we = /* @__PURE__ */
|
|
1337
|
+
}, we = /* @__PURE__ */ ie({
|
|
1332
1338
|
name: "UpdateOnDemand",
|
|
1333
1339
|
props: {
|
|
1334
1340
|
html: {
|
|
@@ -1337,57 +1343,57 @@ const P = {
|
|
|
1337
1343
|
}
|
|
1338
1344
|
},
|
|
1339
1345
|
setup(e) {
|
|
1340
|
-
const t =
|
|
1341
|
-
|
|
1342
|
-
|
|
1346
|
+
const t = b("editorId"), r = b("previewTheme"), o = b("showCodeRowNumber"), n = V(), m = e.html, s = (d, i) => {
|
|
1347
|
+
n.value && (i.forEach((u) => {
|
|
1348
|
+
u.remove();
|
|
1343
1349
|
}), d.forEach(({
|
|
1344
|
-
index:
|
|
1350
|
+
index: u,
|
|
1345
1351
|
newNode: l
|
|
1346
1352
|
}) => {
|
|
1347
|
-
const a =
|
|
1348
|
-
a ?
|
|
1353
|
+
const a = n.value?.childNodes[u];
|
|
1354
|
+
a ? n.value?.replaceChild(l.cloneNode(!0), a) : n.value?.appendChild(l.cloneNode(!0));
|
|
1349
1355
|
}));
|
|
1350
1356
|
};
|
|
1351
1357
|
return w(() => e.html, (d) => {
|
|
1352
|
-
const i = At(d),
|
|
1358
|
+
const i = At(d), u = Array.from(n.value?.childNodes || []), {
|
|
1353
1359
|
updates: l,
|
|
1354
1360
|
deletes: a
|
|
1355
|
-
} = Rt(i,
|
|
1361
|
+
} = Rt(i, u);
|
|
1356
1362
|
s(l, a);
|
|
1357
1363
|
}), () => O("div", {
|
|
1358
1364
|
id: `${t}-preview`,
|
|
1359
|
-
class: [`${h}-preview`, `${r?.value}-theme`,
|
|
1365
|
+
class: [`${h}-preview`, `${r?.value}-theme`, o && `${h}-scrn`],
|
|
1360
1366
|
innerHTML: m,
|
|
1361
|
-
ref:
|
|
1367
|
+
ref: n
|
|
1362
1368
|
}, null);
|
|
1363
1369
|
}
|
|
1364
|
-
}), Ht = /* @__PURE__ */
|
|
1370
|
+
}), Ht = /* @__PURE__ */ ie({
|
|
1365
1371
|
name: "ContentPreview",
|
|
1366
|
-
props:
|
|
1372
|
+
props: Te,
|
|
1367
1373
|
setup(e) {
|
|
1368
|
-
const t =
|
|
1369
|
-
html:
|
|
1374
|
+
const t = b("editorId"), r = b("setting"), {
|
|
1375
|
+
html: o,
|
|
1370
1376
|
key: n
|
|
1371
1377
|
} = Et(e, e.previewOnly);
|
|
1372
|
-
return et(e,
|
|
1378
|
+
return et(e, o, n), St(e, o), xt(e, o), Ft(e, o, n), () => O(He, null, [r.value.preview && (e.previewOnly ? O(we, {
|
|
1373
1379
|
key: n.value,
|
|
1374
|
-
html:
|
|
1380
|
+
html: o.value
|
|
1375
1381
|
}, null) : O("div", {
|
|
1376
1382
|
id: `${t}-preview-wrapper`,
|
|
1377
1383
|
class: `${h}-preview-wrapper`,
|
|
1378
1384
|
key: "content-preview-wrapper"
|
|
1379
1385
|
}, [O(we, {
|
|
1380
1386
|
key: n.value,
|
|
1381
|
-
html:
|
|
1382
|
-
}, null)])),
|
|
1387
|
+
html: o.value
|
|
1388
|
+
}, null)])), r.value.htmlPreview && O("div", {
|
|
1383
1389
|
id: `${t}-html-wrapper`,
|
|
1384
1390
|
class: `${h}-preview-wrapper`,
|
|
1385
1391
|
key: "html-preview-wrapper"
|
|
1386
1392
|
}, [O("div", {
|
|
1387
1393
|
class: `${h}-html`
|
|
1388
|
-
}, [
|
|
1394
|
+
}, [o.value])])]);
|
|
1389
1395
|
}
|
|
1390
|
-
}), Pt = ({ text: e }) => e,
|
|
1396
|
+
}), Pt = ({ text: e }) => e, Ee = {
|
|
1391
1397
|
/**
|
|
1392
1398
|
* markdown content.
|
|
1393
1399
|
*
|
|
@@ -1622,7 +1628,7 @@ const P = {
|
|
|
1622
1628
|
default: !1
|
|
1623
1629
|
}
|
|
1624
1630
|
}, nn = {
|
|
1625
|
-
...
|
|
1631
|
+
...Ee,
|
|
1626
1632
|
/**
|
|
1627
1633
|
* input回调事件
|
|
1628
1634
|
*/
|
|
@@ -1927,14 +1933,14 @@ const P = {
|
|
|
1927
1933
|
type: Number,
|
|
1928
1934
|
default: void 0
|
|
1929
1935
|
}
|
|
1930
|
-
},
|
|
1936
|
+
}, Se = [
|
|
1931
1937
|
"onHtmlChanged",
|
|
1932
1938
|
"onGetCatalog",
|
|
1933
1939
|
"onChange",
|
|
1934
1940
|
"onRemount",
|
|
1935
1941
|
"update:modelValue"
|
|
1936
1942
|
], on = [
|
|
1937
|
-
...
|
|
1943
|
+
...Se,
|
|
1938
1944
|
"onSave",
|
|
1939
1945
|
"onUploadImg",
|
|
1940
1946
|
"onError",
|
|
@@ -1944,28 +1950,28 @@ const P = {
|
|
|
1944
1950
|
"onDrop",
|
|
1945
1951
|
"oninputBoxWidthChange"
|
|
1946
1952
|
], Mt = (e, t, r) => {
|
|
1947
|
-
const { editorId:
|
|
1953
|
+
const { editorId: o } = r, n = {
|
|
1948
1954
|
rerender() {
|
|
1949
|
-
v.emit(
|
|
1955
|
+
v.emit(o, se);
|
|
1950
1956
|
}
|
|
1951
1957
|
};
|
|
1952
|
-
t.expose(
|
|
1953
|
-
},
|
|
1958
|
+
t.expose(n);
|
|
1959
|
+
}, oe = /* @__PURE__ */ ie({
|
|
1954
1960
|
name: "MdPreview",
|
|
1955
|
-
props:
|
|
1956
|
-
emits:
|
|
1961
|
+
props: Ee,
|
|
1962
|
+
emits: Se,
|
|
1957
1963
|
setup(e, t) {
|
|
1958
1964
|
const {
|
|
1959
1965
|
noKatex: r,
|
|
1960
|
-
noMermaid:
|
|
1961
|
-
noHighlight:
|
|
1962
|
-
} = e, m =
|
|
1963
|
-
return
|
|
1966
|
+
noMermaid: o,
|
|
1967
|
+
noHighlight: n
|
|
1968
|
+
} = e, m = V(), s = Qe(e);
|
|
1969
|
+
return Ie(e, {
|
|
1964
1970
|
rootRef: m,
|
|
1965
1971
|
editorId: s
|
|
1966
1972
|
}), Mt(e, t, {
|
|
1967
1973
|
editorId: s
|
|
1968
|
-
}),
|
|
1974
|
+
}), te(() => {
|
|
1969
1975
|
v.clear(s);
|
|
1970
1976
|
}), () => O("div", {
|
|
1971
1977
|
id: s,
|
|
@@ -1984,11 +1990,11 @@ const P = {
|
|
|
1984
1990
|
e.onGetCatalog?.(d), t.emit("onGetCatalog", d);
|
|
1985
1991
|
},
|
|
1986
1992
|
mdHeadingId: e.mdHeadingId,
|
|
1987
|
-
noMermaid:
|
|
1993
|
+
noMermaid: o,
|
|
1988
1994
|
sanitize: e.sanitize,
|
|
1989
1995
|
noKatex: r,
|
|
1990
1996
|
formatCopiedText: e.formatCopiedText,
|
|
1991
|
-
noHighlight:
|
|
1997
|
+
noHighlight: n,
|
|
1992
1998
|
noImgZoomIn: e.noImgZoomIn,
|
|
1993
1999
|
previewOnly: !0,
|
|
1994
2000
|
sanitizeMermaid: e.sanitizeMermaid,
|
|
@@ -2001,10 +2007,10 @@ const P = {
|
|
|
2001
2007
|
}, null)]);
|
|
2002
2008
|
}
|
|
2003
2009
|
});
|
|
2004
|
-
|
|
2010
|
+
oe.install = (e) => (e.component(oe.name, oe), e);
|
|
2005
2011
|
export {
|
|
2006
2012
|
P as C,
|
|
2007
|
-
|
|
2013
|
+
oe as M,
|
|
2008
2014
|
Ht as a,
|
|
2009
2015
|
nn as b,
|
|
2010
2016
|
tn as c,
|