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