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